All files / apps/developer-portal/layers/benchmarks/app/components BenchmarksToolbar.vue

78.57% Statements 11/14
100% Branches 6/6
57.14% Functions 4/7
78.57% Lines 11/14

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  4x               4x                                               4x 4x 4x   4x   4x 4x 12x       4x 4x      
<template>
    <UDashboardToolbar>
        <template #left>
            <UInput
                v-model="search"
                icon="i-lucide-search"
                :placeholder="$t('benchmarksToolbar.search')"
                size="sm"
                class="w-56"
            />
            <USelect
                v-model="verdict"
                :items="verdictItems"
                value-key="value"
                size="sm"
                class="w-44"
            />
            <USelect v-model="kind" :items="kindItems" value-key="value" size="sm" class="w-40" />
        </template>
    </UDashboardToolbar>
</template>
 
<script setup lang="ts">
import { BENCHMARK_VERDICTS } from "#layers/benchmarks/app/utils/benchmarks.ts";
import type { BenchmarkVerdict } from "#layers/benchmarks/app/types/BenchmarkVerdict.ts";
 
interface Props {
    /** Every kind of site in the library, to filter by. */
    kinds: string[];
}
 
const { kinds } = defineProps<Props>();
 
const search = defineModel<string>("search", { required: true });
const verdict = defineModel<BenchmarkVerdict | "all">("verdict", { required: true });
const kind = defineModel<string>("kind", { required: true });
 
const { t } = useI18n();
 
const verdictItems = computed(() =>
    filterItems(t("benchmarksToolbar.everyVerdict"), BENCHMARK_VERDICTS, (value) =>
        t(`benchmarks.verdict.${value}`),
    ),
);
 
const kindItems = computed(() =>
    filterItems(t("benchmarksToolbar.everyKind"), kinds, benchmarkKindLabel),
);
</script>