body {
height: fit-content;
width: fit-content;
- margin: 0.001%;
- padding: 0.001%;
+ margin: 0.005%;
+ padding: 0.005%;
}
</style>
<Button @click="stopChargingStation()">Stop Charging Station</Button>
<Button @click="openConnection()">Open Connection</Button>
<Button @click="closeConnection()">Close Connection</Button>
+ <Button @click="deleteChargingStation()">Delete Charging Station</Button>
</td>
<td class="cs-table__connectors-column">
<table id="connectors-table">
function closeConnection(): void {
UIClient.closeConnection(getHashId())
}
+function deleteChargingStation(): void {
+ UIClient.deleteChargingStation(getHashId())
+}
// function showTagModal(): void {
// state.isTagModalVisible = true
// }
}
.connectors-table__row {
- min-height: 4rem;
display: flex;
justify-content: center;
align-items: center;
return this.sendRequest(ProcedureName.STOP_SIMULATOR, {})
}
+ public async deleteChargingStation(hashId: string): Promise<ResponsePayload> {
+ return this.sendRequest(ProcedureName.DELETE_CHARGING_STATIONS, { hashIds: [hashId] })
+ }
+
public async listChargingStations(): Promise<ResponsePayload> {
return this.sendRequest(ProcedureName.LIST_CHARGING_STATIONS, {})
}
})
}
- private openWS(): void {
+ public openWS(): void {
const protocols =
this.configuration.uiServer.authentication?.enabled === true &&
this.configuration.uiServer.authentication?.type === AuthenticationType.PROTOCOL_BASIC_AUTH
payload: RequestPayload
): Promise<ResponsePayload> {
return new Promise<ResponsePayload>((resolve, reject) => {
- if (this.ws.readyState !== WebSocket.OPEN) {
- this.openWS()
- }
if (this.ws.readyState === WebSocket.OPEN) {
const uuid = crypto.randomUUID()
const msg = JSON.stringify([uuid, procedureName, payload])
import { createApp } from 'vue'
+import type { ConfigurationData } from './types'
import router from '@/router'
import { UIClient } from '@/composables'
import App from '@/App.vue'
-const app = createApp(App)
+const initializeApp = async (config: ConfigurationData) => {
+ const app = createApp(App)
+ app.config.errorHandler = (error, instance, info) => {
+ console.error('Error:', error)
+ console.info('Vue instance:', instance)
+ console.info('Error info:', info)
+ // TODO: Add code for UI notifications or other error handling logic
+ }
+ app.config.globalProperties.$UIClient = UIClient.getInstance(config)
+ app.config.globalProperties.$UIClient.openWS()
+ app.use(router).mount('#app')
+}
fetch('/config.json')
.then(response => response.json())
+ .catch(error => {
+ console.error('Error at fetching app configuration:', error)
+ throw error
+ })
.then(config => {
- app.config.errorHandler = (error, instance, info) => {
- console.error('Error:', error)
- console.info('Vue instance:', instance)
- console.info('Error info:', info)
- // TODO: Add code for UI notifications or other error handling logic
- }
- app.config.globalProperties.$UIClient = UIClient.getInstance(config)
- app.use(router).mount('#app')
+ initializeApp(config)
+ })
+ .catch(error => {
+ console.error('Error at initializing app:', error)
})
export enum ProcedureName {
START_SIMULATOR = 'startSimulator',
STOP_SIMULATOR = 'stopSimulator',
+ DELETE_CHARGING_STATIONS = 'deleteChargingStations',
LIST_CHARGING_STATIONS = 'listChargingStations',
START_CHARGING_STATION = 'startChargingStation',
STOP_CHARGING_STATION = 'stopChargingStation',