refactor(ui): trivial code cleanups
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 1 Mar 2024 15:29:20 +0000 (16:29 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 1 Mar 2024 15:29:20 +0000 (16:29 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
ui/web/src/components/actions/AddChargingStations.vue
ui/web/src/components/buttons/ToggleButton.vue
ui/web/src/views/ChargingStationsView.vue

index a0661a08d083060058d8546bdebcec9e77a860f7..9c7224fb02f3ffac512c41490d1f96a22f8703fc 100644 (file)
@@ -8,7 +8,7 @@
       v-for="template in app?.appContext.config.globalProperties.$templates"
       v-show="
         Array.isArray(app?.appContext.config.globalProperties.$templates) &&
-        app?.appContext.config.globalProperties.$templates.length > 0
+        app.appContext.config.globalProperties.$templates.length > 0
       "
     >
       {{ template }}
index b51c85580fea8bf14658fc7808c3e78b98d76e73..0c36be2292f1406096f1149fcf887b09dda966a6 100644 (file)
@@ -34,13 +34,6 @@ const click = (): void => {
   }
   setToLocalStorage<boolean>(id, !getFromLocalStorage<boolean>(id, props.status ?? false))
   state.value.status = getFromLocalStorage<boolean>(id, props.status ?? false)
-  // console.log(`----begin----`)
-  // for (const key in localStorage) {
-  //   if (key.startsWith('shared-toggle-button-')) {
-  //     console.log(key, getFromLocalStorage<boolean>(key, props.status ?? false))
-  //   }
-  // }
-  // console.log(`----end----`)
   if (getFromLocalStorage<boolean>(id, props.status ?? false)) {
     props.on?.()
   } else {
index 7ffefe76e51d893a2bcc103e21c02ec9635d9d25..cbd8a34ba64bf13ad17f8e57a679cb67aa455c63 100644 (file)
       <ReloadButton
         id="reload-button"
         :loading="state.loading"
-        @click="loadChargingStations(() => (state.renderChargingStationsList = randomUUID()))"
+        @click="loadChargingStations(() => (state.renderChargingStations = randomUUID()))"
       />
     </Container>
     <CSTable
       v-show="
         Array.isArray(app?.appContext.config.globalProperties.$chargingStations) &&
-        app?.appContext.config.globalProperties.$chargingStations.length > 0
+        app.appContext.config.globalProperties.$chargingStations.length > 0
       "
-      :key="state.renderChargingStationsList"
+      :key="state.renderChargingStations"
       :charging-stations="app?.appContext.config.globalProperties.$chargingStations"
     />
   </Container>
@@ -118,7 +118,7 @@ const clearChargingStations = (): void => {
   clearToggleButtons()
   app!.appContext.config.globalProperties.$chargingStations = []
   state.value.renderAddChargingStations = randomUUID()
-  state.value.renderChargingStationsList = randomUUID()
+  state.value.renderChargingStations = randomUUID()
 }
 
 const initializeWSEventListeners = () => {
@@ -139,7 +139,7 @@ const initializeWSEventListeners = () => {
       })
     loadChargingStations(() => {
       state.value.renderAddChargingStations = randomUUID()
-      state.value.renderChargingStationsList = randomUUID()
+      state.value.renderChargingStations = randomUUID()
     })
   })
   app?.appContext.config.globalProperties.$uiClient.registerWSEventListener(
@@ -158,7 +158,7 @@ onMounted(() => {
 
 const state = ref({
   renderAddChargingStations: randomUUID(),
-  renderChargingStationsList: randomUUID(),
+  renderChargingStations: randomUUID(),
   loading: false,
   uiServerIndex: getFromLocalStorage<number>('uiServerConfigurationIndex', 0)
 })