@saltcorn/server 1.1.0-beta.12 → 1.1.0-beta.14
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/load_plugins.js +9 -3
- package/locales/en.json +14 -1
- package/locales/pl.json +19 -2
- package/markup/admin.js +1 -0
- package/package.json +9 -9
- package/public/saltcorn-common.js +53 -38
- package/public/saltcorn.js +31 -11
- package/routes/actions.js +895 -4
- package/routes/eventlog.js +36 -0
- package/routes/fields.js +8 -2
- package/routes/tables.js +33 -1
- package/serve.js +1 -5
package/load_plugins.js
CHANGED
|
@@ -97,7 +97,10 @@ const loadPlugin = async (plugin, force, forceFetch) => {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
// load plugin
|
|
100
|
-
const loader = new PluginInstaller(plugin
|
|
100
|
+
const loader = new PluginInstaller(plugin, {
|
|
101
|
+
scVersion: packagejson.version,
|
|
102
|
+
envVars: { PUPPETEER_SKIP_DOWNLOAD: true },
|
|
103
|
+
});
|
|
101
104
|
const res = await loader.install(force);
|
|
102
105
|
const configuration =
|
|
103
106
|
typeof plugin.configuration === "string"
|
|
@@ -162,7 +165,10 @@ const reloadAuthFromRoot = () => {
|
|
|
162
165
|
* @returns {Promise<{plugin_module: *}|{plugin_module: any}>}
|
|
163
166
|
*/
|
|
164
167
|
const requirePlugin = async (plugin, force) => {
|
|
165
|
-
const loader = new PluginInstaller(plugin
|
|
168
|
+
const loader = new PluginInstaller(plugin, {
|
|
169
|
+
scVersion: packagejson.version,
|
|
170
|
+
envVars: { PUPPETEER_SKIP_DOWNLOAD: true },
|
|
171
|
+
});
|
|
166
172
|
return await loader.install(force);
|
|
167
173
|
};
|
|
168
174
|
|
|
@@ -231,7 +237,7 @@ const loadAndSaveNewPlugin = async (
|
|
|
231
237
|
const loadMsgs = [];
|
|
232
238
|
const loader = new PluginInstaller(plugin, {
|
|
233
239
|
scVersion: packagejson.version,
|
|
234
|
-
envVars: { PUPPETEER_SKIP_DOWNLOAD:
|
|
240
|
+
envVars: { PUPPETEER_SKIP_DOWNLOAD: true },
|
|
235
241
|
});
|
|
236
242
|
const { version, plugin_module, location, loadedWithReload, msgs } =
|
|
237
243
|
await loader.install(force);
|
package/locales/en.json
CHANGED
|
@@ -1497,5 +1497,18 @@
|
|
|
1497
1497
|
"Capacitor builder": "Capacitor builder",
|
|
1498
1498
|
"Pulling the capacitor-builder docker image...": "Pulling the capacitor-builder docker image...",
|
|
1499
1499
|
"Pull done with code %s": "Pull done with code %s",
|
|
1500
|
-
"Default locale": "Default locale"
|
|
1500
|
+
"Default locale": "Default locale",
|
|
1501
|
+
"Next step": "Next step",
|
|
1502
|
+
"Step name": "Step name",
|
|
1503
|
+
"Step saved": "Step saved",
|
|
1504
|
+
"Initial step": "Initial step",
|
|
1505
|
+
"Confirm leaving unsaved": "Confirm leaving unsaved",
|
|
1506
|
+
"Ask the user to confirm if they close a tab with unsaved changes": "Ask the user to confirm if they close a tab with unsaved changes",
|
|
1507
|
+
"Workflow runs": "Workflow runs",
|
|
1508
|
+
"Workflow run": "Workflow run",
|
|
1509
|
+
"Share to enabled": "Share to enabled",
|
|
1510
|
+
"Enable the share to feature": "Enable the share to feature",
|
|
1511
|
+
"Allocate new row": "Allocate new row",
|
|
1512
|
+
"If the view is run without existing row, allocate a new row on load. Defaults must be set on all required fields.": "If the view is run without existing row, allocate a new row on load. Defaults must be set on all required fields.",
|
|
1513
|
+
"Step traces": "Step traces"
|
|
1501
1514
|
}
|
package/locales/pl.json
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"If you did not request this, please ignore this email.": "Jeżeli nie żądałeś tego, nie klikaj w poniższy link.",
|
|
58
58
|
"Your password will not change until you access the link above and set a new one.": "Twoje hasło nie ulegnie zmianie dopóki nie klikniesz w powyższy link i nie ustawisz nowego hasła.",
|
|
59
59
|
"Change my password": "Zmień moje hasło",
|
|
60
|
-
"Must be admin": "
|
|
60
|
+
"Must be admin": "Musisz być adminem",
|
|
61
61
|
"Site identity": "Tożsamość strony",
|
|
62
62
|
"Authentication": "Uwierzytelnianie",
|
|
63
63
|
"Development": "Development",
|
|
@@ -1491,5 +1491,22 @@
|
|
|
1491
1491
|
"Login and signup views should be accessible by public users": "Widoki logowania i rejestracji powinny być dostępne dla użytkowników publicznych",
|
|
1492
1492
|
"Shared: %s": "Udostępnione: %s",
|
|
1493
1493
|
"Sharing not enabled": "Udostępnianie nie jest włączone",
|
|
1494
|
-
"You must be logged in to share": "Musisz być zalogowany, aby udostępniać"
|
|
1494
|
+
"You must be logged in to share": "Musisz być zalogowany, aby udostępniać",
|
|
1495
|
+
"Fluid layout": "Układ elastyczny",
|
|
1496
|
+
"Request fluid layout from theme for a wider display for this page": "Poproś o elastyczny układ z motywu, aby zapewnić szerszy widok dla tej strony",
|
|
1497
|
+
"Location of view to create new row": "Lokalizacja widoku do utworzenia nowego wiersza",
|
|
1498
|
+
"Capacitor builder": "Capacitor builder",
|
|
1499
|
+
"Pulling the capacitor-builder docker image...": "Pobieranie obrazu Docker capacitor-builder...",
|
|
1500
|
+
"Pull done with code %s": "Pobieranie zakończone z kodem %s",
|
|
1501
|
+
"Default locale": "Domyślny język/region",
|
|
1502
|
+
"Next step": "Następny krok",
|
|
1503
|
+
"Step name": "Nazwa kroku",
|
|
1504
|
+
"Step saved": "Krok zapisany",
|
|
1505
|
+
"Initial step": "Początkowy krok",
|
|
1506
|
+
"Confirm leaving unsaved": "Potwierdzenie opuszczenia bez zapisania",
|
|
1507
|
+
"Ask the user to confirm if they close a tab with unsaved changes": "Poproś użytkownika o potwierdzenie, czy chce zamknąć kartę z niezapisanymi zmianami",
|
|
1508
|
+
"Workflow runs": "Przepływ pracy jest uruchomiony",
|
|
1509
|
+
"Workflow run": "Uruchomienie przepływu pracy",
|
|
1510
|
+
"Share to enabled": "Udostępnij włączone",
|
|
1511
|
+
"Enable the share to feature": "Włącz udostępnianie funkcji"
|
|
1495
1512
|
}
|
package/markup/admin.js
CHANGED
|
@@ -310,6 +310,7 @@ const send_events_page = (args) => {
|
|
|
310
310
|
{ text: "Custom", href: "/eventlog/custom" },
|
|
311
311
|
{ text: "Settings", href: "/eventlog/settings" },
|
|
312
312
|
{ text: "Event log", href: "/eventlog" },
|
|
313
|
+
{ text: "Workflow runs", href: "/actions/runs" },
|
|
313
314
|
...(isRoot ? [{ text: "Crash log", href: "/crashlog" }] : []),
|
|
314
315
|
],
|
|
315
316
|
...args,
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/server",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.14",
|
|
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": "1.1.0-beta.
|
|
11
|
-
"@saltcorn/builder": "1.1.0-beta.
|
|
12
|
-
"@saltcorn/data": "1.1.0-beta.
|
|
13
|
-
"@saltcorn/admin-models": "1.1.0-beta.
|
|
14
|
-
"@saltcorn/filemanager": "1.1.0-beta.
|
|
15
|
-
"@saltcorn/markup": "1.1.0-beta.
|
|
16
|
-
"@saltcorn/plugins-loader": "1.1.0-beta.
|
|
17
|
-
"@saltcorn/sbadmin2": "1.1.0-beta.
|
|
10
|
+
"@saltcorn/base-plugin": "1.1.0-beta.14",
|
|
11
|
+
"@saltcorn/builder": "1.1.0-beta.14",
|
|
12
|
+
"@saltcorn/data": "1.1.0-beta.14",
|
|
13
|
+
"@saltcorn/admin-models": "1.1.0-beta.14",
|
|
14
|
+
"@saltcorn/filemanager": "1.1.0-beta.14",
|
|
15
|
+
"@saltcorn/markup": "1.1.0-beta.14",
|
|
16
|
+
"@saltcorn/plugins-loader": "1.1.0-beta.14",
|
|
17
|
+
"@saltcorn/sbadmin2": "1.1.0-beta.14",
|
|
18
18
|
"@socket.io/cluster-adapter": "^0.2.1",
|
|
19
19
|
"@socket.io/sticky": "^1.0.1",
|
|
20
20
|
"adm-zip": "0.5.10",
|
|
@@ -40,6 +40,19 @@ $(window).resize(() => {
|
|
|
40
40
|
setScreenInfoCookie();
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
function get_current_state_url(e) {
|
|
44
|
+
const localizer = e ? $(e).closest("[data-sc-local-state]") : [];
|
|
45
|
+
let $modal = $("#scmodal");
|
|
46
|
+
if (localizer.length) {
|
|
47
|
+
const localState = localizer.attr("data-sc-local-state") || "";
|
|
48
|
+
return localState;
|
|
49
|
+
} else if ($modal.length === 0 || !$modal.hasClass("show"))
|
|
50
|
+
return getIsNode()
|
|
51
|
+
? window.location.href
|
|
52
|
+
: parent.saltcorn.mobileApp.navigation.currentUrl();
|
|
53
|
+
else return $modal.prop("data-modal-state");
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
//avoids hiding in overflow:hidden
|
|
44
57
|
function init_bs5_dropdowns() {
|
|
45
58
|
$("body").on(
|
|
@@ -704,7 +717,7 @@ function doMobileTransforms() {
|
|
|
704
717
|
href: [
|
|
705
718
|
{
|
|
706
719
|
web: "javascript:history.back()",
|
|
707
|
-
mobile: "javascript:parent.goBack()",
|
|
720
|
+
mobile: "javascript:parent.saltcorn.mobileApp.navigation.goBack()",
|
|
708
721
|
},
|
|
709
722
|
{
|
|
710
723
|
web: "javascript:ajax_modal",
|
|
@@ -714,7 +727,7 @@ function doMobileTransforms() {
|
|
|
714
727
|
onclick: [
|
|
715
728
|
{
|
|
716
729
|
web: "history.back()",
|
|
717
|
-
mobile: "parent.goBack()",
|
|
730
|
+
mobile: "parent.saltcorn.mobileApp.navigation.goBack()",
|
|
718
731
|
},
|
|
719
732
|
{
|
|
720
733
|
web: "ajax_modal",
|
|
@@ -823,48 +836,46 @@ function doMobileTransforms() {
|
|
|
823
836
|
});
|
|
824
837
|
|
|
825
838
|
$("[mobile-img-path]").each(async function () {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
839
|
+
const fileId = $(this).attr("mobile-img-path");
|
|
840
|
+
const base64Encoded =
|
|
841
|
+
await parent.saltcorn.mobileApp.common.loadEncodedFile(fileId);
|
|
842
|
+
this.src = base64Encoded;
|
|
831
843
|
});
|
|
832
844
|
|
|
833
845
|
$("[mobile-bg-img-path]").each(async function () {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
}
|
|
846
|
+
const fileId = $(this).attr("mobile-bg-img-path");
|
|
847
|
+
if (fileId) {
|
|
848
|
+
const base64Encoded =
|
|
849
|
+
await parent.saltcorn.mobileApp.common.loadEncodedFile(fileId);
|
|
850
|
+
this.style.backgroundImage = `url("${base64Encoded}")`;
|
|
840
851
|
}
|
|
841
852
|
});
|
|
842
853
|
|
|
843
854
|
$("img:not([mobile-img-path]):not([mobile-bg-img-path])").each(
|
|
844
855
|
async function () {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
856
|
+
const jThis = $(this);
|
|
857
|
+
const src = jThis.attr("src");
|
|
858
|
+
if (src?.includes("/files/serve/")) {
|
|
859
|
+
const tokens = src.split("/files/serve/");
|
|
860
|
+
if (tokens.length > 1) {
|
|
861
|
+
const fileId = tokens[1];
|
|
862
|
+
const base64Encoded =
|
|
863
|
+
await parent.saltcorn.mobileApp.common.loadEncodedFile(fileId);
|
|
864
|
+
this.src = base64Encoded;
|
|
865
|
+
}
|
|
866
|
+
} else if (src?.includes("/files/resize/")) {
|
|
867
|
+
const tokens = src.split("/files/resize/");
|
|
868
|
+
if (tokens.length > 1) {
|
|
869
|
+
const idAndDims = tokens[1].split("/");
|
|
870
|
+
const width = idAndDims[0];
|
|
871
|
+
const height = idAndDims.length > 2 ? idAndDims[1] : undefined;
|
|
872
|
+
const fileId = idAndDims[idAndDims.length - 1];
|
|
873
|
+
const style = { width: `${width || 50}px` };
|
|
874
|
+
if (height > 0) style.height = `${height}px`;
|
|
875
|
+
const base64Encoded =
|
|
876
|
+
await parent.saltcorn.mobileApp.common.loadEncodedFile(fileId);
|
|
877
|
+
this.src = base64Encoded;
|
|
878
|
+
jThis.css(style);
|
|
868
879
|
}
|
|
869
880
|
}
|
|
870
881
|
}
|
|
@@ -1569,14 +1580,15 @@ async function common_done(res, viewnameOrElem, isWeb = true) {
|
|
|
1569
1580
|
});
|
|
1570
1581
|
}
|
|
1571
1582
|
if (res.eval_js) await handle(res.eval_js, eval_it);
|
|
1583
|
+
/// TODO got and resume_workflow - use localStorage
|
|
1572
1584
|
if (res.goto) {
|
|
1573
1585
|
if (!isWeb) {
|
|
1574
1586
|
const next = new URL(res.goto, "http://localhost");
|
|
1575
1587
|
const pathname = next.pathname;
|
|
1576
1588
|
if (pathname.startsWith("/view/") || pathname.startsWith("/page/")) {
|
|
1577
1589
|
const route = `get${pathname}${next.search ? "?" + next.search : ""}`;
|
|
1578
|
-
await parent.handleRoute(route);
|
|
1579
|
-
} else parent.cordova.InAppBrowser.open(res.goto, "_system");
|
|
1590
|
+
await parent.saltcorn.mobileApp.navigation.handleRoute(route);
|
|
1591
|
+
} else parent.cordova.InAppBrowser.open(res.goto, "_system"); // TODO
|
|
1580
1592
|
} else if (res.target === "_blank") window.open(res.goto, "_blank").focus();
|
|
1581
1593
|
else {
|
|
1582
1594
|
const prev = new URL(window.location.href);
|
|
@@ -1591,6 +1603,9 @@ async function common_done(res, viewnameOrElem, isWeb = true) {
|
|
|
1591
1603
|
location.reload();
|
|
1592
1604
|
}
|
|
1593
1605
|
}
|
|
1606
|
+
if (res.resume_workflow) {
|
|
1607
|
+
ajax_post_json(`/actions/resume-workflow/${res.resume_workflow}`, {});
|
|
1608
|
+
}
|
|
1594
1609
|
if (res.reload_page) {
|
|
1595
1610
|
(isWeb ? location : parent).reload(); //TODO notify to cookie if reload or goto
|
|
1596
1611
|
}
|
package/public/saltcorn.js
CHANGED
|
@@ -84,17 +84,6 @@ function removeQueryStringParameter(uri1, key) {
|
|
|
84
84
|
return uri + hash;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
function get_current_state_url(e) {
|
|
88
|
-
const localizer = e ? $(e).closest("[data-sc-local-state]") : [];
|
|
89
|
-
let $modal = $("#scmodal");
|
|
90
|
-
if (localizer.length) {
|
|
91
|
-
const localState = localizer.attr("data-sc-local-state") || "";
|
|
92
|
-
return localState;
|
|
93
|
-
} else if ($modal.length === 0 || !$modal.hasClass("show"))
|
|
94
|
-
return window.location.href;
|
|
95
|
-
else return $modal.prop("data-modal-state");
|
|
96
|
-
}
|
|
97
|
-
|
|
98
87
|
function select_id(id, e) {
|
|
99
88
|
pjax_to(updateQueryStringParameter(get_current_state_url(e), "id", id), e);
|
|
100
89
|
}
|
|
@@ -423,6 +412,27 @@ function saveAndContinueAsync(e) {
|
|
|
423
412
|
});
|
|
424
413
|
}
|
|
425
414
|
|
|
415
|
+
function saveAndContinueIfValid(e, k, event) {
|
|
416
|
+
//wait for applyShowIf
|
|
417
|
+
setTimeout(() => {
|
|
418
|
+
if (
|
|
419
|
+
event &&
|
|
420
|
+
event.target &&
|
|
421
|
+
event.target.classList &&
|
|
422
|
+
event.target.classList.contains("no-form-change")
|
|
423
|
+
)
|
|
424
|
+
return;
|
|
425
|
+
var form = $(e).closest("form");
|
|
426
|
+
|
|
427
|
+
if (form[0].checkValidity?.() === false) {
|
|
428
|
+
form[0].reportValidity();
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
saveAndContinue(e, k, event);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
|
|
426
436
|
function saveAndContinue(e, k, event) {
|
|
427
437
|
if (
|
|
428
438
|
event &&
|
|
@@ -432,6 +442,7 @@ function saveAndContinue(e, k, event) {
|
|
|
432
442
|
)
|
|
433
443
|
return;
|
|
434
444
|
var form = $(e).closest("form");
|
|
445
|
+
|
|
435
446
|
let focusedEl = null;
|
|
436
447
|
if (!event || !event.srcElement) {
|
|
437
448
|
const el = form.find("select[sc-received-focus]")[0];
|
|
@@ -460,6 +471,7 @@ function saveAndContinue(e, k, event) {
|
|
|
460
471
|
data: form_data,
|
|
461
472
|
success: function (res) {
|
|
462
473
|
ajax_indicator(false);
|
|
474
|
+
form.removeAttr("data-unsaved-changes");
|
|
463
475
|
form.parent().find(".full-form-error").text("");
|
|
464
476
|
if (res.id && form.find("input[name=id")) {
|
|
465
477
|
form.append(
|
|
@@ -1189,6 +1201,14 @@ function installPWA() {
|
|
|
1189
1201
|
}
|
|
1190
1202
|
}
|
|
1191
1203
|
|
|
1204
|
+
function check_unsaved_form(event, script_tag) {
|
|
1205
|
+
const form = $(script_tag).parent().find("form");
|
|
1206
|
+
if (form.attr("data-unsaved-changes")) {
|
|
1207
|
+
event.preventDefault();
|
|
1208
|
+
event.returnValue = true;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1192
1212
|
(() => {
|
|
1193
1213
|
const e = document.querySelector("[data-sidebar-toggler]");
|
|
1194
1214
|
let closed = localStorage.getItem("sidebarClosed") === "true";
|