mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
chore: added test data mocks
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,369 +1,4 @@
|
||||
{
|
||||
"optionSections": [
|
||||
"status",
|
||||
"timetables",
|
||||
"reality",
|
||||
"package-access",
|
||||
"station-type",
|
||||
"access",
|
||||
"control",
|
||||
"blockades",
|
||||
"signals",
|
||||
"addons"
|
||||
],
|
||||
|
||||
"options": [
|
||||
{
|
||||
"id": "real",
|
||||
"name": "real",
|
||||
"section": "reality",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "fictional",
|
||||
"name": "fictional",
|
||||
"section": "reality",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "default",
|
||||
"name": "default",
|
||||
"section": "package-access",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "not-default",
|
||||
"name": "notDefault",
|
||||
"section": "package-access",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "non-public",
|
||||
"name": "nonPublic",
|
||||
"section": "access",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "unavailable",
|
||||
"name": "unavailable",
|
||||
"section": "access",
|
||||
"value": false,
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "abandoned",
|
||||
"name": "abandoned",
|
||||
"section": "access",
|
||||
"value": false,
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "junction",
|
||||
"name": "junction",
|
||||
"section": "station-type",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "nonJunction",
|
||||
"name": "nonJunction",
|
||||
"section": "station-type",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SPK",
|
||||
"name": "SPK",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SCS",
|
||||
"name": "SCS",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SPE",
|
||||
"name": "SPE",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
|
||||
{
|
||||
"id": "SPK-M",
|
||||
"name": "mechaniczne+SPK",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SCS-M",
|
||||
"name": "mechaniczne+SCS",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "mechanical",
|
||||
"name": "mechaniczne",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SPK-R",
|
||||
"name": "ręczne+SPK",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SCS-R",
|
||||
"name": "ręczne+SCS",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "manual",
|
||||
"name": "ręczne",
|
||||
"section": "control",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SUP",
|
||||
"name": "SUP",
|
||||
"section": "addons",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "noSUP",
|
||||
"name": "noSUP",
|
||||
"section": "addons",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "ASDEK",
|
||||
"name": "ASDEK",
|
||||
"section": "addons",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "noASDEK",
|
||||
"name": "noASDEK",
|
||||
"section": "addons",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "SBL",
|
||||
"name": "SBL",
|
||||
"section": "blockades",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "PBL",
|
||||
"name": "PBL",
|
||||
"section": "blockades",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "modern",
|
||||
"name": "współczesna",
|
||||
"section": "signals",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "semaphores",
|
||||
"name": "kształtowa",
|
||||
"section": "signals",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "mixed",
|
||||
"name": "mieszana",
|
||||
"section": "signals",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "historical",
|
||||
"name": "historyczna",
|
||||
"section": "signals",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
|
||||
{
|
||||
"id": "free",
|
||||
"name": "free",
|
||||
|
||||
"section": "status",
|
||||
"value": false,
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"id": "occupied",
|
||||
"name": "occupied",
|
||||
|
||||
"section": "status",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "endingStatus",
|
||||
"name": "endingStatus",
|
||||
|
||||
"section": "status",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "afkStatus",
|
||||
"name": "afkStatus",
|
||||
|
||||
"section": "status",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "noSpaceStatus",
|
||||
"name": "noSpaceStatus",
|
||||
|
||||
"section": "status",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "unavailableStatus",
|
||||
"name": "unavailableStatus",
|
||||
|
||||
"section": "status",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "withActiveTimetables",
|
||||
"name": "withActiveTimetables",
|
||||
"section": "timetables",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "withoutActiveTimetables",
|
||||
"name": "withoutActiveTimetables",
|
||||
"section": "timetables",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
}
|
||||
],
|
||||
"sliders": [
|
||||
{
|
||||
"id": "min-lvl",
|
||||
"name": "minLevel",
|
||||
"minRange": 0,
|
||||
"maxRange": 20,
|
||||
"step": 1,
|
||||
"value": 0,
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "max-lvl",
|
||||
"name": "maxLevel",
|
||||
"minRange": 0,
|
||||
"maxRange": 20,
|
||||
"step": 1,
|
||||
"value": 20,
|
||||
"defaultValue": 20
|
||||
},
|
||||
{
|
||||
"id": "min-vmax",
|
||||
"name": "minVmax",
|
||||
"minRange": 0,
|
||||
"maxRange": 200,
|
||||
"step": 10,
|
||||
"value": 0,
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "max-vmax",
|
||||
"name": "maxVmax",
|
||||
"minRange": 0,
|
||||
"maxRange": 200,
|
||||
"step": 10,
|
||||
"value": 200,
|
||||
"defaultValue": 200
|
||||
},
|
||||
{
|
||||
"id": "routes-1t-cat",
|
||||
"name": "minOneWayCatenary",
|
||||
"minRange": 0,
|
||||
"maxRange": 5,
|
||||
"step": 1,
|
||||
"value": 0,
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "routes-1t-other",
|
||||
"name": "minOneWay",
|
||||
"minRange": 0,
|
||||
"maxRange": 5,
|
||||
"step": 1,
|
||||
"value": 0,
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "routes-2t-cat",
|
||||
"name": "minTwoWayCatenary",
|
||||
"minRange": 0,
|
||||
"maxRange": 5,
|
||||
"step": 1,
|
||||
"value": 0,
|
||||
"defaultValue": 0
|
||||
},
|
||||
{
|
||||
"id": "routes-2t-other",
|
||||
"name": "minTwoWay",
|
||||
"minRange": 0,
|
||||
"maxRange": 5,
|
||||
"step": 1,
|
||||
"value": 0,
|
||||
"defaultValue": 0
|
||||
}
|
||||
],
|
||||
"modes": [
|
||||
{
|
||||
"id": "include-selected",
|
||||
"name": "include-selected",
|
||||
"section": "mode",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"id": "save",
|
||||
"name": "save",
|
||||
"section": "mode",
|
||||
"value": true,
|
||||
"defaultValue": true
|
||||
}
|
||||
],
|
||||
"regions": [
|
||||
{
|
||||
"id": "eu",
|
||||
|
||||
@@ -55,6 +55,18 @@ export const useApiStore = defineStore('apiStore', {
|
||||
},
|
||||
|
||||
async fetchActiveData() {
|
||||
if (import.meta.env.VITE_API_ACTIVE_DATA_MODE == 'mocking') {
|
||||
import('../../tests/data/getActiveData.json').then((data) => {
|
||||
console.warn('activeData: mocking mode');
|
||||
this.activeData = data.default as API.ActiveData.Response;
|
||||
this.lastFetchData = new Date();
|
||||
|
||||
this.dataStatuses.connection = Status.Data.Loaded;
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.activeData) this.dataStatuses.connection = Status.Data.Loading;
|
||||
|
||||
try {
|
||||
@@ -94,6 +106,16 @@ export const useApiStore = defineStore('apiStore', {
|
||||
},
|
||||
|
||||
async fetchVehiclesInfo() {
|
||||
if (import.meta.env.VITE_API_VEHICLES_MODE == 'mocking') {
|
||||
import('../../tests/data/vehicles.json').then((data) => {
|
||||
console.warn('vehicles.json: mocking mode');
|
||||
this.vehiclesData = data.default;
|
||||
this.dataStatuses.vehicles = Status.Data.Loaded;
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await this.client!.get<API.Vehicles.Response>('vehicles');
|
||||
|
||||
|
||||
Vendored
+4
-2
@@ -6,8 +6,10 @@ declare module '*.vue' {
|
||||
export default component;
|
||||
}
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_APP_API_DEV: string;
|
||||
readonly VITE_APP_WS_DEV: string;
|
||||
readonly VITE_API_MODE: 'production' | 'mocking' | 'development';
|
||||
readonly VITE_API_VEHICLES_MODE: 'production' | 'mocking' | 'development';
|
||||
readonly VITE_API_ACTIVE_DATA_MODE: 'production' | 'mocking' | 'development';
|
||||
readonly VITE_UPDATE_TEST: 'test' | 'production';
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
||||
Reference in New Issue
Block a user