@saltcorn/server 0.7.3 → 0.7.4-beta.2
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/auth/admin.js +2 -1
- package/auth/routes.js +80 -92
- package/errors.js +51 -48
- package/locales/en.json +47 -2
- package/locales/it.json +2 -1
- package/locales/ru.json +42 -6
- package/locales/zh.json +1 -1
- package/markup/admin.js +15 -1
- package/markup/plugin-store.js +5 -5
- package/package.json +7 -7
- package/public/jquery-menu-editor.min.js +1 -1
- package/public/saltcorn-builder.css +75 -0
- package/public/saltcorn-common.js +24 -9
- package/public/saltcorn.css +28 -1
- package/public/saltcorn.js +9 -7
- package/routes/actions.js +2 -39
- package/routes/admin.js +375 -90
- package/routes/api.js +9 -1
- package/routes/common_lists.js +419 -0
- package/routes/fields.js +34 -19
- package/routes/homepage.js +60 -60
- package/routes/index.js +4 -0
- package/routes/menu.js +65 -4
- package/routes/packs.js +4 -4
- package/routes/page.js +5 -1
- package/routes/pageedit.js +13 -98
- package/routes/plugins.js +116 -118
- package/routes/settings.js +3 -3
- package/routes/tables.js +158 -193
- package/routes/tag_entries.js +173 -0
- package/routes/tags.js +266 -0
- package/routes/tenant.js +27 -27
- package/routes/utils.js +4 -0
- package/routes/view.js +18 -1
- package/routes/viewedit.js +22 -132
- package/serve.js +54 -38
- package/tests/admin.test.js +1 -1
- package/tests/api.test.js +17 -0
- package/tests/clientjs.test.js +11 -1
- package/tests/plugins.test.js +1 -1
- package/tests/viewedit.test.js +1 -1
- package/wrapper.js +57 -55
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/server",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4-beta.2",
|
|
4
4
|
"description": "Server app for Saltcorn, open-source no-code platform",
|
|
5
5
|
"homepage": "https://saltcorn.com",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@saltcorn/base-plugin": "0.7.
|
|
10
|
-
"@saltcorn/builder": "0.7.
|
|
11
|
-
"@saltcorn/data": "0.7.
|
|
12
|
-
"@saltcorn/admin-models": "0.7.
|
|
13
|
-
"@saltcorn/markup": "0.7.
|
|
14
|
-
"@saltcorn/sbadmin2": "0.7.
|
|
9
|
+
"@saltcorn/base-plugin": "0.7.4-beta.2",
|
|
10
|
+
"@saltcorn/builder": "0.7.4-beta.2",
|
|
11
|
+
"@saltcorn/data": "0.7.4-beta.2",
|
|
12
|
+
"@saltcorn/admin-models": "0.7.4-beta.2",
|
|
13
|
+
"@saltcorn/markup": "0.7.4-beta.2",
|
|
14
|
+
"@saltcorn/sbadmin2": "0.7.4-beta.2",
|
|
15
15
|
"@socket.io/cluster-adapter": "^0.1.0",
|
|
16
16
|
"@socket.io/sticky": "^1.0.1",
|
|
17
17
|
"aws-sdk": "^2.1037.0",
|
|
@@ -364,3 +364,78 @@ Copyright (c) 2017 Taha Paksu
|
|
|
364
364
|
.dropdown-menu.searchbar-dropdown.show {
|
|
365
365
|
transform: translate(0px, 40px);
|
|
366
366
|
}
|
|
367
|
+
|
|
368
|
+
.tippy-box[data-animation="fade"][data-state="hidden"] {
|
|
369
|
+
opacity: 0;
|
|
370
|
+
}
|
|
371
|
+
[data-tippy-root] {
|
|
372
|
+
max-width: calc(100vw - 10px);
|
|
373
|
+
}
|
|
374
|
+
.tippy-box {
|
|
375
|
+
position: relative;
|
|
376
|
+
background-color: #333;
|
|
377
|
+
color: #fff;
|
|
378
|
+
border-radius: 4px;
|
|
379
|
+
font-size: 14px;
|
|
380
|
+
line-height: 1.4;
|
|
381
|
+
white-space: normal;
|
|
382
|
+
outline: 0;
|
|
383
|
+
transition-property: transform, visibility, opacity;
|
|
384
|
+
}
|
|
385
|
+
.tippy-box[data-placement^="top"] > .tippy-arrow {
|
|
386
|
+
bottom: 0;
|
|
387
|
+
}
|
|
388
|
+
.tippy-box[data-placement^="top"] > .tippy-arrow:before {
|
|
389
|
+
bottom: -7px;
|
|
390
|
+
left: 0;
|
|
391
|
+
border-width: 8px 8px 0;
|
|
392
|
+
border-top-color: initial;
|
|
393
|
+
transform-origin: center top;
|
|
394
|
+
}
|
|
395
|
+
.tippy-box[data-placement^="bottom"] > .tippy-arrow {
|
|
396
|
+
top: 0;
|
|
397
|
+
}
|
|
398
|
+
.tippy-box[data-placement^="bottom"] > .tippy-arrow:before {
|
|
399
|
+
top: -7px;
|
|
400
|
+
left: 0;
|
|
401
|
+
border-width: 0 8px 8px;
|
|
402
|
+
border-bottom-color: initial;
|
|
403
|
+
transform-origin: center bottom;
|
|
404
|
+
}
|
|
405
|
+
.tippy-box[data-placement^="left"] > .tippy-arrow {
|
|
406
|
+
right: 0;
|
|
407
|
+
}
|
|
408
|
+
.tippy-box[data-placement^="left"] > .tippy-arrow:before {
|
|
409
|
+
border-width: 8px 0 8px 8px;
|
|
410
|
+
border-left-color: initial;
|
|
411
|
+
right: -7px;
|
|
412
|
+
transform-origin: center left;
|
|
413
|
+
}
|
|
414
|
+
.tippy-box[data-placement^="right"] > .tippy-arrow {
|
|
415
|
+
left: 0;
|
|
416
|
+
}
|
|
417
|
+
.tippy-box[data-placement^="right"] > .tippy-arrow:before {
|
|
418
|
+
left: -7px;
|
|
419
|
+
border-width: 8px 8px 8px 0;
|
|
420
|
+
border-right-color: initial;
|
|
421
|
+
transform-origin: center right;
|
|
422
|
+
}
|
|
423
|
+
.tippy-box[data-inertia][data-state="visible"] {
|
|
424
|
+
transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);
|
|
425
|
+
}
|
|
426
|
+
.tippy-arrow {
|
|
427
|
+
width: 16px;
|
|
428
|
+
height: 16px;
|
|
429
|
+
color: #333;
|
|
430
|
+
}
|
|
431
|
+
.tippy-arrow:before {
|
|
432
|
+
content: "";
|
|
433
|
+
position: absolute;
|
|
434
|
+
border-color: transparent;
|
|
435
|
+
border-style: solid;
|
|
436
|
+
}
|
|
437
|
+
.tippy-content {
|
|
438
|
+
position: relative;
|
|
439
|
+
padding: 5px 9px;
|
|
440
|
+
z-index: 1;
|
|
441
|
+
}
|
|
@@ -39,16 +39,26 @@ function apply_showif() {
|
|
|
39
39
|
$("[data-show-if]").each(function (ix, element) {
|
|
40
40
|
var e = $(element);
|
|
41
41
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
let to_show = e.data("data-show-if-fun");
|
|
43
|
+
if (!to_show) {
|
|
44
|
+
to_show = new Function(
|
|
45
|
+
"e",
|
|
46
|
+
"return " + decodeURIComponent(e.attr("data-show-if"))
|
|
47
|
+
);
|
|
48
|
+
e.data("data-show-if-fun", to_show);
|
|
49
|
+
}
|
|
50
|
+
if (!e.data("data-closest-form-ns"))
|
|
51
|
+
e.data("data-closest-form-ns", e.closest(".form-namespace"));
|
|
46
52
|
if (to_show(e))
|
|
47
53
|
e.show()
|
|
48
54
|
.find("input, textarea, button, select")
|
|
49
55
|
.prop("disabled", e.attr("data-disabled") || false);
|
|
50
56
|
else
|
|
51
|
-
e.hide()
|
|
57
|
+
e.hide()
|
|
58
|
+
.find(
|
|
59
|
+
"input:enabled, textarea:enabled, button:enabled, select:enabled"
|
|
60
|
+
)
|
|
61
|
+
.prop("disabled", true);
|
|
52
62
|
} catch (e) {
|
|
53
63
|
console.error(e);
|
|
54
64
|
}
|
|
@@ -111,7 +121,12 @@ function apply_showif() {
|
|
|
111
121
|
`<option ${
|
|
112
122
|
`${current}` === `${r[dynwhere.refname]}` ? "selected" : ""
|
|
113
123
|
} value="${r[dynwhere.refname]}">${
|
|
114
|
-
|
|
124
|
+
dynwhere.label_formula
|
|
125
|
+
? new Function(
|
|
126
|
+
`{${Object.keys(r).join(",")}}`,
|
|
127
|
+
"return " + dynwhere.label_formula
|
|
128
|
+
)(r)
|
|
129
|
+
: r[dynwhere.summary_field]
|
|
115
130
|
}</option>`
|
|
116
131
|
)
|
|
117
132
|
);
|
|
@@ -510,7 +525,7 @@ const repeaterCopyValuesToForm = (form, editor, noTriggerChange) => {
|
|
|
510
525
|
if ($e.length) $e.val(v);
|
|
511
526
|
else
|
|
512
527
|
form.append(
|
|
513
|
-
`<input type="hidden" name="${k}_${ix}" value="${v}"></input>`
|
|
528
|
+
`<input type="hidden" data-repeater-ix="${ix}" name="${k}_${ix}" value="${v}"></input>`
|
|
514
529
|
);
|
|
515
530
|
};
|
|
516
531
|
vs.forEach((v, ix) => {
|
|
@@ -521,8 +536,8 @@ const repeaterCopyValuesToForm = (form, editor, noTriggerChange) => {
|
|
|
521
536
|
});
|
|
522
537
|
});
|
|
523
538
|
//delete
|
|
524
|
-
//for (let ix = vs.length; ix < vs.length +
|
|
525
|
-
//
|
|
539
|
+
//for (let ix = vs.length; ix < vs.length + 5; ix++) {
|
|
540
|
+
// $(`input[data-repeater-ix="${ix}"]`).remove();
|
|
526
541
|
//}
|
|
527
542
|
$(`input[type=hidden]`).each(function () {
|
|
528
543
|
const name = $(this).attr("name");
|
package/public/saltcorn.css
CHANGED
|
@@ -319,4 +319,31 @@ table.table-inner-grid, table.table-inner-grid th, table.table-inner-grid td {
|
|
|
319
319
|
.editStarRating input:checked + label,
|
|
320
320
|
.editStarRating input:checked + label ~ label {
|
|
321
321
|
color: #ffc107;
|
|
322
|
-
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.CodeMirror {
|
|
325
|
+
resize: vertical;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* copied from bootstrap and adjusted to show the arrow on the left */
|
|
329
|
+
.card .card-header-left-collapse[data-bs-toggle=collapse] {
|
|
330
|
+
text-decoration: none;
|
|
331
|
+
position: relative;
|
|
332
|
+
padding: 0.75rem 3.25rem 0.75rem 1.25rem;
|
|
333
|
+
}
|
|
334
|
+
.card .card-header-left-collapse[data-bs-toggle=collapse]::before {
|
|
335
|
+
position: absolute;
|
|
336
|
+
left: 0;
|
|
337
|
+
top: 0;
|
|
338
|
+
line-height: 51px;
|
|
339
|
+
font-weight: 900;
|
|
340
|
+
content: "\f107";
|
|
341
|
+
font-family: "Font Awesome 5 Free";
|
|
342
|
+
color: #d1d3e2;
|
|
343
|
+
}
|
|
344
|
+
.card .card-header-left-collapse[data-bs-toggle=collapse].collapsed {
|
|
345
|
+
border-radius: 0.35rem;
|
|
346
|
+
}
|
|
347
|
+
.card .card-header-left-collapse[data-bs-toggle=collapse].collapsed::before {
|
|
348
|
+
content: "\f105";
|
|
349
|
+
}
|
package/public/saltcorn.js
CHANGED
|
@@ -143,6 +143,8 @@ function view_post(viewname, route, data, onDone) {
|
|
|
143
143
|
}).done(function (res) {
|
|
144
144
|
if (onDone) onDone(res);
|
|
145
145
|
ajax_done(res);
|
|
146
|
+
}).fail(function (res) {
|
|
147
|
+
notifyAlert({ type: "danger", text: res.responseText });
|
|
146
148
|
});
|
|
147
149
|
}
|
|
148
150
|
var logged_errors = [];
|
|
@@ -210,9 +212,9 @@ function ajax_modal(url, opts = {}) {
|
|
|
210
212
|
$("#scmodal .modal-body").html(res);
|
|
211
213
|
new bootstrap.Modal($("#scmodal")).show();
|
|
212
214
|
initialize_page();
|
|
213
|
-
(opts.onOpen || function () {})(res);
|
|
215
|
+
(opts.onOpen || function () { })(res);
|
|
214
216
|
$("#scmodal").on("hidden.bs.modal", function (e) {
|
|
215
|
-
(opts.onClose || function () {})(res);
|
|
217
|
+
(opts.onClose || function () { })(res);
|
|
216
218
|
$("body").css("overflow", "");
|
|
217
219
|
});
|
|
218
220
|
},
|
|
@@ -264,7 +266,7 @@ function applyViewConfig(e, url, k) {
|
|
|
264
266
|
"CSRF-Token": _sc_globalCsrf,
|
|
265
267
|
},
|
|
266
268
|
data: JSON.stringify(cfg),
|
|
267
|
-
error: function (request) {},
|
|
269
|
+
error: function (request) { },
|
|
268
270
|
success: function (res) {
|
|
269
271
|
k && k(res);
|
|
270
272
|
},
|
|
@@ -444,16 +446,16 @@ Copyright (c) 2015 Jeff Green
|
|
|
444
446
|
stateObject,
|
|
445
447
|
document.title,
|
|
446
448
|
window.location.pathname +
|
|
447
|
-
|
|
448
|
-
|
|
449
|
+
window.location.search +
|
|
450
|
+
$(this).attr("href")
|
|
449
451
|
);
|
|
450
452
|
} else {
|
|
451
453
|
window.history.replaceState(
|
|
452
454
|
stateObject,
|
|
453
455
|
document.title,
|
|
454
456
|
window.location.pathname +
|
|
455
|
-
|
|
456
|
-
|
|
457
|
+
window.location.search +
|
|
458
|
+
$(this).attr("href")
|
|
457
459
|
);
|
|
458
460
|
}
|
|
459
461
|
});
|
package/routes/actions.js
CHANGED
|
@@ -8,6 +8,7 @@ const Router = require("express-promise-router");
|
|
|
8
8
|
const { isAdmin, error_catcher, get_base_url } = require("./utils.js");
|
|
9
9
|
const { getState } = require("@saltcorn/data/db/state");
|
|
10
10
|
const Trigger = require("@saltcorn/data/models/trigger");
|
|
11
|
+
const { getTriggerList } = require("./common_lists");
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @type {object}
|
|
@@ -97,45 +98,7 @@ router.get(
|
|
|
97
98
|
type: "card",
|
|
98
99
|
title: req.__("Triggers"),
|
|
99
100
|
contents: div(
|
|
100
|
-
|
|
101
|
-
[
|
|
102
|
-
{ label: req.__("Name"), key: "name" },
|
|
103
|
-
{ label: req.__("Action"), key: "action" },
|
|
104
|
-
{
|
|
105
|
-
label: req.__("Table or Channel"),
|
|
106
|
-
key: (r) => r.table_name || r.channel,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: req.__("When"),
|
|
110
|
-
key: (a) =>
|
|
111
|
-
a.when_trigger === "API call"
|
|
112
|
-
? `API: ${base_url}api/action/${a.name}`
|
|
113
|
-
: a.when_trigger,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
label: req.__("Test run"),
|
|
117
|
-
key: (r) =>
|
|
118
|
-
r.table_id
|
|
119
|
-
? ""
|
|
120
|
-
: link(`/actions/testrun/${r.id}`, req.__("Test run")),
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
label: req.__("Edit"),
|
|
124
|
-
key: (r) => link(`/actions/edit/${r.id}`, req.__("Edit")),
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
label: req.__("Configure"),
|
|
128
|
-
key: (r) =>
|
|
129
|
-
link(`/actions/configure/${r.id}`, req.__("Configure")),
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
label: req.__("Delete"),
|
|
133
|
-
key: (r) => post_delete_btn(`/actions/delete/${r.id}`, req),
|
|
134
|
-
},
|
|
135
|
-
],
|
|
136
|
-
triggers,
|
|
137
|
-
{ hover: true }
|
|
138
|
-
),
|
|
101
|
+
getTriggerList(triggers, req),
|
|
139
102
|
link("/actions/new", req.__("Add trigger"))
|
|
140
103
|
),
|
|
141
104
|
},
|