@opengis/bi 1.2.28 → 1.2.30
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/dist/bi.js +1 -1
- package/dist/bi.umd.cjs +75 -75
- package/dist/{import-file-CeeuNrOS.js → import-file-B4o9p2_2.js} +2359 -1792
- package/dist/{vs-funnel-bar-D0j-vBjL.js → vs-funnel-bar-BOWwPnjW.js} +1 -1
- package/dist/{vs-list-BlFV_Syw.js → vs-list-D8jGusRT.js} +1 -1
- package/dist/{vs-map-DnGaeJ0j.js → vs-map-BGplOwpB.js} +2 -2
- package/dist/{vs-map-cluster-CtwhYhfw.js → vs-map-cluster-CHQJV2As.js} +2 -2
- package/dist/{vs-number-poGPfqSn.js → vs-number-jPqxFQ6d.js} +1 -1
- package/dist/{vs-table-D3hPaMk1.js → vs-table-BDgIvJbY.js} +1 -1
- package/dist/{vs-text-Bs5tYckh.js → vs-text-DcHOffy9.js} +1 -1
- package/package.json +75 -75
- package/server/routes/dashboard/controllers/dashboard.list.js +36 -16
- package/server/routes/edit/controllers/widget.edit.js +22 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as l, c as h, a as c, b as d, d as p } from "./import-file-
|
|
1
|
+
import { _ as l, c as h, a as c, b as d, d as p } from "./import-file-B4o9p2_2.js";
|
|
2
2
|
import { createElementBlock as u, openBlock as m } from "vue";
|
|
3
3
|
const o = typeof window < "u" ? window.echarts : null, f = {
|
|
4
4
|
name: "VsFunnelBar",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createBlock as b, openBlock as l, unref as L, mergeProps as v, createElementBlock as d, createElementVNode as c, withDirectives as F, toDisplayString as S, vShow as R, Fragment as P, renderList as V, normalizeClass as D, resolveComponent as A, createVNode as H } from "vue";
|
|
2
|
-
import { e as x, X as J, _ as w } from "./import-file-
|
|
2
|
+
import { e as x, X as J, _ as w } from "./import-file-B4o9p2_2.js";
|
|
3
3
|
/**
|
|
4
4
|
* @license lucide-vue-next v0.577.0 - ISC
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as E, a as L, p as $, V as T, b as B, c as H, d as O, l as F, e as N } from "./vs-list-
|
|
2
|
-
import { _ as V, c as P } from "./import-file-
|
|
1
|
+
import { _ as E, a as L, p as $, V as T, b as B, c as H, d as O, l as F, e as N } from "./vs-list-D8jGusRT.js";
|
|
2
|
+
import { _ as V, c as P } from "./import-file-B4o9p2_2.js";
|
|
3
3
|
import { resolveComponent as u, createElementBlock as c, openBlock as i, Fragment as w, createElementVNode as r, createBlock as C, createCommentVNode as m, createVNode as x, Teleport as R, toDisplayString as g, renderList as S, normalizeStyle as k, normalizeClass as I } from "vue";
|
|
4
4
|
const A = {
|
|
5
5
|
components: { legendIcon: L, closeIcon: E },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as A, a as F, p as T, c as G, V as P, b as Z, d as q, e as D, l as K } from "./vs-list-
|
|
2
|
-
import { e as W, _ as H, V as J, c as Q, g as U, h as X, i as Y } from "./import-file-
|
|
1
|
+
import { _ as A, a as F, p as T, c as G, V as P, b as Z, d as q, e as D, l as K } from "./vs-list-D8jGusRT.js";
|
|
2
|
+
import { e as W, _ as H, V as J, c as Q, g as U, h as X, i as Y } from "./import-file-B4o9p2_2.js";
|
|
3
3
|
import { createElementBlock as g, createCommentVNode as S, openBlock as p, createElementVNode as l, normalizeClass as V, Fragment as R, renderList as N, toDisplayString as O, normalizeStyle as j, createBlock as z, unref as $, mergeProps as ee, resolveComponent as m, withDirectives as M, resolveDynamicComponent as te, createVNode as w, vShow as C } from "vue";
|
|
4
4
|
/**
|
|
5
5
|
* @license lucide-vue-next v0.577.0 - ISC
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as m, c as f, b as _, d as b } from "./import-file-
|
|
1
|
+
import { _ as m, c as f, b as _, d as b } from "./import-file-B4o9p2_2.js";
|
|
2
2
|
import { createElementBlock as a, openBlock as r, createElementVNode as s, Fragment as n, renderList as c, toDisplayString as d } from "vue";
|
|
3
3
|
const x = {
|
|
4
4
|
name: "VsTable",
|
package/package.json
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@opengis/bi",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "BI data visualization module",
|
|
5
|
-
"main": "dist/bi.js",
|
|
6
|
-
"browser": "dist/bi.umd.cjs",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist",
|
|
10
|
-
"server",
|
|
11
|
-
"plugin.js",
|
|
12
|
-
"utils.js"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"patch": "npm version patch && git push && npm publish",
|
|
16
|
-
"prepublishOnly": "npm run build:lib",
|
|
17
|
-
"debug": "node --watch-path=server server",
|
|
18
|
-
"dev": "vite",
|
|
19
|
-
"type-check": "vue-tsc --noEmit",
|
|
20
|
-
"build": "vite build",
|
|
21
|
-
"build:lib": "cross-env APP=true vite build",
|
|
22
|
-
"build-app": "vite build",
|
|
23
|
-
"lint": "eslint .",
|
|
24
|
-
"format": "prettier --write .",
|
|
25
|
-
"test": "node --test",
|
|
26
|
-
"test21": "node --test ./test/plugins/*",
|
|
27
|
-
"start": "node server.js",
|
|
28
|
-
"prod": "NODE_ENV=production npm run start",
|
|
29
|
-
"docs:i": "npm install --prefix ./docs",
|
|
30
|
-
"docs:dev": "npm run --prefix ./docs docs:dev",
|
|
31
|
-
"docs:build": "npm run --prefix ./docs docs:build",
|
|
32
|
-
"docs:preview": "npm run --prefix ./docs docs:preview",
|
|
33
|
-
"adduser": "node script/adduser.js"
|
|
34
|
-
},
|
|
35
|
-
"keywords": [
|
|
36
|
-
"bi",
|
|
37
|
-
"data visualization",
|
|
38
|
-
"chart",
|
|
39
|
-
"opengis",
|
|
40
|
-
"vue",
|
|
41
|
-
"fastify"
|
|
42
|
-
],
|
|
43
|
-
"author": "Softpro",
|
|
44
|
-
"license": "ISC",
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"@mapbox/sphericalmercator": "^1.2.0",
|
|
47
|
-
"@opengis/table": "^0.0.30",
|
|
48
|
-
"lucide-vue-next": "^0.577.0"
|
|
49
|
-
},
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@opengis/core": "^0.0.33",
|
|
52
|
-
"@opengis/fastify-table": "^2.0.33",
|
|
53
|
-
"@opengis/form": "0.0.137",
|
|
54
|
-
"@turf/turf": "^7.1.0",
|
|
55
|
-
"@types/node": "^22.7.5",
|
|
56
|
-
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
57
|
-
"@typescript-eslint/parser": "^6.21.0",
|
|
58
|
-
"@vitejs/plugin-vue": "^5.1.4",
|
|
59
|
-
"cross-env": "^10.1.0",
|
|
60
|
-
"eslint": "^8.57.1",
|
|
61
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
62
|
-
"eslint-config-prettier": "^9.1.0",
|
|
63
|
-
"eslint-plugin-vue": "^9.29.0",
|
|
64
|
-
"globals": "^15.10.0",
|
|
65
|
-
"marked": "^14.1.2",
|
|
66
|
-
"prettier": "^3.3.3",
|
|
67
|
-
"rollup-plugin-visualizer": "^7.0.0",
|
|
68
|
-
"sass-embedded": "1.89.2",
|
|
69
|
-
"typescript": "^5.4.5",
|
|
70
|
-
"vite": "^5.1.5",
|
|
71
|
-
"vue": "^3.4.27",
|
|
72
|
-
"vue-router": "^4.4.3",
|
|
73
|
-
"vue-tsc": "^2.1.6"
|
|
74
|
-
}
|
|
75
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@opengis/bi",
|
|
3
|
+
"version": "1.2.30",
|
|
4
|
+
"description": "BI data visualization module",
|
|
5
|
+
"main": "dist/bi.js",
|
|
6
|
+
"browser": "dist/bi.umd.cjs",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"server",
|
|
11
|
+
"plugin.js",
|
|
12
|
+
"utils.js"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"patch": "npm version patch && git push && npm publish",
|
|
16
|
+
"prepublishOnly": "npm run build:lib",
|
|
17
|
+
"debug": "node --watch-path=server server",
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"type-check": "vue-tsc --noEmit",
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"build:lib": "cross-env APP=true vite build",
|
|
22
|
+
"build-app": "vite build",
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"format": "prettier --write .",
|
|
25
|
+
"test": "node --test",
|
|
26
|
+
"test21": "node --test ./test/plugins/*",
|
|
27
|
+
"start": "node server.js",
|
|
28
|
+
"prod": "NODE_ENV=production npm run start",
|
|
29
|
+
"docs:i": "npm install --prefix ./docs",
|
|
30
|
+
"docs:dev": "npm run --prefix ./docs docs:dev",
|
|
31
|
+
"docs:build": "npm run --prefix ./docs docs:build",
|
|
32
|
+
"docs:preview": "npm run --prefix ./docs docs:preview",
|
|
33
|
+
"adduser": "node script/adduser.js"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"bi",
|
|
37
|
+
"data visualization",
|
|
38
|
+
"chart",
|
|
39
|
+
"opengis",
|
|
40
|
+
"vue",
|
|
41
|
+
"fastify"
|
|
42
|
+
],
|
|
43
|
+
"author": "Softpro",
|
|
44
|
+
"license": "ISC",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@mapbox/sphericalmercator": "^1.2.0",
|
|
47
|
+
"@opengis/table": "^0.0.30",
|
|
48
|
+
"lucide-vue-next": "^0.577.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@opengis/core": "^0.0.33",
|
|
52
|
+
"@opengis/fastify-table": "^2.0.33",
|
|
53
|
+
"@opengis/form": "0.0.137",
|
|
54
|
+
"@turf/turf": "^7.1.0",
|
|
55
|
+
"@types/node": "^22.7.5",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
57
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
58
|
+
"@vitejs/plugin-vue": "^5.1.4",
|
|
59
|
+
"cross-env": "^10.1.0",
|
|
60
|
+
"eslint": "^8.57.1",
|
|
61
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
62
|
+
"eslint-config-prettier": "^9.1.0",
|
|
63
|
+
"eslint-plugin-vue": "^9.29.0",
|
|
64
|
+
"globals": "^15.10.0",
|
|
65
|
+
"marked": "^14.1.2",
|
|
66
|
+
"prettier": "^3.3.3",
|
|
67
|
+
"rollup-plugin-visualizer": "^7.0.0",
|
|
68
|
+
"sass-embedded": "1.89.2",
|
|
69
|
+
"typescript": "^5.4.5",
|
|
70
|
+
"vite": "^5.1.5",
|
|
71
|
+
"vue": "^3.4.27",
|
|
72
|
+
"vue-router": "^4.4.3",
|
|
73
|
+
"vue-tsc": "^2.1.6"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1,39 +1,59 @@
|
|
|
1
|
-
import { pgClients, getTemplatePath, getTemplate } from '@opengis/fastify-table/utils.js';
|
|
1
|
+
import { pgClients, getTemplatePath, getTemplate, getTemplateSync } from '@opengis/fastify-table/utils.js';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const dirContent = getTemplatePath('dashboard').map(([filename, filepath]) => {
|
|
4
|
+
const obj = getTemplateSync('dashboard', filename);
|
|
5
|
+
const index = obj?.find?.((el) => el[0] === 'index.yml')?.[1];
|
|
6
|
+
const { table_name, description, title } = index || {};
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
return { name: filename, path: filepath, type: 'file', title, description, table_name };
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const maxLimit = 100;
|
|
12
|
+
|
|
13
|
+
export default async function dashboardList({
|
|
6
14
|
pg = pgClients.client, query = {}, user = {}
|
|
7
15
|
}) {
|
|
8
16
|
const time = Date.now();
|
|
9
|
-
const { type = 'file' } = query;
|
|
17
|
+
const { type = 'file', page, search, sql } = query;
|
|
18
|
+
|
|
19
|
+
const limit = Math.min(maxLimit, +(query.limit || 15));
|
|
20
|
+
const offset = page && page > 0 ? (page - 1) * limit : 0;
|
|
21
|
+
|
|
22
|
+
const dir = type === 'file' ? dirContent : [];
|
|
10
23
|
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
const where = [search ? `lower(title) ~ $1` : null, type === 'viewer' ? `left(table_name,5)='demo.'` : null].filter(Boolean).join(' and ') || 'true';
|
|
25
|
+
const q1 = `select count(*)::int as total, count(*) filter(where ${where})::int as filtered from bi.dashboard`;
|
|
26
|
+
|
|
27
|
+
const q = `select dashboard_id as name, 'db' as type, title, description, table_name, words, public from bi.dashboard where ${where} limit ${limit} offset ${offset}`;
|
|
28
|
+
|
|
29
|
+
if (user?.user_type?.includes('admin') && ['db', 'viewer'].includes(type) && sql) {
|
|
30
|
+
return `${q1};${q}`;
|
|
31
|
+
}
|
|
17
32
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
) : [];
|
|
33
|
+
const args = [search].filter(Boolean);
|
|
34
|
+
const { total = 0, filtered = 0 } = ['db', 'viewer'].includes(type) ? await pg.query(q1, args).then(el => el.rows?.[0] || {}) : {};
|
|
21
35
|
|
|
22
|
-
const
|
|
36
|
+
const rows = ['db', 'viewer'].includes(type) ? await pg.query(q, args).then(el => el.rows || []) : [];
|
|
23
37
|
|
|
24
38
|
if (type === 'viewer') {
|
|
25
39
|
return {
|
|
26
40
|
time: Date.now() - time,
|
|
27
41
|
db: pg.options?.database,
|
|
28
|
-
|
|
42
|
+
total,
|
|
43
|
+
filtered,
|
|
44
|
+
count: rows.length,
|
|
45
|
+
rows,
|
|
29
46
|
};
|
|
30
47
|
}
|
|
31
48
|
|
|
32
|
-
const list = dir.concat(rows);
|
|
49
|
+
const list = (user?.user_type?.includes('admin') ? dir : dir.map(el => ({ ...el, path: undefined }))).concat(rows);
|
|
33
50
|
|
|
34
51
|
const res = {
|
|
35
52
|
time: Date.now() - time,
|
|
36
53
|
db: pg.options?.database,
|
|
54
|
+
total,
|
|
55
|
+
filtered,
|
|
56
|
+
count: rows.length,
|
|
37
57
|
rows: list,
|
|
38
58
|
};
|
|
39
59
|
return res;
|
|
@@ -2,17 +2,17 @@ import { dataUpdate, pgClients } from '@opengis/fastify-table/utils.js';
|
|
|
2
2
|
|
|
3
3
|
import { getWidget, yamlSafe } from '../../../../utils.js';
|
|
4
4
|
|
|
5
|
-
export default async function widgetEdit({ pg = pgClients.client, body, params }) {
|
|
5
|
+
export default async function widgetEdit({ pg = pgClients.client, body, params }, reply) {
|
|
6
6
|
const { widget: widgetName, name: dashboardName } = params;
|
|
7
7
|
const data = body.yml && !body.style ? yamlSafe.load(body.yml) : body;
|
|
8
8
|
const yml = body.yml ?? yamlSafe.dump(body.data);
|
|
9
9
|
// console.log(body.data, data, body.yml, yml);
|
|
10
10
|
|
|
11
11
|
if (!widgetName || !dashboardName) {
|
|
12
|
-
return {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
12
|
+
return reply.status(400).send({
|
|
13
|
+
error: 'not enough params: dashboard and widget name',
|
|
14
|
+
code: 400,
|
|
15
|
+
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const { widget_id: widgetId, dashboard_id: dashboardId, widgets } = await pg.query(
|
|
@@ -23,7 +23,10 @@ export default async function widgetEdit({ pg = pgClients.client, body, params }
|
|
|
23
23
|
// get Data
|
|
24
24
|
const templateData = await getWidget({ pg, dashboard: dashboardName, widget: widgetName });
|
|
25
25
|
if (!templateData) {
|
|
26
|
-
return
|
|
26
|
+
return reply.status(404).send({
|
|
27
|
+
error: `widget not found ${widgetName}`,
|
|
28
|
+
code: 404,
|
|
29
|
+
});
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
if (data?.data) {
|
|
@@ -43,22 +46,28 @@ export default async function widgetEdit({ pg = pgClients.client, body, params }
|
|
|
43
46
|
|| widgetData?.table_name
|
|
44
47
|
|| templateData.table;
|
|
45
48
|
|
|
46
|
-
const loadTemplate = pg
|
|
49
|
+
const loadTemplate = pg?.pk?.['admin.doc_template'] ? await pg.query(
|
|
47
50
|
'select body from admin.doc_template where doc_type=5 and title=$1',
|
|
48
51
|
[tableName]
|
|
49
52
|
).then(el => el.rows?.[0]?.body) : null;
|
|
50
53
|
|
|
51
|
-
if (!tableName || !(pg.pk?.[loadTemplate?.table || tableName] || pgClients[widgetData?.data?.db || templateData?.db || 'client']?.pk?.[loadTemplate?.table || tableName])) {
|
|
52
|
-
return
|
|
54
|
+
if (!pg || !tableName || !(pg.pk?.[loadTemplate?.table || tableName] || pgClients[widgetData?.data?.db || templateData?.db || 'client']?.pk?.[loadTemplate?.table || tableName])) {
|
|
55
|
+
return reply.status(400).send({
|
|
56
|
+
error: 'bad params: table ' + tableName,
|
|
57
|
+
code: 400,
|
|
58
|
+
});
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
if (yml) {
|
|
56
62
|
Object.assign(widgetData, { yml })
|
|
57
63
|
}
|
|
58
64
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
if (widgetData?.data) {
|
|
66
|
+
Object.assign(widgetData, { data: { ...widgetData?.data || {}, table_name: tableName } });
|
|
67
|
+
}
|
|
68
|
+
Object.assign(widgetData, { table_name: tableName });
|
|
69
|
+
// console.log(widgetData);
|
|
70
|
+
const row = await dataUpdate({
|
|
62
71
|
pg,
|
|
63
72
|
table: 'bi.widget',
|
|
64
73
|
id: widgetId,
|
|
@@ -102,5 +111,5 @@ export default async function widgetEdit({ pg = pgClients.client, body, params }
|
|
|
102
111
|
data: { widgets },
|
|
103
112
|
});
|
|
104
113
|
|
|
105
|
-
return
|
|
114
|
+
return row;
|
|
106
115
|
}
|