All files / apps/developer-portal/layers/decisions/app/components DecisionsToolbar.vue

100% Statements 21/21
100% Branches 8/8
100% Functions 12/12
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64  13x     3x         14x   1x             1x               14x                           8x 8x 8x 8x   8x   8x 8x 24x       8x 8x 16x       8x 32x      
<template>
    <UDashboardToolbar>
        <template #left>
            <UInput
                v-model="search"
                icon="i-lucide-search"
                :placeholder="$t('decisionsToolbar.search')"
                size="sm"
                class="w-56"
            />
            <USelect
                v-model="status"
                :items="statusItems"
                value-key="value"
                size="sm"
                class="w-40"
            />
            <USelect
                v-model="decision"
                :items="outcomeItems"
                value-key="value"
                size="sm"
                class="w-40"
            />
        </template>
        <template #right>
            <USelect v-model="sort" :items="sortItems" value-key="value" size="sm" class="w-44" />
        </template>
    </UDashboardToolbar>
</template>
 
<script setup lang="ts">
import { DECISION_SORTS, type DecisionSort } from "#layers/decisions/shared/decisionReports.ts";
import {
    DECISION_OUTCOMES,
    DECISION_STATUSES,
    type DecisionOutcome,
    type DecisionStatus,
} from "#layers/snapshot/shared/decisions.ts";
 
const search = defineModel<string>("search", { required: true });
const status = defineModel<DecisionStatus | "all">("status", { required: true });
const decision = defineModel<DecisionOutcome | "all">("decision", { required: true });
const sort = defineModel<DecisionSort>("sort", { required: true });
 
const { t } = useI18n();
 
const statusItems = computed(() =>
    filterItems(t("decisionsToolbar.everyStatus"), DECISION_STATUSES, (value) =>
        t(`decisions.status.${value}`),
    ),
);
 
const outcomeItems = computed(() =>
    filterItems(t("decisionsToolbar.everyDecision"), DECISION_OUTCOMES, (value) =>
        t(`decisions.outcome.${value}`),
    ),
);
 
const sortItems = computed(() =>
    DECISION_SORTS.map((value) => ({ label: t(`decisionsToolbar.sorts.${value}`), value })),
);
</script>