@saltcorn/server 1.1.2-beta.13 → 1.1.2-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/routes/tables.js +10 -4
- package/tests/admin.test.js +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/server",
|
|
3
|
-
"version": "1.1.2-beta.
|
|
3
|
+
"version": "1.1.2-beta.15",
|
|
4
4
|
"description": "Server app for Saltcorn, open-source no-code platform",
|
|
5
5
|
"homepage": "https://saltcorn.com",
|
|
6
6
|
"main": "index.js",
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@aws-sdk/client-s3": "^3.735.0",
|
|
10
10
|
"@dr.pogodin/csurf": "^1.14.1",
|
|
11
|
-
"@saltcorn/base-plugin": "1.1.2-beta.
|
|
12
|
-
"@saltcorn/builder": "1.1.2-beta.
|
|
13
|
-
"@saltcorn/data": "1.1.2-beta.
|
|
14
|
-
"@saltcorn/admin-models": "1.1.2-beta.
|
|
15
|
-
"@saltcorn/filemanager": "1.1.2-beta.
|
|
16
|
-
"@saltcorn/markup": "1.1.2-beta.
|
|
17
|
-
"@saltcorn/plugins-loader": "1.1.2-beta.
|
|
18
|
-
"@saltcorn/sbadmin2": "1.1.2-beta.
|
|
11
|
+
"@saltcorn/base-plugin": "1.1.2-beta.15",
|
|
12
|
+
"@saltcorn/builder": "1.1.2-beta.15",
|
|
13
|
+
"@saltcorn/data": "1.1.2-beta.15",
|
|
14
|
+
"@saltcorn/admin-models": "1.1.2-beta.15",
|
|
15
|
+
"@saltcorn/filemanager": "1.1.2-beta.15",
|
|
16
|
+
"@saltcorn/markup": "1.1.2-beta.15",
|
|
17
|
+
"@saltcorn/plugins-loader": "1.1.2-beta.15",
|
|
18
|
+
"@saltcorn/sbadmin2": "1.1.2-beta.15",
|
|
19
19
|
"@socket.io/cluster-adapter": "^0.2.1",
|
|
20
20
|
"@socket.io/sticky": "^1.0.1",
|
|
21
21
|
"adm-zip": "0.5.16",
|
package/routes/tables.js
CHANGED
|
@@ -67,6 +67,7 @@ const {
|
|
|
67
67
|
InvalidConfiguration,
|
|
68
68
|
removeAllWhiteSpace,
|
|
69
69
|
comparingCaseInsensitive,
|
|
70
|
+
validSqlId,
|
|
70
71
|
} = require("@saltcorn/data/utils");
|
|
71
72
|
const { EOL } = require("os");
|
|
72
73
|
|
|
@@ -484,7 +485,10 @@ const buildTableMarkup = (table) => {
|
|
|
484
485
|
const members = fields
|
|
485
486
|
// .filter((f) => !f.reftable_name)
|
|
486
487
|
.map((f) =>
|
|
487
|
-
indentString(
|
|
488
|
+
indentString(
|
|
489
|
+
`${removeAllWhiteSpace(f.type_name)} ${validSqlId(f.name)}`,
|
|
490
|
+
6
|
|
491
|
+
)
|
|
488
492
|
)
|
|
489
493
|
.join(EOL);
|
|
490
494
|
const keys = table
|
|
@@ -794,7 +798,9 @@ router.get(
|
|
|
794
798
|
const triggers = table.id ? Trigger.find({ table_id: table.id }) : [];
|
|
795
799
|
triggers.sort(comparingCaseInsensitive("name"));
|
|
796
800
|
let fieldCard;
|
|
797
|
-
const
|
|
801
|
+
const primaryKeys = fields.filter((f) => f.primary_key);
|
|
802
|
+
const nPrimaryKeys = primaryKeys.length;
|
|
803
|
+
const nonSerialPKS = primaryKeys.some((f) => f.attributes?.NonSerial);
|
|
798
804
|
|
|
799
805
|
if (fields.length === 0) {
|
|
800
806
|
fieldCard = [
|
|
@@ -858,11 +864,11 @@ router.get(
|
|
|
858
864
|
{ hover: true }
|
|
859
865
|
);
|
|
860
866
|
fieldCard = [
|
|
861
|
-
nPrimaryKeys > 1 &&
|
|
867
|
+
(nPrimaryKeys > 1 || nonSerialPKS) &&
|
|
862
868
|
div(
|
|
863
869
|
{ class: "alert alert-danger", role: "alert" },
|
|
864
870
|
i({ class: "fas fa-exclamation-triangle" }),
|
|
865
|
-
"This table has composite primary keys which
|
|
871
|
+
"This table has composite or non-defaulted primary keys, which are not supported in Saltcorn. A procedure to introduce a single autoincrementing primary key is available.",
|
|
866
872
|
post_btn(
|
|
867
873
|
`/table/repair-composite-primary/${table.id}`,
|
|
868
874
|
"Add autoincrementing primary key",
|
package/tests/admin.test.js
CHANGED
|
@@ -472,6 +472,18 @@ describe("actions", () => {
|
|
|
472
472
|
.set("Cookie", loginCookie)
|
|
473
473
|
.expect(toRedirect("/actions/"));
|
|
474
474
|
});
|
|
475
|
+
it("post Never trigger with table", async () => {
|
|
476
|
+
const app = await getApp({ disableCsrf: true });
|
|
477
|
+
const loginCookie = await getAdminLoginCookie();
|
|
478
|
+
await request(app)
|
|
479
|
+
.post("/actions/new")
|
|
480
|
+
.set("Cookie", loginCookie)
|
|
481
|
+
.send("action=run_js_code")
|
|
482
|
+
.send("table_id=2")
|
|
483
|
+
.send("name=NeverTableTrigger")
|
|
484
|
+
.send("when_trigger=Never")
|
|
485
|
+
.expect(302);
|
|
486
|
+
});
|
|
475
487
|
});
|
|
476
488
|
describe("localizer", () => {
|
|
477
489
|
itShouldRedirectUnauthToLogin("/site-structure/localizer");
|