@saltcorn/server 0.8.5-beta.1 → 0.8.5-beta.3
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 +15 -1
- package/locales/pl.json +1110 -0
- package/package.json +9 -8
- package/public/saltcorn-common.js +44 -8
- package/public/saltcorn.css +2 -3
- package/public/saltcorn.js +17 -2
- package/routes/actions.js +25 -12
- package/routes/admin.js +70 -30
- package/routes/api.js +8 -8
- package/routes/tables.js +103 -33
- package/routes/utils.js +19 -0
- package/tests/table.test.js +2 -2
package/routes/utils.js
CHANGED
|
@@ -18,6 +18,24 @@ const cookieSession = require("cookie-session");
|
|
|
18
18
|
const is = require("contractis/is");
|
|
19
19
|
const { validateHeaderName, validateHeaderValue } = require("http");
|
|
20
20
|
const Crash = require("@saltcorn/data/models/crash");
|
|
21
|
+
const si = require("systeminformation");
|
|
22
|
+
|
|
23
|
+
const get_sys_info = async () => {
|
|
24
|
+
const disks = await si.fsSize();
|
|
25
|
+
let size = 0;
|
|
26
|
+
let used = 0;
|
|
27
|
+
disks.forEach((d) => {
|
|
28
|
+
if (d && d.used && d.size) {
|
|
29
|
+
size += d.size;
|
|
30
|
+
used += d.used;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const diskUsage = Math.round(100 * (used / size));
|
|
34
|
+
const simem = await si.mem();
|
|
35
|
+
const memUsage = Math.round(100 - 100 * (simem.available / simem.total));
|
|
36
|
+
const cpuUsage = Math.round((await si.currentLoad()).currentLoad);
|
|
37
|
+
return { memUsage, diskUsage, cpuUsage };
|
|
38
|
+
};
|
|
21
39
|
|
|
22
40
|
/**
|
|
23
41
|
* Checks that user logged or not.
|
|
@@ -314,4 +332,5 @@ module.exports = {
|
|
|
314
332
|
get_tenant_from_req,
|
|
315
333
|
addOnDoneRedirect,
|
|
316
334
|
is_relative_url,
|
|
335
|
+
get_sys_info,
|
|
317
336
|
};
|
package/tests/table.test.js
CHANGED
|
@@ -198,11 +198,11 @@ Gordon Kane, 217`;
|
|
|
198
198
|
.set("Cookie", loginCookie)
|
|
199
199
|
.expect(toInclude("books constraints"));
|
|
200
200
|
await request(app)
|
|
201
|
-
.get("/table/add-constraint/" + id)
|
|
201
|
+
.get("/table/add-constraint/" + id + "/Unique")
|
|
202
202
|
.set("Cookie", loginCookie)
|
|
203
203
|
.expect(toInclude("Add constraint to books"));
|
|
204
204
|
await request(app)
|
|
205
|
-
.post("/table/add-constraint/" + id)
|
|
205
|
+
.post("/table/add-constraint/" + id + "/Unique")
|
|
206
206
|
.send("author=on")
|
|
207
207
|
.send("pages=on")
|
|
208
208
|
.set("Cookie", loginCookie)
|