@saltcorn/server 0.9.6-beta.0 → 0.9.6-beta.10

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/routes/tables.js CHANGED
@@ -681,6 +681,10 @@ const attribBadges = (f) => {
681
681
  "on_delete_cascade",
682
682
  "on_delete",
683
683
  "unique_error_msg",
684
+ "ref",
685
+ "table",
686
+ "agg_field",
687
+ "agg_relation",
684
688
  ].includes(k)
685
689
  )
686
690
  return;
package/routes/utils.js CHANGED
@@ -14,7 +14,7 @@ const {
14
14
  } = require("@saltcorn/data/db/state");
15
15
  const { get_base_url } = require("@saltcorn/data/models/config");
16
16
  const { hash } = require("@saltcorn/data/utils");
17
- const { input, script, domReady } = require("@saltcorn/markup/tags");
17
+ const { input, script, domReady, a } = require("@saltcorn/markup/tags");
18
18
  const session = require("express-session");
19
19
  const cookieSession = require("cookie-session");
20
20
  const is = require("contractis/is");
@@ -398,7 +398,10 @@ const admin_config_route = ({
398
398
  if (restart_required)
399
399
  res.json({
400
400
  success: "ok",
401
- notify: req.__("Restart required for changes to take effect."),
401
+ notify:
402
+ req.__("Restart required for changes to take effect.") +
403
+ " " +
404
+ a({ href: "/admin/system" }, req.__("Restart here")),
402
405
  });
403
406
  else res.json({ success: "ok" });
404
407
  }
package/routes/view.js CHANGED
@@ -127,7 +127,7 @@ router.get(
127
127
  else {
128
128
  const qs = "";
129
129
  const contents =
130
- typeof contents0 === "string" && !req.xhr
130
+ typeof contents0 === "string"
131
131
  ? div(
132
132
  {
133
133
  class: "d-inline",
@@ -371,6 +371,7 @@ router.get(
371
371
  const form = await viewForm(req, tableOptions, roles, pages, viewrow);
372
372
  const inbound_connected = await viewrow.inbound_connected_objects();
373
373
  form.hidden("id");
374
+ form.onChange = `saveAndContinue(this)`;
374
375
  res.sendWrap(req.__(`Edit view`), {
375
376
  above: [
376
377
  {
@@ -383,6 +384,7 @@ router.get(
383
384
  {
384
385
  type: "card",
385
386
  class: "mt-0",
387
+ titleAjaxIndicator: true,
386
388
  title: req.__(
387
389
  `%s view - %s on %s`,
388
390
  viewname,
@@ -541,12 +543,14 @@ router.post(
541
543
  //console.log(v);
542
544
  await View.create(v);
543
545
  }
544
- res.redirect(
545
- addOnDoneRedirect(
546
- `/viewedit/config/${encodeURIComponent(v.name)}`,
547
- req
548
- )
549
- );
546
+ if (req.xhr) res.json({ success: "ok" });
547
+ else
548
+ res.redirect(
549
+ addOnDoneRedirect(
550
+ `/viewedit/config/${encodeURIComponent(v.name)}`,
551
+ req
552
+ )
553
+ );
550
554
  }
551
555
  } else {
552
556
  sendForm(form);
@@ -902,7 +906,7 @@ router.post(
902
906
  ? `/${req.query.on_done_redirect}`
903
907
  : "/viewedit";
904
908
  res.redirect(redirectTarget);
905
- } else res.json({ okay: true, responseText: message });
909
+ } else res.json({ success: "ok" });
906
910
  })
907
911
  );
908
912
 
@@ -76,7 +76,7 @@ describe("page create", () => {
76
76
  await request(app)
77
77
  .get("/pageedit/new")
78
78
  .set("Cookie", loginCookie)
79
- .expect(toInclude("A short name that will be in your URL"));
79
+ .expect(toInclude("A short name that will be in the page URL"));
80
80
  });
81
81
  it("shows new with html file selector", async () => {
82
82
  const app = await getApp({ disableCsrf: true });
@@ -237,7 +237,7 @@ describe("pageedit", () => {
237
237
  await request(app)
238
238
  .get("/pageedit/edit-properties/a_page")
239
239
  .set("Cookie", loginCookie)
240
- .expect(toInclude("A short name that will be in your URL"));
240
+ .expect(toInclude("A short name that will be in the page URL"));
241
241
 
242
242
  //TODO full context
243
243
  const ctx = encodeURIComponent(JSON.stringify({}));
@@ -137,8 +137,10 @@ describe("Plugin dependency resolution and upgrade", () => {
137
137
  .expect(toRedirect("/plugins"));
138
138
  const quill = await Plugin.findOne({ name: "quill-editor" });
139
139
  expect(quill.location).toBe("@saltcorn/quill-editor");
140
+ expect(quill.name).toBe("quill-editor");
140
141
  const html = await Plugin.findOne({ location: "@saltcorn/html" });
141
142
  expect(html.location).toBe("@saltcorn/html");
143
+ expect(html.name).toBe("html");
142
144
  const html_type = getState().types.HTML;
143
145
  expect(!!html_type.fieldviews.Quill).toBe(true);
144
146
  });