@saltcorn/server 1.1.0-beta.21 → 1.1.0-beta.22

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 CHANGED
@@ -1511,6 +1511,7 @@
1511
1511
  "Allocate new row": "Allocate new row",
1512
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
1513
  "Step traces": "Step traces",
1514
+ "Please enter a version in the format 'x.y.z' (e.g. 0.0.1 with numbers from 0 to 999) or leave it empty.": "Please enter a version in the format 'x.y.z' (e.g. 0.0.1 with numbers from 0 to 999) or leave it empty.",
1514
1515
  "Delete unchanged": "Delete unchanged",
1515
1516
  "Delete allocated row if there are no changes.": "Delete allocated row if there are no changes.",
1516
1517
  "Triggers on table": "Triggers on table"
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "1.1.0-beta.21",
3
+ "version": "1.1.0-beta.22",
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.21",
11
- "@saltcorn/builder": "1.1.0-beta.21",
12
- "@saltcorn/data": "1.1.0-beta.21",
13
- "@saltcorn/admin-models": "1.1.0-beta.21",
14
- "@saltcorn/filemanager": "1.1.0-beta.21",
15
- "@saltcorn/markup": "1.1.0-beta.21",
16
- "@saltcorn/plugins-loader": "1.1.0-beta.21",
17
- "@saltcorn/sbadmin2": "1.1.0-beta.21",
10
+ "@saltcorn/base-plugin": "1.1.0-beta.22",
11
+ "@saltcorn/builder": "1.1.0-beta.22",
12
+ "@saltcorn/data": "1.1.0-beta.22",
13
+ "@saltcorn/admin-models": "1.1.0-beta.22",
14
+ "@saltcorn/filemanager": "1.1.0-beta.22",
15
+ "@saltcorn/markup": "1.1.0-beta.22",
16
+ "@saltcorn/plugins-loader": "1.1.0-beta.22",
17
+ "@saltcorn/sbadmin2": "1.1.0-beta.22",
18
18
  "@socket.io/cluster-adapter": "^0.2.1",
19
19
  "@socket.io/sticky": "^1.0.1",
20
20
  "adm-zip": "0.5.10",
