Files
dougal-software/lib/www/client/source/src/views/LineList.vue

156 lines
3.2 KiB
Vue
Raw Normal View History

2020-08-08 23:59:13 +02:00
<template>
<v-container fluid>
2020-09-30 20:04:35 +02:00
<v-card>
<v-card-title>
<v-toolbar flat>
<v-toolbar-title>Sequences</v-toolbar-title>
<v-spacer></v-spacer>
<v-text-field
v-model="filter"
append-icon="mdi-magnify"
label="Filter"
single-line
clearable
></v-text-field>
</v-toolbar>
</v-card-title>
<v-card-text>
<v-data-table
:headers="headers"
:items="items"
:search="filter"
:loading="loading"
:fixed-header="true"
:item-class="(item) => activeItem == item ? 'blue accent-1 elevation-3' : ''"
@click:row="setActiveItem"
>
2020-09-30 20:04:35 +02:00
<template v-slot:item.status="{item}">
<dougal-line-status
:preplot="item"
:sequences="sequences.filter(s => s.line == item.line)"
:sequence-href="(s) => `/projects/${$route.params.project}/log/sequence/${s.sequence}`"
>
</dougal-line-status>
</template>
<template v-slot:item.length="props">
<span>{{ Math.round(props.value) }} m</span>
</template>
<template v-slot:item.azimuth="props">
<span>{{ props.value.toFixed(1) }} °</span>
</template>
</v-data-table>
</v-card-text>
</v-card>
2020-08-08 23:59:13 +02:00
</v-container>
</template>
<script>
import { mapActions, mapGetters } from 'vuex';
import DougalLineStatus from '@/components/line-status';
2020-08-08 23:59:13 +02:00
export default {
name: "LineList",
components: {
DougalLineStatus
},
2020-08-08 23:59:13 +02:00
data () {
return {
headers: [
{
value: "line",
text: "Line"
},
{
value: "status",
text: "Status"
},
{
value: "fsp",
text: "FSP",
align: "end"
},
{
value: "lsp",
text: "LSP",
align: "end"
},
{
value: "num_points",
text: "Num. points",
align: "end"
},
{
value: "length",
text: "Length",
align: "end"
},
{
value: "azimuth",
text: "Azimuth",
align: "end"
},
{
value: "remarks",
text: "Remarks"
}
],
items: [],
num_lines: null,
sequences: [],
activeItem: null,
2020-09-30 20:04:35 +02:00
filter: null
2020-08-08 23:59:13 +02:00
}
},
computed: {
...mapGetters(['loading'])
},
2020-08-08 23:59:13 +02:00
methods: {
async getNumLines () {
const projectInfo = await this.api([`/project/${this.$route.params.project}`]);
this.num_lines = projectInfo.lines;
},
async getLines () {
2020-09-30 20:04:35 +02:00
const url = `/project/${this.$route.params.project}/line`;
2020-08-08 23:59:13 +02:00
this.items = await this.api([url]) || [];
},
async getSequences () {
const url = `/project/${this.$route.params.project}/sequence`;
this.sequences = await this.api([url]) || [];
},
2020-08-08 23:59:13 +02:00
setActiveItem (item) {
this.activeItem = this.activeItem == item
? null
: item;
},
2020-08-08 23:59:13 +02:00
...mapActions(["api"])
},
mounted () {
this.getLines();
this.getNumLines();
this.getSequences();
2020-08-08 23:59:13 +02:00
}
}
</script>