feat: add select-filtered button for visible databases search

This commit is contained in:
t8y2 2026-06-12 01:10:53 +08:00
parent 19b5b70fb7
commit cded066fdf
3 changed files with 11 additions and 0 deletions

View File

@ -101,10 +101,16 @@ function toggleDatabase(database: string) {
selectedNames.value = next;
}
const isSearching = computed(() => searchText.value.trim().length > 0);
function selectAll() {
selectedNames.value = new Set(listedDatabaseNames.value);
}
function selectFiltered() {
selectedNames.value = new Set(filteredDatabaseNames.value);
}
function clearSelection() {
selectedNames.value = new Set();
}
@ -142,6 +148,9 @@ async function saveSelection() {
<button class="hover:text-foreground disabled:opacity-50" :disabled="isLoading" @click="selectAll">
{{ t("visibleDatabases.selectAll") }}
</button>
<button v-if="isSearching" class="hover:text-foreground disabled:opacity-50" :disabled="isLoading" @click="selectFiltered">
{{ t("visibleDatabases.selectFiltered") }}
</button>
<button class="hover:text-foreground disabled:opacity-50" :disabled="isLoading" @click="clearSelection">
{{ t("visibleDatabases.clear") }}
</button>

View File

@ -1161,6 +1161,7 @@
searchPlaceholder: "Search databases...",
selectedCount: "{selected}/{total} selected",
selectAll: "Select all",
selectFiltered: "Select search results",
clear: "Clear",
showAll: "Show all",
showSystemDatabases: "Show system databases",

View File

@ -1160,6 +1160,7 @@
searchPlaceholder: "搜索数据库...",
selectedCount: "已选择 {selected}/{total}",
selectAll: "全选",
selectFiltered: "选中搜索结果",
clear: "清空",
showAll: "显示全部",
showSystemDatabases: "显示系统库",