25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { strict as assert } from "node:assert";
import { test } from "vitest";
import { dataGridSaveActionMode, dataGridSaveToolbarState } from "../../apps/desktop/src/lib/dataGrid/dataGridSaveUi.ts";
test("uses concise save and commit labels for the primary grid save action", () => {
assert.deepEqual(dataGridSaveActionMode({ pendingChangeCount: 3, useTransaction: true }), {
labelKey: "grid.commit",
tooltipKey: "grid.transactionSaveHint",
secondaryActionKey: "grid.rollback",
});
assert.deepEqual(dataGridSaveActionMode({ pendingChangeCount: 3, useTransaction: false }), {
labelKey: "grid.save",
tooltipKey: "grid.nonTransactionalSaveHint",
secondaryActionKey: "grid.discard",
});
});
test("keeps grid save actions visible for editable grids even without pending changes", () => {
assert.deepEqual(
dataGridSaveToolbarState({
editable: true,
hasSaveTarget: true,
hasPendingChanges: false,
isSaving: false,
}),
{
showActions: true,
actionsDisabled: true,
},
);
assert.deepEqual(
dataGridSaveToolbarState({
editable: true,
hasSaveTarget: true,
hasPendingChanges: true,
isSaving: false,
}),
{
showActions: true,
actionsDisabled: false,
},
);
});
test("hides grid save actions when a grid cannot save edits", () => {
assert.deepEqual(
dataGridSaveToolbarState({
editable: false,
hasSaveTarget: true,
hasPendingChanges: false,
isSaving: false,
}),
{
showActions: false,
actionsDisabled: true,
},
);
assert.deepEqual(
dataGridSaveToolbarState({
editable: true,
hasSaveTarget: false,
hasPendingChanges: true,
isSaving: false,
}),
{
showActions: false,
actionsDisabled: true,
},
);
});