@@ -745,15 +745,27 @@ function doMobileTransforms() {
745
745
  const normalisePluginsPrefix = (path) => {
746
746
  if (path.startsWith("/plugins/") || path.startsWith("plugins/"))
747
747
  return path.replace(/\/?plugins\//, "sc_plugins/");
748
- return path;
748
+ return null;
749
749
  };
750
750
  $("link").each(function () {
751
751
  const path = $(this).attr("href");
752
- if (path) $(this).attr("href", normalisePluginsPrefix(path));
752
+ if (path) {
753
+ const newPath = normalisePluginsPrefix(path);
754
+ if (newPath) {
755
+ $(this).attr("href", newPath);
756
+ console.log("transformed link", path, newPath);
757
+ }
758
+ }
753
759
  });
754
760
  $("script").each(function () {
755
761
  const path = $(this).attr("src");
756
- if (path) $(this).attr("src", normalisePluginsPrefix(path));
762
+ if (path) {
763
+ const newPath = normalisePluginsPrefix(path);
764
+ if (newPath) {
765
+ $(this).attr("src", newPath);
766
+ console.log("transformed script", path, newPath);
767
+ }
768
+ }
757
769
  });
758
770
 
759
771
  $("a").each(function () {
@@ -1058,7 +1070,11 @@ function initialize_page() {
1058
1070
  </form>`
1059
1071
  );
1060
1072
  });
1061
- if (!isNode) doMobileTransforms();
1073
+ if (!isNode) {
1074
+ doMobileTransforms();
1075
+ const anchor = parent.saltcorn.mobileApp.navigation.getAnchor();
1076
+ if (anchor) $(`[href="#${anchor}"][data-bs-toggle="tab"]`).tab("show");
1077
+ }
1062
1078
  function setExplainer(that) {
1063
1079
  var id = $(that).attr("id") + "_explainer";
1064
1080
 
@@ -1201,7 +1217,6 @@ function initialize_page() {
1201
1217
  $(initialize_page);
1202
1218
 
1203
1219
  function cancel_inline_edit(e, opts1) {
1204
- const isNode = getIsNode();
1205
1220
  var opts = JSON.parse(decodeURIComponent(opts1 || "") || "{}");
1206
1221
  var form = $(e.target).closest("form");
1207
1222
  form.replaceWith(opts.resetHtml);
@@ -613,4 +613,8 @@ i[class^="unicode-"], i[class*=" unicode-"] {
613
613
  background-color: #212529;
614
614
  border-color: #32383e;
615
615
  color: #fff;
616
+ }
617
+
618
+ .mobile-toast-margin {
619
+ margin-bottom: 1.0rem
616
620
  }
package/routes/actions.js CHANGED
@@ -1669,7 +1669,7 @@ router.post(
1669
1669
  })
1670
1670
  );
1671
1671
 
1672
- const getWorkflowStepUserForm = async (run, trigger, step, user) => {
1672
+ const getWorkflowStepUserForm = async (run, trigger, step, req) => {
1673
1673
  const qTypeToField = (q) => {
1674
1674
  switch (q.qtype) {
1675
1675
  case "Yes/No":
@@ -1700,7 +1700,7 @@ const getWorkflowStepUserForm = async (run, trigger, step, user) => {
1700
1700
  const form = new Form({
1701
1701
  action: `/actions/fill-workflow-form/${run.id}`,
1702
1702
  blurb: run.wait_info.output || step.configuration?.form_header || "",
1703
- formStyle: run.wait_info.output ? "vert" : undefined,
1703
+ formStyle: run.wait_info.output || req.xhr ? "vert" : undefined,
1704
1704
  fields: (step.configuration.user_form_questions || []).map((q) => ({
1705
1705
  label: q.label,
1706
1706
  name: q.var_name,
@@ -1732,7 +1732,7 @@ router.get(
1732
1732
  name: run.current_step,
1733
1733
  });
1734
1734
 
1735
- const form = await getWorkflowStepUserForm(run, trigger, step, req.user);
1735
+ const form = await getWorkflowStepUserForm(run, trigger, step, req);
1736
1736
  if (req.xhr) form.xhrSubmit = true;
1737
1737
  const title = run.wait_info.output ? "Workflow output" : "Fill form";
1738
1738
  res.sendWrap(title, renderForm(form, req.csrfToken()));
@@ -1760,7 +1760,7 @@ router.post(
1760
1760
  name: run.current_step,
1761
1761
  });
1762
1762
 
1763
- const form = await getWorkflowStepUserForm(run, trigger, step, req.user);
1763
+ const form = await getWorkflowStepUserForm(run, trigger, step, req);
1764
1764
  form.validate(req.body);
1765
1765
  if (form.hasErrors) {
1766
1766
  const title = "Fill form";
@@ -1831,11 +1831,12 @@ help file to explain steps, and context
1831
1831
  action explainer
1832
1832
  workflow actions: ForLoop, EndForLoop, ReadFile, WriteFile, APIResponse
1833
1833
 
1834
- interactive workflows for not logged in
1835
- correctly suggest new step name
1836
- show end node in diagram
1834
+ correctly suggest new step name - on step cfg load
1837
1835
 
1838
1836
  Error handlers
1837
+ interactive workflows for not logged in
1838
+ show end node in diagram
1839
+ actions can declare which variables they inject into scope
1839
1840
 
1840
1841
  show unconnected steps
1841
1842
  why is code not initialising
package/routes/admin.js CHANGED
@@ -1992,6 +1992,21 @@ const buildDialogScript = (capacitorBuilderAvailable, isSbadmin2) =>
1992
1992
  function handleMessages() {
1993
1993
  notifyAlert("Building the app, please wait.", true)
1994
1994
  }
1995
+ const versionPattern = /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/;
1996
+ ${domReady(`
1997
+ const versionInput = document.getElementById('appVersionInputId');
1998
+ if (versionInput) {
1999
+ versionInput.addEventListener('change', () => {
2000
+ const version = versionInput.value;
2001
+ if ((version !== '0.0.0' && versionPattern.test(version)) || version === "")
2002
+ versionInput.classList.remove('is-invalid');
2003
+ else
2004
+ versionInput.classList.add('is-invalid');
2005
+ });
2006
+ }
2007
+ else
2008
+ console.error('versionInput not found');
2009
+ `)}
1995
2010
  </script>`;
1996
2011
 
1997
2012
  const imageAvailable = async () => {
@@ -2379,9 +2394,15 @@ router.get(
2379
2394
  class: "form-control",
2380
2395
  name: "appVersion",
2381
2396
  id: "appVersionInputId",
2382
- placeholder: "1.0.0",
2397
+ placeholder: "0.0.1",
2383
2398
  value: builderSettings.appVersion || "",
2384
- })
2399
+ }),
2400
+ div(
2401
+ { class: "invalid-feedback" },
2402
+ req.__(
2403
+ "Please enter a version in the format 'x.y.z' (e.g. 0.0.1 with numbers from 0 to 999) or leave it empty."
2404
+ )
2405
+ )
2385
2406
  )
2386
2407
  ),
2387
2408
  // server url
@@ -3244,6 +3265,16 @@ router.post(
3244
3265
  error: req.__("Please enter a valid server URL."),
3245
3266
  });
3246
3267
  }
3268
+ if (
3269
+ (appVersion && !/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(appVersion)) ||
3270
+ appVersion === "0.0.0"
3271
+ ) {
3272
+ return res.json({
3273
+ error: req.__(
3274
+ "Please enter a version in the format 'x.y.z' (e.g. 0.0.1 with numbers from 0 to 999) or leave it empty."
3275
+ ),
3276
+ });
3277
+ }
3247
3278
  if (iOSPlatform && !provisioningProfile) {
3248
3279
  return res.json({
3249
3280
  error: req.__(