Make preplot lines list searchable

This commit is contained in:
D. Berge
2020-09-30 20:04:35 +02:00
parent d2c65b480b
commit 60000eeaf1

View File

@@ -1,32 +1,50 @@
<template>
<v-container fluid>
<v-data-table
:headers="headers"
:items="items"
:server-items-length="num_lines"
:options.sync="options"
:loading="loading"
:fixed-header="true"
>
<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}`"
<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"
>
</dougal-line-status>
</template>
<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.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>
<template v-slot:item.azimuth="props">
<span>{{ props.value.toFixed(1) }} °</span>
</template>
</v-data-table>
</v-card-text>
</v-card>
</v-container>
</template>
@@ -84,18 +102,9 @@ export default {
}
],
items: [],
options: {},
num_lines: null,
sequences: [],
}
},
watch: {
options: {
handler () {
this.getLines();
},
deep: true
filter: null
}
},
@@ -112,11 +121,7 @@ export default {
async getLines () {
const query = new URLSearchParams(this.options);
if (this.options.itemsPerPage < 0) {
query.delete("itemsPerPage");
}
const url = `/project/${this.$route.params.project}/line?${query.toString()}`;
const url = `/project/${this.$route.params.project}/line`;
this.items = await this.api([url]) || [];