@saltcorn/server 0.7.3 → 0.7.4-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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.7.3",
3
+ "version": "0.7.4-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
- "@saltcorn/base-plugin": "0.7.3",
10
- "@saltcorn/builder": "0.7.3",
11
- "@saltcorn/data": "0.7.3",
12
- "@saltcorn/admin-models": "0.7.3",
13
- "@saltcorn/markup": "0.7.3",
14
- "@saltcorn/sbadmin2": "0.7.3",
9
+ "@saltcorn/base-plugin": "0.7.4-beta.2",
10
+ "@saltcorn/builder": "0.7.4-beta.2",
11
+ "@saltcorn/data": "0.7.4-beta.2",
12
+ "@saltcorn/admin-models": "0.7.4-beta.2",
13
+ "@saltcorn/markup": "0.7.4-beta.2",
14
+ "@saltcorn/sbadmin2": "0.7.4-beta.2",
15
15
  "@socket.io/cluster-adapter": "^0.1.0",
16
16
  "@socket.io/sticky": "^1.0.1",
17
17
  "aws-sdk": "^2.1037.0",
@@ -153,7 +153,7 @@ function MenuEditor(e, t) {
153
153
  }
154
154
  });
155
155
  })((n = $(this).closest("li")));
156
- l.onUpdate();
156
+ //l.onUpdate();
157
157
  }),
