mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Aktywacja widoku historii rozkładów jazdy (WIP)
This commit is contained in:
+65
-72
@@ -131,12 +131,7 @@ export const store = createStore<State>({
|
|||||||
const sceneryData = await (await axios.get(sceneryDataQuery)).data;
|
const sceneryData = await (await axios.get(sceneryDataQuery)).data;
|
||||||
// const sceneryData = await (await axios.get(sceneryDataQuery)).data;
|
// const sceneryData = await (await axios.get(sceneryDataQuery)).data;
|
||||||
|
|
||||||
const sceneryData2 = await (await axios.get('http://127.0.0.1:8000/data')).data;
|
commit(MUTATIONS.SET_SCENERY_DATA, sceneryData);
|
||||||
console.log(sceneryData2);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
commit(MUTATIONS.SET_SCENERY_DATA, sceneryData2);
|
|
||||||
commit(MUTATIONS.SET_SCENERY_DATA_STATUS, DataStatus.Loaded);
|
commit(MUTATIONS.SET_SCENERY_DATA_STATUS, DataStatus.Loaded);
|
||||||
|
|
||||||
dispatch(ACTIONS.fetchOnlineData);
|
dispatch(ACTIONS.fetchOnlineData);
|
||||||
@@ -317,81 +312,35 @@ export const store = createStore<State>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_SCENERY_DATA(state, data: SceneryData[]) {
|
SET_SCENERY_DATA(state, data: any[][]) {
|
||||||
// state.sceneryData = [...data];
|
// state.sceneryData = [...data];
|
||||||
console.log('Data:', data);
|
|
||||||
|
|
||||||
|
|
||||||
state.stationList = data.map(scenery => ({
|
// state.stationList = data.map(scenery => ({
|
||||||
stationName: scenery.name,
|
// stationName: scenery.name,
|
||||||
stationURL: scenery.url,
|
// stationURL: scenery.url,
|
||||||
stationLines: scenery.project_lines,
|
// stationLines: scenery.project_lines,
|
||||||
stationProject: scenery.project_name,
|
// stationProject: scenery.project_name,
|
||||||
reqLevel: scenery.req_level === undefined ? -1 : scenery.req_level,
|
// reqLevel: scenery.req_level === undefined ? -1 : scenery.req_level,
|
||||||
supportersOnly: scenery.supporters_only,
|
// supportersOnly: scenery.supporters_only,
|
||||||
signalType: scenery.signal_type,
|
// signalType: scenery.signal_type,
|
||||||
controlType: scenery.control_type,
|
// controlType: scenery.control_type,
|
||||||
SBL: scenery.sbl_routes,
|
// SBL: scenery.sbl_routes,
|
||||||
TWB: scenery.twb_routes,
|
// TWB: scenery.twb_routes,
|
||||||
routes: {
|
|
||||||
oneWay: {
|
|
||||||
catenary: scenery.track_oneway_e,
|
|
||||||
noCatenary: scenery.track_oneway_ne
|
|
||||||
},
|
|
||||||
twoWay: {
|
|
||||||
catenary: scenery.track_twoway_e,
|
|
||||||
noCatenary: scenery.track_twoway_ne
|
|
||||||
}
|
|
||||||
},
|
|
||||||
checkpoints: scenery.checkpoints ? scenery.checkpoints.split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
|
|
||||||
|
|
||||||
default: scenery.is_default,
|
|
||||||
nonPublic: scenery.is_nonpublic,
|
|
||||||
unavailable: scenery.is_unavailable,
|
|
||||||
|
|
||||||
stationHash: "",
|
|
||||||
maxUsers: 0,
|
|
||||||
currentUsers: 0,
|
|
||||||
dispatcherName: "",
|
|
||||||
dispatcherRate: 0,
|
|
||||||
dispatcherExp: -1,
|
|
||||||
dispatcherId: 0,
|
|
||||||
dispatcherIsSupporter: false,
|
|
||||||
online: false,
|
|
||||||
statusTimestamp: -3,
|
|
||||||
statusID: "free",
|
|
||||||
statusTimeString: "",
|
|
||||||
stationTrains: [],
|
|
||||||
scheduledTrains: [],
|
|
||||||
spawns: []
|
|
||||||
}));
|
|
||||||
|
|
||||||
// state.stationList = data.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] == "TAK",
|
|
||||||
// signalType: station[6] as string,
|
|
||||||
// controlType: station[7] as string,
|
|
||||||
// SBL: station[8] as string,
|
|
||||||
// TWB: station[9] as string,
|
|
||||||
// routes: {
|
// routes: {
|
||||||
// oneWay: {
|
// oneWay: {
|
||||||
// catenary: station[10] as number,
|
// catenary: scenery.track_oneway_e,
|
||||||
// noCatenary: station[11] as number
|
// noCatenary: scenery.track_oneway_ne
|
||||||
// },
|
// },
|
||||||
// twoWay: {
|
// twoWay: {
|
||||||
// catenary: station[12] as number,
|
// catenary: scenery.track_twoway_e,
|
||||||
// noCatenary: station[13] as number
|
// noCatenary: scenery.track_twoway_ne
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
// checkpoints: station[14] ? (station[14] as string).split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
|
// checkpoints: scenery.checkpoints ? scenery.checkpoints.split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
|
||||||
|
|
||||||
// default: station[15] as boolean,
|
// default: scenery.is_default,
|
||||||
// nonPublic: station[16] as boolean,
|
// nonPublic: scenery.is_nonpublic,
|
||||||
// unavailable: station[17] as boolean,
|
// unavailable: scenery.is_unavailable,
|
||||||
|
|
||||||
// stationHash: "",
|
// stationHash: "",
|
||||||
// maxUsers: 0,
|
// maxUsers: 0,
|
||||||
@@ -410,6 +359,50 @@ export const store = createStore<State>({
|
|||||||
// spawns: []
|
// spawns: []
|
||||||
// }));
|
// }));
|
||||||
|
|
||||||
|
state.stationList = data.map(station => ({
|
||||||
|
stationName: station[0] as string,
|
||||||
|
stationURL: station[1] as string,
|
||||||
|
stationLines: station[2] as string,
|
||||||
|
stationProject: station[3] as string,
|
||||||
|
reqLevel: Number(station[4] as string),
|
||||||
|
supportersOnly: station[5] == "TAK",
|
||||||
|
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).split(";").map(sub => ({ checkpointName: sub, scheduledTrains: [] })) : [],
|
||||||
|
|
||||||
|
default: station[15] as boolean,
|
||||||
|
nonPublic: station[16] as boolean,
|
||||||
|
unavailable: station[17] as boolean,
|
||||||
|
|
||||||
|
stationHash: "",
|
||||||
|
maxUsers: 0,
|
||||||
|
currentUsers: 0,
|
||||||
|
dispatcherName: "",
|
||||||
|
dispatcherRate: 0,
|
||||||
|
dispatcherExp: -1,
|
||||||
|
dispatcherId: 0,
|
||||||
|
dispatcherIsSupporter: false,
|
||||||
|
online: false,
|
||||||
|
statusTimestamp: -3,
|
||||||
|
statusID: "free",
|
||||||
|
statusTimeString: "",
|
||||||
|
stationTrains: [],
|
||||||
|
scheduledTrains: [],
|
||||||
|
spawns: []
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -25,13 +25,7 @@
|
|||||||
<div class="history_list">
|
<div class="history_list">
|
||||||
<div class="list_wrapper">
|
<div class="list_wrapper">
|
||||||
<transition name="warning" mode="out-in">
|
<transition name="warning" mode="out-in">
|
||||||
<div class="history_warning">
|
<div :key="historyDataStatus.status">
|
||||||
Usługa czasowo wyłączona!
|
|
||||||
<div>
|
|
||||||
<router-link to="/">[Powrót na stronę główną]</router-link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- <div :key="historyDataStatus.status">
|
|
||||||
<div v-if="isDataLoading" class="history_warning">Ładowanie...</div>
|
<div v-if="isDataLoading" class="history_warning">Ładowanie...</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -127,7 +121,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div> -->
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -146,7 +140,7 @@ import { DataStatus } from "@/scripts/enums/DataStatus";
|
|||||||
const PROD_MODE = true;
|
const PROD_MODE = true;
|
||||||
|
|
||||||
const API_URL = PROD_MODE
|
const API_URL = PROD_MODE
|
||||||
? "https://stacjownik-api-7xmt4.ondigitalocean.app/api/getTimetables"
|
? "https://stacjownik-api-di22o.ondigitalocean.app/api/getTimetables"
|
||||||
: "http://localhost:3001/api/getTimetables";
|
: "http://localhost:3001/api/getTimetables";
|
||||||
|
|
||||||
interface APIResponse {
|
interface APIResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user