@saltcorn/server 0.9.6-beta.0 → 0.9.6-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/locales/en.json CHANGED
@@ -1416,5 +1416,14 @@
1416
1416
  "Description header": "Description header",
1417
1417
  "Lazy load views": "Lazy load views",
1418
1418
  "Log IP address": "Log IP address",
1419
- "Record the request IP address in log messages": "Record the request IP address in log messages"
1419
+ "Record the request IP address in log messages": "Record the request IP address in log messages",
1420
+ "App ID": "App ID",
1421
+ "Build type": "Build type",
1422
+ "debug": "debug",
1423
+ "release": "release",
1424
+ "Keystore File": "Keystore File",
1425
+ "Keystore Alias": "Keystore Alias",
1426
+ "Keystore Password": "Keystore Password",
1427
+ "xcodebuild": "xcodebuild",
1428
+ "Provisioning Profile": "Provisioning Profile"
1420
1429
  }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.9.6-beta.0",
3
+ "version": "0.9.6-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
9
  "@aws-sdk/client-s3": "^3.451.0",
10
- "@saltcorn/base-plugin": "0.9.6-beta.0",
11
- "@saltcorn/builder": "0.9.6-beta.0",
12
- "@saltcorn/data": "0.9.6-beta.0",
13
- "@saltcorn/admin-models": "0.9.6-beta.0",
14
- "@saltcorn/filemanager": "0.9.6-beta.0",
15
- "@saltcorn/markup": "0.9.6-beta.0",
16
- "@saltcorn/plugins-loader": "0.9.6-beta.0",
17
- "@saltcorn/sbadmin2": "0.9.6-beta.0",
10
+ "@saltcorn/base-plugin": "0.9.6-beta.2",
11
+ "@saltcorn/builder": "0.9.6-beta.2",
12
+ "@saltcorn/data": "0.9.6-beta.2",
13
+ "@saltcorn/admin-models": "0.9.6-beta.2",
14
+ "@saltcorn/filemanager": "0.9.6-beta.2",
15
+ "@saltcorn/markup": "0.9.6-beta.2",
16
+ "@saltcorn/plugins-loader": "0.9.6-beta.2",
17
+ "@saltcorn/sbadmin2": "0.9.6-beta.2",
18
18
  "@socket.io/cluster-adapter": "^0.2.1",
19
19
  "@socket.io/sticky": "^1.0.1",
20
20
  "adm-zip": "0.5.10",
@@ -751,6 +751,42 @@ function removeSpinner(elementId, orginalHtml) {
751
751
  $(`#${elementId}`).html(orginalHtml);
752
752
  }
753
753
 
