@saltcorn/server 1.1.1-rc.2 → 1.1.1-rc.4

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
@@ -1551,5 +1551,6 @@
1551
1551
  "Show results in": "Show results in",
1552
1552
  "Show results from each table in this type of element": "Show results from each table in this type of element",
1553
1553
  "Search syntax help": "Search syntax help",
1554
- "Search syntax": "Search syntax"
1554
+ "Search syntax": "Search syntax",
1555
+ "Maximum role": "Maximum role"
1555
1556
  }
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "1.1.1-rc.2",
3
+ "version": "1.1.1-rc.4",
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.1-rc.2",
11
- "@saltcorn/builder": "1.1.1-rc.2",
12
- "@saltcorn/data": "1.1.1-rc.2",
13
- "@saltcorn/admin-models": "1.1.1-rc.2",
14
- "@saltcorn/filemanager": "1.1.1-rc.2",
15
- "@saltcorn/markup": "1.1.1-rc.2",
16
- "@saltcorn/plugins-loader": "1.1.1-rc.2",
17
- "@saltcorn/sbadmin2": "1.1.1-rc.2",
10
+ "@saltcorn/base-plugin": "1.1.1-rc.4",
11
+ "@saltcorn/builder": "1.1.1-rc.4",
12
+ "@saltcorn/data": "1.1.1-rc.4",
13
+ "@saltcorn/admin-models": "1.1.1-rc.4",
14
+ "@saltcorn/filemanager": "1.1.1-rc.4",
15
+ "@saltcorn/markup": "1.1.1-rc.4",
16
+ "@saltcorn/plugins-loader": "1.1.1-rc.4",
17
+ "@saltcorn/sbadmin2": "1.1.1-rc.4",
18
18
  "@socket.io/cluster-adapter": "^0.2.1",
19
19
  "@socket.io/sticky": "^1.0.1",
20
20
  "adm-zip": "0.5.10",
@@ -2116,6 +2116,17 @@ function select_by_view_click(element, event, required) {
2116
2116
  }
2117
2117
  }
2118
2118
 
2119
+ function restrict_options(selector, restriction) {
2120
+ $(selector)
2121
+ .find("option")
2122
+ .each(function () {
2123
+ const $o = $(this);
2124
+ const val = $o.val();
2125
+ if (Array.isArray(restriction))
2126
+ if (val && !restriction.find((rid) => rid == val)) $o.remove();
2127
+ });
2128
+ }
2129
+
2119
2130
  const observer = new IntersectionObserver(
2120
2131
  (entries, observer) => {
2121
2132
  entries.forEach((entry) => {
package/routes/api.js CHANGED
@@ -350,6 +350,13 @@ router.get(
350
350
  const orderByField =
351
351
  (sortBy || tabulator_sort) && table.getField(sortBy || tabulator_sort);
352
352
 
353
+ const use_limit = tabulator_pagination_format
354
+ ? +tabulator_size
355
+ : limit && +limit;
356
+ const use_offset = tabulator_pagination_format
357
+ ? +tabulator_size * (+tabulator_page - 1)
358
+ : offset && +offset;
359
+
353
360
  await passport.authenticate(
354
361
  ["api-bearer", "jwt"],
355
362
  { session: false },
@@ -360,12 +367,8 @@ router.get(
360
367
  const joinOpts = {
361
368
  forUser: req.user || user || { role_id: 100 },
362
369
  forPublic: !(req.user || user),
363
- limit: tabulator_pagination_format
364
- ? +tabulator_size
365
- : limit && +limit,
366
- offset: tabulator_pagination_format
367
- ? +tabulator_size * (+tabulator_page - 1)
368
- : offset && +offset,
370
+ limit: use_limit,
371
+ offset: use_offset,
369
372
  orderDesc:
370
373
  (sortDesc && sortDesc !== "false") || tabulator_dir == "desc",
371
374
  orderBy: orderByField?.name || "id",
@@ -406,9 +409,10 @@ router.get(
406
409
  rows = await table.getJoinedRows({
407
410
  where: qstate,
408
411
  joinFields,
409
- limit: limit && +limit,
410
- offset: offset && +offset,
411
- orderDesc: sortDesc && sortDesc !== "false",
412
+ limit: use_limit,
413
+ offset: use_offset,
414
+ orderDesc:
415
+ (sortDesc && sortDesc !== "false") || tabulator_dir == "desc",
412
416
  orderBy: orderByField?.name || undefined,
413
417
  forPublic: !(req.user || user),
414
418
  forUser: req.user || user,
package/routes/list.js CHANGED
@@ -412,7 +412,7 @@ router.get(
412
412
  height:"100%",
413
413
  pagination:true,
414
414
  paginationMode:"remote",
415
- paginationSize:10,
415
+ paginationSize:20,
416
416
  clipboard:true,
417
417
  persistence:true,
418
418
  persistenceID:"table_tab_${table.name}",
package/routes/menu.js CHANGED
@@ -9,7 +9,11 @@ const Router = require("express-promise-router");
9
9
 
10
10
  //const Field = require("@saltcorn/data/models/field");
11
11
  const Form = require("@saltcorn/data/models/form");
12
- const { isAdmin, error_catcher, isAdminOrHasConfigMinRole } = require("./utils.js");
12
+ const {
13
+ isAdmin,
14
+ error_catcher,
15
+ isAdminOrHasConfigMinRole,
16
+ } = require("./utils.js");
13
17
  const { getState } = require("@saltcorn/data/db/state");
14
18
  //const File = require("@saltcorn/data/models/file");
15
19
  const User = require("@saltcorn/data/models/user");
@@ -307,6 +311,13 @@ const menuForm = async (req) => {
307
311
  input_type: "select",
308
312
  options: roles.map((r) => ({ label: r.role, value: r.id })),
309
313
  },
314
+ {
315
+ name: "max_role",
316
+ label: req.__("Maximum role"),
317
+ class: "item-menu",
318
+ input_type: "select",
319
+ options: roles.map((r) => ({ label: r.role, value: r.id })),
320
+ },
310
321
  {
311
322
  name: "disable_on_mobile",
312
323
  label: req.__("Disable on mobile"),
@@ -566,7 +577,7 @@ const jQMEtoMenu = (menu_items) =>
566
577
  */
567
578
  router.post(
568
579
  "/",
569
- isAdminOrHasConfigMinRole("min_role_edit_menu"),
580
+ isAdminOrHasConfigMinRole("min_role_edit_menu"),
570
581
  error_catcher(async (req, res) => {
571
582
  const new_menu = req.body;
572
583
  const menu_items = jQMEtoMenu(new_menu);