158
158
  s.on("click", ".btnUp", function (e) {
159
159
  e.preventDefault();
@@ -364,3 +364,78 @@ Copyright (c) 2017 Taha Paksu
364
364
  .dropdown-menu.searchbar-dropdown.show {
365
365
  transform: translate(0px, 40px);
366
366
  }
367
+
368
+ .tippy-box[data-animation="fade"][data-state="hidden"] {
369
+ opacity: 0;
370
+ }
371
+ [data-tippy-root] {
372
+ max-width: calc(100vw - 10px);
373
+ }
374
+ .tippy-box {
375
+ position: relative;
376
+ background-color: #333;
377
+ color: #fff;
378
+ border-radius: 4px;
379
+ font-size: 14px;
380
+ line-height: 1.4;
381
+ white-space: normal;
382
+ outline: 0;
383
+ transition-property: transform, visibility, opacity;
384
+ }
385
+ .tippy-box[data-placement^="top"] > .tippy-arrow {
386
+ bottom: 0;
387
+ }
388
+ .tippy-box[data-placement^="top"] > .tippy-arrow:before {
389
+ bottom: -7px;
390
+ left: 0;
391
+ border-width: 8px 8px 0;
392
+ border-top-color: initial;
393
+ transform-origin: center top;
394
+ }
395
+ .tippy-box[data-placement^="bottom"] > .tippy-arrow {
396
+ top: 0;
397
+ }
398
+ .tippy-box[data-placement^="bottom"] > .tippy-arrow:before {
399
+ top: -7px;
400
+ left: 0;
401
+ border-width: 0 8px 8px;
402
+ border-bottom-color: initial;
403
+ transform-origin: center bottom;
404
+ }
405
+ .tippy-box[data-placement^="left"] > .tippy-arrow {
406
+ right: 0;
407
+ }
408
+ .tippy-box[data-placement^="left"] > .tippy-arrow:before {
409
+ border-width: 8px 0 8px 8px;
410
+ border-left-color: initial;
411
+ right: -7px;
412
+ transform-origin: center left;
413
+ }
414
+ .tippy-box[data-placement^="right"] > .tippy-arrow {
415
+ left: 0;
416
+ }
417
+ .tippy-box[data-placement^="right"] > .tippy-arrow:before {
418
+ left: -7px;
419
+ border-width: 8px 8px 8px 0;
420
+ border-right-color: initial;
421
+ transform-origin: center right;
422
+ }
423
+ .tippy-box[data-inertia][data-state="visible"] {
424
+ transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);
425
+ }
426
+ .tippy-arrow {
427
+ width: 16px;
428
+ height: 16px;
429
+ color: #333;
430
+ }
431
+ .tippy-arrow:before {
432
+ content: "";
433
+ position: absolute;
434
+ border-color: transparent;
435
+ border-style: solid;
436
+ }
437
+ .tippy-content {
438
+ position: relative;
439
+ padding: 5px 9px;
440
+ z-index: 1;
441
+ }
@@ -39,16 +39,26 @@ function apply_showif() {
39
39
  $("[data-show-if]").each(function (ix, element) {
40
40
  var e = $(element);
41
41
  try {
42
- var to_show = new Function(
43
- "e",
44
- "return " + decodeURIComponent(e.attr("data-show-if"))
45
- );
42
+ let to_show = e.data("data-show-if-fun");
43
+ if (!to_show) {
44
+ to_show = new Function(
45
+ "e",
46
+ "return " + decodeURIComponent(e.attr("data-show-if"))
47
+ );
48
+ e.data("data-show-if-fun", to_show);
49
+ }
50
+ if (!e.data("data-closest-form-ns"))
51
+ e.data("data-closest-form-ns", e.closest(".form-namespace"));
46
52
  if (to_show(e))
47
53
  e.show()
48
54
  .find("input, textarea, button, select")
49
55
  .prop("disabled", e.attr("data-disabled") || false);
50
56
  else
51
- e.hide().find("input, textarea, button, select").prop("disabled", true);
57
+ e.hide()
58
+ .find(
59
+ "input:enabled, textarea:enabled, button:enabled, select:enabled"
60
+ )
61
+ .prop("disabled", true);
52
62
  } catch (e) {
53
63
  console.error(e);
54
64
  }
@@ -111,7 +121,12 @@ function apply_showif() {
111
121
  `<option ${
112
122
  `${current}` === `${r[dynwhere.refname]}` ? "selected" : ""
113
123
  } value="${r[dynwhere.refname]}">${
114
- r[dynwhere.summary_field]
124
+ dynwhere.label_formula
125
+ ? new Function(
126
+ `{${Object.keys(r).join(",")}}`,
127
+ "return " + dynwhere.label_formula
128
+ )(r)
129
+ : r[dynwhere.summary_field]
115
130
  }</option>`
116
131
  )
117
132
  );
@@ -510,7 +525,7 @@ const repeaterCopyValuesToForm = (form, editor, noTriggerChange) => {
510
525
  if ($e.length) $e.val(v);
511
526
  else
512
527
  form.append(
513
- `<input type="hidden" name="${k}_${ix}" value="${v}"></input>`
528
+ `<input type="hidden" data-repeater-ix="${ix}" name="${k}_${ix}" value="${v}"></input>`
514
529
  );
515
530
  };
516
531
  vs.forEach((v, ix) => {
@@ -521,8 +536,8 @@ const repeaterCopyValuesToForm = (form, editor, noTriggerChange) => {
521
536
  });
522
537
  });
523
538
  //delete
524
- //for (let ix = vs.length; ix < vs.length + 20; ix++) {
525
- // $(`input[name="${k}_${ix}"]`).remove();
539
+ //for (let ix = vs.length; ix < vs.length + 5; ix++) {
540
+ // $(`input[data-repeater-ix="${ix}"]`).remove();
526
541
  //}
527
542
  $(`input[type=hidden]`).each(function () {
528
543
  const name = $(this).attr("name");
@@ -319,4 +319,31 @@ table.table-inner-grid, table.table-inner-grid th, table.table-inner-grid td {
319
319
  .editStarRating input:checked + label,
320
320
  .editStarRating input:checked + label ~ label {
321
321
  color: #ffc107;
322
- }
322
+ }
323
+
324
+ .CodeMirror {
325
+ resize: vertical;
326
+ }
327
+
328
+ /* copied from bootstrap and adjusted to show the arrow on the left */
329
+ .card .card-header-left-collapse[data-bs-toggle=collapse] {
330
+ text-decoration: none;
331
+ position: relative;
332
+ padding: 0.75rem 3.25rem 0.75rem 1.25rem;
333
+ }
334
+ .card .card-header-left-collapse[data-bs-toggle=collapse]::before {
335
+ position: absolute;
336
+ left: 0;
337
+ top: 0;
338
+ line-height: 51px;
339
+ font-weight: 900;
340
+ content: "\f107";
341
+ font-family: "Font Awesome 5 Free";
342
+ color: #d1d3e2;
343
+ }
344
+ .card .card-header-left-collapse[data-bs-toggle=collapse].collapsed {
345
+ border-radius: 0.35rem;
346
+ }
347
+ .card .card-header-left-collapse[data-bs-toggle=collapse].collapsed::before {
348
+ content: "\f105";
349
+ }
@@ -143,6 +143,8 @@ function view_post(viewname, route, data, onDone) {
143
143
  }).done(function (res) {
144
144
  if (onDone) onDone(res);
145
145
  ajax_done(res);
146
+ }).fail(function (res) {
147
+ notifyAlert({ type: "danger", text: res.responseText });
146
148
  });
147
149
  }
148
150
  var logged_errors = [];
@@ -210,9 +212,9 @@ function ajax_modal(url, opts = {}) {
210
212
  $("#scmodal .modal-body").html(res);
211
213
  new bootstrap.Modal($("#scmodal")).show();
212
214
  initialize_page();
213
- (opts.onOpen || function () {})(res);
215
+ (opts.onOpen || function () { })(res);
214
216
  $("#scmodal").on("hidden.bs.modal", function (e) {
215
- (opts.onClose || function () {})(res);
217
+ (opts.onClose || function () { })(res);
216
218
  $("body").css("overflow", "");
217
219
  });
218
220
  },
@@ -264,7 +266,7 @@ function applyViewConfig(e, url, k) {
264
266
  "CSRF-Token": _sc_globalCsrf,
265
267
  },
266
268
  data: JSON.stringify(cfg),
267
- error: function (request) {},
269
+ error: function (request) { },
268
270
  success: function (res) {
269
271
  k && k(res);
270
272
  },
@@ -444,16 +446,16 @@ Copyright (c) 2015 Jeff Green
444
446
  stateObject,
445
447
  document.title,
446
448
  window.location.pathname +
447
- window.location.search +
448
- $(this).attr("href")
449
+ window.location.search +
450
+ $(this).attr("href")
449
451
  );
450
452
  } else {
451
453
  window.history.replaceState(
452
454
  stateObject,
453
455
  document.title,
454
456
  window.location.pathname +
455
- window.location.search +
456
- $(this).attr("href")
457
+ window.location.search +
458
+ $(this).attr("href")
457
459
  );
458
460
  }
