feat(updates): use compact one-line lists and underline tabs in update center

This commit is contained in:
t8y2 committed 2026-09-25 16:12:15 +08:00
1 parent 94a8fd6790
commit 0fbdd86ac3
4 files changed
+44 -32

No files matched your search

+1 -1
View File
@@ -686,7 +686,7 @@ describe("UpdateDialog aggregate update center", () => {
// "Update all" skips the changed-source plugin, so the dialog has to explain why it stays. // "Update all" skips the changed-source plugin, so the dialog has to explain why it stays.
const hint = "Confirm the change in the Plugin Center first"; const hint = "Confirm the change in the Plugin Center first";
const rows = [...document.body.querySelectorAll<HTMLElement>(".rounded-md.border.p-3")]; const rows = [...document.body.querySelectorAll<HTMLElement>("[data-update-entry]")];
const rowFor = (name: string) => rows.find((row) => row.textContent?.includes(name)); const rowFor = (name: string) => rows.find((row) => row.textContent?.includes(name));
expect(rowFor("moved plugin")?.textContent).toContain(hint); expect(rowFor("moved plugin")?.textContent).toContain(hint);
expect(rowFor("same plugin")?.textContent).not.toContain(hint); expect(rowFor("same plugin")?.textContent).not.toContain(hint);
@@ -298,8 +298,8 @@ watch(
</DialogHeader> </DialogHeader>
<div class="flex min-h-0 flex-1 flex-col"> <div class="flex min-h-0 flex-1 flex-col">
<div v-if="tabs.length" class="border-b px-4 py-2"> <div v-if="tabs.length" class="px-5 pb-2.5 pt-1.5">
<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"> <div role="tablist" :aria-label="t('updates.centerTitle')" class="inline-flex h-9 w-full items-center gap-1">
<button <button
v-for="tab in tabs" v-for="tab in tabs"
:key="tab.id" :key="tab.id"
@@ -308,8 +308,8 @@ watch(
:aria-selected="selectedTab === tab.id" :aria-selected="selectedTab === tab.id"
:data-state="selectedTab === tab.id ? 'active' : 'inactive'" :data-state="selectedTab === tab.id ? 'active' : 'inactive'"
:data-update-tab="tab.id" :data-update-tab="tab.id"
class="relative inline-flex h-full flex-1 select-none items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 text-sm font-medium transition-colors hover:text-foreground focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50" class="relative inline-flex h-full select-none items-center gap-1.5 whitespace-nowrap px-2.5 text-sm font-medium transition-colors after:absolute after:inset-x-2.5 after:bottom-0 after:h-0.5 after:rounded-full after:bg-foreground after:opacity-0 after:transition-opacity hover:text-foreground focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50"
:class="selectedTab === tab.id ? 'bg-background text-foreground shadow-sm' : 'text-foreground/60'" :class="selectedTab === tab.id ? 'text-foreground after:opacity-100' : 'text-foreground/60'"
@click="selectTab(tab.id)" @click="selectTab(tab.id)"
> >
<span>{{ tab.label }}</span> <span>{{ tab.label }}</span>
@@ -376,12 +376,14 @@ watch(
{{ t("updates.historyLoadFailed") }} {{ t("updates.historyLoadFailed") }}
</div> </div>
<template v-else> <template v-else>
<div v-for="release in visibleOlderReleases" :key="release.tag" class="flex items-center justify-between gap-4 rounded-md border p-3"> <div class="divide-y overflow-hidden rounded-md border">
<div class="min-w-0"> <div v-for="release in visibleOlderReleases" :key="release.tag" class="flex items-center justify-between gap-4 px-3 py-2">
<div class="font-medium">{{ release.tag }}</div> <span class="min-w-0 truncate font-medium">{{ release.tag }}</span>
<div class="mt-0.5 text-xs text-muted-foreground">{{ t("updates.historyPublishedOn", { date: formatOlderReleaseDate(release.date) }) }}</div> <span class="flex shrink-0 items-center gap-3">
</div> <span class="text-xs text-muted-foreground">{{ t("updates.historyPublishedOn", { date: formatOlderReleaseDate(release.date) }) }}</span>
<Button variant="outline" class="shrink-0" @click="openOlderReleasePage(release.tag)">{{ t("updates.openRelease") }}</Button> <Button variant="outline" class="shrink-0" @click="openOlderReleasePage(release.tag)">{{ t("updates.openRelease") }}</Button>
</span>
</div>
</div> </div>
<Button v-if="hasMoreOlderReleases" variant="ghost" class="w-full" @click="showMoreOlderReleases">{{ t("updates.historyLoadMore") }}</Button> <Button v-if="hasMoreOlderReleases" variant="ghost" class="w-full" @click="showMoreOlderReleases">{{ t("updates.historyLoadMore") }}</Button>
</template> </template>
@@ -400,45 +402,55 @@ watch(
<span>{{ componentUpdatesError }}</span> <span>{{ componentUpdatesError }}</span>
</div> </div>
<template v-if="selectedTab === 'drivers'"> <template v-if="selectedTab === 'drivers'">
<div v-for="driver in driverUpdates" :key="driver.db_type" class="flex items-center justify-between gap-4 rounded-md border p-3"> <div v-if="driverUpdates.length" class="divide-y overflow-hidden rounded-md border">
<div class="min-w-0"> <div v-for="driver in driverUpdates" :key="driver.db_type" data-update-entry class="flex items-center justify-between gap-4 px-3 py-2">
<div class="font-medium">{{ driver.label }}</div> <span class="min-w-0 truncate font-medium">{{ driver.label }}</span>
<div class="mt-0.5 text-xs text-muted-foreground">{{ driver.installed_version || driver.version }} → {{ driver.version }}</div> <span class="flex shrink-0 items-center gap-3">
<span class="text-xs tabular-nums text-muted-foreground">{{ driver.installed_version || driver.version }} → {{ driver.version }}</span>
<span class="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</span>
</div> </div>
<span class="shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</div> </div>
</template> </template>
<template v-else-if="selectedTab === 'jdbc' && jdbcUpdate?.update_available"> <template v-else-if="selectedTab === 'jdbc' && jdbcUpdate?.update_available">
<div class="flex items-center justify-between gap-4 rounded-md border p-3"> <div class="divide-y overflow-hidden rounded-md border">
<div class="min-w-0"> <div data-update-entry class="flex items-center justify-between gap-4 px-3 py-2">
<div class="font-medium">{{ t("settings.updateJdbc") }}</div> <span class="min-w-0 truncate font-medium">{{ t("settings.updateJdbc") }}</span>
<div class="mt-0.5 text-xs text-muted-foreground">{{ jdbcUpdate.version || t("updates.notInstalled") }} → {{ jdbcUpdate.latest_version || t("settings.updateAvailable") }}</div> <span class="flex shrink-0 items-center gap-3">
<span class="text-xs tabular-nums text-muted-foreground">{{ jdbcUpdate.version || t("updates.notInstalled") }} → {{ jdbcUpdate.latest_version || t("settings.updateAvailable") }}</span>
<span class="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</span>
</div> </div>
<span class="shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</div> </div>
</template> </template>
<template v-else-if="selectedTab === 'mcp' && mcpAvailable && mcpUpdate"> <template v-else-if="selectedTab === 'mcp' && mcpAvailable && mcpUpdate">
<div class="flex items-center justify-between gap-4 rounded-md border p-3"> <div class="divide-y overflow-hidden rounded-md border">
<div class="min-w-0"> <div data-update-entry class="flex items-center justify-between gap-4 px-3 py-2">
<div class="font-medium">{{ t("settings.updateMcp") }}</div> <span class="min-w-0 truncate font-medium">{{ t("settings.updateMcp") }}</span>
<div class="mt-0.5 text-xs text-muted-foreground">{{ mcpUpdate.current_version || t("updates.notInstalled") }} → {{ mcpUpdate.latest_version || t("settings.updateAvailable") }}</div> <span class="flex shrink-0 items-center gap-3">
<span class="text-xs tabular-nums text-muted-foreground">{{ mcpUpdate.current_version || t("updates.notInstalled") }} → {{ mcpUpdate.latest_version || t("settings.updateAvailable") }}</span>
<span class="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</span>
</div> </div>
<span class="shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</div> </div>
</template> </template>
<template v-else-if="selectedTab === 'plugins'"> <template v-else-if="selectedTab === 'plugins'">
<div v-for="plugin in pluginUpdates" :key="plugin.key" class="flex items-center justify-between gap-4 rounded-md border p-3"> <div class="divide-y overflow-hidden rounded-md border">
<div class="min-w-0"> <div v-for="plugin in pluginUpdates" :key="plugin.key" data-update-entry class="px-3 py-2">
<div class="truncate font-medium">{{ plugin.name }}</div> <div class="flex items-center justify-between gap-4">
<div class="mt-0.5 text-xs text-muted-foreground">{{ plugin.installed?.manifest.version || t("updates.notInstalled") }} → {{ plugin.plugin.latestVersion }}</div> <span class="min-w-0 truncate font-medium">{{ plugin.name }}</span>
<span class="flex shrink-0 items-center gap-3">
<span class="text-xs tabular-nums text-muted-foreground">{{ plugin.installed?.manifest.version || t("updates.notInstalled") }} → {{ plugin.plugin.latestVersion }}</span>
<span class="rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</span>
</div>
<!-- "Update all" deliberately skips a changed source: the user has to confirm it in <!-- "Update all" deliberately skips a changed source: the user has to confirm it in
the Plugin Center, so say so instead of leaving an item that never updates. --> the Plugin Center, so say so instead of leaving an item that never updates. -->
<div v-if="pluginSourceChange(plugin)" class="mt-1 text-xs text-amber-600 dark:text-amber-400">{{ t("pluginPlatform.updateSourceChangeRequired") }}</div> <div v-if="pluginSourceChange(plugin)" class="mt-1 text-xs text-amber-600 dark:text-amber-400">{{ t("pluginPlatform.updateSourceChangeRequired") }}</div>
</div> </div>
<span class="shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary">{{ t("settings.updateAvailable") }}</span>
</div> </div>
</template> </template>
+1 -1
View File
@@ -7907,7 +7907,7 @@ export default withEnglishFallback({
checkUpdates: "立即检查", checkUpdates: "立即检查",
updateAll: "一键更新", updateAll: "一键更新",
updateClient: "DBX", updateClient: "DBX",
updateDrivers: "数据库驱动", updateDrivers: "驱动",
updateJdbc: "JDBC", updateJdbc: "JDBC",
updateMcp: "MCP", updateMcp: "MCP",
updatePlugins: "插件", updatePlugins: "插件",
+1 -1
View File
@@ -6558,7 +6558,7 @@ export default withEnglishFallback({
checkUpdates: "立即檢查", checkUpdates: "立即檢查",
updateAll: "更新全部", updateAll: "更新全部",
updateClient: "DBX", updateClient: "DBX",
updateDrivers: "資料庫驅動程式", updateDrivers: "驅動程式",
updateJdbc: "JDBC", updateJdbc: "JDBC",
updateMcp: "MCP", updateMcp: "MCP",
updatePlugins: "外掛", updatePlugins: "外掛",