fix(mongodb): remove duplicate refresh button in document browser (#2696)

This commit is contained in:
LSD 2026-07-06 18:28:42 +08:00 committed by GitHub
parent ce096ca21f
commit 095cb867a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 8 deletions

View File

@ -2,7 +2,7 @@
import { computed, ref, onMounted, onBeforeUnmount } from "vue";
import { uuid } from "@/lib/common/utils";
import { useI18n } from "vue-i18n";
import { RefreshCw, RefreshCcw, Loader2, Trash2, Plus, Save, ChevronLeft, ChevronRight, Table2, Braces, X, Columns3, Check, Search, Wrench, Filter } from "@lucide/vue";
import { RefreshCw, Trash2, Plus, Save, ChevronLeft, ChevronRight, Table2, Braces, X, Columns3, Check, Search, Wrench, Filter } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { Input } from "@/components/ui/input";
@ -1124,13 +1124,6 @@ function resetTableSearchSplitWidth() {
</button>
</div>
</div>
<div class="flex shrink-0 items-center gap-1 border-l px-1">
<Button variant="ghost" size="sm" class="h-5 shrink-0 gap-1 px-1.5 text-xs" :disabled="loading" @click="load">
<Loader2 v-if="loading" class="h-3 w-3 animate-spin" />
<RefreshCcw v-else class="h-3 w-3" />
{{ t("grid.refresh") }}
</Button>
</div>
</template>
</DataGrid>

View File

@ -0,0 +1,19 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import path from "node:path";
import { test } from "vitest";
function searchBarSlotSource(): string {
const source = readFileSync(path.resolve("apps/desktop/src/components/document/DocumentBrowser.vue"), "utf8");
const start = source.indexOf('<template #search-bar');
const end = source.indexOf("\n </DataGrid>", start);
assert.notEqual(start, -1, "expected DocumentBrowser search-bar slot");
assert.notEqual(end, -1, "expected DocumentBrowser DataGrid closing tag");
return source.slice(start, end);
}
test("mongo document result search bar does not render a duplicate refresh button", () => {
const slot = searchBarSlotSource();
assert.equal(slot.includes('{{ t("grid.refresh") }}'), false);
assert.equal(slot.includes("RefreshCcw"), false);
});