diff --git a/src/components/JournalView/JournalDispatchers.vue b/src/components/JournalView/JournalDispatchers.vue index 61012e2..a479803 100644 --- a/src/components/JournalView/JournalDispatchers.vue +++ b/src/components/JournalView/JournalDispatchers.vue @@ -100,7 +100,7 @@ import JournalOptions from '@/components/JournalView/JournalOptions.vue'; import { URLs } from '@/scripts/utils/apiURLs'; -const PROD_MODE = process.env.VUE_APP_JORUNAL_DISPATCHERS_DEV != "1" || process.env.NODE_ENV === 'production'; +const PROD_MODE = process.env.VUE_APP_JORUNAL_DISPATCHERS_DEV != '1' || process.env.NODE_ENV === 'production'; const DISPATCHERS_API_URL = (PROD_MODE ? `${URLs.stacjownikAPI}/api` : 'http://localhost:3001/api') + '/getDispatchers'; @@ -132,6 +132,13 @@ export default defineComponent({ components: { SearchBox, ActionButton, JournalOptions }, mixins: [dateMixin], + props: { + searchedSceneryName: { + type: String, + required: false, + }, + }, + data: () => ({ icons: { loading: require('@/assets/icon-loading.svg'), @@ -153,7 +160,10 @@ export default defineComponent({ const sorterActive = ref({ id: 'timestampFrom', dir: -1 }); const journalFilterActive = ref({}); - const searchersValues = reactive([{ id: 'search-dispatcher', value: '' }, { id: 'search-station', value: '' }]) + const searchersValues = reactive([ + { id: 'search-dispatcher', value: '' }, + { id: 'search-station', value: '' }, + ]); const countFromIndex = ref(0); const countLimit = 15; @@ -197,10 +207,15 @@ export default defineComponent({ activated() { window.addEventListener('scroll', this.handleScroll); + + if (this.searchedSceneryName) { + this.searchersValues[1].value = this.searchedSceneryName; + this.search(); + } }, deactivated() { - window.removeEventListener('scroll', this.handleScroll); + window.removeEventListener('scroll', this.handleScroll); }, methods: { @@ -248,7 +263,7 @@ export default defineComponent({ search() { this.fetchHistoryData({ - searchers: this.searchersValues + searchers: this.searchersValues, }); this.scrollNoMoreData = false; @@ -287,7 +302,7 @@ export default defineComponent({ const dispatcher = props.searchers?.find((s) => s.id == 'search-dispatcher')?.value.trim(); const station = props.searchers?.find((s) => s.id == 'search-station')?.value.trim(); - + if (dispatcher) queries.push(`dispatcherName=${dispatcher}`); if (station) queries.push(`stationName=${station}`); @@ -301,7 +316,9 @@ export default defineComponent({ this.currentQuery = queries.join('&'); try { - const responseData: APIResponse | null = await (await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`)).data; + const responseData: APIResponse | null = await ( + await axios.get(`${DISPATCHERS_API_URL}?${this.currentQuery}`) + ).data; if (!responseData) { this.historyDataStatus.status = DataStatus.Error; diff --git a/src/components/TrainsView/TrainInfo.vue b/src/components/TrainsView/TrainInfo.vue index 099c4b0..00bb9c3 100644 --- a/src/components/TrainsView/TrainInfo.vue +++ b/src/components/TrainsView/TrainInfo.vue @@ -43,13 +43,18 @@
@@ -203,6 +203,7 @@ ul.stock-list { color: #aaa; font-size: 0.9em; } + } .schedule-wrapper { diff --git a/src/views/JournalView.vue b/src/views/JournalView.vue index ec7e879..d1cdb59 100644 --- a/src/views/JournalView.vue +++ b/src/views/JournalView.vue @@ -21,7 +21,7 @@