Skip to content

Commit 5bb5c56

Browse files
committed
file-tree: define styled Select widget as DropDownSimple
1 parent 052e673 commit 5bb5c56

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<script lang="ts" setup>
2+
const { tag, options } = defineProps<{
3+
tag: string,
4+
options: string[],
5+
}>();
6+
7+
const selected = defineModel<string | null>({ default: null });
8+
</script>
9+
10+
<template>
11+
<span class="input">{{ tag }}:</span>
12+
<span class="select">
13+
<Select v-model="selected" filter :options="options" />
14+
</span>
15+
</template>
16+
17+
<style scoped>
18+
.input {
19+
font-size: 14.5px;
20+
font-weight: bold;
21+
padding-right: 10px;
22+
color: var(--p-button-primary-background);
23+
}
24+
25+
.select {
26+
padding-right: 10px;
27+
}
28+
</style>

os-checks/pages/file-tree.vue

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,9 @@
33

44
<div v-if="displayFilters">
55
<div style="padding: 6px 8px 6px 8px">
6-
<span class="input">User:</span>
7-
<span class="select">
8-
<Select v-model="selected.user" filter :options="users" :optionLabel="label" />
9-
</span>
10-
11-
<span class="input">Repo:</span>
12-
<span class="select">
13-
<Select v-model="selected.repo" filter :options="repos" :optionLabel="label" />
14-
</span>
15-
6+
<DropDownSimple v-model="selected.user" tag="User" :options="users" />
7+
<DropDownSimple v-model="selected.repo" tag="Repo" :options="repos" />
168
<DropDownWithCount v-model="selected.target" tag="Target" :all="ALL_TARGETS" :counts="targets" />
17-
189
</div>
1910

2011
<div style="padding: 2px 8px 10px 8px">
@@ -48,8 +39,8 @@ highlightRust();
4839
const label = (a: string) => a;
4940
5041
const selected = reactive<{
51-
user: string,
52-
repo: string,
42+
user: string | null,
43+
repo: string | null,
5344
target: string | null,
5445
pkg: string | null,
5546
features: string | null,
@@ -79,7 +70,7 @@ githubFetch<UserRepo>({ path: "ui/user_repo.json" })
7970
8071
// Init filters.
8172
const users = computed(() => Object.keys(user_repo.value).sort());
82-
const repos = computed(() => user_repo.value[selected.user]);
73+
const repos = computed(() => selected.user ? user_repo.value[selected.user] : []);
8374
const targets = computed<DropDownOptions>(() => {
8475
const t = basic.value?.targets;
8576
return t ? gen_targets(t) : emptyOptions();

0 commit comments

Comments
 (0)