* Encapsulates the pending-key guard, toast feedback, and error logging pattern
* shared across layout composables.
* @param initialPending - Object defining the pending keys (e.g. `{ connection: false, startStop: false }`)
- * @param onRefresh - Called after each successful action (e.g. `() => emit('need-refresh')`)
+ * @param onRefresh - Called after each successful action to signal state has changed
* @returns `{ pending, run }` — reactive pending map and action executor
*/
export function useAsyncAction<T extends Record<string, boolean>> (
v-for="station in $chargingStations"
:key="station.stationInfo.hashId"
:charging-station="station"
- @need-refresh="getChargingStations"
@open-authorize="openAuthorizeDialog"
@open-set-url="openSetUrlDialog"
@open-start-tx="openStartTxDialog"
const $chargingStations = useChargingStations()
const layoutData = useLayoutData()
-const { getChargingStations, simulatorState, uiServerConfigurations } = layoutData
+const { simulatorState, uiServerConfigurations } = layoutData
const uiServerIndex = ref(getFromLocalStorage<number>(UI_SERVER_CONFIGURATION_INDEX_KEY, 0))
}>()
const emit = defineEmits<{
- 'need-refresh': []
'open-start-tx': [
data: {
chargingStationId: string
} = useConnectorActions({
connectorId: computed(() => props.connectorId),
hashId: computed(() => props.hashId),
- onRefresh: () => emit('need-refresh'),
})
const identifier = computed(() =>
:evse-id="entry.evseId"
:hash-id="chargingStation.stationInfo.hashId"
:ocpp-version="chargingStation.stationInfo.ocppVersion"
- @need-refresh="$emit('need-refresh')"
@open-start-tx="data => $emit('open-start-tx', data)"
/>
</div>
}>()
const emit = defineEmits<{
- 'need-refresh': []
'open-authorize': [data: { chargingStationId: string; hashId: string; ocppVersion?: OCPPVersion }]
'open-set-url': [data: { chargingStationId: string; hashId: string }]
'open-start-tx': [
const confirmingDelete = ref(false)
const { closeConnection, deleteStation, openConnection, pending, startStation, stopStation } =
- useStationActions({ onRefresh: () => emit('need-refresh') })
+ useStationActions()
const wsOpen = computed(() => props.chargingStation.wsState === WebSocketReadyState.OPEN)