rework reaktywności danych z API i WS

This commit is contained in:
2023-10-30 23:19:17 +01:00
parent 12ece46089
commit 8de03b9210
24 changed files with 501 additions and 446 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
<template>
<label @dblclick="handleDbClick">
<input
:value="optionValue"
@input="$emit('update:optionValue', ($event.target as HTMLInputElement).value)"
:checked="optionValue"
@input="$emit('update:optionValue', ($event.target as HTMLInputElement).checked)"
type="checkbox"
:class="option.section"
:name="option.id"
+23 -8
View File
@@ -79,11 +79,19 @@
</span>
<span v-else-if="station.generalInfo.availability == 'abandoned'">
<img src="/images/icon-abandoned.svg" alt="non-public" :title="$t('desc.abandoned')" />
<img
src="/images/icon-abandoned.svg"
alt="non-public"
:title="$t('desc.abandoned')"
/>
</span>
<span v-else-if="station.generalInfo.availability == 'nonPublic'">
<img src="/images/icon-lock.svg" alt="non-public" :title="$t('desc.non-public')" />
<img
src="/images/icon-lock.svg"
alt="non-public"
:title="$t('desc.non-public')"
/>
</span>
<span v-else>
@@ -234,7 +242,7 @@
</td>
<td
class="station_schedules"
class="station_schedules all"
style="width: 30px"
:class="{ inactive: !station.onlineInfo }"
>
@@ -244,20 +252,23 @@
</td>
<td
class="station_schedules"
class="station_schedules unconfirmed"
style="width: 30px"
:class="{ inactive: !station.onlineInfo }"
>
<span style="color: #ccc">
{{
station.onlineInfo?.scheduledTrains?.filter((train) => !train.stopInfo.confirmed)
.length || 0
new Set([
...(station.onlineInfo?.scheduledTrains
?.filter((train) => !train.stopInfo.confirmed)
.map((train) => train.checkpointName) || [])
]).size || 0
}}
</span>
</td>
<td
class="station_schedules"
class="station_schedules confirmed"
style="width: 30px"
:class="{ inactive: !station.onlineInfo }"
>
@@ -336,9 +347,13 @@ export default defineComponent({
if (!station) return;
this.lastSelectedStationName = station.name;
this.$router.push({
name: 'SceneryView',
query: { station: station.name.replaceAll(' ', '_') }
query: {
station: station.name.replaceAll(' ', '_'),
region: this.$route.query.region || undefined
}
});
},