Date: Wed, 5 Jun 2024 20:03:05 +0200
Subject: [PATCH 08/19] chore: added scenery timetables history modes
---
src/components/JournalView/typings.ts | 4 +-
.../SceneryView/SceneryDispatchersHistory.vue | 2 +-
src/components/SceneryView/SceneryInfo.vue | 5 --
.../SceneryView/SceneryTimetablesHistory.vue | 71 ++++++++++++++-----
src/locales/en.json | 8 ++-
src/locales/pl.json | 6 ++
src/styles/JournalSection.scss | 2 +-
src/styles/sceneryViewTables.scss | 1 +
src/views/JournalTimetables.vue | 26 +++++--
src/views/SceneryView.vue | 27 +++----
10 files changed, 105 insertions(+), 47 deletions(-)
diff --git a/src/components/JournalView/typings.ts b/src/components/JournalView/typings.ts
index ae7c02b..447c427 100644
--- a/src/components/JournalView/typings.ts
+++ b/src/components/JournalView/typings.ts
@@ -6,7 +6,9 @@ export namespace Journal {
| 'search-train'
| 'search-date'
| 'search-dispatcher'
- | 'search-issuedFrom';
+ | 'search-issuedFrom'
+ | 'search-terminatingAt'
+ | 'search-via';
export type TimetableSearchType = {
[key in TimetableSearchKey]: string;
diff --git a/src/components/SceneryView/SceneryDispatchersHistory.vue b/src/components/SceneryView/SceneryDispatchersHistory.vue
index 24fbb6a..3e63a9c 100644
--- a/src/components/SceneryView/SceneryDispatchersHistory.vue
+++ b/src/components/SceneryView/SceneryDispatchersHistory.vue
@@ -37,7 +37,7 @@
{{ historyItem.dispatcherLevel >= 2 ? historyItem.dispatcherLevel : 'L' }}
- ?
+ -
{{ historyItem.dispatcherRate }}
diff --git a/src/components/SceneryView/SceneryInfo.vue b/src/components/SceneryView/SceneryInfo.vue
index 120daf5..1bec2a2 100644
--- a/src/components/SceneryView/SceneryInfo.vue
+++ b/src/components/SceneryView/SceneryInfo.vue
@@ -124,11 +124,6 @@ h3.section-header {
align-items: center;
font-size: 1.2em;
-
- img {
- width: 1.1em;
- margin-left: 0.5em;
- }
}
.info-lists {
diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue
index d036175..ba04962 100644
--- a/src/components/SceneryView/SceneryTimetablesHistory.vue
+++ b/src/components/SceneryView/SceneryTimetablesHistory.vue
@@ -1,11 +1,19 @@
-
+
-
+
-
+
@@ -18,11 +26,11 @@
| {{ $t('scenery.timetables-history-id') }} |
- {{ $t('scenery.timetables-history-number') }} |
- {{ $t('scenery.timetables-history-route') }} |
+ {{ $t('scenery.timetables-history-number') }} |
+ {{ $t('scenery.timetables-history-route') }} |
{{ $t('scenery.timetables-history-driver') }} |
{{ $t('scenery.timetables-history-author') }} |
- {{ $t('scenery.timetables-history-date') }} |
+ {{ $t('scenery.timetables-history-date') }} |
@@ -33,7 +41,7 @@
- {{ historyItem.trainCategoryCode }}
+ {{ historyItem.trainCategoryCode }}
{{ historyItem.trainNo }}
|
{{ historyItem.route.replace('|', ' -> ') }} |
@@ -52,8 +60,14 @@
{{ $t('scenery.timetable-author-unknown') }}
- {{ localeDay(historyItem.beginDate, $i18n.locale) }}
- {{ localeTime(historyItem.beginDate, $i18n.locale) }}
+ {{
+ localeDateTime(
+ historyItem.createdAt > historyItem.beginDate
+ ? historyItem.beginDate
+ : historyItem.createdAt,
+ $i18n.locale
+ )
+ }}
|
@@ -77,6 +91,9 @@ import { API } from '../../typings/api';
import { ActiveScenery, Station, Status } from '../../typings/common';
import { useApiStore } from '../../store/apiStore';
+const historyModeList = ['issuedFrom', 'terminatingAt', 'via'] as const;
+type HistoryMode = (typeof historyModeList)[number];
+
export default defineComponent({
name: 'SceneryTimetablesHistory',
mixins: [dateMixin],
@@ -92,9 +109,13 @@ export default defineComponent({
data() {
return {
historyList: [] as API.TimetableHistory.Response,
+ historyModeList,
+
apiStore: useApiStore(),
dataStatus: Status.Data.Loading,
- DataStatus: Status.Data
+ DataStatus: Status.Data,
+
+ checkedHistoryMode: 'issuedFrom' as HistoryMode
};
},
@@ -104,17 +125,22 @@ export default defineComponent({
methods: {
async fetchAPIData() {
- if (!this.station && !this.onlineScenery) {
+ const stationName = this.$route.query['station'];
+
+ if (!stationName) {
+ this.historyList = [];
this.dataStatus = Status.Data.Loaded;
return;
}
+ const requestFilters: Record = {};
+ requestFilters[this.checkedHistoryMode] = stationName.toString();
+ requestFilters.countLimit = 30;
+
try {
const response: API.TimetableHistory.Response = await (
await this.apiStore.client!.get('api/getTimetables', {
- params: {
- issuedFrom: this.station?.name || this.onlineScenery?.name
- }
+ params: requestFilters
})
).data;
@@ -126,11 +152,17 @@ export default defineComponent({
}
},
+ checkHistoryMode(mode: HistoryMode) {
+ this.checkedHistoryMode = mode;
+ this.dataStatus = Status.Data.Loading;
+ this.fetchAPIData();
+ },
+
navigateToHistory() {
this.$router.push({
path: '/journal/timetables',
query: {
- 'search-issuedFrom': this.station?.name || this.onlineScenery?.name
+ [`search-${this.checkedHistoryMode}`]: this.station?.name || this.onlineScenery?.name
}
});
}
@@ -149,7 +181,7 @@ export default defineComponent({
display: grid;
gap: 1em;
- grid-template-rows: 40px auto 40px;
+ grid-template-rows: auto 1fr 40px;
}
.history-wrapper {
@@ -160,7 +192,14 @@ export default defineComponent({
.top-filters {
display: flex;
justify-content: center;
+ flex-wrap: wrap;
+
gap: 0.5em;
padding: 0.25em;
+
+ button {
+ padding: 0.35em;
+ min-width: 120px;
+ }
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 6b34693..414d0ef 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -125,7 +125,9 @@
"search-dispatcher": "Dispatcher name",
"search-station": "Scenery name",
"search-author": "Timetable author name",
- "search-issuedFrom": "Origin scenery name",
+ "search-issuedFrom": "Issuing scenery name",
+ "search-via": "Via scenery name",
+ "search-terminatingAt": "Terminating scenery name",
"search-timetables-date": "Timetable date (UTC+2 / CEST)",
"search-dispatchers-date": "Service date (UTC+2 / CEST)",
"search-date": "Date (UTC+2 / CEST)",
@@ -493,6 +495,10 @@
"option-timetables-history": "Timetables history PL1",
"option-dispatchers-history": "Dispatchers history PL1",
+ "timetable-via": "ALL TIMETABLES",
+ "timetable-issuedFrom": "BEGINS HERE",
+ "timetable-terminatingAt": "TERMINATES HERE",
+
"timetable-author-title": "Issued by",
"timetable-author-unknown": "Author unknown",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 4dcf451..32add3f 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -122,6 +122,8 @@
"search-station": "Nazwa scenerii",
"search-author": "Nick autora rozkładu jazdy",
"search-issuedFrom": "Sceneria początkowa",
+ "search-via": "Przez scenerię",
+ "search-terminatingAt": "Sceneria końcowa",
"search-timetables-date": "Data rozkładu jazdy (UTC+2 / CEST)",
"search-dispatchers-date": "Data służby (UTC+2 / CEST)",
"search-date": "Data (UTC+2 / CEST)",
@@ -476,6 +478,10 @@
"option-timetables-history": "Historia rozkładów PL1",
"option-dispatchers-history": "Historia dyżurów PL1",
+ "timetable-via": "WSZYSTKIE RJ",
+ "timetable-issuedFrom": "ROZPOCZYNA BIEG",
+ "timetable-terminatingAt": "KOŃCZY BIEG",
+
"timetable-author-title": "Wydany przez",
"timetable-author-unknown": "Autor nieznany",
diff --git a/src/styles/JournalSection.scss b/src/styles/JournalSection.scss
index a37fed7..3e18826 100644
--- a/src/styles/JournalSection.scss
+++ b/src/styles/JournalSection.scss
@@ -4,7 +4,7 @@
.list_wrapper {
overflow-y: auto;
height: 90vh;
- min-height: 550px;
+ min-height: 650px;
margin-top: 0.5em;
position: relative;
diff --git a/src/styles/sceneryViewTables.scss b/src/styles/sceneryViewTables.scss
index 1306edb..a4d7a08 100644
--- a/src/styles/sceneryViewTables.scss
+++ b/src/styles/sceneryViewTables.scss
@@ -1,5 +1,6 @@
table.scenery-history-table {
width: 100%;
+ min-width: 900px;
border-collapse: collapse;
thead {
diff --git a/src/views/JournalTimetables.vue b/src/views/JournalTimetables.vue
index 9a72e0e..5b7a1ae 100644
--- a/src/views/JournalTimetables.vue
+++ b/src/views/JournalTimetables.vue
@@ -126,6 +126,8 @@ interface TimetablesQueryParams {
dateTo?: string;
issuedFrom?: string;
+ terminatingAt?: string;
+ via?: string;
countFrom?: number;
countLimit?: number;
@@ -206,6 +208,8 @@ export default defineComponent({
'search-driver': '',
'search-dispatcher': '',
'search-issuedFrom': '',
+ 'search-via': '',
+ 'search-terminatingAt': '',
'search-date': ''
} as Journal.TimetableSearchType);
@@ -299,11 +303,17 @@ export default defineComponent({
},
setOptions(options: { [key: string]: string }) {
- this.searchersValues['search-date'] = options['search-date'] ?? '';
- this.searchersValues['search-driver'] = options['search-driver'] ?? '';
- this.searchersValues['search-train'] = options['search-train'] ?? '';
- this.searchersValues['search-dispatcher'] = options['search-dispatcher'] ?? '';
- this.searchersValues['search-issuedFrom'] = options['search-issuedFrom'] ?? '';
+ Object.keys(this.searchersValues).forEach((v) => {
+ this.searchersValues[v as Journal.TimetableSearchKey] = options[v] ?? '';
+ });
+
+ // this.searchersValues['search-date'] = options['search-date'] ?? '';
+ // this.searchersValues['search-driver'] = options['search-driver'] ?? '';
+ // this.searchersValues['search-train'] = options['search-train'] ?? '';
+ // this.searchersValues['search-dispatcher'] = options['search-dispatcher'] ?? '';
+ // this.searchersValues['search-issuedFrom'] = options['search-issuedFrom'] ?? '';
+ // this.searchersValues['search-via'] = options['search-via'] ?? '';
+ // this.searchersValues['search-terminatingAt'] = options['search-terminatingAt'] ?? '';
this.sorterActive.id =
(options['sorter-active'] as Journal.TimetableSorterKey) ?? 'timetableId';
@@ -347,6 +357,8 @@ export default defineComponent({
const authorName = this.searchersValues['search-dispatcher'].trim() || undefined;
const dateFrom = this.searchersValues['search-date'].trim() || undefined;
const issuedFrom = this.searchersValues['search-issuedFrom'].trim() || undefined;
+ const via = this.searchersValues['search-via'].trim() || undefined;
+ const terminatingAt = this.searchersValues['search-terminatingAt'].trim() || undefined;
let dateTo: string | undefined = undefined;
@@ -418,6 +430,10 @@ export default defineComponent({
queryParams['authorName'] = authorName;
queryParams['dateFrom'] = dateFrom;
queryParams['dateTo'] = dateTo;
+ queryParams['issuedFrom'] = issuedFrom;
+ queryParams['terminatingAt'] = terminatingAt;
+ queryParams['via'] = via;
+
queryParams['issuedFrom'] = issuedFrom;
queryParams['sortBy'] =
this.sorterActive.id != 'timetableId' ? this.sorterActive.id : undefined;
diff --git a/src/views/SceneryView.vue b/src/views/SceneryView.vue
index 76ed7a6..2653441 100644
--- a/src/views/SceneryView.vue
+++ b/src/views/SceneryView.vue
@@ -22,8 +22,8 @@
v-for="(viewMode, i) in viewModes"
:key="i"
class="btn btn--option"
+ :class="{ checked: currentMode == viewMode.component }"
@click="setViewMode(viewMode.component)"
- :data-checked="currentMode == viewMode.component"
>
{{ $t(viewMode.id) }}
@@ -223,26 +223,25 @@ button.back-btn {
}
}
-.scenery-left {
+.scenery-left,
+.scenery-right {
position: relative;
+ overflow: auto;
+
background-color: #181818;
padding: 1em 0.5em;
height: calc(100vh - 0.5em);
min-height: 800px;
- overflow: auto;
+ max-height: 2000px;
+}
+.scenery-left {
display: flex;
flex-direction: column;
}
.scenery-right {
- background: #181818;
- padding: 1em 0.5em;
-
- height: calc(100vh - 0.5em);
- min-height: 800px;
-
display: grid;
grid-template-rows: auto 1fr;
gap: 1em;
@@ -254,18 +253,12 @@ button.back-btn {
.info-actions {
display: flex;
- justify-content: center;
- align-items: center;
flex-wrap: wrap;
+ justify-content: center;
gap: 0.75em;
- .btn {
+ button {
padding: 0.5em;
- box-shadow: 0 0 10px 4px #242424;
-
- &[data-checked='true'] {
- color: var(--clr-primary);
- }
}
}
From 7c974e8d0eeabdadf04943eacfcc5272b106d85a Mon Sep 17 00:00:00 2001
From: Spythere
Date: Thu, 6 Jun 2024 14:04:07 +0200
Subject: [PATCH 09/19] bump: 1.25.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index ba2b2f1..6840f82 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "stacjownik",
- "version": "1.24.4",
+ "version": "1.25.0",
"private": true,
"scripts": {
"dev": "vite",
From fee9774f8807ad3e350a05429c380302118f3f75 Mon Sep 17 00:00:00 2001
From: Spythere
Date: Thu, 6 Jun 2024 14:12:21 +0200
Subject: [PATCH 10/19] chore: layout fixes
---
src/App.vue | 2 +-
src/components/StationsView/StationTable.vue | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/App.vue b/src/App.vue
index 63d6a30..e9e4ff1 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -180,7 +180,7 @@ export default defineComponent({
const naviLanguage = window.navigator.language.toString();
- if (naviLanguage.includes('en')) {
+ if (naviLanguage.startsWith('en')) {
this.changeLang('en');
return;
}
diff --git a/src/components/StationsView/StationTable.vue b/src/components/StationsView/StationTable.vue
index 9ee51e3..e5a71c8 100644
--- a/src/components/StationsView/StationTable.vue
+++ b/src/components/StationsView/StationTable.vue
@@ -412,15 +412,13 @@ export default defineComponent({
@import '../../styles/icons.scss';
$rowCol: #424242;
-$tableBgCol: #555555;
.station_table {
height: 80vh;
+ max-height: 2000px;
min-height: 700px;
- overflow-y: scroll;
- overflow-x: auto;
+ overflow: auto;
font-weight: 500;
- background-color: $tableBgCol;
}
.no-stations {
From c9de1a48ce2dd717831f971e20523b47d46b77ac Mon Sep 17 00:00:00 2001
From: Spythere
Date: Thu, 6 Jun 2024 14:19:17 +0200
Subject: [PATCH 11/19] chore: scenery timetables history translation; layout
fixes
---
.../SceneryView/SceneryTimetablesHistory.vue | 11 +++++++++--
src/locales/en.json | 2 +-
src/locales/pl.json | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue
index ba04962..3f0ddf5 100644
--- a/src/components/SceneryView/SceneryTimetablesHistory.vue
+++ b/src/components/SceneryView/SceneryTimetablesHistory.vue
@@ -1,6 +1,6 @@
-
+
@@ -110,7 +104,7 @@ import StopLabel from './StopLabel.vue';
import StockList from '../Global/StockList.vue';
import { useMainStore } from '../../store/mainStore';
import { useApiStore } from '../../store/apiStore';
-import { Train } from '../../typings/common';
+import { StationRoutesInfo, Train } from '../../typings/common';
export interface TrainScheduleStop {
nameHtml: string;
@@ -136,17 +130,15 @@ export interface TrainScheduleStop {
isSBL: boolean;
sceneryName: string | null;
- sceneryHash: string;
distance: number;
arrivalLine: string | null;
departureLine: string | null;
- arrivalLineSpeed: number;
- arrivalLineElectrified: boolean | null;
+ arrivalLineInfo?: StationRoutesInfo;
+ departureLineInfo?: StationRoutesInfo;
- departureLineSpeed: number;
- departureLineElectrified: boolean | null;
+ isExternal: boolean;
comments: string | null;
}
@@ -177,13 +169,14 @@ export default defineComponent({
return (
this.train.timetableData?.followingStops.map((stop, i, arr) => {
- if (
+ const isExternal =
i > 0 &&
- stop.arrivalLine &&
- stop.arrivalLine != arr[i - 1].departureLine &&
- !/sbl/gi.test(stop.arrivalLine)
- )
- currentSceneryIndex++;
+ stop.arrivalLine != null &&
+ (stop.arrivalLine != arr[i - 1].departureLine ||
+ (stop.arrivalLine == arr[i - 1].departureLine &&
+ !/-|_|(^it\d+)|(^sbl)/gi.test(stop.arrivalLine)));
+
+ if (isExternal) currentSceneryIndex++;
const sceneryName = this.train.timetableData!.sceneryNames[currentSceneryIndex];
const sceneryInfo = this.apiStore.sceneryData.find((st) => st.name == sceneryName);
@@ -214,12 +207,12 @@ export default defineComponent({
comments: stop.comments ?? null,
arrivalLine: stop.arrivalLine,
- arrivalLineSpeed: arrivalLineInfo?.routeSpeed ?? 0,
- arrivalLineElectrified: arrivalLineInfo?.isElectric ?? null,
-
departureLine: stop.departureLine,
- departureLineSpeed: departureLineInfo?.routeSpeed ?? 0,
- departureLineElectrified: departureLineInfo?.isElectric ?? null,
+
+ arrivalLineInfo: arrivalLineInfo,
+ departureLineInfo: departureLineInfo,
+
+ isExternal,
type: stop.stopType,
distance: stop.stopDistance,
@@ -227,7 +220,6 @@ export default defineComponent({
isLastConfirmed: this.lastConfirmed === i && !stop.terminatesHere,
isSBL: /sbl/gi.test(stop.stopName),
position: stop.beginsHere ? 'begin' : stop.terminatesHere ? 'end' : 'en-route',
- sceneryHash: '',
sceneryName,
status: stop.confirmed ? 'confirmed' : stop.stopped ? 'stopped' : 'unconfirmed'
};
@@ -531,9 +523,9 @@ $blinkAnim: 0.5s ease-in-out alternate infinite blink;
}
.scenery-route {
- display: flex;
- align-items: center;
- gap: 5px;
+ img {
+ vertical-align: middle;
+ }
}
.scenery-change-name {
diff --git a/src/locales/en.json b/src/locales/en.json
index 2f8696d..165b8ba 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -332,6 +332,7 @@
"current-track": "on track",
"vmax-tooltip": "Maximum train speed based on rolling stock vehicles - braked weight is not included",
+ "we4a-tooltip": "Non-electrified track",
"delayed": "Delayed: ",
"preponed": "Ahead of schedule: ",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 958ae2b..db452a2 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -318,6 +318,7 @@
"current-track": "na szlaku",
"vmax-tooltip": "Maksymalna prędkość na podstawie pojazdów w składzie - nie bierze pod uwagę masy hamowania",
+ "we4a-tooltip": "Szlak niezelektryfikowany",
"delayed": "Opóźniony: ",
"preponed": "Przed czasem: ",
From fb56378f18a322c437308554cf83eaafa292fec5 Mon Sep 17 00:00:00 2001
From: Spythere
Date: Fri, 7 Jun 2024 16:44:09 +0200
Subject: [PATCH 14/19] chore: redesigned scenery history tables
---
.../SceneryView/SceneryDispatchersHistory.vue | 127 ++++++++-------
.../SceneryView/SceneryTimetablesHistory.vue | 150 +++++++++++-------
src/styles/sceneryViewTables.scss | 1 +
src/typings/api.ts | 1 +
4 files changed, 170 insertions(+), 109 deletions(-)
diff --git a/src/components/SceneryView/SceneryDispatchersHistory.vue b/src/components/SceneryView/SceneryDispatchersHistory.vue
index 3e63a9c..dc7e8d3 100644
--- a/src/components/SceneryView/SceneryDispatchersHistory.vue
+++ b/src/components/SceneryView/SceneryDispatchersHistory.vue
@@ -3,64 +3,63 @@
-
+
{{ $t('scenery.history-list-empty') }}
-
-
- | {{ $t('scenery.dispatchers-history-hash') }} |
- {{ $t('scenery.dispatchers-history-dispatcher') }} |
- {{ $t('scenery.dispatchers-history-level') }} |
- {{ $t('scenery.dispatchers-history-rate') }} |
- {{ $t('scenery.dispatchers-history-date') }} |
-
-
-
-
- | #{{ historyItem.stationHash }} |
-
+
+
+
+
+ #{{ historyItem.stationHash }}
+
+
+ {{ historyItem.dispatcherLevel >= 2 ? historyItem.dispatcherLevel : 'L' }}
+
+
- {{ historyItem.dispatcherName }}
+ {{ historyItem.dispatcherName }}
- |
-
-
- {{ historyItem.dispatcherLevel >= 2 ? historyItem.dispatcherLevel : 'L' }}
-
+
- -
- |
-
- {{ historyItem.dispatcherRate }}
- |
-
-
- {{ $d(historyItem.timestampFrom) }}
+
+
+ Ocena:
+ {{ historyItem.dispatcherRate }}
+
+ |
+
+ Zmiany statusów: {{ historyItem.statusHistory.length }}
+
+
+
- {{ timestampToString(historyItem.timestampFrom) }}
- - {{ timestampToString(historyItem.timestampTo) }} ({{
- calculateDuration(historyItem.currentDuration)
- }})
-
+
+
+ {{ $d(historyItem.timestampFrom) }}
-
- {{ $t('journal.online-since') }}
- {{ timestampToString(historyItem.timestampFrom) }}
- ({{ calculateDuration(historyItem.currentDuration) }})
-
- |
-
-
-
+ {{ timestampToString(historyItem.timestampFrom) }}
+ - {{ timestampToString(historyItem.timestampTo) }} ({{
+ calculateDuration(historyItem.currentDuration)
+ }})
+
+
+
+ {{ $t('journal.online-since') }}
+ {{ timestampToString(historyItem.timestampFrom) }}
+ ({{ calculateDuration(historyItem.currentDuration) }})
+
+
+
+
@@ -165,8 +164,29 @@ export default defineComponent({
overflow: auto;
}
+.history-list {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5em;
+ text-align: left;
+}
+
+.history-list > div {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ flex-wrap: wrap;
+
+ gap: 0.5em;
+ padding: 0.5em;
+ background-color: #2b2b2b;
+ line-height: 1.75em;
+}
+
.level-badge {
- margin: 0 auto;
+ text-align: center;
+ display: inline-block;
+ line-height: 1.6em;
}
.dispatcher-online {
@@ -174,13 +194,10 @@ export default defineComponent({
}
@include smallScreen {
- .history-list {
- font-size: 1.1em;
- }
- .list-item {
- align-items: center;
+ .history-list > div {
flex-direction: column;
+ justify-content: center;
+ text-align: center;
}
}
-../../store/storeTypes
diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue
index 3f0ddf5..7636247 100644
--- a/src/components/SceneryView/SceneryTimetablesHistory.vue
+++ b/src/components/SceneryView/SceneryTimetablesHistory.vue
@@ -10,68 +10,80 @@
>
{{ $t(`scenery.timetable-${mode}`) }}
-
-
-
-
-
+
{{ $t('scenery.history-list-empty') }}
-
-
- | {{ $t('scenery.timetables-history-id') }} |
- {{ $t('scenery.timetables-history-number') }} |
- {{ $t('scenery.timetables-history-route') }} |
- {{ $t('scenery.timetables-history-driver') }} |
- {{ $t('scenery.timetables-history-author') }} |
- {{ $t('scenery.timetables-history-date') }} |
-
+
+
+
+
+
+ {{
+ timetableHistory.terminated
+ ? timetableHistory.fulfilled
+ ? '⦿'
+ : '⦻'
+ : '◯'
+ }}
+
+ #{{ timetableHistory.id }} |
+ {{ timetableHistory.trainCategoryCode }}
+ {{ timetableHistory.trainNo }}
+ {{ timetableHistory.route.replace('|', ' ⇒ ') }}
+
-
-
- |
-
- #{{ historyItem.id }}
-
- |
-
- {{ historyItem.trainCategoryCode }}
- {{ historyItem.trainNo }}
- |
- {{ historyItem.route.replace('|', ' -> ') }} |
-
-
- {{ historyItem.driverName }}
-
- |
-
-
- {{ historyItem.authorName }}
-
- {{ $t('scenery.timetable-author-unknown') }}
- |
-
+
+ Wystawiony
{{
localeDateTime(
- historyItem.createdAt > historyItem.beginDate
- ? historyItem.beginDate
- : historyItem.createdAt,
+ timetableHistory.createdAt > timetableHistory.beginDate
+ ? timetableHistory.beginDate
+ : timetableHistory.createdAt,
$i18n.locale
)
}}
- |
-
-
-
+
+ przez:
+
+
+ {{ timetableHistory.authorName }}
+
+
+
+ dla maszynisty:
+
+
+ {{ timetableHistory.driverName }}
+
+
+
+
+
+
+
+
@@ -90,13 +102,15 @@ import Loading from '../Global/Loading.vue';
import { API } from '../../typings/api';
import { ActiveScenery, Station, Status } from '../../typings/common';
import { useApiStore } from '../../store/apiStore';
+import routerMixin from '../../mixins/routerMixin';
+import { useMainStore } from '../../store/mainStore';
const historyModeList = ['issuedFrom', 'terminatingAt', 'via'] as const;
type HistoryMode = (typeof historyModeList)[number];
export default defineComponent({
name: 'SceneryTimetablesHistory',
- mixins: [dateMixin],
+ mixins: [dateMixin, routerMixin],
props: {
station: {
type: Object as PropType
@@ -112,6 +126,7 @@ export default defineComponent({
historyModeList,
apiStore: useApiStore(),
+ mainStore: useMainStore(),
dataStatus: Status.Data.Loading,
DataStatus: Status.Data,
@@ -203,10 +218,37 @@ export default defineComponent({
}
}
-table td a {
- max-width: 200px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
+.history-list {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5em;
+ text-align: left;
}
+
+.history-list > div {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 0.5em;
+ background-color: #2b2b2b;
+ line-height: 1.5em;
+}
+
+.history-list > div > button > img {
+ width: 2em;
+ transform: rotate(180deg);
+}
+
+.timetable-status-indicator {
+ &[data-fulfilled='true'] {
+ color: limegreen;
+ }
+}
+
+// table td a {
+// max-width: 100%;
+// overflow: hidden;
+// text-overflow: ellipsis;
+// white-space: nowrap;
+// }
diff --git a/src/styles/sceneryViewTables.scss b/src/styles/sceneryViewTables.scss
index a4d7a08..5d19433 100644
--- a/src/styles/sceneryViewTables.scss
+++ b/src/styles/sceneryViewTables.scss
@@ -1,5 +1,6 @@
table.scenery-history-table {
width: 100%;
+ table-layout: fixed;
min-width: 900px;
border-collapse: collapse;
diff --git a/src/typings/api.ts b/src/typings/api.ts
index 2f97f43..a37e82a 100644
--- a/src/typings/api.ts
+++ b/src/typings/api.ts
@@ -39,6 +39,7 @@ export namespace API {
stationName: string;
timestampFrom: number;
timestampTo?: number;
+ statusHistory: string[];
}
}
From c252213ed964558538771a902f71bc44ba6fbacb Mon Sep 17 00:00:00 2001
From: Spythere
Date: Fri, 7 Jun 2024 18:31:20 +0200
Subject: [PATCH 15/19] hotfix
---
.../SceneryView/SceneryTimetablesHistory.vue | 20 ++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue
index 7636247..585df78 100644
--- a/src/components/SceneryView/SceneryTimetablesHistory.vue
+++ b/src/components/SceneryView/SceneryTimetablesHistory.vue
@@ -28,13 +28,7 @@
:data-terminated="timetableHistory.terminated"
:data-fulfilled="timetableHistory.fulfilled"
>
- {{
- timetableHistory.terminated
- ? timetableHistory.fulfilled
- ? '⦿'
- : '⦻'
- : '◯'
- }}
+ ⦿
#{{ timetableHistory.id }} |
{{ timetableHistory.trainCategoryCode }}
@@ -80,7 +74,7 @@
})
"
>
-
+
@@ -241,7 +235,15 @@ export default defineComponent({
.timetable-status-indicator {
&[data-fulfilled='true'] {
- color: limegreen;
+ color: lightgreen;
+ }
+
+ &[data-terminated='false'] {
+ color: lightblue;
+ }
+
+ &[data-terminated='true'][data-fulfilled='false'] {
+ color: lightcoral;
}
}
From 59a5fbe5ac3db37b7cfd045a11fc19b1805b65f3 Mon Sep 17 00:00:00 2001
From: Spythere
Date: Sat, 8 Jun 2024 20:53:22 +0200
Subject: [PATCH 16/19] chore: adjusted to new version of API vehicles data
---
.../Tooltip/VehiclePreviewTooltip.vue | 36 ++++++++++---------
src/components/TrainsView/TrainInfo.vue | 26 +++++---------
src/store/apiStore.ts | 18 +++++-----
src/typings/api.ts | 4 +--
src/typings/common.ts | 26 ++++++++------
vite.config.ts | 19 ++++------
6 files changed, 61 insertions(+), 68 deletions(-)
diff --git a/src/components/Tooltip/VehiclePreviewTooltip.vue b/src/components/Tooltip/VehiclePreviewTooltip.vue
index 6e7f452..5853f7e 100644
--- a/src/components/Tooltip/VehiclePreviewTooltip.vue
+++ b/src/components/Tooltip/VehiclePreviewTooltip.vue
@@ -23,9 +23,9 @@
({{ vehicleCargo.id }})
-
- {{ vehicleProps.speed }}km/h • {{ vehicleProps.length }}m •
- {{ (vehicleProps.weight / 1000).toFixed(1) }}t
+
+ {{ vehicleData.group.speed }}km/h • {{ vehicleData.group.length }}m •
+ {{ (vehicleData.group.weight / 1000).toFixed(1) }}t
(+{{ (vehicleCargo.weight / 1000).toFixed(1) }}t)
@@ -72,23 +72,27 @@ export default defineComponent({
return this.tooltipStore.content.split(':')[0];
},
- vehicleCargo() {
- return this.vehicleProps?.cargoTypes?.find(
- (c) => c.id == this.tooltipStore.content.split(':')[1]
- );
+ vehicleData() {
+ return this.apiStore.vehiclesData?.find((v) => v.name == this.vehicleName);
},
- vehicleProps() {
- const vehicleDataArray = this.apiStore.vehiclesData?.vehicleList.find(
- ([name]) => name === this.vehicleName
- );
-
- if (!vehicleDataArray) return null;
-
- return (
- this.apiStore.vehiclesData!.vehicleProps.find((v) => v.type == vehicleDataArray[1]) ?? null
+ vehicleCargo() {
+ return this.vehicleData?.group.cargoTypes?.find(
+ (c) => c.id == this.tooltipStore.content.split(':')[1]
);
}
+
+ // vehicleProps() {
+ // const vehicleDataArray = this.apiStore.vehiclesData?.vehicleList.find(
+ // ([name]) => name === this.vehicleName
+ // );
+
+ // if (!vehicleDataArray) return null;
+
+ // return (
+ // this.apiStore.vehiclesData!.vehicleProps.find((v) => v.type == vehicleDataArray[1]) ?? null
+ // );
+ // }
}
});
diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue
index 7649429..17c0e15 100644
--- a/src/components/TrainsView/TrainInfo.vue
+++ b/src/components/TrainsView/TrainInfo.vue
@@ -132,7 +132,7 @@
{{ train.speed }} km/h
-
+
•
- {{ maxSpeed }} km/h
+ {{ stockSpeedLimit }} km/h
@@ -204,24 +204,14 @@ export default defineComponent({
},
computed: {
- maxSpeed() {
+ stockSpeedLimit() {
return this.train.stockList.reduce((acc, stockName) => {
- const stockVehicleInfo = this.apiStore.vehiclesData?.vehicleList.find(
- (v) => v[0] == stockName.split(':')[0]
- );
+ const vehicleSpeed =
+ this.apiStore.vehiclesData?.find((v) => v.name == stockName.split(':')[0])?.group.speed ??
+ 300;
- if (!stockVehicleInfo) return acc;
-
- const stockVehicleProps = this.apiStore.vehiclesData?.vehicleProps.find(
- (v) => v.type == stockVehicleInfo[1]
- );
-
- if (!stockVehicleProps) return acc;
-
- if (stockVehicleProps.speed < acc) return stockVehicleProps.speed;
-
- return acc;
- }, Infinity);
+ return Math.min(vehicleSpeed, acc);
+ }, 300);
}
},
diff --git a/src/store/apiStore.ts b/src/store/apiStore.ts
index 8f0562b..bb828dd 100644
--- a/src/store/apiStore.ts
+++ b/src/store/apiStore.ts
@@ -106,18 +106,18 @@ 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;
- });
+ // 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;
- }
+ // return;
+ // }
try {
- const response = await this.client!.get('vehicles');
+ const response = await this.client!.get('api/getVehicles');
this.vehiclesData = response.data;
this.dataStatuses.vehicles = response.data ? Status.Data.Loaded : Status.Data.Warning;
diff --git a/src/typings/api.ts b/src/typings/api.ts
index a37e82a..4619cc0 100644
--- a/src/typings/api.ts
+++ b/src/typings/api.ts
@@ -1,4 +1,4 @@
-import { Status, VehiclesData } from './common';
+import { Status, VehicleData } from './common';
export enum APIDataStatus {
OK = 'OK',
@@ -320,7 +320,7 @@ export namespace API {
}
export namespace Vehicles {
- export type Response = VehiclesData;
+ export type Response = VehicleData[];
}
}
diff --git a/src/typings/common.ts b/src/typings/common.ts
index e53b9da..631aab5 100644
--- a/src/typings/common.ts
+++ b/src/typings/common.ts
@@ -191,22 +191,28 @@ export interface CheckpointTrain {
}
// Vehicles Data
-export interface VehiclesData {
- simulatorVersion: string;
- vehicleList: any[][];
-
- vehicleProps: VehicleProps[];
+export interface VehicleData {
+ id: number;
+ name: string;
+ type: string;
+ cabinName: string | null;
+ restrictions: Record | null;
+ vehicleGroupsId: number;
+ group: VehiclesGroup;
}
-export interface VehicleProps {
- type: string;
+export interface VehiclesGroup {
+ id: number;
+ name: string;
speed: number;
length: number;
weight: number;
- cargoTypes?: VehicleCargo[];
- coldStart?: boolean;
- doubleManned?: boolean;
+ cargoTypes: VehicleCargo[] | null;
+ locoProps: {
+ coldStart: boolean;
+ doubleManned: boolean;
+ } | null;
}
export interface VehicleCargo {
diff --git a/vite.config.ts b/vite.config.ts
index e32fe95..3dc3cb1 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -24,33 +24,26 @@ export default defineConfig({
cleanupOutdatedCaches: true,
runtimeCaching: [
{
- urlPattern: /^https:\/\/stacjownik.spythere.eu\/api\/getSceneries/i,
- handler: 'StaleWhileRevalidate',
+ urlPattern:
+ /^https:\/\/stacjownik.spythere.eu\/api\/(getVehicles|getDonators|getSceneries)/i,
+ handler: 'NetworkFirst',
options: {
- cacheName: 'spythere-sceneries-cache',
+ cacheName: 'stacjownik-api-cache',
cacheableResponse: {
statuses: [0, 200]
}
}
},
- {
- urlPattern: /^https:\/\/stacjownik.spythere.eu\/vehicles/i,
- handler: 'StaleWhileRevalidate',
- options: {
- cacheName: 'spythere-vehicles-cache'
- }
- },
{
urlPattern: /^https:\/\/static.spythere.eu\/.*/i,
- handler: 'CacheFirst',
+ handler: 'StaleWhileRevalidate',
options: {
cacheName: 'spythere-static-cache',
cacheableResponse: {
statuses: [0, 200]
},
expiration: {
- maxEntries: 100,
- maxAgeSeconds: 60 * 60 * 8
+ maxEntries: 100
}
}
}
From 44f548c7b751e4c1a936d53004ab9735ae2a013b Mon Sep 17 00:00:00 2001
From: Spythere
Date: Sat, 8 Jun 2024 21:37:28 +0200
Subject: [PATCH 17/19] chore: scenery history locales
---
.../SceneryView/SceneryDispatchersHistory.vue | 5 +-
.../SceneryView/SceneryTimetablesHistory.vue | 50 +++++++++----------
src/locales/en.json | 19 ++-----
src/locales/pl.json | 19 ++-----
4 files changed, 38 insertions(+), 55 deletions(-)
diff --git a/src/components/SceneryView/SceneryDispatchersHistory.vue b/src/components/SceneryView/SceneryDispatchersHistory.vue
index dc7e8d3..0bbc38d 100644
--- a/src/components/SceneryView/SceneryDispatchersHistory.vue
+++ b/src/components/SceneryView/SceneryDispatchersHistory.vue
@@ -32,12 +32,13 @@
- Ocena:
+ {{ $t('scenery.dispatcher-rate') }}
{{ historyItem.dispatcherRate }}
|
- Zmiany statusów: {{ historyItem.statusHistory.length }}
+ {{ $t('scenery.dispatcher-status-changes') }}
+ {{ historyItem.statusHistory.length }}
diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue
index 585df78..8b1683f 100644
--- a/src/components/SceneryView/SceneryTimetablesHistory.vue
+++ b/src/components/SceneryView/SceneryTimetablesHistory.vue
@@ -37,17 +37,21 @@
- Wystawiony
- {{
- localeDateTime(
- timetableHistory.createdAt > timetableHistory.beginDate
- ? timetableHistory.beginDate
- : timetableHistory.createdAt,
- $i18n.locale
- )
- }}
+
+ {{ $t('scenery.timetable-issued-date') }}
+
+ {{
+ localeDateTime(
+ timetableHistory.createdAt > timetableHistory.beginDate
+ ? timetableHistory.beginDate
+ : timetableHistory.createdAt,
+ $i18n.locale
+ )
+ }}
+
- przez:
+ {{ $t('scenery.timetable-issued-by') }}
- dla maszynisty:
-
-
- {{ timetableHistory.driverName }}
-
-
+
+
+ {{ $t('scenery.timetable-issued-for') }}
+
+
+ {{ timetableHistory.driverName }}
+
+
+
@@ -246,11 +253,4 @@ export default defineComponent({
color: lightcoral;
}
}
-
-// table td a {
-// max-width: 100%;
-// overflow: hidden;
-// text-overflow: ellipsis;
-// white-space: nowrap;
-// }
diff --git a/src/locales/en.json b/src/locales/en.json
index 165b8ba..61d31fe 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -500,21 +500,12 @@
"timetable-issuedFrom": "BEGINS HERE",
"timetable-terminatingAt": "TERMINATES HERE",
- "timetable-author-title": "Issued by",
- "timetable-author-unknown": "Author unknown",
+ "timetable-issued-date": "Issued",
+ "timetable-issued-by": " by:",
+ "timetable-issued-for": " for driver:",
- "timetables-history-id": "ID",
- "timetables-history-number": "Number",
- "timetables-history-route": "Route",
- "timetables-history-driver": "Driver",
- "timetables-history-author": "TT author",
- "timetables-history-date": "Created at",
-
- "dispatchers-history-hash": "Hash",
- "dispatchers-history-dispatcher": "Dispatcher",
- "dispatchers-history-level": "Level",
- "dispatchers-history-rate": "Rate",
- "dispatchers-history-date": "Service date",
+ "dispatcher-rate": "Rate:",
+ "dispatcher-status-changes": "Status changes:",
"req-level": "all dispatcher levels | dispatcher level {lvl} required | dispatcher level {lvl} required",
"history-list-empty": "No recorded scenery history!",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index db452a2..8d2e97f 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -483,21 +483,12 @@
"timetable-issuedFrom": "ROZPOCZYNA BIEG",
"timetable-terminatingAt": "KOŃCZY BIEG",
- "timetable-author-title": "Wydany przez",
- "timetable-author-unknown": "Autor nieznany",
+ "timetable-issued-date": "Wystawiony",
+ "timetable-issued-by": " przez:",
+ "timetable-issued-for": " dla maszynisty:",
- "timetables-history-id": "ID",
- "timetables-history-number": "Numer",
- "timetables-history-route": "Trasa",
- "timetables-history-driver": "Maszynista",
- "timetables-history-author": "Autor RJ",
- "timetables-history-date": "Data stworzenia",
-
- "dispatchers-history-hash": "Hash",
- "dispatchers-history-dispatcher": "Dyżurny",
- "dispatchers-history-level": "Poziom",
- "dispatchers-history-rate": "Ocena",
- "dispatchers-history-date": "Data służby",
+ "dispatcher-rate": "Ocena:",
+ "dispatcher-status-changes": "Zmiany statusów:",
"req-level": "ogólnodostępna | minimum {lvl} poziom dyżurnego | minimum {lvl} poziom dyżurnego",
"history-list-empty": "Brak historii dla tej scenerii!",
From 6084e5876dd9e30982656c4427b71abfada3f2a2 Mon Sep 17 00:00:00 2001
From: Spythere
Date: Sat, 8 Jun 2024 21:38:05 +0200
Subject: [PATCH 18/19] chore: changed default history mode
---
src/components/SceneryView/SceneryTimetablesHistory.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/SceneryView/SceneryTimetablesHistory.vue b/src/components/SceneryView/SceneryTimetablesHistory.vue
index 8b1683f..35c2489 100644
--- a/src/components/SceneryView/SceneryTimetablesHistory.vue
+++ b/src/components/SceneryView/SceneryTimetablesHistory.vue
@@ -106,7 +106,7 @@ import { useApiStore } from '../../store/apiStore';
import routerMixin from '../../mixins/routerMixin';
import { useMainStore } from '../../store/mainStore';
-const historyModeList = ['issuedFrom', 'terminatingAt', 'via'] as const;
+const historyModeList = ['via', 'issuedFrom', 'terminatingAt'] as const;
type HistoryMode = (typeof historyModeList)[number];
export default defineComponent({
@@ -131,7 +131,7 @@ export default defineComponent({
dataStatus: Status.Data.Loading,
DataStatus: Status.Data,
- checkedHistoryMode: 'issuedFrom' as HistoryMode
+ checkedHistoryMode: 'via' as HistoryMode
};
},
From 4e7fba89eec2f696fd618c8bfb1d8c8a3200e233 Mon Sep 17 00:00:00 2001
From: Spythere
Date: Sun, 9 Jun 2024 00:58:45 +0200
Subject: [PATCH 19/19] chore: improved stop label information
---
src/components/TrainsView/StopLabel.vue | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/components/TrainsView/StopLabel.vue b/src/components/TrainsView/StopLabel.vue
index 2681592..bd06a8d 100644
--- a/src/components/TrainsView/StopLabel.vue
+++ b/src/components/TrainsView/StopLabel.vue
@@ -1,5 +1,8 @@
-
+
{{
stop.duration == 0 && stop.departureDelay > 0
@@ -65,7 +64,9 @@
"
>
o.
-
+
{{ timestampToString(stop.departureScheduled) }}
{{ timestampToString(stop.departureReal) }}
@@ -109,7 +110,7 @@ $stopNameClr: #303030;
flex-wrap: wrap;
align-items: center;
- &[data-sbl='true'] {
+ &[data-minor='true'] {
.date {
display: none;
}
|