Revert "fix(objects): guard system source edits"

This reverts commit 17bc2e66d4.
This commit is contained in:
t8y2
2026-05-18 17:53:02 +08:00
parent 2172b624b1
commit af16ac219c
13 changed files with 27 additions and 291 deletions
@@ -1,54 +0,0 @@
import { strict as assert } from "node:assert";
import test from "node:test";
import { shouldShowQueryOutputPane } from "../../apps/desktop/src/lib/contentAreaLayout.ts";
test("object source tabs hide the query output pane while idle", () => {
assert.equal(
shouldShowQueryOutputPane({
mode: "query",
objectSource: { objectType: "PROCEDURE", name: "refresh_cache" },
isExecuting: false,
isExplaining: false,
}),
false,
);
});
test("object source tabs show the query output pane after execution starts or returns feedback", () => {
assert.equal(
shouldShowQueryOutputPane({
mode: "query",
objectSource: { objectType: "FUNCTION", name: "calc_total" },
isExecuting: true,
isExplaining: false,
}),
true,
);
assert.equal(
shouldShowQueryOutputPane({
mode: "query",
objectSource: { objectType: "PROCEDURE", name: "refresh_cache" },
isExecuting: false,
isExplaining: false,
result: {
columns: ["Error"],
rows: [["syntax error"]],
affected_rows: 0,
execution_time_ms: 2,
},
}),
true,
);
});
test("regular query tabs keep the output pane visible before execution", () => {
assert.equal(
shouldShowQueryOutputPane({
mode: "query",
isExecuting: false,
isExplaining: false,
}),
true,
);
});
@@ -3,7 +3,6 @@ import test from "node:test";
import {
buildExecutableObjectSourceSql,
buildExecutableObjectSourceStatements,
objectSourceReadOnlyReason,
objectSourceSaveExecutionMode,
} from "../../apps/desktop/src/lib/objectSourceEditor.ts";
@@ -105,37 +104,3 @@ test("object source SQL joins generated save statements for previews", () => {
'CREATE OR REPLACE PROCEDURE "public"."refresh_cache_v2"(mode text)\nLANGUAGE SQL\nAS $$ SELECT 1 $$;\nDROP PROCEDURE IF EXISTS "public"."refresh_cache"(mode text);',
);
});
test("system schemas open object source as read-only", () => {
assert.equal(
objectSourceReadOnlyReason({
databaseType: "oracle",
schema: "SYS",
name: "DBMS_STATS",
objectType: "PROCEDURE",
}),
"system-object",
);
});
test("Dameng built-in maintenance routines open as read-only without blocking user SP names", () => {
assert.equal(
objectSourceReadOnlyReason({
databaseType: "dameng",
schema: "SYSDBA",
name: "SP_TS_BAKSET_REMOVE_BATCH",
objectType: "PROCEDURE",
}),
"system-object",
);
assert.equal(
objectSourceReadOnlyReason({
databaseType: "dameng",
schema: "SYSDBA",
name: "SP_HELLO",
objectType: "PROCEDURE",
}),
null,
);
});