@opengis/admin 0.1.36 → 0.1.38
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/style.css +1 -1
- package/package.json +1 -1
- package/plugin.js +1 -2
- package/server/plugins/hook.js +14 -14
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
li[data-v-95b2773a]{cursor:move}.map-popup__vertical[data-v-3f5a9aff]{overflow:auto;max-height:300px}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-thumb{border-radius:5px;background-color:#dedede}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-track{background-color:#f5f5f5}.map__popup-body[data-v-3f5a9aff]{table-layout:fixed;width:100%}.map__popup-body-item[data-v-3f5a9aff]:not(:last-child){border-bottom:1px solid #eeeeee}.map__popup-body-item td[data-v-3f5a9aff]{width:50%;word-wrap:break-word;text-align:start}.map__popup-body-item td[data-v-3f5a9aff]:first-child{font-weight:600}.popup-image[data-v-deb51e0a]{max-width:100%;max-height:220px;margin-bottom:10px;object-fit:contain}.maplibregl-ctrl-bottom-right,.maplibregl-popup-close-button{display:none}.widget-file .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.ui-dialog__modal div.flex.justify-between.items-center.py-3.px-4.border-b{border-bottom-width:0px;--tw-text-opacity: 1;color:#1f2937;font-weight:500;font-size:1.125rem;line-height:1.75rem;padding-bottom:0rem}.ui-dialog__modal .ui-dialog__content .p-4{padding-top:0rem}.widget-images__item-desc span:first-child:after{content:"";width:2px;height:2px;border-radius:50%;display:flex;align-items:center;background:#676a6c;margin:0 5px}.disabled{cursor:not-allowed!important}.item__text-content,.item{transition:all .5s cubic-bezier(.4,0,.2,1)}.item:hover .item__text-content{opacity:.8}.vs-widget-images .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.editor-container{max-width:800px;margin:0 auto}.ProseMirror-focused{outline:none}.editor-toolbar{background-color:#f9fafb}.editor-content{min-height:200px}button{transition:background-color .2s ease;outline:none}button:focus{outline:none}.editor-content ul{margin-left:20px}.editor-content ul>li{list-style:disc}.editor-content ol{list-style-type:decimal;margin-left:20px}pre{background-color:#d3d1d1;border-radius:4px;padding:0 2px}.mention-popup{background-color:#fafafa;padding:10px;border-radius:10px;box-shadow:0 4px 6px #0000001a;z-index:1000;max-width:200px;overflow-y:auto;width:auto}.mention-option{padding:5px 10px;cursor:pointer;transition:background-color .2s;border-radius:8px}.mention-option:hover{background-color:#f0f0f0}.border-top:not(:first-child){--tw-border-opacity: 1;border-color:#e5e7eb;border-top-width:1px}.widget-comment-form .vs-button{padding:.625rem 1rem;font-size:.75rem;line-height:1rem;font-weight:500}.widget-comment-form .vs-button:focus{border:transparent;--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 rgba(0, 0, 0, 0))}.grid[data-v-9b7dd8fb]{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:1rem}.admin-wrapper[data-v-3d7ecdff]{display:flex;height:100vh;align-items:start}.vs-popover__content>div{padding:.25rem}
|
|
1
|
+
li[data-v-95b2773a]{cursor:move}.map-popup__vertical[data-v-3f5a9aff]{overflow:auto;max-height:300px}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar{width:6px;height:6px;background-color:#f5f5f5}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-thumb{border-radius:5px;background-color:#dedede}.map-popup__vertical[data-v-3f5a9aff]::-webkit-scrollbar-track{background-color:#f5f5f5}.map__popup-body[data-v-3f5a9aff]{table-layout:fixed;width:100%}.map__popup-body-item[data-v-3f5a9aff]:not(:last-child){border-bottom:1px solid #eeeeee}.map__popup-body-item td[data-v-3f5a9aff]{width:50%;word-wrap:break-word;text-align:start}.map__popup-body-item td[data-v-3f5a9aff]:first-child{font-weight:600}.popup-image[data-v-deb51e0a]{max-width:100%;max-height:220px;margin-bottom:10px;object-fit:contain}.maplibregl-ctrl-bottom-right,.maplibregl-popup-close-button{display:none}.widget-file .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.ui-dialog__modal div.flex.justify-between.items-center.py-3.px-4.border-b{border-bottom-width:0px;--tw-text-opacity: 1;color:#1f2937;font-weight:500;font-size:1.125rem;line-height:1.75rem;padding-bottom:0rem}.ui-dialog__modal .ui-dialog__content .p-4{padding-top:0rem}.widget-images__item-desc span:first-child:after{content:"";width:2px;height:2px;border-radius:50%;display:flex;align-items:center;background:#676a6c;margin:0 5px}.disabled{cursor:not-allowed!important}.item__text-content,.item{transition:all .5s cubic-bezier(.4,0,.2,1)}.item:hover .item__text-content{opacity:.8}.vs-widget-images .vs-button{background-color:#2563eb;color:#fff;font-size:.875rem;line-height:1.25rem;font-weight:600}.editor-container{max-width:800px;margin:0 auto}.ProseMirror-focused{outline:none}.editor-toolbar{background-color:#f9fafb}.editor-content{min-height:200px}button{transition:background-color .2s ease;outline:none}button:focus{outline:none}.editor-content ul{margin-left:20px}.editor-content ul>li{list-style:disc}.editor-content ol{list-style-type:decimal;margin-left:20px}.editor-content pre{background-color:#d3d1d1;border-radius:4px;padding:0 2px}.mention-popup{background-color:#fafafa;padding:10px;border-radius:10px;box-shadow:0 4px 6px #0000001a;z-index:1000;max-width:200px;overflow-y:auto;width:auto}.mention-option{padding:5px 10px;cursor:pointer;transition:background-color .2s;border-radius:8px}.mention-option:hover{background-color:#f0f0f0}.border-top:not(:first-child){--tw-border-opacity: 1;border-color:#e5e7eb;border-top-width:1px}.widget-comment-form .vs-button{padding:.625rem 1rem;font-size:.75rem;line-height:1rem;font-weight:500}.widget-comment-form .vs-button:focus{border:transparent;--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 rgba(0, 0, 0, 0))}.grid[data-v-9b7dd8fb]{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:1rem}.admin-wrapper[data-v-3d7ecdff]{display:flex;height:100vh;align-items:start}.vs-popover__content>div{padding:.25rem}
|
package/package.json
CHANGED
package/plugin.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fp from 'fastify-plugin';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
2
|
import path from 'node:path';
|
|
4
3
|
|
|
5
4
|
import { getTemplatePath, getTemplate, pgClients } from '@opengis/fastify-table/utils.js';
|
|
@@ -72,7 +71,7 @@ async function plugin(fastify, opts = config) {
|
|
|
72
71
|
if (type === 'select') {
|
|
73
72
|
clsQuery.push(`insert into admin.cls(name,type,data,module) values('${name}','sql','${(loadTemplate?.sql || loadTemplate)?.replace(/'/g, "''")}', '${module?.replace(/'/g, "''")}')`);
|
|
74
73
|
} else if (type === 'cls' && loadTemplate?.length) {
|
|
75
|
-
clsQuery.push(`insert into admin.cls(name,type) values('${name}','json');
|
|
74
|
+
clsQuery.push(`insert into admin.cls(name,type, module) values('${name}','json', '${module?.replace(/'/g, "''")}');
|
|
76
75
|
insert into admin.cls(code,name,parent,icon)
|
|
77
76
|
select value->>'id',value->>'text','${name}',value->>'icon'
|
|
78
77
|
from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json)`);
|
package/server/plugins/hook.js
CHANGED
|
@@ -2,7 +2,7 @@ import fp from 'fastify-plugin';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { getTemplatePath, getTemplate, pgClients } from '@opengis/fastify-table/utils.js';
|
|
6
6
|
|
|
7
7
|
import getMenu from '../routes/menu/controllers/getMenu.js';
|
|
8
8
|
|
|
@@ -50,30 +50,30 @@ async function plugin(fastify) {
|
|
|
50
50
|
const clsQuery = [];
|
|
51
51
|
if (!pg.pk?.['admin.cls']) return;
|
|
52
52
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
?.map((el) => ({ module: path.basename(path.dirname(el)),
|
|
57
|
-
?.filter((el) => el.files?.length);
|
|
53
|
+
const selectList = await getTemplatePath('select');
|
|
54
|
+
const clsList = (await getTemplatePath('cls'))?.filter((el) => !(selectList?.map((el) => el?.[0]) || []).includes(el[0]));
|
|
55
|
+
const cls = (selectList || []).concat(clsList || [])
|
|
56
|
+
?.map((el) => ({ name: el[0], module: path.basename(path.dirname(path.dirname(el[1]))), type: { 'json': 'cls', 'sql': 'select' }[el[2]] }))
|
|
58
57
|
if (!cls?.length) return;
|
|
59
58
|
|
|
59
|
+
const dupes = cls.filter((el, idx, arr) => arr.map((item) => item.name).indexOf(el.name) !== idx);
|
|
60
|
+
console.log('cls insert skip dupes', dupes.map((el) => el.name));
|
|
61
|
+
|
|
60
62
|
try {
|
|
61
|
-
await Promise.all(cls.map(async (
|
|
62
|
-
const { module,
|
|
63
|
-
await Promise.all((files.map(async (el) => {
|
|
64
|
-
const { ext, name } = path.parse(el);
|
|
65
|
-
const type = { '.json': 'cls', '.sql': 'select' }[ext];
|
|
63
|
+
await Promise.all(cls.filter((el, idx, arr) => arr.map((item) => item.name).indexOf(el.name) === idx).map(async (el) => {
|
|
64
|
+
const { name, module, type } = el;
|
|
66
65
|
const loadTemplate = await getTemplate(type, name);
|
|
67
66
|
console.log(name, type);
|
|
68
67
|
if (type === 'select') {
|
|
69
68
|
clsQuery.push(`insert into admin.cls(name,type,data,module) values('${name}','sql','${(loadTemplate?.sql || loadTemplate)?.replace(/'/g, "''")}', '${module?.replace(/'/g, "''")}')`);
|
|
70
|
-
} else if (type === 'cls') {
|
|
71
|
-
clsQuery.push(`insert into admin.cls(name,type) values('${name}','json');
|
|
69
|
+
} else if (type === 'cls' && loadTemplate?.length) {
|
|
70
|
+
clsQuery.push(`insert into admin.cls(name,type, module) values('${name}','json', '${module?.replace(/'/g, "''")}');
|
|
72
71
|
insert into admin.cls(code,name,parent,icon)
|
|
73
72
|
select value->>'id',value->>'text','${name}',value->>'icon'
|
|
74
73
|
from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json)`);
|
|
74
|
+
} else {
|
|
75
|
+
console.log(name, type, 'empty');
|
|
75
76
|
}
|
|
76
|
-
})));
|
|
77
77
|
}));
|
|
78
78
|
|
|
79
79
|
await pg.query('truncate admin.cls');
|