2020-07-11 04:13:11 +03:00
|
|
|
<template>
|
2022-07-16 23:33:21 +03:00
|
|
|
<XColumn :menu="menu" :column="column" :is-stacked="isStacked" @parent-focus="$event => emit('parent-focus', $event)">
|
2020-07-11 04:13:11 +03:00
|
|
|
<template #header>
|
2022-12-19 12:01:30 +02:00
|
|
|
<i class="ti ti-antenna"></i><span style="margin-left: 8px;">{{ column.name }}</span>
|
2020-07-11 04:13:11 +03:00
|
|
|
</template>
|
|
|
|
|
2022-03-20 20:11:14 +02:00
|
|
|
<XTimeline v-if="column.antennaId" ref="timeline" src="antenna" :antenna="column.antennaId" @after="() => emit('loaded')"/>
|
2020-10-17 14:12:00 +03:00
|
|
|
</XColumn>
|
2020-07-11 04:13:11 +03:00
|
|
|
</template>
|
|
|
|
|
2022-03-20 20:11:14 +02:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted } from 'vue';
|
2020-07-11 04:13:11 +03:00
|
|
|
import XColumn from './column.vue';
|
2022-07-16 23:33:21 +03:00
|
|
|
import { updateColumn, Column } from './deck-store';
|
2022-08-30 18:24:33 +03:00
|
|
|
import XTimeline from '@/components/MkTimeline.vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import * as os from '@/os';
|
2022-03-20 20:11:14 +02:00
|
|
|
import { i18n } from '@/i18n';
|
2020-07-11 04:13:11 +03:00
|
|
|
|
2022-03-20 20:11:14 +02:00
|
|
|
const props = defineProps<{
|
|
|
|
column: Column;
|
|
|
|
isStacked: boolean;
|
|
|
|
}>();
|
2020-07-11 04:13:11 +03:00
|
|
|
|
2022-03-20 20:11:14 +02:00
|
|
|
const emit = defineEmits<{
|
2022-05-19 11:35:43 +03:00
|
|
|
(ev: 'loaded'): void;
|
|
|
|
(ev: 'parent-focus', direction: 'up' | 'down' | 'left' | 'right'): void;
|
2022-03-20 20:11:14 +02:00
|
|
|
}>();
|
2020-07-11 04:13:11 +03:00
|
|
|
|
2023-01-03 06:37:32 +02:00
|
|
|
let timeline = $shallowRef<InstanceType<typeof XTimeline>>();
|
2020-07-11 04:13:11 +03:00
|
|
|
|
2022-03-20 20:11:14 +02:00
|
|
|
onMounted(() => {
|
|
|
|
if (props.column.antennaId == null) {
|
|
|
|
setAntenna();
|
2020-07-11 04:13:11 +03:00
|
|
|
}
|
|
|
|
});
|
2022-03-20 20:11:14 +02:00
|
|
|
|
|
|
|
async function setAntenna() {
|
|
|
|
const antennas = await os.api('antennas/list');
|
|
|
|
const { canceled, result: antenna } = await os.select({
|
|
|
|
title: i18n.ts.selectAntenna,
|
|
|
|
items: antennas.map(x => ({
|
2022-07-16 23:33:21 +03:00
|
|
|
value: x, text: x.name,
|
2022-03-20 20:11:14 +02:00
|
|
|
})),
|
2022-07-16 23:33:21 +03:00
|
|
|
default: props.column.antennaId,
|
2022-03-20 20:11:14 +02:00
|
|
|
});
|
|
|
|
if (canceled) return;
|
|
|
|
updateColumn(props.column.id, {
|
2022-07-16 23:33:21 +03:00
|
|
|
antennaId: antenna.id,
|
2022-03-20 20:11:14 +02:00
|
|
|
});
|
|
|
|
}
|
2022-07-16 23:33:21 +03:00
|
|
|
|
|
|
|
const menu = [{
|
2022-12-19 12:01:30 +02:00
|
|
|
icon: 'ti ti-pencil',
|
2022-07-16 23:33:21 +03:00
|
|
|
text: i18n.ts.selectAntenna,
|
|
|
|
action: setAntenna,
|
|
|
|
}];
|
|
|
|
|
2022-03-20 20:11:14 +02:00
|
|
|
/*
|
|
|
|
function focus() {
|
|
|
|
timeline.focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
focus,
|
|
|
|
});
|
|
|
|
*/
|
2020-07-11 04:13:11 +03:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 11:29:39 +02:00
|
|
|
<style lang="scss" scoped>
|
2020-07-11 04:13:11 +03:00
|
|
|
</style>
|