mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41e60bc69e | |||
| 933bdecb3c | |||
| 10e183d96b | |||
| 5429d39f5e | |||
| ff31e7f903 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "stacjownik",
|
||||
"version": "1.16.2",
|
||||
"version": "1.16.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
<template>
|
||||
<section class="scenery-dispatchers-history scenery-section">
|
||||
<Loading v-if="dataStatus != 2" />
|
||||
<section class="scenery-table-section">
|
||||
<Loading v-if="dataStatus != DataStatus.Loaded && historyList.length == 0" />
|
||||
<div class="no-history" v-else-if="historyList.length == 0">{{ $t('scenery.history-list-empty') }}</div>
|
||||
|
||||
<table class="scenery-history-table" v-else-if="historyList.length">
|
||||
<table class="scenery-history-table" v-else="historyList.length">
|
||||
<thead>
|
||||
<!-- <th>{{ $t('scenery.timetables-history-id') }}</th>
|
||||
<th>{{ $t('scenery.timetables-history-number') }}</th>
|
||||
<th>{{ $t('scenery.timetables-history-route') }}</th>
|
||||
<th>{{ $t('scenery.timetables-history-driver') }}</th>
|
||||
<th>{{ $t('scenery.timetables-history-author') }}</th>
|
||||
<th>{{ $t('scenery.timetables-history-date') }}</th> -->
|
||||
|
||||
<th>Hash</th>
|
||||
<th>Dyżurny</th>
|
||||
<th>Poziom</th>
|
||||
<th>Ocena</th>
|
||||
<th>Data</th>
|
||||
<th>{{ $t('scenery.dispatchers-history-hash') }}</th>
|
||||
<th>{{ $t('scenery.dispatchers-history-dispatcher') }}</th>
|
||||
<th>{{ $t('scenery.dispatchers-history-level') }}</th>
|
||||
<th>{{ $t('scenery.dispatchers-history-rate') }}</th>
|
||||
<th>{{ $t('scenery.dispatchers-history-date') }}</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@@ -55,10 +49,13 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="no-history" v-else>{{ $t('scenery.history-list-empty') }}</div>
|
||||
<div ref="bottomDiv"></div>
|
||||
</section>
|
||||
|
||||
<div class="bottom-info">
|
||||
<button class="btn btn--option" v-if="historyList.length > 0" @click="navigateToHistory">
|
||||
{{ $t('scenery.bottom-info') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -87,36 +84,35 @@ export default defineComponent({
|
||||
return {
|
||||
historyList: [] as DispatcherHistory[],
|
||||
dataStatus: DataStatus.Loading,
|
||||
DataStatus,
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.mountObserver(this.fireObserverAction, this.$refs['bottomDiv'] as Element);
|
||||
async activated() {
|
||||
// if (this.historyList.length == 0) {
|
||||
const fetchedHistory = await this.fetchAPIData();
|
||||
if (fetchedHistory) this.historyList = fetchedHistory;
|
||||
// }
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
this.unmountObserver();
|
||||
},
|
||||
|
||||
activated() {
|
||||
if (this.historyList.length == 0) this.fetchAPIData();
|
||||
},
|
||||
methods: {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 30) {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 30): Promise<DispatcherHistory[] | null> {
|
||||
try {
|
||||
this.dataStatus = DataStatus.Loading;
|
||||
|
||||
const requestString = `${URLs.stacjownikAPI}/api/getDispatchers?stationName=${this.station.name}&countFrom=${countFrom}&countLimit=${countLimit}`;
|
||||
const historyAPIData: DispatcherHistory[] = await (await axios.get(requestString)).data;
|
||||
|
||||
this.historyList.push(...historyAPIData);
|
||||
this.dataStatus = DataStatus.Loaded;
|
||||
return historyAPIData;
|
||||
} catch (error) {
|
||||
this.dataStatus = DataStatus.Error;
|
||||
console.error(error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
fireObserverAction() {
|
||||
if (this.historyList.length > 0 && this.dataStatus == DataStatus.Loaded)
|
||||
this.fetchAPIData(this.historyList.length);
|
||||
navigateToHistory() {
|
||||
this.$router.push(`/journal/dispatchers?sceneryName=${this.station.name}`);
|
||||
},
|
||||
},
|
||||
components: { Loading },
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
{{ station.name }}
|
||||
</a>
|
||||
|
||||
<div class="scenery-abbrev">{{ $t('scenery.abbrev') }} <b>{{ station.generalInfo?.abbr }}</b></div>
|
||||
<div class="scenery-abbrev">
|
||||
{{ $t('scenery.abbrev') }} <b>{{ station.generalInfo?.abbr }}</b>
|
||||
</div>
|
||||
|
||||
<div class="scenery-hash" v-if="station.onlineInfo?.hash">#{{ station.onlineInfo.hash }}</div>
|
||||
</section>
|
||||
@@ -28,6 +30,10 @@ export default defineComponent({
|
||||
@import '../../styles/variables.scss';
|
||||
@import '../../styles/responsive.scss';
|
||||
|
||||
.info-header {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.scenery-name {
|
||||
font-weight: bold;
|
||||
font-size: 3em;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<section class="scenery-timetables-history scenery-section">
|
||||
<Loading v-if="dataStatus != 2" />
|
||||
<section class="scenery-table-section">
|
||||
<Loading v-if="dataStatus != DataStatus.Loaded" />
|
||||
<div class="no-history" v-else-if="historyList.length == 0">{{ $t('scenery.history-list-empty') }}</div>
|
||||
|
||||
<table class="scenery-history-table" v-else-if="historyList.length">
|
||||
<table class="scenery-history-table" v-else>
|
||||
<thead>
|
||||
<th>{{ $t('scenery.timetables-history-id') }}</th>
|
||||
<th>{{ $t('scenery.timetables-history-number') }}</th>
|
||||
@@ -26,7 +27,7 @@
|
||||
<td>
|
||||
<router-link
|
||||
v-if="historyItem.authorName"
|
||||
:to="`/journal/dispatchers?dispatcherName=${historyItem.authorName}`"
|
||||
:to="`/journal/timetables?authorName=${historyItem.authorName}`"
|
||||
>{{ historyItem.authorName }}
|
||||
</router-link>
|
||||
<i v-else>{{ $t('scenery.timetable-author-unknown') }}</i>
|
||||
@@ -38,10 +39,13 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="no-history" v-else>{{ $t('scenery.history-list-empty') }}</div>
|
||||
<div ref="bottomDiv"></div>
|
||||
</section>
|
||||
|
||||
<div class="bottom-info">
|
||||
<button class="btn btn--option" v-if="historyList.length > 0" @click="navigateToHistory()">
|
||||
{{ $t('scenery.bottom-info') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -69,37 +73,31 @@ export default defineComponent({
|
||||
return {
|
||||
historyList: [] as TimetableHistory[],
|
||||
dataStatus: DataStatus.Loading,
|
||||
DataStatus,
|
||||
};
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.mountObserver(this.fireObserverAction, this.$refs['bottomDiv'] as Element);
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
this.unmountObserver();
|
||||
},
|
||||
|
||||
activated() {
|
||||
if (this.historyList.length == 0) this.fetchAPIData();
|
||||
async activated() {
|
||||
const fetchedHistory = await this.fetchAPIData();
|
||||
if (fetchedHistory) this.historyList = fetchedHistory.timetables;
|
||||
},
|
||||
|
||||
methods: {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 15) {
|
||||
async fetchAPIData(countFrom = 0, countLimit = 15): Promise<SceneryTimetableHistory | null> {
|
||||
try {
|
||||
const requestString = `${URLs.stacjownikAPI}/api/getIssuedTimetables?name=${this.station.name}&countFrom=${countFrom}&countLimit=${countLimit}`;
|
||||
const historyAPIData: SceneryTimetableHistory = await (await axios.get(requestString)).data;
|
||||
|
||||
this.historyList.push(...historyAPIData.timetables);
|
||||
this.dataStatus = DataStatus.Loaded;
|
||||
return historyAPIData;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
fireObserverAction() {
|
||||
if (this.historyList.length > 0 && this.dataStatus == DataStatus.Loaded)
|
||||
this.fetchAPIData(this.historyList.length);
|
||||
navigateToHistory() {
|
||||
this.$router.push(`/journal/timetables?issuedFrom=${this.station.name}`);
|
||||
},
|
||||
},
|
||||
components: { Loading },
|
||||
|
||||
+9
-1
@@ -370,13 +370,21 @@
|
||||
"timetables-history-author": "TT author",
|
||||
"timetables-history-date": "Date",
|
||||
|
||||
"dispatchers-history-hash": "Hash",
|
||||
"dispatchers-history-dispatcher": "Dispatcher",
|
||||
"dispatchers-history-level": "Level",
|
||||
"dispatchers-history-rate": "Rate",
|
||||
"dispatchers-history-date": "Service date",
|
||||
|
||||
"req-level": "all dispatcher levels | dispatcher level {lvl} required | dispatcher level {lvl} required",
|
||||
"history-list-empty": "No recorded scenery history!",
|
||||
|
||||
"forum-topic": "Official {name} forum topic",
|
||||
|
||||
"pragotron-link": "Timetable pallet board (beta)",
|
||||
"tablice-link": "Timetable summary board (by Thundo)"
|
||||
"tablice-link": "Timetable summary board (by Thundo)",
|
||||
|
||||
"bottom-info": "Show full history in the Journal tab"
|
||||
},
|
||||
"availability": {
|
||||
"title": "Availability",
|
||||
|
||||
+9
-1
@@ -373,13 +373,21 @@
|
||||
"timetables-history-author": "Autor RJ",
|
||||
"timetables-history-date": "Data",
|
||||
|
||||
"dispatchers-history-hash": "Hash",
|
||||
"dispatchers-history-dispatcher": "Dyżurny",
|
||||
"dispatchers-history-level": "Poziom",
|
||||
"dispatchers-history-rate": "Ocena",
|
||||
"dispatchers-history-date": "Data służby",
|
||||
|
||||
"req-level": "ogólnodostępna | minimum {lvl} poziom dyżurnego | minimum {lvl} poziom dyżurnego",
|
||||
"history-list-empty": "Brak historii dla tej scenerii!",
|
||||
|
||||
"forum-topic": "Oficjalny wątek scenerii {name}",
|
||||
|
||||
"pragotron-link": "Paletowa tablica informacyjna (beta)",
|
||||
"tablice-link": "Tablica informacyjna zbiorcza (autorstwa Thundo)"
|
||||
"tablice-link": "Tablica informacyjna zbiorcza (autorstwa Thundo)",
|
||||
|
||||
"bottom-info": "Pokaż pełną historię w zakładce Dziennika"
|
||||
},
|
||||
"availability": {
|
||||
"title": "Dostępność",
|
||||
|
||||
@@ -9,8 +9,10 @@ export default defineComponent({
|
||||
methods: {
|
||||
mountObserver(actionFunction: () => void, target: Element) {
|
||||
this.observer = new IntersectionObserver((entries) => {
|
||||
if (entries[0].intersectionRatio > 0) actionFunction();
|
||||
});
|
||||
console.log(entries);
|
||||
|
||||
if (entries[0].intersectionRatio > 0.5) actionFunction();
|
||||
}, { threshold: 0.2 });
|
||||
|
||||
this.observer.observe(target);
|
||||
},
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
.scenery-table-section {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
table.scenery-history-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
@@ -29,3 +35,12 @@ table.scenery-history-table {
|
||||
font-size: 1.2em;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.bottom-info {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
button {
|
||||
padding: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +194,10 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
handleQueries(query: LocationQuery) {
|
||||
if ('sceneryName' in query) this.searchersValues['search-station'] = `${query.sceneryName}`;
|
||||
if ('dispatcherName' in query) this.searchersValues['search-dispatcher'] = `${query.dispatcherName}`;
|
||||
const queryKeys = Object.keys(query);
|
||||
|
||||
if (queryKeys.includes('sceneryName')) this.setSearchers('', `${query.sceneryName}`, '');
|
||||
if (queryKeys.includes('dispatcherName')) this.setSearchers('', '', `${query.dispatcherName}`);
|
||||
},
|
||||
|
||||
setSearchers(date: string, station: string, dispatcher: string) {
|
||||
|
||||
@@ -190,7 +190,11 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
handleQueries(query: LocationQuery) {
|
||||
if ('timetableId' in query) this.searchersValues['search-train'] = `#${query.timetableId}`;
|
||||
const queryKeys = Object.keys(query);
|
||||
|
||||
if (queryKeys.includes('timetableId')) this.setSearchers('', '', `#${query.timetableId}`, '', '');
|
||||
if (queryKeys.includes('issuedFrom')) this.setSearchers('', '', '', '', `${query.issuedFrom}`);
|
||||
if (queryKeys.includes('authorName')) this.setSearchers('', '', '', `${query.authorName}`, '');
|
||||
},
|
||||
|
||||
setSearchers(date: string, driver: string, train: string, dispatcher: string, issuedFrom: string) {
|
||||
|
||||
@@ -33,12 +33,7 @@
|
||||
</div>
|
||||
|
||||
<keep-alive>
|
||||
<component
|
||||
:is="currentViewCompontent"
|
||||
:station="stationInfo"
|
||||
:timetableOnly="timetableOnly"
|
||||
:key="currentViewCompontent"
|
||||
></component>
|
||||
<component :is="currentViewCompontent" :station="stationInfo" :key="currentViewCompontent"></component>
|
||||
</keep-alive>
|
||||
</div>
|
||||
</div>
|
||||
@@ -172,12 +167,6 @@ button.back-btn {
|
||||
}
|
||||
}
|
||||
|
||||
.scenery-section {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.scenery-wrapper {
|
||||
display: grid;
|
||||
grid-template-columns: 4fr 5fr;
|
||||
@@ -214,14 +203,14 @@ button.back-btn {
|
||||
|
||||
.scenery-right {
|
||||
background: #181818;
|
||||
padding: 2em 0.5em;
|
||||
padding: 1em 0.5em;
|
||||
|
||||
height: 95vh;
|
||||
min-height: 550px;
|
||||
max-height: 1000px;
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
gap: 1em;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user