459
461
  });
package/routes/actions.js CHANGED
@@ -8,6 +8,7 @@ const Router = require("express-promise-router");
8
8
  const { isAdmin, error_catcher, get_base_url } = require("./utils.js");
9
9
  const { getState } = require("@saltcorn/data/db/state");
10
10
  const Trigger = require("@saltcorn/data/models/trigger");
11
+ const { getTriggerList } = require("./common_lists");
11
12
 
12
13
  /**
13
14
  * @type {object}
@@ -97,45 +98,7 @@ router.get(
97
98
  type: "card",
98
99
  title: req.__("Triggers"),
99
100
  contents: div(
100
- mkTable(
101
- [
102
- { label: req.__("Name"), key: "name" },
103
- { label: req.__("Action"), key: "action" },
104
- {
105
- label: req.__("Table or Channel"),
106
- key: (r) => r.table_name || r.channel,
107
- },
108
- {
109
- label: req.__("When"),
110
- key: (a) =>
111
- a.when_trigger === "API call"
112
- ? `API: ${base_url}api/action/${a.name}`
113
- : a.when_trigger,
114
- },
115
- {
116
- label: req.__("Test run"),
117
- key: (r) =>
118
- r.table_id
119
- ? ""
120
- : link(`/actions/testrun/${r.id}`, req.__("Test run")),
121
- },
122
- {
123
- label: req.__("Edit"),
124
- key: (r) => link(`/actions/edit/${r.id}`, req.__("Edit")),
125
- },
126
- {
127
- label: req.__("Configure"),
128
- key: (r) =>
129
- link(`/actions/configure/${r.id}`, req.__("Configure")),
130
- },
131
- {
132
- label: req.__("Delete"),
133
- key: (r) => post_delete_btn(`/actions/delete/${r.id}`, req),
134
- },
135
- ],
136
- triggers,
137
- { hover: true }
138
- ),
101
+ getTriggerList(triggers, req),
139
102
  link("/actions/new", req.__("Add trigger"))
140
103
  ),
141
104
  },