Skip to content

Commit

Permalink
add links to previous and next runs
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Oct 13, 2022
1 parent cd53b6f commit 3ce7227
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions src/views/RunView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,33 @@ function readNodes(query: Query) {
}
const nodes = computed(() => readNodes(query));
const run = computed(() => nodes.value.find((n) => n.runNo === runNo));
const index = computed(() => nodes.value.findIndex((n) => n.runNo === runNo));
const run = computed(() => nodes.value[index.value]);
const toPrev = computed(() => {
const prevIndex = index.value - 1;
if (prevIndex < 0) return;
return { name: "run", params: { runNo: nodes.value[prevIndex].runNo } };
});
const toNext = computed(() => {
const nextIndex = index.value + 1;
if (nextIndex >= nodes.value.length) return;
return { name: "run", params: { runNo: nodes.value[nextIndex].runNo } };
});
</script>

<template>
<div class="g-container">
<v-breadcrumbs :items="breadcrumb" class="g-breadcrumbs"> </v-breadcrumbs>
<div class="g-navi">
<v-breadcrumbs :items="breadcrumb"> </v-breadcrumbs>
<span class="pr-6">
<v-btn icon :disabled="!toPrev" :to="toPrev">
<v-icon> mdi-arrow-left-bold </v-icon>
</v-btn>
<v-btn icon :disabled="!toNext" :to="toNext">
<v-icon> mdi-arrow-right-bold </v-icon>
</v-btn>
</span>
</div>
<run-card v-if="run" class="g-card" :run="run"></run-card>
</div>
</template>
Expand All @@ -48,11 +69,14 @@ const run = computed(() => nodes.value.find((n) => n.runNo === runNo));
justify-content: center;
grid-template-columns: minmax(min-content, 80%);
grid-template-rows: min-content 1fr;
grid-template-areas: "breadcrumbs" "card";
grid-template-areas: "navi" "card";
}
.g-breadcrumbs {
grid-area: breadcrumbs;
.g-navi {
grid-area: navi;
display: flex;
justify-content: space-between;
align-items: center;
}
.g-card {
Expand Down

0 comments on commit 3ce7227

Please sign in to comment.