improve(updates): hide client tab when no component updates
This commit is contained in:
2 files changed
+22
-2
No files matched your search
@@ -380,6 +380,26 @@ describe("UpdateDialog release notes safety", () => {
|
||||
});
|
||||
|
||||
describe("UpdateDialog aggregate update center", () => {
|
||||
it("hides the tab bar when no updates are available", async () => {
|
||||
await mountDialog(0, {}, undefined, {
|
||||
updateInfo: {
|
||||
current_version: "0.5.60",
|
||||
latest_version: "0.5.60",
|
||||
update_available: false,
|
||||
portable_mode: false,
|
||||
manual_update_only: false,
|
||||
release_name: "",
|
||||
release_url: "",
|
||||
release_notes: "",
|
||||
},
|
||||
updateCheckMessage: "DBX is up to date (0.5.60).",
|
||||
});
|
||||
|
||||
expect(document.body.querySelector('[role="tablist"]')).toBeNull();
|
||||
expect(document.body.querySelector('[data-update-tab="app"]')).toBeNull();
|
||||
expect(document.body.textContent).toContain("DBX is up to date (0.5.60).");
|
||||
});
|
||||
|
||||
it("keeps the client restart gated while update all is still updating components", async () => {
|
||||
await mountDialog(0, { updateDownloaded: true, downloadProgress: 100 }, undefined, { isUpdatingAll: true });
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ const tabs = computed(() => {
|
||||
if (props.jdbcUpdate?.update_available) available.push({ id: "jdbc", label: t("settings.updateJdbc"), count: 1 });
|
||||
if (mcpAvailable.value) available.push({ id: "mcp", label: t("settings.updateMcp"), count: 1 });
|
||||
if (props.pluginUpdates.length) available.push({ id: "plugins", label: t("settings.updatePlugins"), count: props.pluginUpdates.length });
|
||||
return available.length ? available : [{ id: "app" as const, label: t("settings.updateClient"), count: 0 }];
|
||||
return available;
|
||||
});
|
||||
const totalUpdateCount = computed(() => tabs.value.reduce((total, tab) => total + tab.count, 0));
|
||||
const hasComponentUpdates = computed(() => props.driverUpdates.length > 0 || props.jdbcUpdate?.update_available === true || mcpAvailable.value || props.pluginUpdates.length > 0);
|
||||
@@ -193,7 +193,7 @@ watch(
|
||||
</DialogHeader>
|
||||
|
||||
<div class="flex min-h-0 flex-1 flex-col">
|
||||
<div class="border-b px-4 py-2">
|
||||
<div v-if="tabs.length" class="border-b px-4 py-2">
|
||||
<div role="tablist" :aria-label="t('updates.centerTitle')" class="inline-flex h-9 w-full items-center justify-center rounded-md bg-muted p-[3px] text-muted-foreground">
|
||||
<button
|
||||
v-for="tab in tabs"
|
||||
|
||||
Reference in new issue
Block a user