Optymalizacja listy ze sceneriami | v1.3.4 -> .5

This commit is contained in:
2020-12-26 23:38:52 +01:00
parent f16ecc39e6
commit ff17b791f0
9 changed files with 121 additions and 2277 deletions
+57
View File
@@ -4927,6 +4927,63 @@
"locate-path": "^3.0.0"
}
},
"firebase": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/firebase/-/firebase-2.4.2.tgz",
"integrity": "sha1-ThEZ7AOWylYdinrL/xYw/qxsCjE=",
"requires": {
"faye-websocket": ">=0.6.0"
},
"dependencies": {
"faye-websocket": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.9.3.tgz",
"integrity": "sha1-SCpQWw3wrmJrlphm0710DNuWLoM=",
"requires": {
"websocket-driver": ">=0.5.1"
},
"dependencies": {
"websocket-driver": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.5.2.tgz",
"integrity": "sha1-jHyF2gcTtAYFVrTXHAF3XuEmnrk=",
"requires": {
"websocket-extensions": ">=0.1.1"
},
"dependencies": {
"websocket-extensions": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.1.tgz",
"integrity": "sha1-domUmcGEtu91Q3fC27DNbLVdKec="
}
}
}
}
}
}
},
"firebase-token-generator": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/firebase-token-generator/-/firebase-token-generator-2.0.0.tgz",
"integrity": "sha1-l2fXWewTq9yZuhFf1eqZ2Lk9EgY="
},
"firestore": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/firestore/-/firestore-1.1.6.tgz",
"integrity": "sha1-cyhLzp/psIva1sGCeNJbaW4SPMI=",
"requires": {
"firebase": "^2.1.2",
"firebase-token-generator": "^2.0.0",
"lodash": "^3.1.0"
},
"dependencies": {
"lodash": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y="
}
}
},
"flush-write-stream": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
+1
View File
@@ -10,6 +10,7 @@
"dependencies": {
"core-js": "^3.6.5",
"dotenv": "^8.2.0",
"firestore": "^1.1.6",
"howler": "^2.2.1",
"vue": "^2.6.11",
"vue-class-component": "^7.2.5",
+2
View File
@@ -18,7 +18,9 @@
const firebaseConfig = {
apiKey: "AIzaSyBI36X2-p7vU1flxoJdCEc0noByyTe1mpw",
authDomain: "stacjownik-td2.firebaseapp.com",
databaseURL: "https://stacjownik-td2.firebaseio.com",
projectId: "stacjownik-td2",
storageBucket: "stacjownik-td2.appspot.com",
};
firebase.initializeApp(firebaseConfig);
+1 -1
View File
@@ -59,7 +59,7 @@ export default class App extends Vue {
@Action("synchronizeData") synchronizeData;
@Getter("getAllData") data;
private VERSION = "1.3.4";
private VERSION = "1.3.5";
async mounted() {
this.synchronizeData();
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
View File
+6
View File
@@ -23,10 +23,14 @@ export default interface Station {
reqLevel: string;
supportersOnly: string;
SBL: string;
TWB: string;
signalType: string;
controlType: string;
default: boolean;
nonPublic: boolean;
unavailable: boolean;
routes: {
oneWay: { catenary: number; noCatenary: number };
@@ -40,6 +44,8 @@ export default interface Station {
}[]
| null;
stops: string[] | null;
online: boolean;
occupiedTo: string;
statusTimestamp: number;
+53 -7
View File
@@ -1,7 +1,7 @@
import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators';
import axios from 'axios';
import JSONStationData from '@/data/stations.json';
import JSONStationData from '@/data/stationData.json';
import Station from '@/scripts/interfaces/Station';
import Train from '@/scripts/interfaces/Train';
@@ -310,9 +310,56 @@ export default class Store extends VuexModule {
}
@Mutation setJSONData() {
this.stationList = JSONStationData.map(stationData => ({
...stationData,
stationProject: '',
/*
0: stationName,
1: stationURL,
2: stationlines,
3: stationProject?,
4: reqLevel,
5: supportersOnly,
6: signalType,
7: controlType,
8: SBL,
9: two-way block,
10: routes, one-way, catenary,
11: routes, one-way, no catenary,
12: routes, two-way, catenary,
13: routes, two-way, no catenary,
14: subStations?,
15: stops?,
16: default,
17: nonPublic,
18: unavailable
*/
this.stationList = JSONStationData.map(station => ({
stationName: station[0] as string,
stationURL: station[1] as string,
stationLines: station[2] as string,
stationProject: station[3] as string,
reqLevel: station[4] as string,
supportersOnly: station[5] as string,
signalType: station[6] as string,
controlType: station[7] as string,
SBL: station[8] as string,
TWB: station[9] as string,
routes: {
oneWay: {
catenary: station[10] as number,
noCatenary: station[11] as number,
},
twoWay: {
catenary: station[12] as number,
noCatenary: station[13] as number,
},
},
checkpoints: station[14] ? (station[14] as string[]).map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : null,
stops: station[15] as string[],
default: station[16] as boolean,
nonPublic: station[17] as boolean,
unavailable: station[18] as boolean,
stationHash: '',
maxUsers: 0,
currentUsers: 0,
@@ -327,7 +374,6 @@ export default class Store extends VuexModule {
stationTrains: [],
scheduledTrains: [],
spawns: [],
checkpoints: stationData.subStations ? stationData.subStations.map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : null,
}));
}
@@ -335,7 +381,7 @@ export default class Store extends VuexModule {
private updateOnlineStations(updatedStationList: any[]) {
this.stationList = this.stationList.reduce((acc, station) => {
const onlineStationData = updatedStationList.find(updatedStation => updatedStation.stationName === station.stationName);
const registeredStation = JSONStationData.find(data => data.stationName === station.stationName);
const registeredStation = JSONStationData.find(data => data[0] === station.stationName);
if (onlineStationData)
acc.push({
@@ -417,7 +463,7 @@ export default class Store extends VuexModule {
if (stationName.includes(stopName) && !stop.stopName.includes('po.') && !stop.stopName.includes('podg.')) return true;
if (stopName.includes('podg.') && stopName.split(', podg.')[0] && stationName === stopName.split(', podg.')[0]) return true;
if (JSONStationData.some(data => data.stationName.includes(station.stationName) && data.stops && data.stops.includes(stop.stopNameRAW))) return true;
if (station.stops && station.stops.includes(stop.stopNameRAW)) return true;
return false;
});