@opengis/admin 0.3.56 → 0.3.58
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.
@@ -44,6 +44,33 @@
|
|
44
44
|
"email"
|
45
45
|
]
|
46
46
|
},
|
47
|
+
"d2": {
|
48
|
+
"type": "HTML",
|
49
|
+
"title": false,
|
50
|
+
"text": "<h4 class='text-center'>Логін / Пароль</h4><br>",
|
51
|
+
"hidden": true,
|
52
|
+
"col": 12
|
53
|
+
},
|
54
|
+
"login": {
|
55
|
+
"type": "Text",
|
56
|
+
"ua": "Логін",
|
57
|
+
"i": "Вноситься довільний логін користувача латинськими літерами, що буде використовуватися для входу в систему",
|
58
|
+
"ru": "Логин"
|
59
|
+
},
|
60
|
+
"password": {
|
61
|
+
"type": "Password",
|
62
|
+
"validators": [
|
63
|
+
{
|
64
|
+
"type": "regexp",
|
65
|
+
"regexp": "^.{8,}$",
|
66
|
+
"flags": "gm",
|
67
|
+
"message": "Пароль повинен бути більше 8 символів"
|
68
|
+
}
|
69
|
+
],
|
70
|
+
"ua": "Пароль",
|
71
|
+
"i": "Вноситься пароль, що буде використовуватися для входу в систему (рекомендоване використання складних паролів)",
|
72
|
+
"ru": "Пароль"
|
73
|
+
},
|
47
74
|
"d3": {
|
48
75
|
"type": "HTML",
|
49
76
|
"text": "<h4 class='text-center'>Доступ</h4><br>",
|
package/package.json
CHANGED
@@ -46,7 +46,7 @@ export default async function tableList(data, opt) {
|
|
46
46
|
skip[name] = name.includes('{{') && !nameHBS;
|
47
47
|
if (skip[name]) continue;
|
48
48
|
|
49
|
-
result.push(`<th class="py-2">
|
49
|
+
result.push(`<th class="py-2 min-w-[200px] last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0">
|
50
50
|
${nameHBS || name}
|
51
51
|
</th>`)
|
52
52
|
}
|
@@ -55,7 +55,7 @@ export default async function tableList(data, opt) {
|
|
55
55
|
// body
|
56
56
|
for (let k = 0; k < data.length; k += 1) {
|
57
57
|
const row = data[k];
|
58
|
-
result.push('<tr class="odd:bg-gray-50">');
|
58
|
+
result.push('<tr class="bg-white odd:bg-gray-50 ">');
|
59
59
|
const obj = { form: hash.form, table: hash.table, id: row[hash.id] }
|
60
60
|
const token = hash.table ? setToken({ ids: [JSON.stringify(obj)], uid: hash.uid, array: 1 })[0] : null;
|
61
61
|
for (let i = 0; i < keys.length; i += 2) {
|
@@ -67,7 +67,7 @@ export default async function tableList(data, opt) {
|
|
67
67
|
|
68
68
|
const tokenData = key == 'actions' ? token : null;
|
69
69
|
const d1 = key.includes('{{') ? await handlebars.compile(key)({ ...row, token, hash }) || '-' : null
|
70
|
-
result.push(`<td class="py-2 pr-5">
|
70
|
+
result.push(`<td class="py-2 pr-5 last:sticky last:right-0 ">
|
71
71
|
${d1 || format(tokenData || row[key], key, row, hash)}
|
72
72
|
</td>`);
|
73
73
|
|
@@ -79,5 +79,5 @@ export default async function tableList(data, opt) {
|
|
79
79
|
result.push('</tbody>');
|
80
80
|
|
81
81
|
// console.log(Date.now() - time)
|
82
|
-
return '<table class="min-w-full divide-y-2 divide-gray-200 bg-white min-w-full divide-y-2 divide-gray-200 bg-white text-[12px] text-gray-600">' + result.join('') + '</table>';
|
82
|
+
return '<table class="min-w-full relative divide-y-2 divide-gray-200 bg-white min-w-full overflow-auto divide-y-2 divide-gray-200 bg-white text-[12px] text-gray-600">' + result.join('') + '</table>';
|
83
83
|
}
|
package/server/plugins/hook.js
CHANGED
@@ -123,6 +123,7 @@ export default async function plugin(fastify) {
|
|
123
123
|
const hashes = await rclient.hgetall('cls-insert-hashes').then(obj => Object.keys(obj));
|
124
124
|
const dbdata = await client.query(`select json_object_agg(name, hash) from admin.cls where parent is null`).then(el => el.rows?.[0]?.json_object_agg || {});
|
125
125
|
const names = Object.keys(dbdata);
|
126
|
+
console.log('admin/hook cls promise start');
|
126
127
|
const qHashes = await Promise.all(cls.filter((el, idx, arr) => arr.map((item) => item.name).indexOf(el.name) === idx).map(async (el) => {
|
127
128
|
const { name, module, type } = el;
|
128
129
|
const loadTemplate = await getTemplate(type, name);
|
@@ -134,20 +135,20 @@ export default async function plugin(fastify) {
|
|
134
135
|
|
135
136
|
if (type === 'select' && (loadTemplate?.sql || loadTemplate) && el.update) {
|
136
137
|
clsQuery.push(`insert into admin.cls(name,type,data,module,hash) values('${name}','sql','${(loadTemplate?.sql || loadTemplate)?.replace(/'/g, "''")}', '${module?.replace(/'/g, "''")}','${el.hash}')`);
|
137
|
-
console.log(name, type, 'insert fresh select');
|
138
|
+
if (config.trace) console.log(name, type, 'insert fresh select');
|
138
139
|
return el.hash;
|
139
140
|
} else if (type === 'cls' && loadTemplate?.length && el.update) {
|
140
141
|
clsQuery.push(`insert into admin.cls(name,type, module,hash) values('${name}','json', '${module?.replace(/'/g, "''")}','${el.hash}');
|
141
142
|
insert into admin.cls(code,name,parent,icon,data)
|
142
143
|
select value->>'id',value->>'text','${name}',value->>'icon',value->>'data'
|
143
144
|
from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json)`);
|
144
|
-
console.log(name, type, 'insert fresh cls');
|
145
|
+
if (config.trace) console.log(name, type, 'insert fresh cls');
|
145
146
|
return el.hash;
|
146
147
|
} else if (hashes.includes(el.hash)) {
|
147
|
-
console.log(name, type, names.includes(name) ? 'skip equal hash' : 'insert missing cls');
|
148
|
+
if (config.trace) console.log(name, type, names.includes(name) ? 'skip equal hash' : 'insert missing cls');
|
148
149
|
return el.hash;
|
149
150
|
} else {
|
150
|
-
console.log(name, type, 'empty');
|
151
|
+
if (config.trace) console.log(name, type, 'empty');
|
151
152
|
return el.hash;
|
152
153
|
}
|
153
154
|
}));
|
@@ -165,6 +166,7 @@ export default async function plugin(fastify) {
|
|
165
166
|
logger.file('migration/hash', { list: qHashes.filter(el => el) });
|
166
167
|
console.log('admin/hook cls sql finish', clsQuery?.length);
|
167
168
|
}
|
169
|
+
console.log('admin/hook cls promise finish', rowCount);
|
168
170
|
} catch (err) {
|
169
171
|
console.error('admin/hook cls sql error', err.toString());
|
170
172
|
console.trace(err);
|
@@ -37,6 +37,9 @@ export default async function adminMenu({ user = {}, session, pg = pgClients.cli
|
|
37
37
|
|
38
38
|
const { rows } = await pgClients.client.query(`select property_key as key,property_text as val from admin.properties where property_key~'^(${config.settingKeys || 'site|map|admin'})'`);
|
39
39
|
const settings = rows.reduce((p, { key, val }) => { const [k1, k2] = key.split('.'); p[k1] = p[k1] || {}; p[k1][k2] = val; return p }, {});
|
40
|
+
|
41
|
+
if (config.settings) Object.assign(settings, config.settings);
|
42
|
+
|
40
43
|
// update user access
|
41
44
|
const { user_name, sur_name, father_name, email, phone, uid } = user;
|
42
45
|
const result = { settings, user: { uid, user_name, sur_name, father_name, email, phone } };
|