fix(frontend): restore formatting checks
This commit is contained in:
1 parent
3db119ca4a
commit
073139cde9
5 files changed
+46
-10
No files matched your search
@@ -485,7 +485,25 @@ const {
|
||||
confirmDropAllMongoIndexes,
|
||||
} = useSidebarDatabaseSpecificMutationRuntime({ activeNode, connectionStore });
|
||||
|
||||
const { isTableNotView, supportsTruncate, supportsMysqlAutoIncrement, canDropTableCascade, canTruncateTableCascade, refreshDropTablePreviewSql, refreshTruncateTablePreviewSql, dropTable, refreshTableList, confirmDropTable, emptyTable, confirmEmptyTable, truncateTable, confirmTruncateTable, mysqlAutoIncrement, refreshMysqlAutoIncrementPreviewSql, confirmMysqlAutoIncrement } = useSidebarTableMutationRuntime({
|
||||
const {
|
||||
isTableNotView,
|
||||
supportsTruncate,
|
||||
supportsMysqlAutoIncrement,
|
||||
canDropTableCascade,
|
||||
canTruncateTableCascade,
|
||||
refreshDropTablePreviewSql,
|
||||
refreshTruncateTablePreviewSql,
|
||||
dropTable,
|
||||
refreshTableList,
|
||||
confirmDropTable,
|
||||
emptyTable,
|
||||
confirmEmptyTable,
|
||||
truncateTable,
|
||||
confirmTruncateTable,
|
||||
mysqlAutoIncrement,
|
||||
refreshMysqlAutoIncrementPreviewSql,
|
||||
confirmMysqlAutoIncrement,
|
||||
} = useSidebarTableMutationRuntime({
|
||||
activeNode,
|
||||
releaseActiveNodeReference,
|
||||
connectionStore,
|
||||
|
||||
@@ -6,7 +6,21 @@ import type { DatabaseType, TreeNode } from "@/types/database";
|
||||
import { supportsTableTruncate } from "@/lib/database/databaseCapabilities";
|
||||
import { buildDropTableSql, buildEmptyTableSql, buildMysqlAutoIncrementSql, buildTruncateTableSql, supportsDropTableCascade, supportsNativeMysqlAutoIncrement, supportsTruncateTableCascade, type MysqlAutoIncrementSqlOptions, type TableAdminSqlOptions } from "@/lib/database/dbAdminSql";
|
||||
import { isSqlServerLinkedNode } from "@/lib/database/sqlServerLinkedServers";
|
||||
import { sidebarDangerTarget, showDropTableConfirm, showEmptyTableConfirm, showMysqlAutoIncrementConfirm, showTruncateTableConfirm, dropTablePreviewSql, dropTableCascade, emptyTablePreviewSql, mysqlAutoIncrementPreviewKey, mysqlAutoIncrementPreviewSql, mysqlAutoIncrementValue, truncateTablePreviewSql, truncateTableCascade } from "@/components/sidebar/sidebarTreeDialogState";
|
||||
import {
|
||||
sidebarDangerTarget,
|
||||
showDropTableConfirm,
|
||||
showEmptyTableConfirm,
|
||||
showMysqlAutoIncrementConfirm,
|
||||
showTruncateTableConfirm,
|
||||
dropTablePreviewSql,
|
||||
dropTableCascade,
|
||||
emptyTablePreviewSql,
|
||||
mysqlAutoIncrementPreviewKey,
|
||||
mysqlAutoIncrementPreviewSql,
|
||||
mysqlAutoIncrementValue,
|
||||
truncateTablePreviewSql,
|
||||
truncateTableCascade,
|
||||
} from "@/components/sidebar/sidebarTreeDialogState";
|
||||
|
||||
interface SidebarTableMutationRuntimeOptions {
|
||||
activeNode: ShallowRef<TreeNode>;
|
||||
|
||||
+1
-4
@@ -259,10 +259,7 @@ describe("DatabaseUserAdmin MySQL account Host changes", () => {
|
||||
await vi.waitFor(() => expect(mocks.executeQuery.mock.calls.some((call) => call[2] === "SHOW GRANTS FOR 'same-user'@'new-host';")).toBe(true));
|
||||
expect(mocks.executeMulti.mock.calls[0][2]).toBe("RENAME USER 'same-user'@'old-host' TO 'same-user'@'new-host';");
|
||||
expect(mocks.productionGuard).toHaveBeenCalledWith(expect.objectContaining({ connection: nativeMysqlConnection, sql: "RENAME USER 'same-user'@'old-host' TO 'same-user'@'new-host';" }));
|
||||
expect(mocks.executeQuery.mock.calls.slice(2).map((call) => call[2])).toEqual([
|
||||
"SELECT User AS user, Host AS host, plugin AS plugin FROM mysql.user ORDER BY User, Host;",
|
||||
"SHOW GRANTS FOR 'same-user'@'new-host';",
|
||||
]);
|
||||
expect(mocks.executeQuery.mock.calls.slice(2).map((call) => call[2])).toEqual(["SELECT User AS user, Host AS host, plugin AS plugin FROM mysql.user ORDER BY User, Host;", "SHOW GRANTS FOR 'same-user'@'new-host';"]);
|
||||
expect(root?.textContent).toContain("same-user@new-host");
|
||||
expect(root?.querySelector('input[placeholder="userAdmin.newHost"]')).toBeNull();
|
||||
});
|
||||
|
||||
@@ -91,9 +91,7 @@ describe("database user admin providers", () => {
|
||||
expect(blankLegacyNative).toBe(nativeMysqlUserAdminProvider);
|
||||
expect(native).toBe(nativeMysqlUserAdminProvider);
|
||||
expect(normalizedNative).toBe(nativeMysqlUserAdminProvider);
|
||||
expect(native?.renameUserSql?.({ user: "app'user", host: "old\\host" }, "new'\\host")).toBe(
|
||||
"RENAME USER 'app''user'@'old\\\\host' TO 'app''user'@'new''\\\\host';",
|
||||
);
|
||||
expect(native?.renameUserSql?.({ user: "app'user", host: "old\\host" }, "new'\\host")).toBe("RENAME USER 'app''user'@'old\\\\host' TO 'app''user'@'new''\\\\host';");
|
||||
});
|
||||
|
||||
it("does not expose account Host changes to MySQL-compatible providers", () => {
|
||||
|
||||
+10
-1
@@ -13,7 +13,16 @@ const apiMock = vi.hoisted(() => ({
|
||||
|
||||
vi.mock("@/lib/backend/api", () => apiMock);
|
||||
|
||||
import { buildDuplicateTableStructurePlan, buildMysqlAutoIncrementSql, collectDuplicateTableColumnComments, damengDropSchemaExecutionSchema, damengDuplicateTableCreateOptions, duplicateTableStructureRequiresScript, oracleDuplicateTableCreateOptions, supportsNativeMysqlAutoIncrement } from "@/lib/database/dbAdminSql";
|
||||
import {
|
||||
buildDuplicateTableStructurePlan,
|
||||
buildMysqlAutoIncrementSql,
|
||||
collectDuplicateTableColumnComments,
|
||||
damengDropSchemaExecutionSchema,
|
||||
damengDuplicateTableCreateOptions,
|
||||
duplicateTableStructureRequiresScript,
|
||||
oracleDuplicateTableCreateOptions,
|
||||
supportsNativeMysqlAutoIncrement,
|
||||
} from "@/lib/database/dbAdminSql";
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
Reference in new issue
Block a user