@saltcorn/server 1.1.2-beta.10 → 1.1.2-beta.11
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/admin.js +3 -0
- package/routes/delete.js +4 -2
- package/routes/list.js +4 -3
- package/routes/pageedit.js +1 -1
- package/routes/tables.js +17 -9
- package/tests/admin.test.js +3 -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.11",
|
|
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.11",
|
|
12
|
+
"@saltcorn/builder": "1.1.2-beta.11",
|
|
13
|
+
"@saltcorn/data": "1.1.2-beta.11",
|
|
14
|
+
"@saltcorn/admin-models": "1.1.2-beta.11",
|
|
15
|
+
"@saltcorn/filemanager": "1.1.2-beta.11",
|
|
16
|
+
"@saltcorn/markup": "1.1.2-beta.11",
|
|
17
|
+
"@saltcorn/plugins-loader": "1.1.2-beta.11",
|
|
18
|
+
"@saltcorn/sbadmin2": "1.1.2-beta.11",
|
|
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/admin.js
CHANGED
|
@@ -3786,6 +3786,9 @@ router.post(
|
|
|
3786
3786
|
}
|
|
3787
3787
|
if (form.values.triggers) {
|
|
3788
3788
|
await db.deleteWhere("_sc_tag_entries", { not: { trigger_id: null } });
|
|
3789
|
+
await db.deleteWhere("_sc_workflow_trace");
|
|
3790
|
+
await db.deleteWhere("_sc_workflow_runs");
|
|
3791
|
+
await db.deleteWhere("_sc_workflow_steps");
|
|
3789
3792
|
await db.deleteWhere("_sc_triggers");
|
|
3790
3793
|
await getState().refresh_triggers();
|
|
3791
3794
|
}
|
package/routes/delete.js
CHANGED
|
@@ -35,9 +35,11 @@ router.post(
|
|
|
35
35
|
// todo check that works after where change
|
|
36
36
|
const table = Table.findOne({ name: tableName });
|
|
37
37
|
const role = req.user && req.user.id ? req.user.role_id : 100;
|
|
38
|
+
const where = { [table.pk_name]: id };
|
|
39
|
+
|
|
38
40
|
try {
|
|
39
41
|
if (role <= table.min_role_write)
|
|
40
|
-
await table.deleteRows(
|
|
42
|
+
await table.deleteRows(where, req.user || { role_id: 100 });
|
|
41
43
|
else if (
|
|
42
44
|
(table.ownership_field_id || table.ownership_formula) &&
|
|
43
45
|
req.user
|
|
@@ -47,7 +49,7 @@ router.post(
|
|
|
47
49
|
{ forUser: req.user, forPublic: !req.user }
|
|
48
50
|
);
|
|
49
51
|
if (row && table.is_owner(req.user, row))
|
|
50
|
-
await table.deleteRows(
|
|
52
|
+
await table.deleteRows(where, req.user || { role_id: 100 });
|
|
51
53
|
else req.flash("error", req.__("Not authorized"));
|
|
52
54
|
} else
|
|
53
55
|
req.flash(
|
package/routes/list.js
CHANGED
|
@@ -282,6 +282,7 @@ router.get(
|
|
|
282
282
|
cellClick: "__delete_tabulator_row",
|
|
283
283
|
});
|
|
284
284
|
const isDark = getState().getLightDarkMode(req.user) === "dark";
|
|
285
|
+
const pkNm = table.pk_name
|
|
285
286
|
res.sendWrap(
|
|
286
287
|
{
|
|
287
288
|
title: req.__(`%s data table`, table.name),
|
|
@@ -428,7 +429,7 @@ router.get(
|
|
|
428
429
|
ajax_indicator(true);
|
|
429
430
|
$.ajax({
|
|
430
431
|
type: "POST",
|
|
431
|
-
url: "/api/${table.name}/" + (row
|
|
432
|
+
url: "/api/${table.name}/" + (row.${pkNm}||""),
|
|
432
433
|
data: row,
|
|
433
434
|
headers: {
|
|
434
435
|
"CSRF-Token": _sc_globalCsrf,
|
|
@@ -438,8 +439,8 @@ router.get(
|
|
|
438
439
|
ajax_indicator(false);
|
|
439
440
|
//if (item._versions) item._versions = +item._versions + 1;
|
|
440
441
|
//data.resolve(fixKeys(item));
|
|
441
|
-
if(resp.success &&(typeof resp.success ==="number" || typeof resp.success ==="string") && !row
|
|
442
|
-
window.tabulator_table.updateRow(cell.getRow(), {
|
|
442
|
+
if(resp.success &&(typeof resp.success ==="number" || typeof resp.success ==="string") && !row.${pkNm}) {
|
|
443
|
+
window.tabulator_table.updateRow(cell.getRow(), {${pkNm}: resp.success});
|
|
443
444
|
}
|
|
444
445
|
|
|
445
446
|
}).fail(function (resp) {
|
package/routes/pageedit.js
CHANGED
|
@@ -289,7 +289,7 @@ const getRootPageForm = (pages, pageGroups, roles, req) => {
|
|
|
289
289
|
input_type: "select",
|
|
290
290
|
options: [
|
|
291
291
|
"",
|
|
292
|
-
...pages.map((p) => p.name),
|
|
292
|
+
...pages.filter((p) => p.min_role >= r.id).map((p) => p.name),
|
|
293
293
|
...pageGroups.map((g) => ({
|
|
294
294
|
label: `${g.name} (group)`,
|
|
295
295
|
value: g.name,
|
package/routes/tables.js
CHANGED
|
@@ -50,6 +50,7 @@ const {
|
|
|
50
50
|
code,
|
|
51
51
|
pre,
|
|
52
52
|
button,
|
|
53
|
+
text_attr,
|
|
53
54
|
} = require("@saltcorn/markup/tags");
|
|
54
55
|
const { stringify } = require("csv-stringify");
|
|
55
56
|
const TableConstraint = require("@saltcorn/data/models/table_constraints");
|
|
@@ -696,7 +697,14 @@ const typeBadges = (f, req) => {
|
|
|
696
697
|
if (f.primary_key) s += badge("warning", req.__("Primary key"));
|
|
697
698
|
if (f.required) s += badge("primary", req.__("Required"));
|
|
698
699
|
if (f.is_unique) s += badge("success", req.__("Unique"));
|
|
699
|
-
if (f.calculated)
|
|
700
|
+
if (f.calculated)
|
|
701
|
+
s += badge(
|
|
702
|
+
"info",
|
|
703
|
+
req.__("Calculated"),
|
|
704
|
+
f.expression && f.expression !== "__aggregation"
|
|
705
|
+
? text_attr(f.expression)
|
|
706
|
+
: undefined
|
|
707
|
+
);
|
|
700
708
|
if (f.stored) s += badge("warning", req.__("Stored"));
|
|
701
709
|
return s;
|
|
702
710
|
};
|
|
@@ -978,8 +986,8 @@ router.get(
|
|
|
978
986
|
table.name === "users"
|
|
979
987
|
? `/useradmin/`
|
|
980
988
|
: fields.length === 1
|
|
981
|
-
|
|
982
|
-
|
|
989
|
+
? `javascript:;` // Fix problem with edition of table with only one column ID / Primary Key
|
|
990
|
+
: `/list/${encodeURIComponent(table.name)}`,
|
|
983
991
|
},
|
|
984
992
|
i({ class: "fas fa-2x fa-edit" }),
|
|
985
993
|
"<br/>",
|
|
@@ -1535,12 +1543,12 @@ router.get(
|
|
|
1535
1543
|
r.type === "Unique"
|
|
1536
1544
|
? r.configuration.fields.join(", ")
|
|
1537
1545
|
: r.type === "Index" && r.configuration?.field === "_fts"
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1546
|
+
? "Full text search"
|
|
1547
|
+
: r.type === "Index"
|
|
1548
|
+
? r.configuration.field
|
|
1549
|
+
: r.type === "Formula"
|
|
1550
|
+
? r.configuration.formula
|
|
1551
|
+
: "",
|
|
1544
1552
|
},
|
|
1545
1553
|
{
|
|
1546
1554
|
label: req.__("Delete"),
|
package/tests/admin.test.js
CHANGED
|
@@ -647,6 +647,9 @@ describe("clear all page", () => {
|
|
|
647
647
|
.send("users=on")
|
|
648
648
|
.send("config=on")
|
|
649
649
|
.send("plugins=on")
|
|
650
|
+
.send("triggers=on")
|
|
651
|
+
.send("library=on")
|
|
652
|
+
.send("eventlog=on")
|
|
650
653
|
.expect(toRedirect("/auth/create_first_user"));
|
|
651
654
|
});
|
|
652
655
|
it("restores backup after clear all", async () => {
|