mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 05:18:11 +00:00
Dodano godzinę przystąpienia do dyżuru w widoku scenerii
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { URLs } from '@/scripts/utils/apiURLs';
|
||||
import axios from 'axios';
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
@@ -76,7 +77,7 @@ interface HistoryResultAPI {
|
||||
errorMessage?: any;
|
||||
}
|
||||
|
||||
const API_URL = 'https://stacjownik-api-di22o.ondigitalocean.app/api/getSceneryHistory';
|
||||
const API_URL = `${URLs.stacjownikAPI}/api/getSceneryHistory`;
|
||||
|
||||
export default defineComponent({
|
||||
data: () => ({
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
<span class="dispatcher_name">{{ station.onlineInfo.dispatcherName }}</span>
|
||||
</div>
|
||||
|
||||
<span class="status-badge" v-if="station.onlineInfo && onlineFrom > 0">
|
||||
OD {{ new Date(onlineFrom).toLocaleTimeString('pl-PL', { hour: "2-digit", minute: "2-digit" }) }}
|
||||
</span>
|
||||
|
||||
<span class="status-badge" v-if="station.onlineInfo" :class="station.onlineInfo.statusID">
|
||||
{{ $t(`status.${station.onlineInfo.statusID}`) }}
|
||||
{{ station.onlineInfo.statusID == 'online' ? station.onlineInfo.statusTimeString : '' }}
|
||||
@@ -28,6 +32,16 @@ import { defineComponent } from 'vue';
|
||||
import styleMixin from '@/mixins/styleMixin';
|
||||
import Station from '@/scripts/interfaces/Station';
|
||||
import axios from 'axios';
|
||||
import { URLs } from '@/scripts/utils/apiURLs';
|
||||
|
||||
interface SceneryHistoryData {
|
||||
response?: {
|
||||
stationName: string;
|
||||
currentDispatcher: string;
|
||||
currentDispatcherId: number;
|
||||
currentDispatcherFrom: number;
|
||||
};
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
mixins: [styleMixin],
|
||||
@@ -39,13 +53,19 @@ export default defineComponent({
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
// const dispatcherInfo = await axios.get()
|
||||
const dispatcherInfo: SceneryHistoryData = await (
|
||||
await axios.get(`${URLs.stacjownikAPI}/api/getSceneryHistory?name=${this.station.name.replace(/ /g, '_')}&historyCount=0`)
|
||||
).data;
|
||||
|
||||
this.onlineFrom = dispatcherInfo.response?.currentDispatcherFrom || -1;
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
icons: {
|
||||
spawn: require('@/assets/icon-spawn.svg'),
|
||||
},
|
||||
|
||||
onlineFrom: -1
|
||||
}),
|
||||
});
|
||||
</script>
|
||||
@@ -56,6 +76,8 @@ export default defineComponent({
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
flex-wrap: wrap;
|
||||
|
||||
.dispatcher {
|
||||
font-size: 2em;
|
||||
|
||||
@@ -79,6 +101,7 @@ export default defineComponent({
|
||||
|
||||
.status-badge {
|
||||
font-size: 1.2em;
|
||||
margin: 0.5em 0.25em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user