@saltcorn/server 0.9.1-beta.13 → 0.9.1-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/locales/en.json +2 -1
- package/package.json +8 -8
- package/public/saltcorn-common.js +16 -11
- package/public/saltcorn.js +31 -1
- package/routes/actions.js +6 -2
- package/routes/menu.js +11 -2
package/locales/en.json
CHANGED
|
@@ -1283,5 +1283,6 @@
|
|
|
1283
1283
|
"Theme for role": "Theme for role",
|
|
1284
1284
|
"Set theme for each user role »": "Set theme for each user role »",
|
|
1285
1285
|
"Available themes": "Available themes",
|
|
1286
|
-
"Install more themes »": "Install more themes »"
|
|
1286
|
+
"Install more themes »": "Install more themes »",
|
|
1287
|
+
"Configure action": "Configure action"
|
|
1287
1288
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/server",
|
|
3
|
-
"version": "0.9.1-beta.
|
|
3
|
+
"version": "0.9.1-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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@aws-sdk/client-s3": "^3.451.0",
|
|
10
|
-
"@saltcorn/base-plugin": "0.9.1-beta.
|
|
11
|
-
"@saltcorn/builder": "0.9.1-beta.
|
|
12
|
-
"@saltcorn/data": "0.9.1-beta.
|
|
13
|
-
"@saltcorn/admin-models": "0.9.1-beta.
|
|
14
|
-
"@saltcorn/filemanager": "0.9.1-beta.
|
|
15
|
-
"@saltcorn/markup": "0.9.1-beta.
|
|
16
|
-
"@saltcorn/sbadmin2": "0.9.1-beta.
|
|
10
|
+
"@saltcorn/base-plugin": "0.9.1-beta.15",
|
|
11
|
+
"@saltcorn/builder": "0.9.1-beta.15",
|
|
12
|
+
"@saltcorn/data": "0.9.1-beta.15",
|
|
13
|
+
"@saltcorn/admin-models": "0.9.1-beta.15",
|
|
14
|
+
"@saltcorn/filemanager": "0.9.1-beta.15",
|
|
15
|
+
"@saltcorn/markup": "0.9.1-beta.15",
|
|
16
|
+
"@saltcorn/sbadmin2": "0.9.1-beta.15",
|
|
17
17
|
"@socket.io/cluster-adapter": "^0.2.1",
|
|
18
18
|
"@socket.io/sticky": "^1.0.1",
|
|
19
19
|
"adm-zip": "0.5.10",
|
|
@@ -1049,7 +1049,10 @@ function notifyAlert(note, spin) {
|
|
|
1049
1049
|
type = note.type;
|
|
1050
1050
|
}
|
|
1051
1051
|
const { id, html } = buildToast(txt, type, spin);
|
|
1052
|
-
$("#
|
|
1052
|
+
let $modal = $("#scmodal");
|
|
1053
|
+
if ($modal.length && $modal.hasClass("show"))
|
|
1054
|
+
$("#modal-toasts-area").append(html);
|
|
1055
|
+
else $("#toasts-area").append(html);
|
|
1053
1056
|
if (type === "success") {
|
|
1054
1057
|
setTimeout(() => {
|
|
1055
1058
|
$(`#${id}`).removeClass("show");
|
|
@@ -1085,19 +1088,21 @@ function common_done(res, viewname, isWeb = true) {
|
|
|
1085
1088
|
if (Array.isArray(element)) for (const current of element) fn(current);
|
|
1086
1089
|
else fn(element);
|
|
1087
1090
|
};
|
|
1091
|
+
const eval_it = (s) => {
|
|
1092
|
+
if (res.row && res.field_names) {
|
|
1093
|
+
const f = new Function(`viewname, row, {${res.field_names}}`, s);
|
|
1094
|
+
const evalres = f(viewname, res.row, res.row);
|
|
1095
|
+
if (evalres) common_done(evalres, viewname, isWeb);
|
|
1096
|
+
} else {
|
|
1097
|
+
const f = new Function(`viewname`, s);
|
|
1098
|
+
const evalres = f(viewname);
|
|
1099
|
+
if (evalres) common_done(evalres, viewname, isWeb);
|
|
1100
|
+
}
|
|
1101
|
+
};
|
|
1088
1102
|
if (res.notify) handle(res.notify, notifyAlert);
|
|
1089
1103
|
if (res.error)
|
|
1090
1104
|
handle(res.error, (text) => notifyAlert({ type: "danger", text: text }));
|
|
1091
|
-
|
|
1092
|
-
if (res.eval_js && res.row && res.field_names) {
|
|
1093
|
-
const f = new Function(`viewname, row, {${res.field_names}}`, res.eval_js);
|
|
1094
|
-
const evalres = f(viewname, res.row, res.row);
|
|
1095
|
-
if (evalres) common_done(evalres, viewname, isWeb);
|
|
1096
|
-
} else if (res.eval_js) {
|
|
1097
|
-
const f = new Function(`viewname`, res.eval_js);
|
|
1098
|
-
const evalres = f(viewname);
|
|
1099
|
-
if (evalres) common_done(evalres, viewname, isWeb);
|
|
1100
|
-
}
|
|
1105
|
+
if (res.eval_js) handle(res.eval_js, eval_it);
|
|
1101
1106
|
|
|
1102
1107
|
if (res.reload_page) {
|
|
1103
1108
|
(isWeb ? location : parent).reload(); //TODO notify to cookie if reload or goto
|
package/public/saltcorn.js
CHANGED
|
@@ -135,6 +135,29 @@ $(function () {
|
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
function reload_embedded_view(viewname) {
|
|
139
|
+
$(`[data-sc-embed-viewname="${viewname}"]`).each(function () {
|
|
140
|
+
const $e = $(this);
|
|
141
|
+
const url =
|
|
142
|
+
$e.attr("data-sc-local-state") || $e.attr("data-sc-view-source");
|
|
143
|
+
if (!url) return;
|
|
144
|
+
const headers = {
|
|
145
|
+
pjaxpageload: "true",
|
|
146
|
+
localizedstate: "true", //no admin bar
|
|
147
|
+
};
|
|
148
|
+
$.ajax(url, {
|
|
149
|
+
headers,
|
|
150
|
+
success: function (res, textStatus, request) {
|
|
151
|
+
$e.html(res);
|
|
152
|
+
initialize_page();
|
|
153
|
+
},
|
|
154
|
+
error: function (res) {
|
|
155
|
+
notifyAlert({ type: "danger", text: res.responseText });
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
138
161
|
function pjax_to(href, e) {
|
|
139
162
|
let $modal = $("#scmodal");
|
|
140
163
|
const inModal = $modal.length && $modal.hasClass("show");
|
|
@@ -281,6 +304,13 @@ function ensure_modal_exists_and_closed() {
|
|
|
281
304
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
|
|
282
305
|
</button>
|
|
283
306
|
</div>
|
|
307
|
+
<div
|
|
308
|
+
id="modal-toasts-area"
|
|
309
|
+
class="toast-container position-fixed top-0 end-0 p-2 "
|
|
310
|
+
style: "z-index: 7000;"
|
|
311
|
+
aria-live="polite"
|
|
312
|
+
aria-atomic="true">
|
|
313
|
+
</div>
|
|
284
314
|
</div>
|
|
285
315
|
<div class="modal-body">
|
|
286
316
|
<p>Modal body text goes here.</p>
|
|
@@ -292,9 +322,9 @@ function ensure_modal_exists_and_closed() {
|
|
|
292
322
|
// remove reload handler added by edit, for when we have popup link
|
|
293
323
|
// in autosave edit in popup
|
|
294
324
|
$("#scmodal").off("hidden.bs.modal");
|
|
295
|
-
|
|
296
325
|
close_saltcorn_modal();
|
|
297
326
|
}
|
|
327
|
+
$("#modal-toasts-area").empty();
|
|
298
328
|
}
|
|
299
329
|
|
|
300
330
|
function expand_thumbnail(img_id, filename) {
|
package/routes/actions.js
CHANGED
|
@@ -400,7 +400,7 @@ router.get(
|
|
|
400
400
|
{ class: "ms-3" },
|
|
401
401
|
trigger.action,
|
|
402
402
|
table ? ` on ` + a({ href: `/table/${table.name}` }, table.name) : ""
|
|
403
|
-
);
|
|
403
|
+
) + a({href: `/actions/testrun/${id}`, class: "ms-2" }, req.__("Test run")+" »");
|
|
404
404
|
if (!action) {
|
|
405
405
|
req.flash("warning", req.__("Action not found"));
|
|
406
406
|
res.redirect(`/actions/`);
|
|
@@ -618,7 +618,7 @@ router.get(
|
|
|
618
618
|
let table, row;
|
|
619
619
|
if (trigger.table_id) {
|
|
620
620
|
table = Table.findOne({ id: trigger.table_id });
|
|
621
|
-
row = await table.getRow({});
|
|
621
|
+
row = await table.getRow({}, {orderBy: "RANDOM()"});
|
|
622
622
|
}
|
|
623
623
|
let runres;
|
|
624
624
|
|
|
@@ -665,6 +665,10 @@ router.get(
|
|
|
665
665
|
{ href: `/actions`, class: "mt-4 btn btn-primary me-1" },
|
|
666
666
|
"« " + req.__("back to actions")
|
|
667
667
|
),
|
|
668
|
+
a(
|
|
669
|
+
{ href: `/actions/configure/${trigger.id}`, class: "mt-4 btn btn-primary me-1" },
|
|
670
|
+
req.__("Configure action")
|
|
671
|
+
),
|
|
668
672
|
a(
|
|
669
673
|
{
|
|
670
674
|
href: `/actions/testrun/${id}`,
|
package/routes/menu.js
CHANGED
|
@@ -307,7 +307,16 @@ const menuForm = async (req) => {
|
|
|
307
307
|
name: "location",
|
|
308
308
|
label: req.__("Location"),
|
|
309
309
|
showIf: {
|
|
310
|
-
type: [
|
|
310
|
+
type: [
|
|
311
|
+
"View",
|
|
312
|
+
"Page",
|
|
313
|
+
"Link",
|
|
314
|
+
"Header",
|
|
315
|
+
"Dynamic",
|
|
316
|
+
"Search",
|
|
317
|
+
"Separator",
|
|
318
|
+
"Action",
|
|
319
|
+
],
|
|
311
320
|
},
|
|
312
321
|
sublabel: req.__("Not all themes support all locations"),
|
|
313
322
|
class: "item-menu",
|
|
@@ -317,7 +326,7 @@ const menuForm = async (req) => {
|
|
|
317
326
|
//default: "Standard",
|
|
318
327
|
attributes: {
|
|
319
328
|
inline: true,
|
|
320
|
-
options: "Standard, Mobile Bottom",
|
|
329
|
+
options: "Standard, Mobile Bottom, Secondary Menu",
|
|
321
330
|
},
|
|
322
331
|
},
|
|
323
332
|
],
|