mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
refactor typów danych
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import StatusIndicator from './StatusIndicator.vue';
|
||||
import Clock from './Clock.vue';
|
||||
import RegionDropdown from '../Global/RegionDropdown.vue';
|
||||
|
||||
@@ -194,9 +194,9 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import { useStore } from '../../store/store';
|
||||
import { StoreState } from '../../scripts/interfaces/store/storeTypes';
|
||||
import { StoreState } from '../../store/typings';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
data() {
|
||||
@@ -204,7 +204,7 @@ export default defineComponent({
|
||||
tooltipActive: false,
|
||||
indicator: {
|
||||
offline: false,
|
||||
status: DataStatus.Loading,
|
||||
status: Status.Data.Loading,
|
||||
message: 'data-status.S3'
|
||||
},
|
||||
|
||||
@@ -217,7 +217,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.setSignalStatus(DataStatus.Loading);
|
||||
this.setSignalStatus(Status.Data.Loading);
|
||||
},
|
||||
|
||||
setup() {
|
||||
@@ -240,44 +240,44 @@ export default defineComponent({
|
||||
const dispatcherDataStatus = statuses.dispatchers;
|
||||
|
||||
if (this.store.isOffline) {
|
||||
this.setSignalStatus(DataStatus.Initialized);
|
||||
this.indicator.status = DataStatus.Initialized;
|
||||
this.setSignalStatus(Status.Data.Initialized);
|
||||
this.indicator.status = Status.Data.Initialized;
|
||||
this.indicator.message = 'data-status.S1-offline';
|
||||
return;
|
||||
}
|
||||
|
||||
if (connectionStatus == DataStatus.Error) {
|
||||
if (connectionStatus == Status.Data.Error) {
|
||||
this.setSignalStatus(connectionStatus);
|
||||
this.indicator.status = connectionStatus;
|
||||
this.indicator.message = 'data-status.S1a-connection';
|
||||
return;
|
||||
}
|
||||
|
||||
if (sceneryDataStatus == DataStatus.Error) {
|
||||
if (sceneryDataStatus == Status.Data.Error) {
|
||||
this.setSignalStatus(sceneryDataStatus);
|
||||
this.indicator.status = sceneryDataStatus;
|
||||
this.indicator.message = 'data-status.S1a-sceneries';
|
||||
return;
|
||||
}
|
||||
|
||||
if (trainsDataStatus == DataStatus.Warning) {
|
||||
if (trainsDataStatus == Status.Data.Warning) {
|
||||
this.setSignalStatus(trainsDataStatus);
|
||||
this.indicator.status = trainsDataStatus;
|
||||
this.indicator.message = 'data-status.S5-trains';
|
||||
return;
|
||||
}
|
||||
|
||||
if (dispatcherDataStatus == DataStatus.Warning) {
|
||||
if (dispatcherDataStatus == Status.Data.Warning) {
|
||||
this.setSignalStatus(dispatcherDataStatus);
|
||||
this.indicator.status = dispatcherDataStatus;
|
||||
this.indicator.message = 'data-status.S5-dispatchers';
|
||||
return;
|
||||
}
|
||||
|
||||
if (sceneryDataStatus == DataStatus.Loaded) {
|
||||
this.setSignalStatus(DataStatus.Loaded);
|
||||
if (sceneryDataStatus == Status.Data.Loaded) {
|
||||
this.setSignalStatus(Status.Data.Loaded);
|
||||
|
||||
this.indicator.status = DataStatus.Loaded;
|
||||
this.indicator.status = Status.Data.Loaded;
|
||||
this.indicator.message = 'data-status.S2';
|
||||
}
|
||||
}
|
||||
@@ -285,31 +285,31 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
methods: {
|
||||
setSignalStatus(status: DataStatus) {
|
||||
setSignalStatus(status: Status.Data) {
|
||||
this.greenLight = false;
|
||||
this.greenBlinkLight = false;
|
||||
this.redTopLight = false;
|
||||
this.orangeLight = false;
|
||||
this.redBottomLight = false;
|
||||
|
||||
if (status == DataStatus.Initialized) {
|
||||
if (status == Status.Data.Initialized) {
|
||||
this.redTopLight = true;
|
||||
}
|
||||
|
||||
if (status == DataStatus.Loaded) {
|
||||
if (status == Status.Data.Loaded) {
|
||||
this.greenLight = true;
|
||||
}
|
||||
|
||||
if (status == DataStatus.Warning) {
|
||||
if (status == Status.Data.Warning) {
|
||||
this.orangeLight = true;
|
||||
}
|
||||
|
||||
if (status == DataStatus.Error) {
|
||||
if (status == Status.Data.Error) {
|
||||
this.redTopLight = true;
|
||||
this.redBottomLight = true;
|
||||
}
|
||||
|
||||
if (status == DataStatus.Loading) {
|
||||
if (status == Status.Data.Loading) {
|
||||
this.greenBlinkLight = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, Ref, ref } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { regions as regionsJSON } from '../../data/options.json';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
|
||||
interface Item {
|
||||
id: string;
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { DispatcherStatus } from '../../scripts/enums/DispatcherStatus';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
dispatcherStatus: {
|
||||
type: Number as PropType<DispatcherStatus | number>
|
||||
type: Number as PropType<Status.ActiveDispatcher | number>
|
||||
},
|
||||
isOnline: {
|
||||
type: Boolean
|
||||
@@ -34,25 +34,25 @@ export default defineComponent({
|
||||
if (!this.dispatcherStatus) return 'free';
|
||||
|
||||
switch (this.dispatcherStatus) {
|
||||
case DispatcherStatus.AFK:
|
||||
case Status.ActiveDispatcher.AFK:
|
||||
return 'afk';
|
||||
|
||||
case DispatcherStatus.ENDING:
|
||||
case Status.ActiveDispatcher.ENDING:
|
||||
return 'ending';
|
||||
|
||||
case DispatcherStatus.INVALID:
|
||||
case Status.ActiveDispatcher.INVALID:
|
||||
return 'invalid';
|
||||
|
||||
case DispatcherStatus.NOT_LOGGED_IN:
|
||||
case Status.ActiveDispatcher.NOT_LOGGED_IN:
|
||||
return 'not-signed';
|
||||
|
||||
case DispatcherStatus.NO_SPACE:
|
||||
case Status.ActiveDispatcher.NO_SPACE:
|
||||
return 'no-space';
|
||||
|
||||
case DispatcherStatus.UNAVAILABLE:
|
||||
case Status.ActiveDispatcher.UNAVAILABLE:
|
||||
return 'unavailable';
|
||||
|
||||
case DispatcherStatus.UNKNOWN:
|
||||
case Status.ActiveDispatcher.UNKNOWN:
|
||||
return 'unknown';
|
||||
|
||||
default:
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { RollingStockInfo } from '../../scripts/interfaces/github_api/StockInfoGithubData';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { API } from '../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -71,7 +71,7 @@ export default defineComponent({
|
||||
onImageError(event: Event, stockName: string) {
|
||||
const fallbackName =
|
||||
Object.keys(this.store.rollingStockData!.info).find((type) => {
|
||||
return this.store.rollingStockData!.info[type as keyof RollingStockInfo].find(
|
||||
return this.store.rollingStockData!.info[type as keyof API.RollingStock.Info].find(
|
||||
(v) => v[0] === stockName.split(':')[0]
|
||||
);
|
||||
}) || 'vehicle-unknown';
|
||||
|
||||
@@ -51,16 +51,16 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import TrainStop from '../../scripts/interfaces/TrainStop';
|
||||
import { TrainStop } from '../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dateMixin],
|
||||
|
||||
props: {
|
||||
stop: {
|
||||
type: Object as () => TrainStop,
|
||||
type: Object as PropType<TrainStop>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
import { defineComponent } from 'vue';
|
||||
import modalTrainMixin from '../../mixins/modalTrainMixin';
|
||||
import trainInfoMixin from '../../mixins/trainInfoMixin';
|
||||
import { useStore } from '../../store/store';
|
||||
import TrainInfo from '../TrainsView/TrainInfo.vue';
|
||||
import TrainSchedule from '../TrainsView/TrainSchedule.vue';
|
||||
|
||||
@@ -30,14 +29,6 @@ export default defineComponent({
|
||||
};
|
||||
},
|
||||
|
||||
setup() {
|
||||
const store = useStore();
|
||||
|
||||
return {
|
||||
store
|
||||
};
|
||||
},
|
||||
|
||||
activated() {
|
||||
const contentEl = this.$refs['content'] as HTMLElement;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { RollingStockInfo } from '../../scripts/interfaces/github_api/StockInfoGithubData';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { API } from '../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -54,7 +54,7 @@ export default defineComponent({
|
||||
|
||||
return (
|
||||
Object.keys(this.store.rollingStockData.info).find((type) => {
|
||||
return this.store.rollingStockData?.info[type as keyof RollingStockInfo].find(
|
||||
return this.store.rollingStockData?.info[type as keyof API.RollingStock.Info].find(
|
||||
(v) => v[0] === this.name.split(':')[0]
|
||||
);
|
||||
}) || 'vehicle-unknown'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<section class="daily-stats">
|
||||
<span :data-active="statsStatus">
|
||||
<b v-if="statsStatus == DataStatus.Loading">
|
||||
<b v-if="statsStatus == Status.Data.Loading">
|
||||
{{ $t('app.loading') }}
|
||||
</b>
|
||||
|
||||
@@ -32,24 +32,26 @@
|
||||
</i18n-t>
|
||||
</div>
|
||||
|
||||
<div v-if="stats.timetableId">
|
||||
<div v-if="stats.maxTimetable">
|
||||
•
|
||||
<i18n-t keypath="journal.timetable-stats-longest">
|
||||
<template #id>
|
||||
<router-link :to="`/journal/timetables?timetableId=${stats.timetableId}`">
|
||||
<b>{{ stats.timetableId }}</b>
|
||||
<router-link :to="`/journal/timetables?timetableId=${stats.maxTimetable.id}`">
|
||||
<b>{{ stats.maxTimetable.id }}</b>
|
||||
</router-link>
|
||||
</template>
|
||||
<template #author>
|
||||
<router-link :to="`/journal/dispatchers?dispatcherName=${stats.timetableAuthor}`">
|
||||
<b>{{ stats.timetableAuthor }}</b>
|
||||
<router-link
|
||||
:to="`/journal/dispatchers?dispatcherName=${stats.maxTimetable.authorName}`"
|
||||
>
|
||||
<b>{{ stats.maxTimetable.authorName }}</b>
|
||||
</router-link>
|
||||
</template>
|
||||
<template #driver>
|
||||
<b class="text--primary">{{ stats.timetableDriver }}</b>
|
||||
<b class="text--primary">{{ stats.maxTimetable.driverName }}</b>
|
||||
</template>
|
||||
<template #distance>
|
||||
<b class="text--primary">{{ stats.timetableRouteDistance }} km</b>
|
||||
<b class="text--primary">{{ stats.maxTimetable.routeDistance }} km</b>
|
||||
</template>
|
||||
</i18n-t>
|
||||
</div>
|
||||
@@ -134,12 +136,10 @@
|
||||
import axios from 'axios';
|
||||
import { defineComponent } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import {
|
||||
ITimetablesDailyStats,
|
||||
ITimetablesDailyStatsResponse
|
||||
} from '../../scripts/interfaces/api/StatsAPIData';
|
||||
|
||||
import { URLs } from '../../scripts/utils/apiURLs';
|
||||
import { API } from '../../typings/api';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dateMixin],
|
||||
@@ -147,22 +147,11 @@ export default defineComponent({
|
||||
|
||||
data() {
|
||||
return {
|
||||
DataStatus,
|
||||
statsStatus: DataStatus.Loading,
|
||||
Status,
|
||||
statsStatus: Status.Data.Loading,
|
||||
intervalId: -1,
|
||||
|
||||
stats: {
|
||||
totalTimetables: 0,
|
||||
distanceSum: 0,
|
||||
distanceAvg: 0,
|
||||
timetableAuthor: '',
|
||||
timetableDriver: '',
|
||||
timetableId: 0,
|
||||
timetableRouteDistance: 0,
|
||||
longestDuties: [],
|
||||
mostActiveDrivers: [],
|
||||
mostActiveDispatchers: []
|
||||
} as ITimetablesDailyStats
|
||||
stats: {} as API.DailyStats.Response
|
||||
};
|
||||
},
|
||||
|
||||
@@ -187,28 +176,30 @@ export default defineComponent({
|
||||
methods: {
|
||||
async fetchDailyTimetableStats() {
|
||||
try {
|
||||
const res: ITimetablesDailyStatsResponse = await (
|
||||
const res: API.DailyStats.Response = await (
|
||||
await axios.get(`${URLs.stacjownikAPI}/api/getDailyTimetableStats`)
|
||||
).data;
|
||||
|
||||
this.stats = {
|
||||
totalTimetables: res.totalTimetables,
|
||||
distanceSum: res.distanceSum,
|
||||
distanceAvg: res.distanceAvg,
|
||||
timetableAuthor: res.maxTimetable?.authorName || '',
|
||||
timetableDriver: res.maxTimetable?.driverName || '',
|
||||
timetableId: res.maxTimetable?.id || 0,
|
||||
timetableRouteDistance: res.maxTimetable?.routeDistance || 0,
|
||||
// this.stats = {
|
||||
// totalTimetables: res.totalTimetables,
|
||||
// distanceSum: res.distanceSum,
|
||||
// distanceAvg: res.distanceAvg,
|
||||
// // timetableAuthor: res.maxTimetable?.authorName || '',
|
||||
// // timetableDriver: res.maxTimetable?.driverName || '',
|
||||
// // timetableId: res.maxTimetable?.id || 0,
|
||||
// // timetableRouteDistance: res.maxTimetable?.routeDistance || 0,
|
||||
|
||||
mostActiveDispatchers: res.mostActiveDispatchers,
|
||||
mostActiveDrivers: res.mostActiveDrivers,
|
||||
longestDuties: res.longestDuties
|
||||
};
|
||||
// mostActiveDispatchers: res.mostActiveDispatchers,
|
||||
// mostActiveDrivers: res.mostActiveDrivers,
|
||||
// longestDuties: res.longestDuties
|
||||
// };
|
||||
|
||||
this.statsStatus = DataStatus.Loaded;
|
||||
this.stats = res;
|
||||
|
||||
this.statsStatus = Status.Data.Loaded;
|
||||
} catch (error) {
|
||||
console.error('Ups! Wystąpił błąd podczas pobierania statystyk rozkładów jazdy...');
|
||||
this.statsStatus = DataStatus.Error;
|
||||
this.statsStatus = Status.Data.Error;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -52,11 +52,10 @@
|
||||
<script lang="ts">
|
||||
import axios from 'axios';
|
||||
import { defineComponent } from 'vue';
|
||||
import { DispatcherStatsAPIData } from '../../scripts/interfaces/api/DispatcherStatsAPIData';
|
||||
import { TimetableHistory } from '../../scripts/interfaces/api/TimetablesAPIData';
|
||||
import { URLs } from '../../scripts/utils/apiURLs';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import Loading from '../Global/Loading.vue';
|
||||
import { API } from '../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
components: { Loading },
|
||||
@@ -73,7 +72,7 @@ export default defineComponent({
|
||||
return {
|
||||
cardVisible: false,
|
||||
lastDispatcherName: '',
|
||||
timetables: [] as TimetableHistory[]
|
||||
timetables: [] as API.TimetableHistory.Response
|
||||
};
|
||||
},
|
||||
|
||||
@@ -90,13 +89,13 @@ export default defineComponent({
|
||||
this.store.dispatcherStatsData = undefined;
|
||||
}
|
||||
|
||||
const statsData: DispatcherStatsAPIData = await (
|
||||
const statsData: API.DispatcherStats.Response = await (
|
||||
await axios.get(
|
||||
`${URLs.stacjownikAPI}/api/getDispatcherInfo?name=${this.store.dispatcherStatsName}`
|
||||
)
|
||||
).data;
|
||||
|
||||
const timetables: TimetableHistory[] = await (
|
||||
const timetables: API.TimetableHistory.Response = await (
|
||||
await axios.get(
|
||||
`${URLs.stacjownikAPI}/api/getTimetables?authorName=${this.store.dispatcherStatsName}`
|
||||
)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
{{ $t('app.offline') }}
|
||||
</div>
|
||||
|
||||
<Loading v-else-if="dataStatus == DataStatus.Loading" />
|
||||
<Loading v-else-if="dataStatus == Status.Data.Loading" />
|
||||
|
||||
<div v-else-if="dataStatus == DataStatus.Error" class="journal_warning error">
|
||||
<div v-else-if="dataStatus == Status.Data.Error" class="journal_warning error">
|
||||
{{ $t('app.error') }}
|
||||
</div>
|
||||
|
||||
@@ -114,13 +114,13 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { DispatcherHistory } from '../../scripts/interfaces/api/DispatchersAPIData';
|
||||
import styleMixin from '../../mixins/styleMixin';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import Loading from '../Global/Loading.vue';
|
||||
import { regions } from '../../data/options.json';
|
||||
import AddDataButton from '../Global/AddDataButton.vue';
|
||||
import { API } from '../../typings/api';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
components: { Loading, AddDataButton },
|
||||
@@ -129,7 +129,7 @@ export default defineComponent({
|
||||
|
||||
props: {
|
||||
dispatcherHistory: {
|
||||
type: Array as PropType<DispatcherHistory[]>,
|
||||
type: Array as PropType<API.DispatcherHistory.Response>,
|
||||
required: true
|
||||
},
|
||||
scrollNoMoreData: {
|
||||
@@ -142,13 +142,13 @@ export default defineComponent({
|
||||
type: Function as PropType<() => void>
|
||||
},
|
||||
dataStatus: {
|
||||
type: Number as PropType<DataStatus>
|
||||
type: Number as PropType<Status.Data>
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
DataStatus,
|
||||
Status,
|
||||
store: useStore(),
|
||||
regions
|
||||
};
|
||||
@@ -166,7 +166,7 @@ export default defineComponent({
|
||||
|
||||
return acc;
|
||||
},
|
||||
[] as (DispatcherHistory | string)[]
|
||||
[] as (API.DispatcherHistory.Data | string)[]
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<b v-else-if="store.driverStatsStatus == DataStatus.Loading">{{
|
||||
<b v-else-if="store.driverStatsStatus == Status.Data.Loading">{{
|
||||
$t('journal.stats-loading')
|
||||
}}</b>
|
||||
<b v-else-if="store.driverStatsStatus == DataStatus.Error">
|
||||
<b v-else-if="store.driverStatsStatus == Status.Data.Error">
|
||||
{{ $t('journal.stats-error ') }}
|
||||
</b>
|
||||
<b v-else>{{ $t('journal.driver-stats-info') }}</b>
|
||||
@@ -55,14 +55,14 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
store: useStore(),
|
||||
DataStatus
|
||||
Status: Status
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -113,12 +113,11 @@
|
||||
import axios from 'axios';
|
||||
import { defineComponent, inject, PropType } from 'vue';
|
||||
import keyMixin from '../../mixins/keyMixin';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import { DriverStatsAPIData } from '../../scripts/interfaces/api/DriverStatsAPIData';
|
||||
import { URLs } from '../../scripts/utils/apiURLs';
|
||||
import { useStore } from '../../store/store';
|
||||
import { JournalFilterSection } from '../../scripts/enums/JournalFilterType';
|
||||
import { JournalFilter } from '../../scripts/types/JournalTimetablesTypes';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import { Journal } from './typings';
|
||||
import { API } from '../../typings/api';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
emits: ['onSearchConfirm', 'onOptionsReset', 'onRefreshData'],
|
||||
@@ -131,13 +130,13 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
filters: {
|
||||
type: Array as PropType<JournalFilter[]>,
|
||||
type: Array as PropType<Journal.TimetableFilter[]>,
|
||||
default: () => []
|
||||
},
|
||||
|
||||
dataStatus: {
|
||||
type: Number as PropType<DataStatus>,
|
||||
default: DataStatus.Initialized
|
||||
type: Number as PropType<Status.Data>,
|
||||
default: -1
|
||||
},
|
||||
|
||||
currentOptionsActive: {
|
||||
@@ -154,7 +153,6 @@ export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
showOptions: false,
|
||||
JournalFilterSection,
|
||||
|
||||
driverSuggestions: [] as string[],
|
||||
dispatcherSuggestions: [] as string[],
|
||||
@@ -162,7 +160,7 @@ export default defineComponent({
|
||||
searchTimeout: 0,
|
||||
store: useStore(),
|
||||
|
||||
DataStatus
|
||||
JournalFilterSection: Journal.FilterSection
|
||||
};
|
||||
},
|
||||
|
||||
@@ -170,7 +168,7 @@ export default defineComponent({
|
||||
return {
|
||||
searchersValues: inject('searchersValues') as { [key: string]: string },
|
||||
sorterActive: inject('sorterActive') as { id: string | number; dir: number },
|
||||
filterList: inject('filterList') as JournalFilter[] | undefined
|
||||
filterList: inject('filterList') as Journal.TimetableFilter[] | undefined
|
||||
};
|
||||
},
|
||||
|
||||
@@ -212,23 +210,23 @@ export default defineComponent({
|
||||
this.store.driverStatsData = undefined;
|
||||
|
||||
if (!this.store.driverStatsName) {
|
||||
this.store.driverStatsStatus = DataStatus.Initialized;
|
||||
this.store.driverStatsStatus = Status.Data.Initialized;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.store.driverStatsStatus = DataStatus.Loading;
|
||||
this.store.driverStatsStatus = Status.Data.Loading;
|
||||
|
||||
const statsData: DriverStatsAPIData = await (
|
||||
const statsData: API.DriverStats.Response = await (
|
||||
await axios.get(
|
||||
`${URLs.stacjownikAPI}/api/getDriverInfo?name=${this.store.driverStatsName}`
|
||||
)
|
||||
).data;
|
||||
|
||||
this.store.driverStatsData = statsData;
|
||||
this.store.driverStatsStatus = DataStatus.Loaded;
|
||||
this.store.driverStatsStatus = Status.Data.Loaded;
|
||||
} catch (error) {
|
||||
this.store.driverStatsStatus = DataStatus.Error;
|
||||
this.store.driverStatsStatus = Status.Data.Error;
|
||||
console.error('Ups! Wystąpił błąd przy próbie pobrania statystyk maszynisty! :/');
|
||||
}
|
||||
},
|
||||
@@ -270,7 +268,7 @@ export default defineComponent({
|
||||
this.$emit('onSearchConfirm');
|
||||
},
|
||||
|
||||
onFilterChange(filter: JournalFilter) {
|
||||
onFilterChange(filter: Journal.TimetableFilter) {
|
||||
// this.journalFilterActive = filter;
|
||||
this.filterList
|
||||
?.filter((f) => f.filterSection === filter.filterSection)
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, Ref, ref, watch } from 'vue';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import JournalDailyStats from './DailyStats.vue';
|
||||
import JournalDriverStats from './JournalDriverStats.vue';
|
||||
import StorageManager from '../../scripts/managers/storageManager';
|
||||
import StorageManager from '../../managers/storageManager';
|
||||
|
||||
// Types
|
||||
type TStatTab = 'daily' | 'driver';
|
||||
@@ -60,7 +60,8 @@ let data = reactive({
|
||||
|
||||
// Methods
|
||||
function onTabButtonClick(tab: TStatTab) {
|
||||
if (lastClickedTab.value == tab || !lastClickedTab.value || !areStatsOpen.value) areStatsOpen.value = !areStatsOpen.value;
|
||||
if (lastClickedTab.value == tab || !lastClickedTab.value || !areStatsOpen.value)
|
||||
areStatsOpen.value = !areStatsOpen.value;
|
||||
|
||||
if (tab == 'daily') {
|
||||
StorageManager.setBooleanValue('dailyStatsOpen', areStatsOpen.value);
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
{{ $t('app.offline') }}
|
||||
</div>
|
||||
|
||||
<Loading v-else-if="dataStatus == DataStatus.Loading" />
|
||||
<Loading v-else-if="dataStatus == Status.Data.Loading" />
|
||||
|
||||
<div v-else-if="dataStatus == DataStatus.Error" class="journal_warning error">
|
||||
<div v-else-if="dataStatus == Status.Data.Error" class="journal_warning error">
|
||||
{{ $t('app.error') }}
|
||||
</div>
|
||||
|
||||
@@ -38,20 +38,20 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
import { DataStatus } from '../../../scripts/enums/DataStatus';
|
||||
import { TimetableHistory } from '../../../scripts/interfaces/api/TimetablesAPIData';
|
||||
import { useStore } from '../../../store/store';
|
||||
|
||||
import Loading from '../../Global/Loading.vue';
|
||||
import AddDataButton from '../../Global/AddDataButton.vue';
|
||||
import TimetableHistoryList from './TimetableHistoryList.vue';
|
||||
import { useStore } from '../../../store/mainStore';
|
||||
import { Status } from '../../../typings/common';
|
||||
import { API } from '../../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
components: { Loading, AddDataButton, TimetableHistoryList },
|
||||
|
||||
props: {
|
||||
timetableHistory: {
|
||||
type: Array as PropType<TimetableHistory[]>,
|
||||
type: Array as PropType<API.TimetableHistory.Response>,
|
||||
required: true
|
||||
},
|
||||
scrollNoMoreData: {
|
||||
@@ -64,13 +64,13 @@ export default defineComponent({
|
||||
type: Function as PropType<() => void>
|
||||
},
|
||||
dataStatus: {
|
||||
type: Number as PropType<DataStatus>
|
||||
type: Number as PropType<Status.Data>
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
DataStatus,
|
||||
Status,
|
||||
store: useStore()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import { TimetableHistory } from '../../../scripts/interfaces/api/TimetablesAPIData';
|
||||
import StockList from '../../Global/StockList.vue';
|
||||
import { API } from '../../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
components: { StockList },
|
||||
@@ -88,7 +88,7 @@ export default defineComponent({
|
||||
required: true
|
||||
},
|
||||
timetable: {
|
||||
type: Object as PropType<TimetableHistory>,
|
||||
type: Object as PropType<API.TimetableHistory.Data>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -62,24 +62,24 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import { TimetableHistory } from '../../../scripts/interfaces/api/TimetablesAPIData';
|
||||
|
||||
import dateMixin from '../../../mixins/dateMixin';
|
||||
import modalTrainMixin from '../../../mixins/modalTrainMixin';
|
||||
import styleMixin from '../../../mixins/styleMixin';
|
||||
import { API } from '../../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dateMixin, modalTrainMixin, styleMixin],
|
||||
|
||||
props: {
|
||||
timetable: {
|
||||
type: Object as PropType<TimetableHistory>,
|
||||
type: Object as PropType<API.TimetableHistory.Data>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
showTimetable(timetable: TimetableHistory, target: EventTarget | null) {
|
||||
showTimetable(timetable: API.TimetableHistory.Data, target: EventTarget | null) {
|
||||
if (timetable?.terminated) return;
|
||||
|
||||
this.selectModalTrain(timetable.driverName + timetable.trainNo.toString(), target);
|
||||
|
||||
@@ -38,17 +38,17 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent, ref } from 'vue';
|
||||
import { TimetableHistory } from '../../../scripts/interfaces/api/TimetablesAPIData';
|
||||
|
||||
import TimetableGeneral from './TimetableGeneral.vue';
|
||||
import TimetableStops from './TimetableStops.vue';
|
||||
import TimetableStatus from './TimetableStatus.vue';
|
||||
import TimetableExtra from './TimetableExtra.vue';
|
||||
import { API } from '../../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
timetableHistory: {
|
||||
type: Array as PropType<TimetableHistory[]>,
|
||||
type: Array as PropType<API.TimetableHistory.Response>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import { TimetableHistory } from '../../../scripts/interfaces/api/TimetablesAPIData';
|
||||
import ProgressBar from '../../Global/ProgressBar.vue';
|
||||
import { API } from '../../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
components: { ProgressBar },
|
||||
props: {
|
||||
timetable: {
|
||||
type: Object as PropType<TimetableHistory>,
|
||||
type: Object as PropType<API.TimetableHistory.Data>,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import dateMixin from '../../../mixins/dateMixin';
|
||||
|
||||
import { TimetableHistory } from '../../../scripts/interfaces/api/TimetablesAPIData';
|
||||
import { API } from '../../../typings/api';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [dateMixin],
|
||||
@@ -37,7 +36,7 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
timetable: {
|
||||
type: Object as PropType<TimetableHistory>,
|
||||
type: Object as PropType<API.TimetableHistory.Data>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
export namespace Journal {
|
||||
export type DispatcherSearcher = {
|
||||
[key in 'search-dispatcher' | 'search-station' | 'search-date']: string;
|
||||
};
|
||||
|
||||
export interface DispatcherSorter {
|
||||
id: 'timestampFrom' | 'duration';
|
||||
dir: -1 | 1;
|
||||
}
|
||||
|
||||
export type TimetableSearchKey =
|
||||
| 'search-driver'
|
||||
| 'search-train'
|
||||
| 'search-date'
|
||||
| 'search-dispatcher'
|
||||
| 'search-issuedFrom';
|
||||
|
||||
export type TimetableSearchType = {
|
||||
[key in TimetableSearchKey]: string;
|
||||
};
|
||||
|
||||
export const enum TimetableFilterId {
|
||||
ACTIVE = 'active',
|
||||
FULFILLED = 'fulfilled',
|
||||
ABANDONED = 'abandoned',
|
||||
ALL = 'all',
|
||||
TWR = 'twr',
|
||||
SKR = 'skr',
|
||||
TWR_SKR = 'twr-skr'
|
||||
}
|
||||
|
||||
export enum FilterSection {
|
||||
TIMETABLE_STATUS = 'timetable-status',
|
||||
TWRSKR = 'twrskr'
|
||||
}
|
||||
|
||||
export interface TimetableFilter {
|
||||
id: TimetableFilterId;
|
||||
filterSection: string;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export type TimetableSorterKey = 'timetableId' | 'beginDate' | 'distance' | 'total-stops';
|
||||
|
||||
export interface TimetableSorter {
|
||||
id: TimetableSorterKey;
|
||||
dir: 'asc' | 'desc';
|
||||
}
|
||||
}
|
||||
@@ -69,14 +69,14 @@
|
||||
import axios from 'axios';
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import { DispatcherHistory } from '../../scripts/interfaces/api/DispatchersAPIData';
|
||||
import Station from '../../scripts/interfaces/Station';
|
||||
import { URLs } from '../../scripts/utils/apiURLs';
|
||||
import Loading from '../Global/Loading.vue';
|
||||
import styleMixin from '../../mixins/styleMixin';
|
||||
import listObserverMixin from '../../mixins/listObserverMixin';
|
||||
import { OnlineScenery } from '../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../store/typings';
|
||||
import { API } from '../../typings/api';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SceneryDispatchersHistory',
|
||||
@@ -95,9 +95,9 @@ export default defineComponent({
|
||||
|
||||
data() {
|
||||
return {
|
||||
historyList: [] as DispatcherHistory[],
|
||||
dataStatus: DataStatus.Loading,
|
||||
DataStatus
|
||||
historyList: [] as API.DispatcherHistory.Response,
|
||||
dataStatus: Status.Data.Loading,
|
||||
DataStatus: Status.Data
|
||||
};
|
||||
},
|
||||
|
||||
@@ -109,17 +109,22 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
methods: {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 30): Promise<DispatcherHistory[] | null> {
|
||||
async fetchAPIData(
|
||||
countFrom = 0,
|
||||
countLimit = 30
|
||||
): Promise<API.DispatcherHistory.Response | null> {
|
||||
try {
|
||||
this.dataStatus = DataStatus.Loading;
|
||||
this.dataStatus = Status.Data.Loading;
|
||||
|
||||
const requestString = `${URLs.stacjownikAPI}/api/getDispatchers?stationName=${this.station.name}&countFrom=${countFrom}&countLimit=${countLimit}`;
|
||||
const historyAPIData: DispatcherHistory[] = await (await axios.get(requestString)).data;
|
||||
const historyAPIData: API.DispatcherHistory.Response = await (
|
||||
await axios.get(requestString)
|
||||
).data;
|
||||
|
||||
this.dataStatus = DataStatus.Loaded;
|
||||
this.dataStatus = Status.Data.Loaded;
|
||||
return historyAPIData;
|
||||
} catch (error) {
|
||||
this.dataStatus = DataStatus.Error;
|
||||
this.dataStatus = Status.Data.Error;
|
||||
console.error(error);
|
||||
return null;
|
||||
}
|
||||
@@ -153,3 +158,4 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
</style>
|
||||
../../store/storeTypes
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import Station from '../../scripts/interfaces/Station';
|
||||
import { OnlineScenery } from '../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -58,3 +58,4 @@ export default defineComponent({
|
||||
font-size: 1.2em;
|
||||
}
|
||||
</style>
|
||||
../../store/storeTypes
|
||||
|
||||
@@ -90,7 +90,7 @@ import SceneryInfoUserList from './SceneryInfo/SceneryInfoUserList.vue';
|
||||
import SceneryInfoSpawnList from './SceneryInfo/SceneryInfoSpawnList.vue';
|
||||
import SceneryInfoRoutes from './SceneryInfo/SceneryInfoRoutes.vue';
|
||||
import Station from '../../scripts/interfaces/Station';
|
||||
import { OnlineScenery } from '../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -110,7 +110,7 @@ export default defineComponent({
|
||||
type: Object as PropType<OnlineScenery>,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import dateMixin from '../../../mixins/dateMixin';
|
||||
import routerMixin from '../../../mixins/routerMixin';
|
||||
import styleMixin from '../../../mixins/styleMixin';
|
||||
import StationStatusBadge from '../../Global/StationStatusBadge.vue';
|
||||
import { OnlineScenery } from '../../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [styleMixin, dateMixin, routerMixin],
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
</h3>
|
||||
|
||||
<transition-group name="spawns-anim" tag="ul">
|
||||
<li class="badge spawn badge-none" v-if="!onlineScenery || onlineScenery.spawns.length == 0" key="no-spawns">
|
||||
<li
|
||||
class="badge spawn badge-none"
|
||||
v-if="!onlineScenery || onlineScenery.spawns.length == 0"
|
||||
key="no-spawns"
|
||||
>
|
||||
{{ $t('scenery.no-spawns') }}
|
||||
</li>
|
||||
|
||||
@@ -26,7 +30,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import { OnlineScenery } from '../../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
import { PropType, defineComponent } from 'vue';
|
||||
import modalTrainMixin from '../../../mixins/modalTrainMixin';
|
||||
import routerMixin from '../../../mixins/routerMixin';
|
||||
import { OnlineScenery } from '../../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [routerMixin, modalTrainMixin],
|
||||
|
||||
@@ -185,10 +185,10 @@ import Loading from '../Global/Loading.vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import routerMixin from '../../mixins/routerMixin';
|
||||
import Station from '../../scripts/interfaces/Station';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import modalTrainMixin from '../../mixins/modalTrainMixin';
|
||||
import ScheduledTrainStatus from './ScheduledTrainStatus.vue';
|
||||
import { OnlineScenery } from '../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SceneryTimetable',
|
||||
|
||||
@@ -56,16 +56,14 @@
|
||||
import axios from 'axios';
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import {
|
||||
TimetableHistory,
|
||||
SceneryTimetableHistory
|
||||
} from '../../scripts/interfaces/api/TimetablesAPIData';
|
||||
|
||||
import Station from '../../scripts/interfaces/Station';
|
||||
import { URLs } from '../../scripts/utils/apiURLs';
|
||||
import Loading from '../Global/Loading.vue';
|
||||
import listObserverMixin from '../../mixins/listObserverMixin';
|
||||
import { OnlineScenery } from '../../scripts/interfaces/store/storeTypes';
|
||||
import { OnlineScenery } from '../../store/typings';
|
||||
import { API } from '../../typings/api';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SceneryTimetablesHistory',
|
||||
@@ -83,28 +81,28 @@ export default defineComponent({
|
||||
|
||||
data() {
|
||||
return {
|
||||
historyList: [] as TimetableHistory[],
|
||||
dataStatus: DataStatus.Loading,
|
||||
DataStatus
|
||||
historyList: [] as API.TimetableHistory.Response,
|
||||
dataStatus: Status.Data.Loading,
|
||||
DataStatus: Status.Data
|
||||
};
|
||||
},
|
||||
|
||||
async activated() {
|
||||
const fetchedHistory = await this.fetchAPIData();
|
||||
if (fetchedHistory) this.historyList = fetchedHistory.timetables;
|
||||
this.fetchAPIData();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 15): Promise<SceneryTimetableHistory | null> {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 15) {
|
||||
try {
|
||||
const requestString = `${URLs.stacjownikAPI}/api/getIssuedTimetables?name=${this.station.name}&countFrom=${countFrom}&countLimit=${countLimit}`;
|
||||
const historyAPIData: SceneryTimetableHistory = await (await axios.get(requestString)).data;
|
||||
const requestString = `${URLs.stacjownikAPI}/api/getTimetables?issuedFrom=${this.station.name}&countFrom=${countFrom}&countLimit=${countLimit}`;
|
||||
|
||||
this.dataStatus = DataStatus.Loaded;
|
||||
return historyAPIData;
|
||||
const response: API.TimetableHistory.Response = await (await axios.get(requestString)).data;
|
||||
|
||||
this.historyList = response;
|
||||
|
||||
this.dataStatus = Status.Data.Loaded;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -120,3 +118,4 @@ export default defineComponent({
|
||||
@import '../../styles/responsive.scss';
|
||||
@import '../../styles/sceneryViewTables.scss';
|
||||
</style>
|
||||
../../store/storeTypes
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
import { ScheduledTrain, StopStatus } from '../../scripts/interfaces/ScheduledTrain';
|
||||
import { ScheduledTrain, StopStatus } from '../../store/typings';
|
||||
|
||||
interface ScheduledTrainComp extends ScheduledTrain {
|
||||
stopStatusIndicator: string;
|
||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
||||
stopStatusIndicator = '';
|
||||
|
||||
switch (stopStatus) {
|
||||
case StopStatus.arriving:
|
||||
case StopStatus.ARRIVING:
|
||||
stopStatusIndicator = `${this.$t('timetables.from')}: ${prevDepartureIndicator}`;
|
||||
stopStatusDescription = this.$t('timetables.desc-arriving', {
|
||||
prevStationName,
|
||||
@@ -50,8 +50,8 @@ export default defineComponent({
|
||||
});
|
||||
break;
|
||||
|
||||
case StopStatus.online:
|
||||
case StopStatus.stopped:
|
||||
case StopStatus.ONLINE:
|
||||
case StopStatus.STOPPED:
|
||||
stopStatusIndicator = nextArrivalLine
|
||||
? `${this.$t('timetables.to')}: ${nextArrivalIndicator}`
|
||||
: `${this.$t('timetables.desc-end')}`;
|
||||
@@ -60,7 +60,7 @@ export default defineComponent({
|
||||
: '';
|
||||
break;
|
||||
|
||||
case StopStatus.departed:
|
||||
case StopStatus.DEPARTED:
|
||||
stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`;
|
||||
stopStatusDescription = this.$t('timetables.desc-departed', {
|
||||
nextStationName,
|
||||
@@ -68,7 +68,7 @@ export default defineComponent({
|
||||
});
|
||||
break;
|
||||
|
||||
case StopStatus['departed-away']:
|
||||
case StopStatus.DEPARTED_AWAY:
|
||||
stopStatusIndicator = `${this.$t('timetables.to')}: ${nextArrivalIndicator}`;
|
||||
stopStatusDescription = this.$t('timetables.desc-departed-away', {
|
||||
nextStationName,
|
||||
@@ -76,7 +76,7 @@ export default defineComponent({
|
||||
});
|
||||
break;
|
||||
|
||||
case StopStatus.terminated:
|
||||
case StopStatus.TERMINATED:
|
||||
stopStatusIndicator = `X ${this.$t('timetables.desc-terminated')}`;
|
||||
stopStatusDescription = this.$t('timetables.desc-terminated');
|
||||
break;
|
||||
|
||||
@@ -138,11 +138,11 @@
|
||||
import { defineComponent, inject } from 'vue';
|
||||
import keyMixin from '../../mixins/keyMixin';
|
||||
import routerMixin from '../../mixins/routerMixin';
|
||||
import StorageManager from '../../scripts/managers/storageManager';
|
||||
import { useStationFiltersStore } from '../../store/stationFiltersStore';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
|
||||
import FilterOption from './FilterOption.vue';
|
||||
import StorageManager from '../../managers/storageManager';
|
||||
|
||||
export default defineComponent({
|
||||
components: { FilterOption },
|
||||
|
||||
@@ -279,13 +279,13 @@ import { defineComponent, computed, PropType } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import stationInfoMixin from '../../mixins/stationInfoMixin';
|
||||
import styleMixin from '../../mixins/styleMixin';
|
||||
import { DataStatus } from '../../scripts/enums/DataStatus';
|
||||
import Station from '../../scripts/interfaces/Station';
|
||||
import { useStationFiltersStore } from '../../store/stationFiltersStore';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import Loading from '../Global/Loading.vue';
|
||||
import { HeadIdsTypes, headIconsIds, headIds } from '../../scripts/data/stationHeaderNames';
|
||||
import StationStatusBadge from '../Global/StationStatusBadge.vue';
|
||||
import { Status } from '../../typings/common';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
@@ -315,8 +315,9 @@ export default defineComponent({
|
||||
const stationFiltersStore = useStationFiltersStore();
|
||||
|
||||
const isDataLoaded = computed(() => {
|
||||
return store.dataStatuses.sceneries != DataStatus.Loading;
|
||||
return store.dataStatuses.sceneries != Status.Data.Loading;
|
||||
});
|
||||
|
||||
return {
|
||||
isDataLoaded,
|
||||
stationFiltersStore
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
export interface FilterOption {
|
||||
id: string;
|
||||
name: string;
|
||||
value: boolean;
|
||||
defaultValue: boolean;
|
||||
}
|
||||
|
||||
export interface Filter {
|
||||
[key: string]: boolean | number | string;
|
||||
default: boolean;
|
||||
notDefault: boolean;
|
||||
real: boolean;
|
||||
fictional: boolean;
|
||||
SPK: boolean;
|
||||
SCS: boolean;
|
||||
SPE: boolean;
|
||||
SUP: boolean;
|
||||
noSUP: boolean;
|
||||
ręczne: boolean;
|
||||
'ręczne+SPK': boolean;
|
||||
'ręczne+SCS': boolean;
|
||||
mechaniczne: boolean;
|
||||
'mechaniczne+SPK': boolean;
|
||||
'mechaniczne+SCS': boolean;
|
||||
SBL: boolean;
|
||||
PBL: boolean;
|
||||
współczesna: boolean;
|
||||
kształtowa: boolean;
|
||||
historyczna: boolean;
|
||||
mieszana: boolean;
|
||||
minLevel: number;
|
||||
maxLevel: number;
|
||||
minOneWayCatenary: number;
|
||||
minOneWay: number;
|
||||
minTwoWayCatenary: number;
|
||||
minTwoWay: number;
|
||||
'no-1track': boolean;
|
||||
'no-2track': boolean;
|
||||
'include-selected': boolean;
|
||||
free: boolean;
|
||||
occupied: boolean;
|
||||
nonPublic: boolean;
|
||||
unavailable: boolean;
|
||||
abandoned: boolean;
|
||||
|
||||
endingStatus: boolean;
|
||||
afkStatus: boolean;
|
||||
noSpaceStatus: boolean;
|
||||
unavailableStatus: boolean;
|
||||
unsignedStatus: boolean;
|
||||
|
||||
authors: string;
|
||||
|
||||
onlineFromHours: number;
|
||||
}
|
||||
@@ -23,7 +23,11 @@
|
||||
v-model="searchedTrain"
|
||||
/>
|
||||
<button class="search-exit">
|
||||
<img src="/images/icon-exit.svg" alt="Trains search clear icon" @click="onInputClear('train')" />
|
||||
<img
|
||||
src="/images/icon-exit.svg"
|
||||
alt="Trains search clear icon"
|
||||
@click="onInputClear('train')"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +40,11 @@
|
||||
v-model="searchedDriver"
|
||||
/>
|
||||
<button class="search-exit">
|
||||
<img src="/images/icon-exit.svg" alt="Driver search clear icon" @click="onInputClear('driver')" />
|
||||
<img
|
||||
src="/images/icon-exit.svg"
|
||||
alt="Driver search clear icon"
|
||||
@click="onInputClear('driver')"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -87,8 +95,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, inject, PropType } from 'vue';
|
||||
import keyMixin from '../../mixins/keyMixin';
|
||||
import { TrainFilterSection } from '../../scripts/enums/TrainFilterType';
|
||||
import { TrainFilter } from '../../scripts/interfaces/Trains/TrainFilter';
|
||||
import { TrainFilter, TrainFilterSection } from './typings';
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [keyMixin],
|
||||
|
||||
@@ -72,10 +72,10 @@
|
||||
import { computed, defineComponent, PropType } from 'vue';
|
||||
import dateMixin from '../../mixins/dateMixin';
|
||||
import Train from '../../scripts/interfaces/Train';
|
||||
import TrainStop from '../../scripts/interfaces/TrainStop';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import StopDate from '../Global/StopDate.vue';
|
||||
import StockList from '../Global/StockList.vue';
|
||||
import { TrainStop } from '../../store/typings';
|
||||
|
||||
export default defineComponent({
|
||||
components: { StopDate, StockList },
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
import { computed, defineComponent, inject, PropType, Ref } from 'vue';
|
||||
import modalTrainMixin from '../../mixins/modalTrainMixin';
|
||||
import Train from '../../scripts/interfaces/Train';
|
||||
import { useStore } from '../../store/store';
|
||||
import { useStore } from '../../store/mainStore';
|
||||
import Loading from '../Global/Loading.vue';
|
||||
import TrainInfo from './TrainInfo.vue';
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
export enum TrainFilterSection {
|
||||
TRAIN_TYPE = 'TRAIN_TYPE',
|
||||
TIMETABLE_TYPE = 'TIMETABLE_TYPE',
|
||||
COMMENTS = 'COMMENTS',
|
||||
TIMETABLE = 'TIMETABLE'
|
||||
}
|
||||
|
||||
export const enum TrainFilterId {
|
||||
noComments = 'noComments',
|
||||
withComments = 'withComments',
|
||||
|
||||
twr = 'twr',
|
||||
skr = 'skr',
|
||||
common = 'common',
|
||||
|
||||
passenger = 'passenger',
|
||||
freight = 'freight',
|
||||
other = 'other',
|
||||
noTimetable = 'noTimetable',
|
||||
withTimetable = 'withTimetable'
|
||||
}
|
||||
|
||||
export interface TrainFilter {
|
||||
id: TrainFilterId;
|
||||
section: TrainFilterSection;
|
||||
isActive: boolean;
|
||||
}
|
||||
|
||||
export interface TrainSorter {
|
||||
id: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export const trainFilters: TrainFilter[] = [
|
||||
{
|
||||
id: TrainFilterId.twr,
|
||||
section: TrainFilterSection.TRAIN_TYPE,
|
||||
isActive: true
|
||||
},
|
||||
{
|
||||
id: TrainFilterId.skr,
|
||||
section: TrainFilterSection.TRAIN_TYPE,
|
||||
isActive: true
|
||||
},
|
||||
{
|
||||
id: TrainFilterId.common,
|
||||
section: TrainFilterSection.TRAIN_TYPE,
|
||||
isActive: true
|
||||
},
|
||||
|
||||
{
|
||||
id: TrainFilterId.passenger,
|
||||
section: TrainFilterSection.TIMETABLE_TYPE,
|
||||
isActive: true
|
||||
},
|
||||
{
|
||||
id: TrainFilterId.freight,
|
||||
section: TrainFilterSection.TIMETABLE_TYPE,
|
||||
isActive: true
|
||||
},
|
||||
{
|
||||
id: TrainFilterId.other,
|
||||
section: TrainFilterSection.TIMETABLE_TYPE,
|
||||
isActive: true
|
||||
},
|
||||
|
||||
{
|
||||
id: TrainFilterId.withComments,
|
||||
section: TrainFilterSection.COMMENTS,
|
||||
isActive: true
|
||||
},
|
||||
{
|
||||
id: TrainFilterId.noComments,
|
||||
section: TrainFilterSection.COMMENTS,
|
||||
isActive: true
|
||||
},
|
||||
|
||||
{
|
||||
id: TrainFilterId.withTimetable,
|
||||
section: TrainFilterSection.TIMETABLE,
|
||||
isActive: true
|
||||
},
|
||||
{
|
||||
id: TrainFilterId.noTimetable,
|
||||
section: TrainFilterSection.TIMETABLE,
|
||||
isActive: true
|
||||
}
|
||||
];
|
||||
|
||||
export const sorterOptions: TrainSorter[] = [
|
||||
{
|
||||
id: 'distance',
|
||||
value: 'kilometraż'
|
||||
},
|
||||
{
|
||||
id: 'id',
|
||||
value: 'id rozkładu'
|
||||
},
|
||||
{
|
||||
id: 'progress',
|
||||
value: 'przebyta trasa'
|
||||
},
|
||||
{
|
||||
id: 'delay',
|
||||
value: 'opóźnienie'
|
||||
},
|
||||
{
|
||||
id: 'mass',
|
||||
value: 'masa'
|
||||
},
|
||||
{
|
||||
id: 'speed',
|
||||
value: 'prędkość'
|
||||
},
|
||||
{
|
||||
id: 'length',
|
||||
value: 'długość'
|
||||
}
|
||||
];
|
||||
Reference in New Issue
Block a user