filtrowanie statusów; poprawki w statystykach

This commit is contained in:
2023-10-31 22:53:18 +01:00
parent e4ed24de80
commit 380c97655c
14 changed files with 183 additions and 215 deletions
+2 -1
View File
@@ -43,9 +43,10 @@
#app { #app {
color: white; color: white;
font-size: 1rem; font-size: 1rem;
overflow-x: hidden;
@include smallScreen() { @include smallScreen() {
font-size: calc(0.55rem + 1.1vw); font-size: calc(0.65rem + 0.8vw);
} }
@include screenLandscape() { @include screenLandscape() {
+1 -1
View File
@@ -80,7 +80,7 @@ export default defineComponent({
connectedSocketCount: 0 connectedSocketCount: 0
}; };
this.store.setOnlineData(); this.store.setStatuses();
}); });
window.addEventListener('online', () => { window.addEventListener('online', () => {
@@ -243,10 +243,6 @@ export default defineComponent({
} }
@include smallScreen { @include smallScreen {
.daily-stats {
text-align: justify;
}
h3 { h3 {
text-align: center; text-align: center;
} }
@@ -51,7 +51,11 @@
/> />
<button class="search-exit" v-if="propName != 'search-date'"> <button class="search-exit" v-if="propName != 'search-date'">
<img src="/images/icon-exit.svg" alt="exit-icon" @click="onInputClear(propName)" /> <img
src="/images/icon-exit.svg"
alt="exit-icon"
@click="onInputClear(propName)"
/>
</button> </button>
</div> </div>
</div> </div>
@@ -180,7 +184,7 @@ export default defineComponent({
}, },
watch: { watch: {
async driverStatsName() { async 'store.driverStatsName'() {
await this.fetchDriverStats(); await this.fetchDriverStats();
// if (value) this.store.currentStatsTab = 'driver'; // if (value) this.store.currentStatsTab = 'driver';
@@ -86,8 +86,6 @@ watch(
); );
onMounted(() => { onMounted(() => {
console.log(StorageManager.getBooleanValue('dailyStatsOpen'));
if (StorageManager.getBooleanValue('dailyStatsOpen')) { if (StorageManager.getBooleanValue('dailyStatsOpen')) {
areStatsOpen.value = true; areStatsOpen.value = true;
store.currentStatsTab = 'daily'; store.currentStatsTab = 'daily';
@@ -3,7 +3,7 @@
<h3 class="user-header section-header"> <h3 class="user-header section-header">
<img src="/images/icon-user.svg" alt="Users icon" /> <img src="/images/icon-user.svg" alt="Users icon" />
&nbsp;{{ $t('scenery.users') }} &nbsp; &nbsp;{{ $t('scenery.users') }} &nbsp;
<span class="text--primary">{{ onlineScenery?.currentUsers || 0 }}</span <span class="text--primary">{{ onlineScenery?.stationTrains?.length || 0 }}</span
>&nbsp;/&nbsp;<span class="text--primary">{{ onlineScenery?.maxUsers || 0 }}</span> >&nbsp;/&nbsp;<span class="text--primary">{{ onlineScenery?.maxUsers || 0 }}</span>
</h3> </h3>
@@ -22,7 +22,7 @@
<div <div
class="badge user badge-none" class="badge user badge-none"
v-if="!onlineScenery?.scheduledTrains || onlineScenery.scheduledTrains.length == 0" v-if="!onlineScenery?.stationTrains?.length"
> >
{{ $t('scenery.no-users') }} {{ $t('scenery.no-users') }}
</div> </div>
+27 -23
View File
@@ -6,13 +6,10 @@
<span>{{ $t('scenery.timetables') }}</span> <span>{{ $t('scenery.timetables') }}</span>
<span> <span>
<span class="text--primary">{{ onlineScenery?.scheduledTrains?.length || '0' }}</span> <span class="text--primary">{{ onlineScenery?.scheduledTrainCount.all || 0 }}</span>
<span> / </span> <span> / </span>
<span class="text--grayed"> <span class="text--grayed">
{{ {{ onlineScenery?.scheduledTrainCount.confirmed || '0' }}
onlineScenery?.scheduledTrains?.filter((train) => train.stopInfo.confirmed).length ||
'0'
}}
</span> </span>
</span> </span>
@@ -48,27 +45,34 @@
</div> </div>
<div class="timetable-list"> <div class="timetable-list">
<div
style="padding-bottom: 5em"
v-if="store.dataStatuses.trains == 0 && computedScheduledTrains.length == 0"
>
<Loading />
</div>
<span
class="timetable-item empty"
v-else-if="computedScheduledTrains.length == 0 && !onlineScenery"
>
{{ $t('scenery.offline') }}
</span>
<span class="timetable-item empty" v-else-if="computedScheduledTrains.length == 0">
{{ $t('scenery.no-timetables') }}
</span>
<transition-group name="list-anim"> <transition-group name="list-anim">
<div
style="padding-bottom: 5em"
v-if="store.dataStatuses.trains == 0 && computedScheduledTrains.length == 0"
key="list-loading"
>
<Loading />
</div>
<span
class="timetable-item empty"
v-else-if="computedScheduledTrains.length == 0 && !onlineScenery"
key="list-offline"
>
{{ $t('scenery.offline') }}
</span>
<div
class="timetable-item empty"
v-else-if="computedScheduledTrains.length == 0"
key="list-no-timetables"
>
{{ $t('scenery.no-timetables') }}
</div>
<div <div
class="timetable-item" class="timetable-item"
v-else
v-for="scheduledTrain in computedScheduledTrains" v-for="scheduledTrain in computedScheduledTrains"
:key="scheduledTrain.trainId" :key="scheduledTrain.trainId"
tabindex="0" tabindex="0"
+26 -27
View File
@@ -230,11 +230,9 @@
</td> </td>
<td class="station_users" :class="{ inactive: !station.onlineInfo }"> <td class="station_users" :class="{ inactive: !station.onlineInfo }">
<span> <span>{{ station.onlineInfo?.currentUsers || 0 }}</span>
<span class="highlight">{{ station.onlineInfo?.currentUsers || 0 }}</span> /
/ <span>{{ station.onlineInfo?.maxUsers || 0 }}</span>
<span class="highlight">{{ station.onlineInfo?.maxUsers || 0 }}</span>
</span>
</td> </td>
<td class="station_spawns" :class="{ inactive: !station.onlineInfo }"> <td class="station_spawns" :class="{ inactive: !station.onlineInfo }">
@@ -246,9 +244,7 @@
style="width: 30px" style="width: 30px"
:class="{ inactive: !station.onlineInfo }" :class="{ inactive: !station.onlineInfo }"
> >
<span class="highlight"> {{ station.onlineInfo?.scheduledTrainCount.all }}
{{ station.onlineInfo?.scheduledTrains?.length || 0 }}
</span>
</td> </td>
<td <td
@@ -256,15 +252,7 @@
style="width: 30px" style="width: 30px"
:class="{ inactive: !station.onlineInfo }" :class="{ inactive: !station.onlineInfo }"
> >
<span style="color: #ccc"> {{ station.onlineInfo?.scheduledTrainCount.unconfirmed }}
{{
new Set([
...(station.onlineInfo?.scheduledTrains
?.filter((train) => !train.stopInfo.confirmed)
.map((train) => train.checkpointName) || [])
]).size || 0
}}
</span>
</td> </td>
<td <td
@@ -272,12 +260,7 @@
style="width: 30px" style="width: 30px"
:class="{ inactive: !station.onlineInfo }" :class="{ inactive: !station.onlineInfo }"
> >
<span style="color: #66ff6c"> {{ station.onlineInfo?.scheduledTrainCount.confirmed }}
{{
station.onlineInfo?.scheduledTrains?.filter((train) => train.stopInfo.confirmed)
.length || 0
}}
</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -391,10 +374,6 @@ $rowCol: #424242;
} }
} }
.highlight {
color: gold;
}
section.station_table { section.station_table {
overflow: auto; overflow: auto;
overflow-y: hidden; overflow-y: hidden;
@@ -576,6 +555,26 @@ td.station {
} }
} }
.station_users {
span {
color: gold;
}
}
.station_schedules {
&.all {
color: gold;
}
&.unconfirmed {
color: #ccc;
}
&.confirmed {
color: lime;
}
}
.separator { .separator {
border-left: 3px solid #b3b3b3; border-left: 3px solid #b3b3b3;
} }
+11
View File
@@ -0,0 +1,11 @@
export enum DispatcherStatusID {
Unknown = 'unknown',
Outdated = 'outdated',
Unauthorized = 'not-signed',
OnlineNoLimit = 'no-limit',
Afk = 'brb',
Ending = 'ending',
NoSpace = 'no-space',
Unavailable = 'unavailable',
OnlineWithHours = 'online'
}
+2 -30
View File
@@ -1,4 +1,4 @@
import { Availability } from './store/storeTypes'; import { Availability, OnlineScenery } from './store/storeTypes';
import { ScheduledTrain } from './ScheduledTrain'; import { ScheduledTrain } from './ScheduledTrain';
import StationRoutes from './StationRoutes'; import StationRoutes from './StationRoutes';
@@ -32,33 +32,5 @@ export default interface Station {
}[]; }[];
}; };
onlineInfo?: { onlineInfo?: OnlineScenery;
hash: string;
name: string;
region: string;
maxUsers: number;
currentUsers: number;
spawns: { spawnName: string; spawnLength: number; isElectrified: boolean }[];
dispatcherRate: number;
dispatcherName: string;
dispatcherExp: number;
dispatcherId: number;
dispatcherIsSupporter: boolean;
statusTimestamp: number;
// statusTimeString: string;
statusID: string;
stationTrains?: {
driverName: string;
driverId: number;
trainNo: number;
trainId: string;
stopStatus?: string;
}[];
scheduledTrains?: ScheduledTrain[];
};
} }
+11 -2
View File
@@ -7,6 +7,7 @@ import { DriverStatsAPIData } from '../api/DriverStatsAPIData';
import { RollingStockGithubData } from '../github_api/StockInfoGithubData'; import { RollingStockGithubData } from '../github_api/StockInfoGithubData';
import Station from '../Station'; import Station from '../Station';
import { ScheduledTrain } from '../ScheduledTrain'; import { ScheduledTrain } from '../ScheduledTrain';
import { DispatcherStatusID } from '../../enums/DispatcherStatus';
export type Availability = 'default' | 'unavailable' | 'nonPublic' | 'abandoned' | 'nonDefault'; export type Availability = 'default' | 'unavailable' | 'nonPublic' | 'abandoned' | 'nonDefault';
@@ -15,7 +16,7 @@ export interface StoreState {
apiData: APIData; apiData: APIData;
rollingStockData?: RollingStockGithubData; rollingStockData?: RollingStockGithubData;
lastDispatcherStatuses: { hash: string; statusTimestamp: number; statusID: string }[]; lastDispatcherStatuses: { hash: string; statusTimestamp: number; statusID: DispatcherStatusID }[];
sceneryData: any[][]; sceneryData: any[][];
@@ -113,8 +114,16 @@ export interface OnlineScenery {
dispatcherIsSupporter: boolean; dispatcherIsSupporter: boolean;
statusTimestamp: number; statusTimestamp: number;
statusID: string; statusID: DispatcherStatusID;
isOnline: boolean;
stationTrains?: StationTrain[]; stationTrains?: StationTrain[];
scheduledTrains?: ScheduledTrain[]; scheduledTrains?: ScheduledTrain[];
scheduledTrainCount: {
all: number;
confirmed: number;
unconfirmed: number;
}
} }
+6 -1
View File
@@ -1,4 +1,5 @@
import { HeadIdsTypes } from '../data/stationHeaderNames'; import { HeadIdsTypes } from '../data/stationHeaderNames';
import { DispatcherStatusID } from '../enums/DispatcherStatus';
import Filter from '../interfaces/Filter'; import Filter from '../interfaces/Filter';
import Station from '../interfaces/Station'; import Station from '../interfaces/Station';
@@ -90,11 +91,15 @@ export const filterStations = (station: Station, filters: Filter) => {
if (station.onlineInfo) { if (station.onlineInfo) {
const { statusID, statusTimestamp } = station.onlineInfo; const { statusID, statusTimestamp } = station.onlineInfo;
const isEnding = statusID == 'ending' && filters['endingStatus']; const isEnding = statusID == DispatcherStatusID.Ending && filters['endingStatus'];
const isNotSigned = const isNotSigned =
(statusID == 'not-signed' || statusID == 'unavailable') && filters['unavailableStatus']; (statusID == 'not-signed' || statusID == 'unavailable') && filters['unavailableStatus'];
const isAFK = statusID == 'brb' && filters['afkStatus']; const isAFK = statusID == 'brb' && filters['afkStatus'];
const isNoSpace = statusID == 'no-space' && filters['noSpaceStatus']; const isNoSpace = statusID == 'no-space' && filters['noSpaceStatus'];
const isOccupied = station.onlineInfo && filters['occupied']; const isOccupied = station.onlineInfo && filters['occupied'];
const isOnlineInBounds = const isOnlineInBounds =
+21 -18
View File
@@ -1,3 +1,4 @@
import { DispatcherStatusID } from '../enums/DispatcherStatus';
import { ScheduledTrain, StopStatus } from '../interfaces/ScheduledTrain'; import { ScheduledTrain, StopStatus } from '../interfaces/ScheduledTrain';
import Station from '../interfaces/Station'; import Station from '../interfaces/Station';
import Train from '../interfaces/Train'; import Train from '../interfaces/Train';
@@ -10,34 +11,39 @@ export const getLocoURL = (locoType: string): string =>
locoType.includes('EN') ? locoType + 'rb' : locoType locoType.includes('EN') ? locoType + 'rb' : locoType
}.png`; }.png`;
export const getStatusID = (stationStatus: any): string => { export const getStatusID = (
if (!stationStatus) return 'unknown'; stationStatus: any[] | undefined,
if (stationStatus == -1) return 'not-signed'; isSWDROnline: boolean
): DispatcherStatusID => {
if (isSWDROnline && !stationStatus) return DispatcherStatusID.Unauthorized;
if (!stationStatus) return DispatcherStatusID.Unknown;
// if (stationStatus == -1) return DispatcherStatusID.Unauthorized;
const statusCode = stationStatus[2]; const statusCode = stationStatus[2];
const statusTimestamp = stationStatus[3]; const statusTimestamp = stationStatus[3];
switch (statusCode) { switch (statusCode) {
case 0: case 0:
if (statusTimestamp - Date.now() > 21000000) return 'no-limit'; if (statusTimestamp - Date.now() > 21000000) return DispatcherStatusID.OnlineNoLimit;
return 'online'; return DispatcherStatusID.OnlineWithHours;
case 1: case 1:
return 'brb'; return DispatcherStatusID.Afk;
case 2: case 2:
if (statusTimestamp == 0) return 'ending'; if (statusTimestamp == 0) return DispatcherStatusID.Ending;
break; break;
case 3: case 3:
return 'no-space'; return DispatcherStatusID.NoSpace;
default: default:
break; break;
} }
return 'unavailable'; return DispatcherStatusID.Unavailable;
}; };
export const getStatusTimestamp = (stationStatus: any): number => { export const getStatusTimestamp = (stationStatus: any): number => {
@@ -219,12 +225,9 @@ export function getDispatcherStatus(state: StoreState, onlineStationData: Statio
(dispatcher) => dispatcher.hash === onlineStationData.stationHash (dispatcher) => dispatcher.hash === onlineStationData.stationHash
); );
const stationStatus = !dispatchers const stationStatus = dispatchers?.find(
? undefined (status: string[]) => status[0] == onlineStationData.stationHash && status[1] == state.region.id
: dispatchers.find( );
(status: string[]) =>
status[0] == onlineStationData.stationHash && status[1] == state.region.id
) || -1;
const statusTimestamp = const statusTimestamp =
prevDispatcherStatus && !dispatchers prevDispatcherStatus && !dispatchers
@@ -234,7 +237,7 @@ export function getDispatcherStatus(state: StoreState, onlineStationData: Statio
const statusID = const statusID =
prevDispatcherStatus && !dispatchers prevDispatcherStatus && !dispatchers
? prevDispatcherStatus.statusID ? prevDispatcherStatus.statusID
: getStatusID(stationStatus); : getStatusID(stationStatus, onlineStationData.isOnline === 1);
return { return {
hash: onlineStationData.stationHash, hash: onlineStationData.stationHash,
@@ -263,8 +266,8 @@ export function getScheduledTrains(
return ( return (
stationName == stopName || stationName == stopName ||
(!/(po\.|podg\.)/.test(stationName) && stopName.includes(stationName)) || (!/(po\.|podg\.)/.test(stopName) && stopName.includes(stationName)) ||
(!/(po\.|podg\.)/.test(stopName) && stationName.includes(stopName)) || (!/(po\.|podg\.)/.test(stationName) && stationName.includes(stopName)) ||
(stopName.split(', podg.')[0] !== undefined && (stopName.split(', podg.')[0] !== undefined &&
stationName.startsWith(stopName.split(', podg.')[0])) stationName.startsWith(stopName.split(', podg.')[0]))
); );
+68 -102
View File
@@ -21,6 +21,8 @@ import {
import packageInfo from '../../package.json'; import packageInfo from '../../package.json';
import { RollingStockGithubData } from '../scripts/interfaces/github_api/StockInfoGithubData'; import { RollingStockGithubData } from '../scripts/interfaces/github_api/StockInfoGithubData';
import { ScheduledTrain } from '../scripts/interfaces/ScheduledTrain';
import { DispatcherStatusID } from '../scripts/enums/DispatcherStatus';
export const useStore = defineStore('store', { export const useStore = defineStore('store', {
state: () => state: () =>
@@ -127,110 +129,72 @@ export const useStore = defineStore('store', {
if (state.isOffline) return []; if (state.isOffline) return [];
if (!state.apiData?.stations) return []; if (!state.apiData?.stations) return [];
return state.apiData?.stations return (
?.filter((apiStation) => apiStation.region == state.region.id && apiStation.isOnline) state.apiData?.stations
.map((apiStation) => { // ?.filter((apiStation) => apiStation.region == state.region.id)
const dispatcherStatus = getDispatcherStatus(state as StoreState, apiStation); .reduce((list, apiStation) => {
const station = this.stationList.find((s) => s.name === apiStation.stationName); if (apiStation.region != state.region.id) return list;
const scheduledTrains = getScheduledTrains( const dispatcherStatus = getDispatcherStatus(state as StoreState, apiStation);
this.trainList,
apiStation,
station?.generalInfo
);
const stationTrains = getStationTrains( if (dispatcherStatus.statusID == DispatcherStatusID.Unknown) return list;
this.trainList,
scheduledTrains,
this.region.id,
apiStation
);
return { const station = this.stationList.find((s) => s.name === apiStation.stationName);
name: apiStation.stationName,
hash: apiStation.stationHash, const scheduledTrains = getScheduledTrains(
region: apiStation.region, this.trainList,
maxUsers: apiStation.maxUsers, apiStation,
currentUsers: apiStation.currentUsers, station?.generalInfo
spawns: parseSpawns(apiStation.spawnString), );
dispatcherName: apiStation.dispatcherName,
dispatcherRate: apiStation.dispatcherRate, const stationTrains = getStationTrains(
dispatcherId: apiStation.dispatcherId, this.trainList,
dispatcherExp: apiStation.dispatcherExp, scheduledTrains,
dispatcherIsSupporter: apiStation.dispatcherIsSupporter, this.region.id,
scheduledTrains: scheduledTrains, apiStation
stationTrains: stationTrains, );
statusTimestamp: dispatcherStatus.statusTimestamp,
statusID: dispatcherStatus.statusID // Remove checkpoint duplicates
}; const uniqueScheduledTrains = scheduledTrains.reduce(
}); (uniqueList, sTrain) =>
uniqueList.find((v) => v.trainId === sTrain.trainId)
? uniqueList
: [...uniqueList, sTrain],
[] as ScheduledTrain[]
);
list.push({
name: apiStation.stationName,
hash: apiStation.stationHash,
region: apiStation.region,
maxUsers: apiStation.maxUsers,
currentUsers: apiStation.currentUsers,
spawns: parseSpawns(apiStation.spawnString),
dispatcherName: apiStation.dispatcherName,
dispatcherRate: apiStation.dispatcherRate,
dispatcherId: apiStation.dispatcherId,
dispatcherExp: apiStation.dispatcherExp,
dispatcherIsSupporter: apiStation.dispatcherIsSupporter,
scheduledTrains: scheduledTrains,
stationTrains: stationTrains,
statusTimestamp: dispatcherStatus.statusTimestamp,
statusID: dispatcherStatus.statusID,
isOnline: apiStation.isOnline == 1,
scheduledTrainCount: {
all: uniqueScheduledTrains.length,
confirmed: uniqueScheduledTrains.filter((train) => train.stopInfo.confirmed).length,
unconfirmed: uniqueScheduledTrains.filter((train) => !train.stopInfo.confirmed).length
}
});
return list;
}, [] as OnlineScenery[])
);
} }
}, },
actions: { actions: {
// setStationsOnlineInfo() {
// const onlineStationNames: string[] = [];
// const prevDispatcherStatuses: StoreState['lastDispatcherStatuses'] = [];
// if (this.isOffline) {
// this.stationList.forEach((station) => {
// station.onlineInfo = undefined;
// });
// return;
// }
// this.apiData.stations?.forEach((stationAPIData) => {
// if (stationAPIData.region !== this.region.id || !stationAPIData.isOnline) return;
// const station = this.stationList.find((s) => s.name === stationAPIData.stationName);
// onlineStationNames.push(stationAPIData.stationName);
// const dispatcherStatus = this.getDispatcherStatus(stationAPIData);
// prevDispatcherStatuses.push(dispatcherStatus);
// const stationTrains = this.getStationTrains(stationAPIData);
// const scheduledTrains = this.getScheduledTrains(station?.generalInfo, stationAPIData);
// const onlineInfo = {
// name: stationAPIData.stationName,
// hash: stationAPIData.stationHash,
// region: stationAPIData.region,
// maxUsers: stationAPIData.maxUsers,
// currentUsers: stationAPIData.currentUsers,
// spawns: parseSpawns(stationAPIData.spawnString),
// dispatcherName: stationAPIData.dispatcherName,
// dispatcherRate: stationAPIData.dispatcherRate,
// dispatcherId: stationAPIData.dispatcherId,
// dispatcherExp: stationAPIData.dispatcherExp,
// dispatcherIsSupporter: stationAPIData.dispatcherIsSupporter,
// stationTrains,
// statusTimestamp: dispatcherStatus.statusTimestamp,
// statusID: dispatcherStatus.statusID,
// scheduledTrains
// };
// if (!station) {
// this.stationList.push({
// name: stationAPIData.stationName,
// onlineInfo
// });
// return;
// }
// station.onlineInfo = { ...onlineInfo };
// });
// this.stationList
// .filter((station) => !onlineStationNames.includes(station.name) && station.onlineInfo)
// .forEach((offlineStation) => {
// offlineStation.onlineInfo = undefined;
// });
// if (this.apiData.dispatchers != null) this.lastDispatcherStatuses = prevDispatcherStatuses;
// },
async fetchStationsGeneralInfo() { async fetchStationsGeneralInfo() {
const sceneryData: StationJSONData[] = await ( const sceneryData: StationJSONData[] = await (
await axios.get(`${URLs.stacjownikAPI}/api/getSceneries`) await axios.get(`${URLs.stacjownikAPI}/api/getSceneries`)
@@ -297,7 +261,7 @@ export const useStore = defineStore('store', {
const mockWebsocketData = await import('../data/mockWebsocketData.json'); const mockWebsocketData = await import('../data/mockWebsocketData.json');
this.dataStatuses.connection = DataStatus.Loaded; this.dataStatuses.connection = DataStatus.Loaded;
this.apiData = mockWebsocketData as any; this.apiData = mockWebsocketData as any;
this.setOnlineData(); this.setStatuses();
console.warn('Stacjownik działa w trybie mockowania danych z WS'); console.warn('Stacjownik działa w trybie mockowania danych z WS');
@@ -320,13 +284,13 @@ export const useStore = defineStore('store', {
socket.on('UPDATE', (data: APIData) => { socket.on('UPDATE', (data: APIData) => {
this.apiData = data; this.apiData = data;
this.dataStatuses.connection = DataStatus.Loaded; this.dataStatuses.connection = DataStatus.Loaded;
this.setOnlineData(); this.setStatuses();
}); });
socket.emit('FETCH_DATA', { version: packageInfo.version }, (data: APIData) => { socket.emit('FETCH_DATA', { version: packageInfo.version }, (data: APIData) => {
this.dataStatuses.connection = DataStatus.Loaded; this.dataStatuses.connection = DataStatus.Loaded;
this.apiData = data; this.apiData = data;
this.setOnlineData(); this.setStatuses();
}); });
this.webSocket = socket; this.webSocket = socket;
@@ -354,7 +318,7 @@ export const useStore = defineStore('store', {
} }
}, },
async setOnlineData() { async setStatuses() {
if (!this.apiData.stations) { if (!this.apiData.stations) {
this.dataStatuses.sceneries = DataStatus.Error; this.dataStatuses.sceneries = DataStatus.Error;
this.dataStatuses.trains = DataStatus.Error; this.dataStatuses.trains = DataStatus.Error;
@@ -368,6 +332,8 @@ export const useStore = defineStore('store', {
this.dataStatuses.dispatchers = !this.apiData.dispatchers this.dataStatuses.dispatchers = !this.apiData.dispatchers
? DataStatus.Warning ? DataStatus.Warning
: DataStatus.Loaded; : DataStatus.Loaded;
// if (this.apiData.dispatchers != null) this.lastDispatcherStatuses = prevDispatcherStatuses;
} }
} }
}); });