754
+ function builderMenuChanged(e) {
755
+ const form = $(e);
756
+ const params = {};
757
+ form.serializeArray().forEach((item) => {
758
+ params[item.name] = item.value;
759
+ });
760
+ params.synchedTables = Array.from($("#synched-tbls-select-id")[0].options)
761
+ .filter((option) => !option.hidden)
762
+ .map((option) => option.value);
763
+ const pluginsSelect = $("#included-plugins-select-id")[0];
764
+ params.includedPlugins = Array.from(pluginsSelect.options || []).map(
765
+ (option) => option.value
766
+ );
767
+ const indicator = $(".sc-ajax-indicator");
768
+ indicator.attr("title", "Saving the configuration");
769
+ indicator.attr("style", "display: inline-block;");
770
+ const icon = $(".fa-save, .fa-exclamation-triangle");
771
+ icon.attr("class", "fas fa-save");
772
+ const setErrorIcon = () => {
773
+ icon.attr("class", "fas fa-exclamation-triangle");
774
+ icon.attr("style", "color: #ff0033!important;");
775
+ indicator.attr("title", "Unable to save the configuration");
776
+ };
777
+ $.ajax("/admin/mobile-app/save-config", {
778
+ type: "POST",
779
+ data: params,
780
+ success: function (res) {
781
+ if (res.success) indicator.attr("style", "display: none;");
782
+ else setErrorIcon();
783
+ },
784
+ error: function (res) {
785
+ setErrorIcon();
786
+ },
787
+ });
788
+ }
789
+
754
790
  function poll_mobile_build_finished(outDirName, pollCount, orginalBtnHtml) {
755
791
  $.ajax("/admin/build-mobile-app/finished", {
756
792
  type: "GET",
@@ -898,26 +934,32 @@ function move_to_synched() {
898
934
  const opts = $("#unsynched-tbls-select-id");
899
935
  $("#synched-tbls-select-id").removeAttr("selected");
900
936
  for (const selected of opts.val()) {
901
- const jUnsOpt = $(`[id='${selected}_unsynched_opt']`);
902
- jUnsOpt.attr("hidden", "true");
903
- jUnsOpt.removeAttr("selected");
904
- const jSynOpt = $(`[id='${selected}_synched_opt']`);
905
- jSynOpt.removeAttr("hidden");
906
- jSynOpt.removeAttr("selected");
937
+ $(`[id='${selected}_unsynched_opt']`).remove();
938
+ $("#synched-tbls-select-id").append(
939
+ $("<option>", {
940
+ value: selected,
941
+ label: selected,
942
+ id: `${selected}_synched_opt`,
943
+ })
944
+ );
907
945
  }
946
+ $("#buildMobileAppForm").trigger("change");
908
947
  }
909
948
 
910
949
  function move_to_unsynched() {
911
950
  const opts = $("#synched-tbls-select-id");
912
951
  $("#unsynched-tbls-select-id").removeAttr("selected");
913
952
  for (const selected of opts.val()) {
914
- const jSynOpt = $(`[id='${selected}_synched_opt']`);
915
- jSynOpt.attr("hidden", "true");
916
- jSynOpt.removeAttr("selected");
917
- const jUnsOpt = $(`[id='${selected}_unsynched_opt']`);
918
- jUnsOpt.removeAttr("hidden");
919
- jUnsOpt.removeAttr("selected");
953
+ $(`[id='${selected}_synched_opt']`).remove();
954
+ $("#unsynched-tbls-select-id").append(
955
+ $("<option>", {
956
+ value: selected,
957
+ label: selected,
958
+ id: `${selected}_unsynched_opt`,
959
+ })
960
+ );
920
961
  }
962
+ $("#buildMobileAppForm").trigger("change");
921
963
  }
922
964
 
923
965
  function move_plugin_to_included() {
@@ -933,6 +975,7 @@ function move_plugin_to_included() {
933
975
  })
934
976
  );
935
977
  }
978
+ $("#buildMobileAppForm").trigger("change");
936
979
  }
937
980
 
938
981
  function move_plugin_to_excluded() {
@@ -948,6 +991,7 @@ function move_plugin_to_excluded() {
948
991
  })
949
992
  );
950
993
  }
994
+ $("#buildMobileAppForm").trigger("change");
951
995
  }
952
996
 
