@saltcorn/server 1.1.0-beta.12 → 1.1.0-beta.13

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 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: "1" },
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,7 @@
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
+ "Confirm leaving unsaved": "Confirm leaving unsaved",
1502
+ "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"
1501
1503
  }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "1.1.0-beta.12",
3
+ "version": "1.1.0-beta.13",
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.12",
11
- "@saltcorn/builder": "1.1.0-beta.12",
12
- "@saltcorn/data": "1.1.0-beta.12",
13
- "@saltcorn/admin-models": "1.1.0-beta.12",
14
- "@saltcorn/filemanager": "1.1.0-beta.12",
15
- "@saltcorn/markup": "1.1.0-beta.12",
16
- "@saltcorn/plugins-loader": "1.1.0-beta.12",
17
- "@saltcorn/sbadmin2": "1.1.0-beta.12",
10
+ "@saltcorn/base-plugin": "1.1.0-beta.13",
11
+ "@saltcorn/builder": "1.1.0-beta.13",
12
+ "@saltcorn/data": "1.1.0-beta.13",
13
+ "@saltcorn/admin-models": "1.1.0-beta.13",
14
+ "@saltcorn/filemanager": "1.1.0-beta.13",
15
+ "@saltcorn/markup": "1.1.0-beta.13",
16
+ "@saltcorn/plugins-loader": "1.1.0-beta.13",
17
+ "@saltcorn/sbadmin2": "1.1.0-beta.13",
18
18
  "@socket.io/cluster-adapter": "^0.2.1",
19
19
  "@socket.io/sticky": "^1.0.1",
20
20
  "adm-zip": "0.5.10",
@@ -460,6 +460,7 @@ function saveAndContinue(e, k, event) {
460
460
  data: form_data,
461
461
  success: function (res) {
462
462
  ajax_indicator(false);
463
+ form.removeAttr("data-unsaved-changes");
463
464
  form.parent().find(".full-form-error").text("");
464
465
  if (res.id && form.find("input[name=id")) {
465
466
  form.append(
@@ -1189,6 +1190,14 @@ function installPWA() {
1189
1190
  }
1190
1191
  }
1191
1192
 
1193
+ function check_unsaved_form(event, script_tag) {
1194
+ const form = $(script_tag).parent().find("form");
1195
+ if (form.attr("data-unsaved-changes")) {
1196
+ event.preventDefault();
1197
+ event.returnValue = true;
1198
+ }
1199
+ }
1200
+
1192
1201
  (() => {
1193
1202
  const e = document.querySelector("[data-sidebar-toggler]");
1194
1203
  let closed = localStorage.getItem("sidebarClosed") === "true";
package/routes/fields.js CHANGED
@@ -362,10 +362,12 @@ const fieldFlow = (req) =>
362
362
  name: req.__("Attributes"),
363
363
  contextField: "attributes",
364
364
  onlyWhen: (context) => {
365
- if (context.calculated) return false;
365
+ const type = getState().types[context.type];
366
+ if (context.calculated && !type?.setTypeAttributesForCalculatedFields)
367
+ return false;
368
+
366
369
  if (context.type === "File") return true;
367
370
  if (new Field(context).is_fkey) return false;
368
- const type = getState().types[context.type];
369
371
  if (!type) return false;
370
372
  const attrs = Field.getTypeAttributes(
371
373
  type.attributes,
package/serve.js CHANGED
@@ -121,11 +121,7 @@ const initMaster = async ({ disableMigrate }, useClusterAdaptor = true) => {
121
121
  if (getState().getConfig("log_sql", false)) db.set_sql_logging();
122
122
  if (db.is_it_multi_tenant()) {
123
123
  const tenants = await getAllTenants();
124
- await init_multi_tenant(
125
- async () => await loadAllPlugins(true),
126
- disableMigrate,
127
- tenants
128
- );
124
+ await init_multi_tenant(loadAllPlugins, disableMigrate, tenants);
129
125
  }
130
126
  eachTenant(async () => {
131
127
  const state = getState();