@saltcorn/server 0.9.0-beta.4 → 0.9.0-beta.6

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/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.9.0-beta.4",
3
+ "version": "0.9.0-beta.6",
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
- "@saltcorn/base-plugin": "0.9.0-beta.4",
10
- "@saltcorn/builder": "0.9.0-beta.4",
11
- "@saltcorn/data": "0.9.0-beta.4",
12
- "@saltcorn/admin-models": "0.9.0-beta.4",
13
- "@saltcorn/filemanager": "0.9.0-beta.4",
14
- "@saltcorn/markup": "0.9.0-beta.4",
15
- "@saltcorn/sbadmin2": "0.9.0-beta.4",
9
+ "@saltcorn/base-plugin": "0.9.0-beta.6",
10
+ "@saltcorn/builder": "0.9.0-beta.6",
11
+ "@saltcorn/data": "0.9.0-beta.6",
12
+ "@saltcorn/admin-models": "0.9.0-beta.6",
13
+ "@saltcorn/filemanager": "0.9.0-beta.6",
14
+ "@saltcorn/markup": "0.9.0-beta.6",
15
+ "@saltcorn/sbadmin2": "0.9.0-beta.6",
16
16
  "@socket.io/cluster-adapter": "^0.2.1",
17
17
  "@socket.io/sticky": "^1.0.1",
18
18
  "adm-zip": "0.5.10",
@@ -539,6 +539,7 @@ function initialize_page() {
539
539
  var ajax = !!$(this).attr("data-inline-edit-ajax");
540
540
  var type = $(this).attr("data-inline-edit-type");
541
541
  var schema = $(this).attr("data-inline-edit-schema");
542
+ var decimalPlaces = $(this).attr("data-inline-edit-decimal-places");
542
543
  if (schema) {
543
544
  schema = JSON.parse(decodeURIComponent(schema));
544
545
  }
@@ -561,6 +562,7 @@ function initialize_page() {
561
562
  type,
562
563
  is_key,
563
564
  schema,
565
+ ...(decimalPlaces ? { decimalPlaces } : {}),
564
566
  })
565
567
  );
566
568
  const doAjaxOptionsFetch = (tblName, target) => {
@@ -613,7 +615,17 @@ function initialize_page() {
613
615
  }
614
616
  <input type="${
615
617
  type === "Integer" || type === "Float" ? "number" : "text"
616
- }" name="${key}" value="${escapeHtml(current)}">
618
+ }" ${
619
+ type === "Float"
620
+ ? `step="${
621
+ decimalPlaces
622
+ ? Math.round(
623
+ Math.pow(10, -decimalPlaces) * Math.pow(10, decimalPlaces)
624
+ ) / Math.pow(10, decimalPlaces)
625
+ : "any"
626
+ }"`
627
+ : ""
628
+ } name="${key}" value="${escapeHtml(current)}">
617
629
  <button type="submit" class="btn btn-sm btn-primary">OK</button>
618
630
  <button onclick="cancel_inline_edit(event, '${opts}')" type="button" class="btn btn-sm btn-danger"><i class="fas fa-times"></i></button>
619
631
  </form>`
@@ -780,6 +792,11 @@ function inline_submit_success(e, form, opts) {
780
792
  : ""
781
793
  }
782
794
  ${opts.current_label ? `data-inline-edit-current-label="${val}"` : ""}
795
+ ${
796
+ opts.decimalPlaces
797
+ ? `data-inline-edit-decimal-places="${opts.decimalPlaces}"`
798
+ : ""
799
+ }
783
800
  data-inline-edit-dest-url="${opts.url}">
784
801
  <span class="current">${val}</span>
785
802
  <i class="editicon ${!isNode ? "visible" : ""} fas fa-edit ms-1"></i>
@@ -5,6 +5,9 @@ const {
5
5
  getAdminLoginCookie,
6
6
  resetToFixtures,
7
7
  respondJsonWith,
8
+ toRedirect,
9
+ toInclude,
10
+ toSucceed,
8
11
  } = require("../auth/testhelp");
9
12
  const db = require("@saltcorn/data/db");
10
13
  const { sleep } = require("@saltcorn/data/tests/mocks");
@@ -181,6 +184,52 @@ describe("load remote insert/updates", () => {
181
184
  }
182
185
  });
183
186
 
187
+ it("sync table with capitals", async () => {
188
+ const app = await getApp({ disableCsrf: true });
189
+ const loginCookie = await getAdminLoginCookie();
190
+ // create table
191
+ await request(app)
192
+ .post("/table")
193
+ .set("Cookie", loginCookie)
194
+ .send(`name=${encodeURIComponent("Table with capitals")}`)
195
+ .expect(toRedirect("/table/16"));
196
+ // add a field
197
+ await request(app)
198
+ .post("/field/")
199
+ .send("stepName=Basic properties")
200
+ .send("name=string_field")
201
+ .send("label=StringField")
202
+ .send("type=String")
203
+ .send(
204
+ `contextEnc=${encodeURIComponent(JSON.stringify({ table_id: 16 }))}`
205
+ )
206
+ .set("Cookie", loginCookie)
207
+ .expect(toInclude("options"));
208
+ // init sync_info table
209
+ await request(app)
210
+ .post("/table")
211
+ .send("id=16")
212
+ .send("has_sync_info=on")
213
+ .set("Cookie", loginCookie)
214
+ .expect(toRedirect("/table/16"));
215
+ const dbTime = await db.time();
216
+
217
+ // call load changes
218
+ await request(app)
219
+ .post("/sync/load_changes")
220
+ .set("Cookie", loginCookie)
221
+ .send({
222
+ loadUntil: (await db.time()).valueOf(),
223
+ syncInfos: {
224
+ "Table with capitals": {
225
+ maxLoadedId: 0,
226
+ syncFrom: dbTime.valueOf(),
227
+ },
228
+ },
229
+ })
230
+ .expect(toSucceed());
231
+ });
232
+
184
233
  it("load sync not authorized", async () => {
185
234
  const app = await getApp({ disableCsrf: true });
186
235
  const loginCookie = await getUserLoginCookie();