953
997
  function toggle_tbl_sync() {
package/routes/actions.js CHANGED
@@ -668,6 +668,7 @@ router.get(
668
668
  // get configuration fields
669
669
  const cfgFields = await getActionConfigFields(action, table, {
670
670
  mode: "trigger",
671
+ when_trigger: trigger.when_trigger,
671
672
  });
672
673
  // create form
673
674
  const form = new Form({
@@ -720,6 +721,7 @@ router.post(
720
721
  } else {
721
722
  const cfgFields = await getActionConfigFields(action, table, {
722
723
  mode: "trigger",
724
+ when_trigger: trigger.when_trigger,
723
725
  });
724
726
  form = new Form({
725
727
  action: `/actions/configure/${id}`,
package/routes/admin.js CHANGED
@@ -1710,11 +1710,14 @@ router.get(
1710
1710
  above: [
1711
1711
  {
1712
1712
  type: "card",
1713
+ titleAjaxIndicator: true,
1713
1714
  title: req.__("Build mobile app"),
1714
1715
  contents: form(
1715
1716
  {
1716
1717
  action: "/admin/build-mobile-app",
1717
1718
  method: "post",
1719
+ onchange: "builderMenuChanged(this)",
1720
+ id: "buildMobileAppForm",
1718
1721
  },
1719
1722
 
1720
1723
  fieldset(
@@ -2178,19 +2181,21 @@ router.get(
2178
2181
  class: "form-control form-select",
2179
2182
  multiple: true,
2180
2183
  },
2181
- withSyncInfo.map((table) =>
2182
- option({
2183
- id: `${table.name}_unsynched_opt`,
2184
- value: table.name,
2185
- label: table.name,
2186
- hidden:
2187
- builderSettings.synchedTables?.indexOf(
2184
+ withSyncInfo
2185
+ .filter(
2186
+ (table) =>
2187
+ !builderSettings.synchedTables ||
2188
+ builderSettings.synchedTables.indexOf(
2188
2189
  table.name
2189
- ) >= 0
2190
- ? true
2191
- : false,
2192
- })
2193
- )
2190
+ ) < 0
2191
+ )
2192
+ .map((table) =>
2193
+ option({
2194
+ id: `${table.name}_unsynched_opt`,
2195
+ value: table.name,
2196
+ label: table.name,
2197
+ })
2198
+ )
2194
2199
  )
2195
2200
  ),
2196
2201
  div(
@@ -2228,19 +2233,20 @@ router.get(
2228
2233
  class: "form-control form-select",
2229
2234
  multiple: true,
2230
2235
  },
2231
- withSyncInfo.map((table) =>
2232
- option({
2233
- id: `${table.name}_synched_opt`,
2234
- value: table.name,
2235
- label: table.name,
2236
- hidden:
2236
+ withSyncInfo
2237
+ .filter(
2238
+ (table) =>
2237
2239
  builderSettings.synchedTables?.indexOf(
2238
2240
  table.name
2239
2241
  ) >= 0
2240
- ? false
2241
- : true,
2242
- })
2243
- )
2242
+ )
2243
+ .map((table) =>
2244
+ option({
2245
+ id: `${table.name}_synched_opt`,
2246
+ value: table.name,
2247
+ label: table.name,
2248
+ })
2249
+ )
2244
2250
  )
2245
2251
  )
2246
2252
  )
@@ -2875,13 +2881,6 @@ router.post(
2875
2881
  ) {
2876
2882
  spawnParams.push("--tenantAppName", db.getTenantSchema());
2877
2883
  }
2878
- const excludedPlugins = (await Plugin.find())
2879
- .filter(
2880
- (plugin) =>
2881
- ["base", "sbadmin2"].indexOf(plugin.name) < 0 &&
2882
- includedPlugins.indexOf(plugin.name) < 0
2883
- )
2884
- .map((plugin) => plugin.name);
2885
2884
 
2886
2885
  if (buildType) spawnParams.push("--buildType", buildType);
2887
2886
  if (keystoreFile) spawnParams.push("--androidKeystore", keystoreFile);
@@ -2889,28 +2888,6 @@ router.post(
2889
2888
  spawnParams.push("--androidKeyStoreAlias", keystoreAlias);
2890
2889
  if (keystorePassword)
2891
2890
  spawnParams.push("--androidKeystorePassword", keystorePassword);
2892
- await getState().setConfig("mobile_builder_settings", {
2893
- entryPoint,
2894
- entryPointType,
2895
- androidPlatform,
2896
- iOSPlatform,
2897
- useDocker,
2898
- appName,
2899
- appId,
2900
- appVersion,
2901
- appIcon,
2902
- serverURL,
2903
- splashPage,
2904
- autoPublicLogin,
2905
- allowOfflineMode,
2906
- synchedTables: synchedTables,
2907
- includedPlugins: includedPlugins,
2908
- excludedPlugins,
2909
- provisioningProfile,
2910
- keystoreFile,
2911
- keystoreAlias,
2912
- buildType,
2913
- });
2914
2891
  // end http call, return the out directory name
2915
2892
  // the gui polls for results
2916
2893
  res.json({ build_dir_name: outDirName });
@@ -3014,6 +2991,29 @@ router.get(
3014
2991
  })
3015
2992
  );
3016
2993
 
2994
+ router.post(
2995
+ "/mobile-app/save-config",
2996
+ isAdmin,
2997
+ error_catcher(async (req, res) => {
2998
+ try {
2999
+ const newCfg = { ...req.body };
3000
+ const excludedPlugins = (await Plugin.find())
3001
+ .filter(
3002
+ (plugin) =>
3003
+ ["base", "sbadmin2"].indexOf(plugin.name) < 0 &&
3004
+ newCfg.includedPlugins.indexOf(plugin.name) < 0
3005
+ )
3006
+ .map((plugin) => plugin.name);
3007
+ newCfg.excludedPlugins = excludedPlugins;
3008
+ await getState().setConfig("mobile_builder_settings", newCfg);
3009
+ res.json({ success: true });
3010
+ } catch (e) {
3011
+ getState().log(1, `Unable to save mobile builder config: ${e.message}`);
3012
+ res.json({ error: e.message });
3013
+ }
3014
+ })
3015
+ );
3016
+
3017
3017
  /**
3018
3018
  * Do Clear All
3019
3019
  * @function
package/routes/fields.js CHANGED
@@ -1156,6 +1156,7 @@ router.post(
1156
1156
  if (!fv) res.send(text(result));
1157
1157
  else res.send(fv.run(result, req, { row, ...configuration }));
1158
1158
  } catch (e) {
1159
+ console.error("show-calculated error", e);
1159
1160
  return res.status(400).send(`Error: ${e.message}`);
1160
1161
  }
1161
1162
  })