Don't try to show QC graphs on a new project.

If there are no sequences, just show a message to the effect.

Fixes #196.
This commit is contained in:
D. Berge
2022-04-26 17:39:59 +02:00
parent 68322ef562
commit c0ec8298fa

View File

@@ -98,7 +98,7 @@
-->
</v-toolbar>
<v-container>
<v-container v-if="sequences.length">
<v-row v-for="(item, idx) in visibleItems" :key="idx">
<v-col>
<component
@@ -110,6 +110,9 @@
</v-col>
</v-row>
</v-container>
<v-card-text class="text-center" v-else>
This project has no sequences.
</v-card-text>
</v-card>
</template>
@@ -299,33 +302,37 @@ export default {
if (!vm.sequences.length) {
vm.sequences = await vm.api([`/project/${vm.$route.params.project}/sequence`]);
}
vm.$router.push({name: "graphsBySequence", params: {
project: vm.$route.params.project,
sequence: vm.sequences[0]?.sequence
}});
if (vm.sequences.length) { // Check that the project has at least one sequence
vm.$router.push({name: "graphsBySequence", params: {
project: vm.$route.params.project,
sequence: vm.sequences[0]?.sequence
}});
}
}
console.log("beforeRouteEnter exit");
});
},
async mounted () {
console.log("Graphs mounted");
this.sequences = await this.api([`/project/${this.$route.params.project}/sequence`]);
if (!this.$route.params.sequence) {
this.$router.push({name: "graphsBySequence", params: {
project: this.$route.params.project,
sequence: this.sequences[0]?.sequence
}});
}
const url = `/project/${this.$route.params.project}/sequence/${this.$route.params.sequence}?project=sequence,point,tstamp,geometrypreplot,errorraw,errorfinal,meta&path=$.raw.smsrc`;
this.data = Object.freeze(await this.api([url]));
if (this.sequences && this.sequences.length) {
if (!this.$route.params.sequence) {
this.$router.push({name: "graphsBySequence", params: {
project: this.$route.params.project,
sequence: this.sequences[0]?.sequence
}});
}
const url = `/project/${this.$route.params.project}/sequence/${this.$route.params.sequence}?project=sequence,point,tstamp,geometrypreplot,errorraw,errorfinal,meta&path=$.raw.smsrc`;
this.data = Object.freeze(await this.api([url]));
}
console.log("Mount finished");
}
}
</script>