Skip to content

Commit

Permalink
Use tabs to filter the package list by status
Browse files Browse the repository at this point in the history
Refs #989
  • Loading branch information
djjuhasz committed Oct 24, 2024
1 parent d851b76 commit 5f553a9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
49 changes: 49 additions & 0 deletions dashboard/src/components/PackageListTabFilters.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
import { usePackageStore } from "@/stores/package";
import { PackageListStatusEnum } from "@/openapi-generator";
const packageStore = usePackageStore();
class tab {
value: string;
label: string;
constructor(v: string, l: string) {
this.value = v;
this.label = l;
}
}
const tabs = [
new tab("", "All"),
new tab("done", "Done"),
new tab("error", "Error"),
new tab("in progress", "In progress"),
new tab("queued", "Queued"),
];
function changeStatusFilter(s: string) {
if (s == packageStore.filters.status) {
return;
}
packageStore.filters.status = s as PackageListStatusEnum;
packageStore.fetchPackages(1);
}
</script>

<template>
<ul class="nav nav-tabs">
<li v-for="tab in tabs">
<a
:class="[
'nav-link',
packageStore.filters.status == tab.value ? 'active' : '',
]"
:aria-current="packageStore.filters.status == tab.value"
href="#"
@click="changeStatusFilter(tab.value)"
>{{ tab.label }}</a
>
</li>
</ul>
</template>
4 changes: 2 additions & 2 deletions dashboard/src/pages/packages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import PackageListFilters from "@/components/PackageListFilters.vue";
import PackageListTabFilters from "@/components/PackageListTabFilters.vue";
import PackageListLegend from "@/components/PackageListLegend.vue";
import PageLoadingAlert from "@/components/PageLoadingAlert.vue";
import StatusBadge from "@/components/StatusBadge.vue";
Expand Down Expand Up @@ -53,7 +53,7 @@ const toggleLegend = () => {
{{ packageStore.page.total }}
</div>

<PackageListFilters />
<PackageListTabFilters />
<PageLoadingAlert :execute="execute" :error="error" />
<PackageListLegend v-model="showLegend" />

Expand Down

0 comments on commit 5f553a9

Please sign in to comment.