Dodano wersję developerską; dodano nowy JSON z danymi scenerii

This commit is contained in:
2022-02-14 23:06:04 +01:00
parent d44c3ea8d0
commit 7beebee235
3 changed files with 54 additions and 44 deletions
+2 -1
View File
@@ -5,7 +5,8 @@
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"deploy": "npm run build && firebase deploy --only hosting" "deploy-prod": "npm run build && firebase deploy --only hosting:prod",
"deploy-dev": "npm run build && firebase deploy --only hosting:dev"
}, },
"dependencies": { "dependencies": {
"core-js": "^3.12.1", "core-js": "^3.12.1",
+1 -1
View File
@@ -1,5 +1,5 @@
export const URLs = { export const URLs = {
sceneryData: "https://spythere.github.io/api/stationData.json", sceneryData: "https://spythere.github.io/api/stationDataDev.json",
sceneryDataDev: "http://127.0.0.1:8000/data", sceneryDataDev: "http://127.0.0.1:8000/data",
stations: "https://api.td2.info.pl:9640/?method=getStationsOnline", stations: "https://api.td2.info.pl:9640/?method=getStationsOnline",
trains: "https://api.td2.info.pl:9640/?method=getTrainsOnline", trains: "https://api.td2.info.pl:9640/?method=getTrainsOnline",
+40 -31
View File
@@ -43,7 +43,41 @@ export interface State {
listenerLaunched: boolean; listenerLaunched: boolean;
} }
type StationJSONData = [string, string, string, string, string, string, string, string, boolean, string, string, number, number, number, number, string | null, boolean, boolean, boolean]; interface StationJSONData {
name: string;
url: string;
lines: string;
project: string;
reqLevel: number;
supportersOnly: boolean;
signalType: string;
controlType: string;
SUP: boolean;
SBL: string;
TWB: string;
routes: {
oneWay: {
catenary: number;
noCatenary: number;
};
twoWay: {
catenary: number;
noCatenary: number;
}
};
checkpoints: string | null;
default: boolean;
nonPublic: boolean;
unavailable: boolean;
}
export const key: InjectionKey<Store<State>> = Symbol() export const key: InjectionKey<Store<State>> = Symbol()
@@ -304,41 +338,16 @@ export const store = createStore<State>({
mutations: { mutations: {
SET_SCENERY_DATA(state, data: StationJSONData[]) { SET_SCENERY_DATA(state, data: StationJSONData[]) {
state.stationList = data.map(station => ({ state.stationList = data.map(stationData => ({
name: station[0], name: stationData.name,
generalInfo: { generalInfo: {
name: station[0], ...stationData,
url: station[1], checkpoints: stationData.checkpoints ? stationData.checkpoints.split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
lines: station[2],
project: station[3],
reqLevel: station[4] == "" || station[4] === null ? -1 : Number(station[4]),
supportersOnly: station[5] == "TAK",
signalType: station[6],
controlType: station[7],
SUP: station[8],
SBL: station[9],
TWB: station[10],
routes: {
oneWay: {
catenary: station[11],
noCatenary: station[12]
},
twoWay: {
catenary: station[13],
noCatenary: station[14]
}
},
checkpoints: station[15] ? (station[15]).split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
default: station[16],
nonPublic: station[17],
unavailable: station[18],
} }
})); }));
console.log(state.stationList);
}, },