Skip to content

Commit

Permalink
Make package status filter a component
Browse files Browse the repository at this point in the history
  • Loading branch information
djjuhasz committed Oct 24, 2024
1 parent 0c4df2c commit d851b76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
26 changes: 26 additions & 0 deletions dashboard/src/components/PackageListFilters.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { usePackageStore } from "@/stores/package";
import { PackageListStatusEnum } from "@/openapi-generator";
const packageStore = usePackageStore();
</script>

<template>
<div class="d-flex flex-wrap gap-3 mb-3 p-3 border bg-light">
<h3 class="mb-0 pe-3 border-end">Filters</h3>
<div class="d-flex gap-2">
<label for="filter-status" class="align-self-center">Status</label>
<select
id="filter-status"
v-model="packageStore.filters.status"
@change="packageStore.fetchPackages(1)"
class="form-select"
>
<option value="">any</option>
<option v-for="item of PackageListStatusEnum" :value="item">
{{ item }}
</option>
</select>
</div>
</div>
</template>
22 changes: 3 additions & 19 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 { PackageListStatusEnum } from "@/openapi-generator";
import PackageListFilters from "@/components/PackageListFilters.vue";
import PackageListLegend from "@/components/PackageListLegend.vue";
import PageLoadingAlert from "@/components/PageLoadingAlert.vue";
import StatusBadge from "@/components/StatusBadge.vue";
Expand Down Expand Up @@ -53,26 +53,10 @@ const toggleLegend = () => {
{{ packageStore.page.total }}
</div>

<div class="d-flex flex-wrap gap-3 mb-3 p-3 border bg-light">
<h3 class="mb-0 pe-3 border-end">Filters</h3>
<div class="d-flex gap-2">
<label for="filter-status" class="align-self-center">Status</label>
<select
id="filter-status"
v-model="packageStore.filters.status"
@change="packageStore.fetchPackages(1)"
class="form-select"
>
<option value="">any</option>
<option v-for="item of PackageListStatusEnum" :value="item">
{{ item }}
</option>
</select>
</div>
</div>

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

<div class="table-responsive mb-3">
<table class="table table-bordered mb-0">
<thead>
Expand Down

0 comments on commit d851b76

Please sign in to comment.