Thème
Superviseur — Frontend / features/panel/panel.store / usePanelStore
Variable: usePanelStore
ts
const usePanelStore: StoreDefinition<"panel", Pick<{
configurations: Ref<object[],
| StationConfiguration[]
| object[]>;
profiles: Ref<object[],
| ModbusProfile[]
| object[]>;
liveStates: Ref<Record<string, FireStationSystem>, Record<string, FireStationSystem>>;
panelStates: Ref<Record<string, PanelSnapshot>, Record<string, PanelSnapshot>>;
selectedStationId: Ref<string | null, string | null>;
selectedPanelId: ComputedRef<string | number | null>;
currentConfig: ComputedRef<
| {
id?: string | number;
name: string;
systemSerialNumber?: string;
label: string;
description?: string;
connectionType?: "Tcp" | "Rtu";
ipAddress?: string;
port?: number;
serialPortName?: string;
baudRate?: number;
dataBits?: number;
parity?: number;
stopBits?: number;
pollingIntervalMilliseconds: number;
slaveId: number;
panelType: string;
color: string;
modbusMapping: string;
modbusProfileId: string;
zones: object[];
points?: object[];
rawConfiguration?: string;
}
| undefined>;
panelState: ComputedRef<
| FireStationSystem
| null>;
apiConnected: Ref<boolean, boolean>;
hasEverConnected: Ref<boolean, boolean>;
modbusConnected: Ref<boolean, boolean>;
systemStatus: ComputedRef<{
text: string;
color: string;
}>;
activeAlerts: ComputedRef<object[]>;
allActiveAlerts: ComputedRef<Alert[]>;
groupedIncidents: ComputedRef<StationGroup[]>;
activeIncidentCount: ComputedRef<number>;
activeAlertsCount: ComputedRef<number>;
allActiveAlertsCount: ComputedRef<number>;
isGlobalEvacuationActive: ComputedRef<boolean>;
connectionStatus: ComputedRef<{
api: {
connected: boolean;
text: string;
color: string;
};
modbus: {
connected: boolean | undefined;
text: string;
color: string;
};
}>;
systemIssues: ComputedRef<SystemIssue[]>;
lastDataChange: Ref<number, number>;
isFleetHealthy: ComputedRef<boolean>;
pendingCommands: Ref<Record<string, boolean>, Record<string, boolean>>;
isCommandPending: (serial) => boolean;
markCommandPending: (serial, delayMs) => void;
statusSince: (serial, kind, index) => number | null;
setPanelState: (newState) => void;
switchPanel: (id) => void;
addPanel: (config) => Promise<void>;
removePanel: (dbId) => Promise<void>;
setPanelSupervision: (panelId, serial, enabled) => Promise<PanelDto>;
setAllPanelsSupervision: (enabled) => Promise<void>;
loadConfigurations: () => Promise<void>;
loadInitialData: () => Promise<void>;
updatePanel: (config) => Promise<void>;
updatePanelState: (snapshot) => void;
forgetPanel: (panelId, systemSerialNumber?) => void;
isPanelConnected: (id) => boolean;
isPanelInAlarm: (id) => boolean;
setConnectionStatus: (isConnected) => void;
setModbusConnected: (s) => boolean;
initialize: () => Promise<void>;
initialized: Ref<boolean, boolean>;
isInitializing: Ref<boolean, boolean>;
toggleMute: () => void;
isAudioMuted: ComputedRef<boolean>;
hasActiveAlert: ComputedRef<boolean>;
acknowledgeAlert: (stationId, type, index, flag?) => Promise<void>;
rearmStation: (stationId) => Promise<void>;
},
| "profiles"
| "modbusConnected"
| "configurations"
| "liveStates"
| "panelStates"
| "selectedStationId"
| "apiConnected"
| "hasEverConnected"
| "lastDataChange"
| "pendingCommands"
| "initialized"
| "isInitializing">, Pick<{
configurations: Ref<object[],
| StationConfiguration[]
| object[]>;
profiles: Ref<object[],
| ModbusProfile[]
| object[]>;
liveStates: Ref<Record<string, FireStationSystem>, Record<string, FireStationSystem>>;
panelStates: Ref<Record<string, PanelSnapshot>, Record<string, PanelSnapshot>>;
selectedStationId: Ref<string | null, string | null>;
selectedPanelId: ComputedRef<string | number | null>;
currentConfig: ComputedRef<
| {
id?: string | number;
name: string;
systemSerialNumber?: string;
label: string;
description?: string;
connectionType?: "Tcp" | "Rtu";
ipAddress?: string;
port?: number;
serialPortName?: string;
baudRate?: number;
dataBits?: number;
parity?: number;
stopBits?: number;
pollingIntervalMilliseconds: number;
slaveId: number;
panelType: string;
color: string;
modbusMapping: string;
modbusProfileId: string;
zones: object[];
points?: object[];
rawConfiguration?: string;
}
| undefined>;
panelState: ComputedRef<
| FireStationSystem
| null>;
apiConnected: Ref<boolean, boolean>;
hasEverConnected: Ref<boolean, boolean>;
modbusConnected: Ref<boolean, boolean>;
systemStatus: ComputedRef<{
text: string;
color: string;
}>;
activeAlerts: ComputedRef<object[]>;
allActiveAlerts: ComputedRef<Alert[]>;
groupedIncidents: ComputedRef<StationGroup[]>;
activeIncidentCount: ComputedRef<number>;
activeAlertsCount: ComputedRef<number>;
allActiveAlertsCount: ComputedRef<number>;
isGlobalEvacuationActive: ComputedRef<boolean>;
connectionStatus: ComputedRef<{
api: {
connected: boolean;
text: string;
color: string;
};
modbus: {
connected: boolean | undefined;
text: string;
color: string;
};
}>;
systemIssues: ComputedRef<SystemIssue[]>;
lastDataChange: Ref<number, number>;
isFleetHealthy: ComputedRef<boolean>;
pendingCommands: Ref<Record<string, boolean>, Record<string, boolean>>;
isCommandPending: (serial) => boolean;
markCommandPending: (serial, delayMs) => void;
statusSince: (serial, kind, index) => number | null;
setPanelState: (newState) => void;
switchPanel: (id) => void;
addPanel: (config) => Promise<void>;
removePanel: (dbId) => Promise<void>;
setPanelSupervision: (panelId, serial, enabled) => Promise<PanelDto>;
setAllPanelsSupervision: (enabled) => Promise<void>;
loadConfigurations: () => Promise<void>;
loadInitialData: () => Promise<void>;
updatePanel: (config) => Promise<void>;
updatePanelState: (snapshot) => void;
forgetPanel: (panelId, systemSerialNumber?) => void;
isPanelConnected: (id) => boolean;
isPanelInAlarm: (id) => boolean;
setConnectionStatus: (isConnected) => void;
setModbusConnected: (s) => boolean;
initialize: () => Promise<void>;
initialized: Ref<boolean, boolean>;
isInitializing: Ref<boolean, boolean>;
toggleMute: () => void;
isAudioMuted: ComputedRef<boolean>;
hasActiveAlert: ComputedRef<boolean>;
acknowledgeAlert: (stationId, type, index, flag?) => Promise<void>;
rearmStation: (stationId) => Promise<void>;
},
| "systemStatus"
| "hasActiveAlert"
| "selectedPanelId"
| "currentConfig"
| "panelState"
| "activeAlerts"
| "allActiveAlerts"
| "groupedIncidents"
| "activeIncidentCount"
| "activeAlertsCount"
| "allActiveAlertsCount"
| "isGlobalEvacuationActive"
| "connectionStatus"
| "systemIssues"
| "isFleetHealthy"
| "isAudioMuted">, Pick<{
configurations: Ref<object[],
| StationConfiguration[]
| object[]>;
profiles: Ref<object[],
| ModbusProfile[]
| object[]>;
liveStates: Ref<Record<string, FireStationSystem>, Record<string, FireStationSystem>>;
panelStates: Ref<Record<string, PanelSnapshot>, Record<string, PanelSnapshot>>;
selectedStationId: Ref<string | null, string | null>;
selectedPanelId: ComputedRef<string | number | null>;
currentConfig: ComputedRef<
| {
id?: string | number;
name: string;
systemSerialNumber?: string;
label: string;
description?: string;
connectionType?: "Tcp" | "Rtu";
ipAddress?: string;
port?: number;
serialPortName?: string;
baudRate?: number;
dataBits?: number;
parity?: number;
stopBits?: number;
pollingIntervalMilliseconds: number;
slaveId: number;
panelType: string;
color: string;
modbusMapping: string;
modbusProfileId: string;
zones: object[];
points?: object[];
rawConfiguration?: string;
}
| undefined>;
panelState: ComputedRef<
| FireStationSystem
| null>;
apiConnected: Ref<boolean, boolean>;
hasEverConnected: Ref<boolean, boolean>;
modbusConnected: Ref<boolean, boolean>;
systemStatus: ComputedRef<{
text: string;
color: string;
}>;
activeAlerts: ComputedRef<object[]>;
allActiveAlerts: ComputedRef<Alert[]>;
groupedIncidents: ComputedRef<StationGroup[]>;
activeIncidentCount: ComputedRef<number>;
activeAlertsCount: ComputedRef<number>;
allActiveAlertsCount: ComputedRef<number>;
isGlobalEvacuationActive: ComputedRef<boolean>;
connectionStatus: ComputedRef<{
api: {
connected: boolean;
text: string;
color: string;
};
modbus: {
connected: boolean | undefined;
text: string;
color: string;
};
}>;
systemIssues: ComputedRef<SystemIssue[]>;
lastDataChange: Ref<number, number>;
isFleetHealthy: ComputedRef<boolean>;
pendingCommands: Ref<Record<string, boolean>, Record<string, boolean>>;
isCommandPending: (serial) => boolean;
markCommandPending: (serial, delayMs) => void;
statusSince: (serial, kind, index) => number | null;
setPanelState: (newState) => void;
switchPanel: (id) => void;
addPanel: (config) => Promise<void>;
removePanel: (dbId) => Promise<void>;
setPanelSupervision: (panelId, serial, enabled) => Promise<PanelDto>;
setAllPanelsSupervision: (enabled) => Promise<void>;
loadConfigurations: () => Promise<void>;
loadInitialData: () => Promise<void>;
updatePanel: (config) => Promise<void>;
updatePanelState: (snapshot) => void;
forgetPanel: (panelId, systemSerialNumber?) => void;
isPanelConnected: (id) => boolean;
isPanelInAlarm: (id) => boolean;
setConnectionStatus: (isConnected) => void;
setModbusConnected: (s) => boolean;
initialize: () => Promise<void>;
initialized: Ref<boolean, boolean>;
isInitializing: Ref<boolean, boolean>;
toggleMute: () => void;
isAudioMuted: ComputedRef<boolean>;
hasActiveAlert: ComputedRef<boolean>;
acknowledgeAlert: (stationId, type, index, flag?) => Promise<void>;
rearmStation: (stationId) => Promise<void>;
},
| "removePanel"
| "addPanel"
| "isCommandPending"
| "markCommandPending"
| "statusSince"
| "setPanelState"
| "switchPanel"
| "setPanelSupervision"
| "setAllPanelsSupervision"
| "loadConfigurations"
| "loadInitialData"
| "updatePanel"
| "updatePanelState"
| "forgetPanel"
| "isPanelConnected"
| "isPanelInAlarm"
| "setConnectionStatus"
| "setModbusConnected"
| "initialize"
| "toggleMute"
| "acknowledgeAlert"
| "rearmStation">>;Défini dans: features/panel/panel.store.ts:36
Store Pinia central gérant l'état temps réel des centrales incendie : configurations, états des zones/points, connexions Modbus/API et alertes actives.