From c3481470cbfa0c43d1d8fbd4174537f0c327bf45 Mon Sep 17 00:00:00 2001 From: Spythere Date: Sat, 3 Jun 2023 15:49:15 +0200 Subject: [PATCH] =?UTF-8?q?optymalizacja=20zapyta=C5=84;=20filtr=20sceneri?= =?UTF-8?q?i=20pocz.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JournalView/JournalOptions.vue | 8 +- src/locales/en.json | 5 +- src/locales/pl.json | 5 +- .../interfaces/api/TimetablesQueryParams.ts | 18 + src/types/Journal/JournalTimetablesTypes.ts | 6 +- src/views/JournalTimetables.vue | 608 +++++++++--------- 6 files changed, 332 insertions(+), 318 deletions(-) create mode 100644 src/scripts/interfaces/api/TimetablesQueryParams.ts diff --git a/src/components/JournalView/JournalOptions.vue b/src/components/JournalView/JournalOptions.vue index ce8ca05..470a1ac 100644 --- a/src/components/JournalView/JournalOptions.vue +++ b/src/components/JournalView/JournalOptions.vue @@ -132,8 +132,8 @@ export default defineComponent({ optionsType: { type: String, - required: true - } + required: true, + }, }, data() { @@ -249,10 +249,6 @@ export default defineComponent({ }); }, - focusEnd() { - console.log('focus end'); - }, - onSorterChange(item: { id: string | number; value: string }) { this.sorterActive.id = item.id; this.sorterActive.dir = -1; diff --git a/src/locales/en.json b/src/locales/en.json index 3cf188f..819e7ee 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -99,19 +99,20 @@ "search-dispatcher": "Dispatcher name", "search-station": "Scenery name", "search-author": "Timetable author name", + "search-issuedFrom": "Origin scenery name", "search-timetables-date": "Timetable date (CEST / GMT+2)", "search-dispatchers-date": "Service date (CEST / GMT+2)", "sort-mass": "mass", "sort-speed": "speed", "sort-length": "length", - "sort-distance": "distance", + "sort-routeDistance": "route distance", "sort-timetable": "train no.", "sort-progress": "route progress", "sort-delay": "current delay", "sort-id": "timetable id", - "sort-total-stops": "total stops", + "sort-allStopsCount": "total stops", "sort-beginDate": "date", "sort-timetableId": "timetable ID", "sort-timestampFrom": "date", diff --git a/src/locales/pl.json b/src/locales/pl.json index 98ca1b9..b02c2d1 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -99,11 +99,12 @@ "search-dispatcher": "Nick dyżurnego", "search-station": "Nazwa scenerii", "search-author": "Nick autora rozkładu jazdy", + "search-issuedFrom": "Sceneria początkowa", "search-timetables-date": "Data rozkładu jazdy (czas polski)", "search-dispatchers-date": "Data służby (czas polski)", - "sort-distance": "kilometraż", - "sort-total-stops": "stacje", + "sort-routeDistance": "kilometraż", + "sort-allStopsCount": "stacje", "sort-beginDate": "data", "sort-timetableId": "ID rozkładu", "sort-timestampFrom": "data", diff --git a/src/scripts/interfaces/api/TimetablesQueryParams.ts b/src/scripts/interfaces/api/TimetablesQueryParams.ts new file mode 100644 index 0000000..131e865 --- /dev/null +++ b/src/scripts/interfaces/api/TimetablesQueryParams.ts @@ -0,0 +1,18 @@ +import { JournalTimetableSorter } from '../../../types/Journal/JournalTimetablesTypes'; + +export interface TimetablesQueryParams { + driverName?: string; + trainNo?: string; + authorName?: string; + timestampFrom?: number; + timestampTo?: number; + issuedFrom?: string; + + countFrom?: number; + countLimit?: number; + + fulfilled?: number; + terminated?: number; + + sortBy?: JournalTimetableSorter['id']; +} diff --git a/src/types/Journal/JournalTimetablesTypes.ts b/src/types/Journal/JournalTimetablesTypes.ts index cf0ad24..d8d8864 100644 --- a/src/types/Journal/JournalTimetablesTypes.ts +++ b/src/types/Journal/JournalTimetablesTypes.ts @@ -1,6 +1,6 @@ import { JournalFilterType } from '../../scripts/enums/JournalFilterType'; -export type JournalTimetableSearchKey = 'search-driver' | 'search-train' | 'search-date' | 'search-dispatcher'; +export type JournalTimetableSearchKey = 'search-driver' | 'search-train' | 'search-date' | 'search-dispatcher' | 'search-issuedFrom'; export type JournalTimetableSearchType = { [key in JournalTimetableSearchKey]: string; @@ -13,6 +13,6 @@ export interface JournalTimetableFilter { } export interface JournalTimetableSorter { - id: 'timetableId' | 'beginDate' | 'distance' | 'total-stops'; - dir: -1 | 1; + id: 'timetableId' | 'beginDate' | 'routeDistance' | 'allStopsCount'; + dir: 'asc' | 'desc'; } diff --git a/src/views/JournalTimetables.vue b/src/views/JournalTimetables.vue index 4b82da7..9401528 100644 --- a/src/views/JournalTimetables.vue +++ b/src/views/JournalTimetables.vue @@ -1,305 +1,303 @@ - - - - - - + + + + +