@saltcorn/server 0.9.4-beta.18 → 0.9.4-beta.19
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 +3 -1
- package/package.json +8 -8
- package/public/dayjslocales/af.js +1 -0
- package/public/dayjslocales/am.js +1 -0
- package/public/dayjslocales/ar-dz.js +1 -0
- package/public/dayjslocales/ar-iq.js +1 -0
- package/public/dayjslocales/ar-kw.js +1 -0
- package/public/dayjslocales/ar-ly.js +1 -0
- package/public/dayjslocales/ar-ma.js +1 -0
- package/public/dayjslocales/ar-sa.js +1 -0
- package/public/dayjslocales/ar-tn.js +1 -0
- package/public/dayjslocales/ar.js +1 -0
- package/public/dayjslocales/az.js +1 -0
- package/public/dayjslocales/be.js +1 -0
- package/public/dayjslocales/bg.js +1 -0
- package/public/dayjslocales/bi.js +1 -0
- package/public/dayjslocales/bm.js +1 -0
- package/public/dayjslocales/bn-bd.js +1 -0
- package/public/dayjslocales/bn.js +1 -0
- package/public/dayjslocales/bo.js +1 -0
- package/public/dayjslocales/br.js +1 -0
- package/public/dayjslocales/bs.js +1 -0
- package/public/dayjslocales/ca.js +1 -0
- package/public/dayjslocales/cs.js +1 -0
- package/public/dayjslocales/cv.js +1 -0
- package/public/dayjslocales/cy.js +1 -0
- package/public/dayjslocales/da.js +1 -0
- package/public/dayjslocales/de-at.js +1 -0
- package/public/dayjslocales/de-ch.js +1 -0
- package/public/dayjslocales/de.js +1 -0
- package/public/dayjslocales/dv.js +1 -0
- package/public/dayjslocales/el.js +1 -0
- package/public/dayjslocales/en-au.js +1 -0
- package/public/dayjslocales/en-ca.js +1 -0
- package/public/dayjslocales/en-gb.js +1 -0
- package/public/dayjslocales/en-ie.js +1 -0
- package/public/dayjslocales/en-il.js +1 -0
- package/public/dayjslocales/en-in.js +1 -0
- package/public/dayjslocales/en-nz.js +1 -0
- package/public/dayjslocales/en-sg.js +1 -0
- package/public/dayjslocales/en-tt.js +1 -0
- package/public/dayjslocales/en.js +1 -0
- package/public/dayjslocales/eo.js +1 -0
- package/public/dayjslocales/es-do.js +1 -0
- package/public/dayjslocales/es-mx.js +1 -0
- package/public/dayjslocales/es-pr.js +1 -0
- package/public/dayjslocales/es-us.js +1 -0
- package/public/dayjslocales/es.js +1 -0
- package/public/dayjslocales/et.js +1 -0
- package/public/dayjslocales/eu.js +1 -0
- package/public/dayjslocales/fa.js +1 -0
- package/public/dayjslocales/fi.js +1 -0
- package/public/dayjslocales/fo.js +1 -0
- package/public/dayjslocales/fr-ca.js +1 -0
- package/public/dayjslocales/fr-ch.js +1 -0
- package/public/dayjslocales/fr.js +1 -0
- package/public/dayjslocales/fy.js +1 -0
- package/public/dayjslocales/ga.js +1 -0
- package/public/dayjslocales/gd.js +1 -0
- package/public/dayjslocales/gl.js +1 -0
- package/public/dayjslocales/gom-latn.js +1 -0
- package/public/dayjslocales/gu.js +1 -0
- package/public/dayjslocales/he.js +1 -0
- package/public/dayjslocales/hi.js +1 -0
- package/public/dayjslocales/hr.js +1 -0
- package/public/dayjslocales/ht.js +1 -0
- package/public/dayjslocales/hu.js +1 -0
- package/public/dayjslocales/hy-am.js +1 -0
- package/public/dayjslocales/id.js +1 -0
- package/public/dayjslocales/is.js +1 -0
- package/public/dayjslocales/it-ch.js +1 -0
- package/public/dayjslocales/it.js +1 -0
- package/public/dayjslocales/ja.js +1 -0
- package/public/dayjslocales/jv.js +1 -0
- package/public/dayjslocales/ka.js +1 -0
- package/public/dayjslocales/kk.js +1 -0
- package/public/dayjslocales/km.js +1 -0
- package/public/dayjslocales/kn.js +1 -0
- package/public/dayjslocales/ko.js +1 -0
- package/public/dayjslocales/ku.js +1 -0
- package/public/dayjslocales/ky.js +1 -0
- package/public/dayjslocales/lb.js +1 -0
- package/public/dayjslocales/lo.js +1 -0
- package/public/dayjslocales/lt.js +1 -0
- package/public/dayjslocales/lv.js +1 -0
- package/public/dayjslocales/me.js +1 -0
- package/public/dayjslocales/mi.js +1 -0
- package/public/dayjslocales/mk.js +1 -0
- package/public/dayjslocales/ml.js +1 -0
- package/public/dayjslocales/mn.js +1 -0
- package/public/dayjslocales/mr.js +1 -0
- package/public/dayjslocales/ms-my.js +1 -0
- package/public/dayjslocales/ms.js +1 -0
- package/public/dayjslocales/mt.js +1 -0
- package/public/dayjslocales/my.js +1 -0
- package/public/dayjslocales/nb.js +1 -0
- package/public/dayjslocales/ne.js +1 -0
- package/public/dayjslocales/nl-be.js +1 -0
- package/public/dayjslocales/nl.js +1 -0
- package/public/dayjslocales/nn.js +1 -0
- package/public/dayjslocales/oc-lnc.js +1 -0
- package/public/dayjslocales/pa-in.js +1 -0
- package/public/dayjslocales/pl.js +1 -0
- package/public/dayjslocales/pt-br.js +1 -0
- package/public/dayjslocales/pt.js +1 -0
- package/public/dayjslocales/rn.js +1 -0
- package/public/dayjslocales/ro.js +1 -0
- package/public/dayjslocales/ru.js +1 -0
- package/public/dayjslocales/rw.js +1 -0
- package/public/dayjslocales/sd.js +1 -0
- package/public/dayjslocales/se.js +1 -0
- package/public/dayjslocales/si.js +1 -0
- package/public/dayjslocales/sk.js +1 -0
- package/public/dayjslocales/sl.js +1 -0
- package/public/dayjslocales/sq.js +1 -0
- package/public/dayjslocales/sr-cyrl.js +1 -0
- package/public/dayjslocales/sr.js +1 -0
- package/public/dayjslocales/ss.js +1 -0
- package/public/dayjslocales/sv-fi.js +1 -0
- package/public/dayjslocales/sv.js +1 -0
- package/public/dayjslocales/sw.js +1 -0
- package/public/dayjslocales/ta.js +1 -0
- package/public/dayjslocales/te.js +1 -0
- package/public/dayjslocales/tet.js +1 -0
- package/public/dayjslocales/tg.js +1 -0
- package/public/dayjslocales/th.js +1 -0
- package/public/dayjslocales/tk.js +1 -0
- package/public/dayjslocales/tl-ph.js +1 -0
- package/public/dayjslocales/tlh.js +1 -0
- package/public/dayjslocales/tr.js +1 -0
- package/public/dayjslocales/tzl.js +1 -0
- package/public/dayjslocales/tzm-latn.js +1 -0
- package/public/dayjslocales/tzm.js +1 -0
- package/public/dayjslocales/ug-cn.js +1 -0
- package/public/dayjslocales/uk.js +1 -0
- package/public/dayjslocales/ur.js +1 -0
- package/public/dayjslocales/uz-latn.js +1 -0
- package/public/dayjslocales/uz.js +1 -0
- package/public/dayjslocales/vi.js +1 -0
- package/public/dayjslocales/x-pseudo.js +1 -0
- package/public/dayjslocales/yo.js +1 -0
- package/public/dayjslocales/zh-cn.js +1 -0
- package/public/dayjslocales/zh-hk.js +1 -0
- package/public/dayjslocales/zh-tw.js +1 -0
- package/public/dayjslocales/zh.js +1 -0
- package/public/gridedit.js +2 -2
- package/public/saltcorn-common.js +1 -0
- package/routes/actions.js +44 -1
- package/routes/admin.js +7 -1
- package/routes/common_lists.js +37 -15
- package/routes/list.js +1 -1
- package/routes/tags.js +4 -0
- package/wrapper.js +9 -1
package/routes/actions.js
CHANGED
|
@@ -219,6 +219,17 @@ const triggerForm = async (req, trigger) => {
|
|
|
219
219
|
"The table for which the trigger condition is checked."
|
|
220
220
|
),
|
|
221
221
|
},
|
|
222
|
+
{
|
|
223
|
+
name: "table_id",
|
|
224
|
+
label: req.__("Table"),
|
|
225
|
+
input_type: "select",
|
|
226
|
+
options: [
|
|
227
|
+
{ value: "", label: "Table not set" },
|
|
228
|
+
...tables.map((t) => ({ value: t.id, label: t.name })),
|
|
229
|
+
],
|
|
230
|
+
showIf: { when_trigger: "Never" },
|
|
231
|
+
sublabel: req.__("Optionally associate a table with this trigger"),
|
|
232
|
+
},
|
|
222
233
|
{
|
|
223
234
|
name: "channel",
|
|
224
235
|
label: req.__("Time of day"),
|
|
@@ -242,9 +253,41 @@ const triggerForm = async (req, trigger) => {
|
|
|
242
253
|
attributes: {
|
|
243
254
|
calcOptions: ["when_trigger", action_options],
|
|
244
255
|
},
|
|
256
|
+
showIf: {
|
|
257
|
+
when_trigger: Trigger.when_options.filter((t) => t !== "Never"),
|
|
258
|
+
},
|
|
259
|
+
sublabel: req.__("The action to be taken when the trigger fires"),
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "action",
|
|
263
|
+
label: req.__("Action"),
|
|
264
|
+
type: "String",
|
|
265
|
+
required: true,
|
|
266
|
+
help: { topic: "Actions" },
|
|
267
|
+
attributes: {
|
|
268
|
+
options: actionsNotRequiringRow,
|
|
269
|
+
},
|
|
270
|
+
showIf: {
|
|
271
|
+
when_trigger: "Never",
|
|
272
|
+
table_id: "",
|
|
273
|
+
},
|
|
274
|
+
sublabel: req.__("The action to be taken when the trigger fires"),
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "action",
|
|
278
|
+
label: req.__("Action"),
|
|
279
|
+
type: "String",
|
|
280
|
+
required: true,
|
|
281
|
+
help: { topic: "Actions" },
|
|
282
|
+
attributes: {
|
|
283
|
+
options: allActions,
|
|
284
|
+
},
|
|
285
|
+
showIf: {
|
|
286
|
+
when_trigger: "Never",
|
|
287
|
+
table_id: tables.map((t) => t.id),
|
|
288
|
+
},
|
|
245
289
|
sublabel: req.__("The action to be taken when the trigger fires"),
|
|
246
290
|
},
|
|
247
|
-
|
|
248
291
|
{
|
|
249
292
|
name: "description",
|
|
250
293
|
label: req.__("Description"),
|
package/routes/admin.js
CHANGED
|
@@ -600,7 +600,13 @@ router.post(
|
|
|
600
600
|
snap.created
|
|
601
601
|
).fromNow()}`
|
|
602
602
|
);
|
|
603
|
-
res.redirect(
|
|
603
|
+
res.redirect(
|
|
604
|
+
type === "trigger"
|
|
605
|
+
? `/actions`
|
|
606
|
+
: /^[a-z]+$/g.test(type)
|
|
607
|
+
? `/${type}edit`
|
|
608
|
+
: "/"
|
|
609
|
+
);
|
|
604
610
|
})
|
|
605
611
|
);
|
|
606
612
|
|
package/routes/common_lists.js
CHANGED
|
@@ -583,6 +583,34 @@ const getPageGroupList = (rows, roles, req) => {
|
|
|
583
583
|
);
|
|
584
584
|
};
|
|
585
585
|
|
|
586
|
+
const trigger_dropdown = (trigger, req, on_done_redirect_str = "") =>
|
|
587
|
+
settingsDropdown(`dropdownMenuButton${trigger.id}`, [
|
|
588
|
+
a(
|
|
589
|
+
{
|
|
590
|
+
class: "dropdown-item",
|
|
591
|
+
href: `/actions/edit/${trigger.id}${on_done_redirect_str}`,
|
|
592
|
+
},
|
|
593
|
+
'<i class="fas fa-edit"></i> ' + req.__("Edit")
|
|
594
|
+
),
|
|
595
|
+
|
|
596
|
+
a(
|
|
597
|
+
{
|
|
598
|
+
class: "dropdown-item",
|
|
599
|
+
href: `javascript:ajax_modal('/admin/snapshot-restore/trigger/${trigger.name}')`,
|
|
600
|
+
},
|
|
601
|
+
'<i class="fas fa-undo-alt"></i> ' + req.__("Restore")
|
|
602
|
+
),
|
|
603
|
+
div({ class: "dropdown-divider" }),
|
|
604
|
+
|
|
605
|
+
post_dropdown_item(
|
|
606
|
+
`/actions/delete/${trigger.id}${on_done_redirect_str}`,
|
|
607
|
+
'<i class="far fa-trash-alt"></i> ' + req.__("Delete"),
|
|
608
|
+
req,
|
|
609
|
+
true,
|
|
610
|
+
trigger.name
|
|
611
|
+
),
|
|
612
|
+
]);
|
|
613
|
+
|
|
586
614
|
const getTriggerList = async (
|
|
587
615
|
triggers,
|
|
588
616
|
req,
|
|
@@ -618,13 +646,7 @@ const getTriggerList = async (
|
|
|
618
646
|
},
|
|
619
647
|
]),
|
|
620
648
|
{ label: req.__("Action"), key: "action" },
|
|
621
|
-
|
|
622
|
-
label: req.__("Table or Channel"),
|
|
623
|
-
key: (r) =>
|
|
624
|
-
r.table_name
|
|
625
|
-
? a({ href: `/table/${r.table_name}` }, r.table_name)
|
|
626
|
-
: r.channel,
|
|
627
|
-
},
|
|
649
|
+
|
|
628
650
|
{
|
|
629
651
|
label: req.__("When"),
|
|
630
652
|
key: (act) =>
|
|
@@ -639,15 +661,15 @@ const getTriggerList = async (
|
|
|
639
661
|
: ""),
|
|
640
662
|
},
|
|
641
663
|
{
|
|
642
|
-
label: req.__("
|
|
664
|
+
label: req.__("Table or Channel"),
|
|
643
665
|
key: (r) =>
|
|
644
|
-
r.
|
|
645
|
-
?
|
|
646
|
-
:
|
|
666
|
+
r.table_name
|
|
667
|
+
? a({ href: `/table/${r.table_name}` }, r.table_name)
|
|
668
|
+
: r.channel,
|
|
647
669
|
},
|
|
648
670
|
{
|
|
649
|
-
label: req.__("
|
|
650
|
-
key: (r) => link(`/actions/
|
|
671
|
+
label: req.__("Test run"),
|
|
672
|
+
key: (r) => link(`/actions/testrun/${r.id}`, req.__("Test run")),
|
|
651
673
|
},
|
|
652
674
|
{
|
|
653
675
|
label: req.__("Configure"),
|
|
@@ -655,8 +677,8 @@ const getTriggerList = async (
|
|
|
655
677
|
},
|
|
656
678
|
!tagId
|
|
657
679
|
? {
|
|
658
|
-
label:
|
|
659
|
-
key: (r) =>
|
|
680
|
+
label: "",
|
|
681
|
+
key: (r) => trigger_dropdown(r, req),
|
|
660
682
|
}
|
|
661
683
|
: {
|
|
662
684
|
label: req.__("Remove From Tag"),
|
package/routes/list.js
CHANGED
|
@@ -288,7 +288,7 @@ router.get(
|
|
|
288
288
|
},
|
|
289
289
|
//css for jsgrid - grid editor external component
|
|
290
290
|
{
|
|
291
|
-
css: `/static_assets/${db.connectObj.version_tag}/
|
|
291
|
+
css: `/static_assets/${db.connectObj.version_tag}/tabulator_bootstrap4.min.css`,
|
|
292
292
|
},
|
|
293
293
|
|
|
294
294
|
// css for date flat picker external component
|
package/routes/tags.js
CHANGED
|
@@ -27,6 +27,7 @@ const {
|
|
|
27
27
|
const db = require("@saltcorn/data/db");
|
|
28
28
|
const { getState } = require("@saltcorn/data/db/state");
|
|
29
29
|
const { create_pack_from_tag } = require("@saltcorn/admin-models/models/pack");
|
|
30
|
+
const Table = require("@saltcorn/data/models/table");
|
|
30
31
|
|
|
31
32
|
const router = new Router();
|
|
32
33
|
module.exports = router;
|
|
@@ -161,6 +162,9 @@ router.get(
|
|
|
161
162
|
await setTableRefs(views);
|
|
162
163
|
const pages = await tag.getPages();
|
|
163
164
|
const triggers = await tag.getTriggers();
|
|
165
|
+
triggers.forEach((tr) => {
|
|
166
|
+
if (tr.table_id) tr.table_name = Table.findOne(tr.table_id)?.name;
|
|
167
|
+
});
|
|
164
168
|
const roles = await User.get_roles();
|
|
165
169
|
|
|
166
170
|
const tablesDomId = "tablesListId";
|
package/wrapper.js
CHANGED
|
@@ -185,17 +185,25 @@ const get_headers = (req, version_tag, description, extras = []) => {
|
|
|
185
185
|
},
|
|
186
186
|
]
|
|
187
187
|
: [];
|
|
188
|
+
const locale = req.getLocale();
|
|
188
189
|
const stdHeaders = [
|
|
189
190
|
{
|
|
190
191
|
headerTag: `<script>var _sc_loglevel = ${
|
|
191
192
|
state.logLevel
|
|
192
|
-
}, _sc_globalCsrf = "${req.csrfToken()}", _sc_version_tag = "${version_tag}"
|
|
193
|
+
}, _sc_globalCsrf = "${req.csrfToken()}", _sc_version_tag = "${version_tag}"${
|
|
194
|
+
locale ? `, _sc_locale = "${locale}"` : ""
|
|
195
|
+
};</script>`,
|
|
193
196
|
},
|
|
194
197
|
{ css: `/static_assets/${version_tag}/saltcorn.css` },
|
|
195
198
|
{ script: `/static_assets/${version_tag}/saltcorn-common.js` },
|
|
196
199
|
{ script: `/static_assets/${version_tag}/saltcorn.js` },
|
|
197
200
|
{ script: `/static_assets/${version_tag}/dayjs.min.js` },
|
|
198
201
|
];
|
|
202
|
+
if (locale !== "en") {
|
|
203
|
+
stdHeaders.push({
|
|
204
|
+
script: `/static_assets/${version_tag}/dayjslocales/${locale}.js`,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
199
207
|
let from_cfg = [];
|
|
200
208
|
if (state.getConfig("page_custom_css", ""))
|
|
201
209
|
from_cfg.push({ style: state.getConfig("page_custom_css", "") });
|