2020-08-08 23:59:13 +02:00
|
|
|
<template>
|
|
|
|
|
<v-container fluid>
|
|
|
|
|
<v-data-table
|
|
|
|
|
:headers="headers"
|
|
|
|
|
:items="items"
|
|
|
|
|
:options.sync="options"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
>
|
|
|
|
|
|
2020-08-26 20:19:59 +02:00
|
|
|
<template v-slot:item.pid="{item, value}">
|
|
|
|
|
<a :href="`/projects/${item.pid}`">{{value}}</a>
|
2020-08-08 23:59:13 +02:00
|
|
|
</template>
|
|
|
|
|
|
2020-08-26 20:19:59 +02:00
|
|
|
<template v-slot:item.shots="{item}">
|
|
|
|
|
{{ item.total ? (item.prime + item.other) : "" }}
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:item.progress="{item}">
|
|
|
|
|
{{
|
|
|
|
|
item.total
|
|
|
|
|
? ((1 - (item.remaining / item.total))*100).toFixed(1)+"%"
|
|
|
|
|
: ""
|
|
|
|
|
}}
|
|
|
|
|
<v-progress-linear v-if="item.total"
|
2020-08-08 23:59:13 +02:00
|
|
|
height="2"
|
2020-08-26 20:19:59 +02:00
|
|
|
:value="((1 - (item.remaining / item.total))*100)"
|
2020-08-08 23:59:13 +02:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</v-data-table>
|
|
|
|
|
|
|
|
|
|
</v-container>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
td p:last-of-type {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
2020-08-26 17:48:55 +02:00
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
2020-08-08 23:59:13 +02:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "ProjectList",
|
|
|
|
|
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
headers: [
|
|
|
|
|
{
|
|
|
|
|
value: "pid",
|
|
|
|
|
text: "Project ID"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "name",
|
|
|
|
|
text: "Name"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "lines",
|
|
|
|
|
text: "Lines"
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-08-26 20:19:59 +02:00
|
|
|
value: "seq_final",
|
2020-08-08 23:59:13 +02:00
|
|
|
text: "Sequences"
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-08-26 20:19:59 +02:00
|
|
|
value: "total",
|
|
|
|
|
text: "Preplot points"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "shots",
|
|
|
|
|
text: "Shots acquired"
|
2020-08-08 23:59:13 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: "progress",
|
|
|
|
|
text: "% Complete"
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
items: [],
|
|
|
|
|
options: {},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2020-08-26 17:48:55 +02:00
|
|
|
computed: {
|
|
|
|
|
...mapGetters(['loading'])
|
|
|
|
|
},
|
|
|
|
|
|
2020-08-08 23:59:13 +02:00
|
|
|
methods: {
|
|
|
|
|
async list () {
|
|
|
|
|
this.items = await this.api(["/project/"]) || [];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async summary (item) {
|
|
|
|
|
const details = await this.api([`/project/${item.pid}/summary`]);
|
|
|
|
|
if (details) {
|
|
|
|
|
return Object.assign({}, details, item);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async load () {
|
|
|
|
|
await this.list();
|
|
|
|
|
const promises = [];
|
|
|
|
|
for (const key in this.items) {
|
|
|
|
|
const item = this.items[key];
|
|
|
|
|
const promise = this.summary(item)
|
|
|
|
|
.then( expanded => {
|
|
|
|
|
if (expanded) {
|
|
|
|
|
this.$set(this.items, key, expanded);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
promises.push(promise);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
...mapActions(["api"])
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mounted () {
|
|
|
|
|
this.load();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|