@opengis/admin 0.3.109 → 0.3.111
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,3 +1,3 @@
|
|
1
1
|
export default function buttonDownload(filepath) {
|
2
|
-
return `<a download=1 class="flex items-center gap-x-2 border py-2 px-3 shadow rounded-xl cursor-pointer w-[42px] y-[34px]" href="${filepath}" target="_blank"><img src="/
|
2
|
+
return `<a download=1 class="flex items-center gap-x-2 border py-2 px-3 shadow rounded-xl cursor-pointer w-[42px] y-[34px]" href="${filepath}" target="_blank"><img src="https://cdn.softpro.ua/assets/file-up.svg" alt="generate"></a>`;
|
3
3
|
}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
export default function buttonPreview(filepath) {
|
2
|
-
return `<a class="flex items-center gap-x-2 border py-2 px-3 shadow rounded-xl cursor-pointer w-[42px] y-[34px]" href="${filepath}" target="_blank"><img src="/
|
2
|
+
return `<a class="flex items-center gap-x-2 border py-2 px-3 shadow rounded-xl cursor-pointer w-[42px] y-[34px]" href="${filepath}" target="_blank"><img src="https://cdn.softpro.ua/assets/eye.svg" alt="eye"></a>`;
|
3
3
|
}
|
@@ -11,29 +11,33 @@ const components = {
|
|
11
11
|
'vs-widget-comments': `select 'vs-widget-comments' as component, count(*) from crm.communications where entity_id=$1`
|
12
12
|
};
|
13
13
|
|
14
|
-
export default async function getCardData(req) {
|
14
|
+
export default async function getCardData(req, reply) {
|
15
15
|
|
16
16
|
const {
|
17
|
-
pg, params = {}, session = {}, user
|
17
|
+
pg, params = {}, session = {}, user = {},
|
18
18
|
} = req;
|
19
19
|
const { table, id } = params;
|
20
|
-
const uid =
|
20
|
+
const { uid } = user;
|
21
21
|
|
22
22
|
const res = await applyHook('cardData', { table, id, user });
|
23
23
|
if (res) return res;
|
24
24
|
|
25
|
-
|
26
25
|
const time = Date.now();
|
27
26
|
|
28
27
|
const template = await getTemplate('card', table);
|
29
|
-
const access = await getAccess({ table, user });
|
28
|
+
const access = await getAccess({ table, user }, pg);
|
29
|
+
|
30
|
+
if (!access?.actions?.length) {
|
31
|
+
return reply.status(403).send('access restricted');
|
32
|
+
}
|
30
33
|
|
31
34
|
const tableTemplate = await getTemplate('table', table);
|
32
35
|
|
33
36
|
const index = template?.find(el => el[0] === 'index.yml')?.[1] || {};
|
34
37
|
|
35
|
-
const { message, rows = [] } = index.table && index.query
|
36
|
-
await
|
38
|
+
const { message, rows = [] } = index.table && index.query
|
39
|
+
? await pg.query(`select * from ${index.table} where ${handlebarsSync.compile(index.query)({ uid, user })}`)
|
40
|
+
: await getTableData({ pg, params: { table, id }, session, user });
|
37
41
|
|
38
42
|
if (message) return { message };
|
39
43
|
|
@@ -70,14 +74,14 @@ export default async function getCardData(req) {
|
|
70
74
|
.forEach(key => {
|
71
75
|
const item = index?.tokens[key];
|
72
76
|
Object.keys(item).filter(el => item[el]?.includes?.('{{')).forEach(el => {
|
73
|
-
item[el] = handlebarsSync.compile(item[el])({ user, uid
|
77
|
+
item[el] = handlebarsSync.compile(item[el])({ user, uid, id, data: rows[0] });
|
74
78
|
});
|
75
79
|
|
76
80
|
const token = item.form && item.table ? setToken({
|
77
81
|
ids: [JSON.stringify(item)],
|
78
82
|
uid,
|
79
83
|
array: 1,
|
80
|
-
})[0] : setOpt(item,
|
84
|
+
})[0] : setOpt(item, uid);
|
81
85
|
tokens[key] = token;
|
82
86
|
});
|
83
87
|
}
|
@@ -93,7 +97,7 @@ export default async function getCardData(req) {
|
|
93
97
|
Object.assign(route, { tableTitle: tableTemplate?.title });
|
94
98
|
if (index?.data && index?.data?.[0]?.name) {
|
95
99
|
await Promise.all(index.data.filter((el) => el?.name && el?.sql).map(async (el) => {
|
96
|
-
const q = handlebarsSync.compile(el.sql)({ data: rows[0], user, uid
|
100
|
+
const q = handlebarsSync.compile(el.sql)({ data: rows[0], user, uid, id });
|
97
101
|
const { rows: sqlData } = await pg.query(q);
|
98
102
|
data[el.name] = sqlData;
|
99
103
|
}));
|