adminizer 4.3.0-build.99 → 4.3.0
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/assets/add-9NSjG6Jx.js +1 -0
- package/assets/add-form-uUiOWEy_.js +1 -0
- package/assets/add-group-Db0HkA1m.js +1 -0
- package/assets/add-group-form-DMz0_Oo9.js +1 -0
- package/assets/add-user-BMklpOqf.js +1 -0
- package/assets/{add-user-form-DrclnTOd.js → add-user-form-izlXhv2-.js} +1 -1
- package/assets/{app-D8oqdt8J.css → app-BJd5vD4i.css} +1 -1
- package/assets/app-layout-DcgYmhNb.js +1 -0
- package/assets/{app-shell-CHEYhVco.js → app-shell-C8Cnr5Hy.js} +1 -1
- package/assets/app-sidebar-HwvXNZzk.js +1 -0
- package/assets/app-sidebar-header-C8TTx8yd.js +1 -0
- package/assets/app.js +5 -5
- package/assets/{breadcrumbs-C439DWrC.js → breadcrumbs-DSMzNYiS.js} +1 -1
- package/assets/catalog-C2INmTwI.js +6 -0
- package/assets/catalog-D4n6dpGl.css +1 -0
- package/assets/{dashboard-Bi5KeZu2.js → dashboard-DwFL6nqn.js} +1 -1
- package/assets/{date-picker-DbJ8nHp5.js → date-picker-kW3wZQr_.js} +1 -1
- package/assets/{del-modal-_b3CSNHb.js → del-modal-DyIWFflP.js} +1 -1
- package/assets/{field-renderer-4obZ_jUo.js → field-renderer-BNQVfOir.js} +3 -3
- package/assets/form-CAIoGuhZ.js +1 -0
- package/assets/form-NUd-JZJN.js +1 -0
- package/assets/{geo-json-CadjdhwW.js → geo-json-YeWQOYnT.js} +1 -1
- package/assets/{home-BUoDaWe0.js → home-CteDT1us.js} +2 -2
- package/assets/{icon-DM49pZW3.js → icon-DpkedrXG.js} +1 -1
- package/assets/{init-user-DNrB8Xt5.js → init-user-DaOvt0vG.js} +1 -1
- package/assets/{input-error--IOnWghB.js → input-error-CmXZF6xy.js} +1 -1
- package/assets/list-CXQmJbH8.js +1 -0
- package/assets/{list-table-BKxxQkCW.js → list-table-BPpHDVPf.js} +4 -4
- package/assets/{login-6Xb8bcPq.js → login-DR6fvKtm.js} +1 -1
- package/assets/manifest.json +82 -82
- package/assets/{material-icon-BedgD2NE.js → material-icon-DwkE6wKL.js} +1 -1
- package/assets/media-manager-DYOfUh8F.js +14 -0
- package/assets/{module-B4-7WkY5.js → module-BIUqcf4-.js} +1 -1
- package/assets/{nav-footer-BwkQkwow.js → nav-footer-B85HLj-j.js} +1 -1
- package/assets/{nav-main-9Eb_A0rf.js → nav-main-BqKm87JZ.js} +1 -1
- package/assets/nav-user-DuCZNsZX.js +1 -0
- package/assets/notification-BQTjxH2H.js +27 -0
- package/assets/pagination-render-io0M2m2O.js +1 -0
- package/assets/{register-BIyjCy8M.js → register-hJD1ETdf.js} +1 -1
- package/assets/{tabs-BK_5wdPA.js → tabs-BhkFoerH.js} +1 -1
- package/assets/{theme-switcher-CKiJbMkh.js → theme-switcher-cgyA7_cO.js} +1 -1
- package/assets/{toast-editor-BZM5RHph.js → toast-editor-DwRk6WqT.js} +1 -1
- package/assets/{user-info-CcYdmjMZ.js → user-info-BGQvqBmO.js} +1 -1
- package/assets/{user-menu-content-DbUk8ZeY.js → user-menu-content-BDm88xaM.js} +1 -1
- package/assets/welcome-ks57d2us.js +1 -0
- package/controllers/add.js +1 -1
- package/controllers/catalog/Catalog.js +21 -20
- package/controllers/catalog/FrontendCatalogAdapter.d.ts +82 -0
- package/controllers/catalog/FrontendCatalogAdapter.js +228 -0
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +4 -4
- package/controllers/catalog/FrontentCatalogAdapter.js +28 -10
- package/controllers/edit.js +14 -5
- package/controllers/form.js +8 -6
- package/controllers/login.js +3 -0
- package/controllers/media-manager/ThumbController.js +1 -1
- package/controllers/media-manager/mediaManagerAdapter.js +1 -1
- package/controllers/media-manager/mediaManagerApi.js +1 -2
- package/controllers/notifications/NotificationController.d.ts +1 -1
- package/controllers/notifications/NotificationController.js +5 -4
- package/controllers/view.js +5 -3
- package/helpers/inertiaAddHelper.js +1 -2
- package/helpers/inertiaFromHelper.js +1 -2
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/interfaces/adminpanelConfig.d.ts +12 -0
- package/lib/Adminizer.d.ts +4 -3
- package/lib/Adminizer.js +16 -22
- package/lib/catalog/AbstractCatalog.d.ts +6 -4
- package/lib/catalog/AbstractCatalog.js +5 -4
- package/lib/catalog/Navigation.d.ts +9 -7
- package/lib/catalog/Navigation.js +69 -40
- package/lib/inertia/inertiaAdapter.js +31 -13
- package/lib/media-manager/AbstractMediaManager.d.ts +5 -3
- package/lib/media-manager/DefaultMediaManager.d.ts +3 -3
- package/lib/media-manager/DefaultMediaManager.js +18 -13
- package/lib/media-manager/Items.js +5 -4
- package/lib/media-manager/MediaManagerHandler.d.ts +3 -3
- package/lib/media-manager/MediaManagerHandler.js +3 -3
- package/lib/media-manager/Thumb.d.ts +2 -1
- package/lib/media-manager/Thumb.js +3 -4
- package/lib/media-manager/helpers/MediaManagerHelper.d.ts +7 -2
- package/lib/media-manager/helpers/MediaManagerHelper.js +12 -8
- package/lib/model/adapter/waterline.js +6 -0
- package/package.json +3 -1
- package/system/Router.js +10 -8
- package/system/bindAccessRights.js +7 -0
- package/system/bindCors.d.ts +2 -0
- package/system/bindCors.js +41 -0
- package/system/bindInertia.js +1 -1
- package/system/bindMediaManager.js +1 -2
- package/system/bindNavigation.d.ts +1 -1
- package/system/bindNavigation.js +33 -35
- package/system/bindNotifications.js +4 -4
- package/system/bindReqFunctions.js +4 -1
- package/system/defaults.js +8 -0
- package/translations/ru.json +121 -120
- package/ui/components/handsontable.js +6 -3
- package/ui/lib/utils.d.ts +1 -0
- package/ui/lib/utils.js +16 -0
- package/assets/add-1E1UsMVZ.js +0 -1
- package/assets/add-form-CGa9QbwE.js +0 -1
- package/assets/add-group-7yAK6uFY.js +0 -1
- package/assets/add-group-form-BNmpvW8K.js +0 -1
- package/assets/add-user-NoYkTfZi.js +0 -1
- package/assets/app-layout-i2zN9Rn-.js +0 -1
- package/assets/app-sidebar-DeF8WNmW.js +0 -1
- package/assets/app-sidebar-header-DdM1EOrb.js +0 -1
- package/assets/catalog-B9hdop59.js +0 -6
- package/assets/catalog-C71LuRag.css +0 -1
- package/assets/form-Bte5kzjB.js +0 -1
- package/assets/form-oUlsuu7h.js +0 -1
- package/assets/list-C04Krl_W.js +0 -1
- package/assets/media-manager-UQT6RhI8.js +0 -14
- package/assets/nav-user-CRAfyE-x.js +0 -1
- package/assets/notification-ma2x7vka.js +0 -27
- package/assets/pagination-render-D3UyVAlr.js +0 -1
- package/assets/welcome-cWh1qnl_.js +0 -1
|
@@ -3,7 +3,7 @@ export declare class NotificationController {
|
|
|
3
3
|
static viewAll(req: ReqType, res: ResType): Promise<import("express").Response<any, Record<string, any>>>;
|
|
4
4
|
static getNotificationClasses(req: ReqType, res: ResType): Promise<ResType>;
|
|
5
5
|
static getNotificationsStream(req: ReqType, res: ResType): Promise<void>;
|
|
6
|
-
static getNotificationsByClass(req: ReqType, res: ResType): Promise<
|
|
6
|
+
static getNotificationsByClass(req: ReqType, res: ResType): Promise<ResType>;
|
|
7
7
|
static getUserNotifications(req: ReqType, res: ResType): Promise<void>;
|
|
8
8
|
static markAsRead(req: ReqType, res: ResType): Promise<void>;
|
|
9
9
|
static markAllAsRead(req: ReqType, res: ResType): Promise<void>;
|
|
@@ -143,16 +143,17 @@ export class NotificationController {
|
|
|
143
143
|
// Проверяем права доступа
|
|
144
144
|
const hasPermission = req.adminizer.accessRightsHelper.hasPermission(`notification-${notificationClass}`, req.user);
|
|
145
145
|
if (!hasPermission) {
|
|
146
|
-
res.status(403).json({ error: 'Forbidden' });
|
|
147
|
-
return;
|
|
146
|
+
return res.status(403).json({ error: 'Forbidden' });
|
|
148
147
|
}
|
|
149
148
|
const service = req.adminizer.notificationHandler.getService(notificationClass);
|
|
149
|
+
if (!service)
|
|
150
|
+
return res.json({});
|
|
150
151
|
const notifications = await service.getNotifications(req.user?.id, Number(limit), Number(skip), unreadOnly === 'true');
|
|
151
|
-
res.json(notifications);
|
|
152
|
+
return res.json(notifications);
|
|
152
153
|
}
|
|
153
154
|
catch (error) {
|
|
154
155
|
Adminizer.log.error('Error getting notifications:', error);
|
|
155
|
-
res.status(500).json({ error: 'Internal server error' });
|
|
156
|
+
return res.status(500).json({ error: 'Internal server error' });
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
// API для получения всех уведомлений пользователя
|
package/controllers/view.js
CHANGED
|
@@ -86,9 +86,11 @@ export default async function view(req, res) {
|
|
|
86
86
|
for (const field of Object.keys(fields)) {
|
|
87
87
|
let fieldConfigConfig = fields[field].config;
|
|
88
88
|
if (fieldConfigConfig.type === 'mediamanager') {
|
|
89
|
-
record[field] = await getRelationsMediaManager({
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
record[field] = await getRelationsMediaManager(req.adminizer, {
|
|
90
|
+
mediaManagerId: fieldConfigConfig.options?.id ?? "default",
|
|
91
|
+
model: entity.model.modelname,
|
|
92
|
+
widgetName: field,
|
|
93
|
+
modelId: req.params.id
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
96
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import inertiaActionsHelper from "./inertiaActionsHelper";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { isObject } from "./JsUtils";
|
|
4
|
-
import { MediaManagerHandler } from "../lib/media-manager/MediaManagerHandler";
|
|
5
4
|
export default function inertiaAddHelper(req, entity, fields, record, view = false) {
|
|
6
5
|
const actionType = 'add';
|
|
7
6
|
let props = {
|
|
@@ -107,7 +106,7 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
|
|
|
107
106
|
if (type === 'mediamanager') {
|
|
108
107
|
const mConfig = field.config;
|
|
109
108
|
const mOptions = mConfig?.options;
|
|
110
|
-
const mediaManager =
|
|
109
|
+
const mediaManager = req.adminizer.mediaManagerHandler.get(mOptions.id || 'default');
|
|
111
110
|
if (!mediaManager) {
|
|
112
111
|
options = {};
|
|
113
112
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { inputText, setSelectMany, getControlsOptions } from "./inertiaAddHelper";
|
|
2
|
-
import { MediaManagerHandler } from "../lib/media-manager/MediaManagerHandler";
|
|
3
2
|
export default function inertiaFormHelper(req, postLink, formData) {
|
|
4
3
|
let props = {
|
|
5
4
|
fields: [],
|
|
@@ -74,7 +73,7 @@ export default function inertiaFormHelper(req, postLink, formData) {
|
|
|
74
73
|
}
|
|
75
74
|
if (type === 'mediamanager') {
|
|
76
75
|
const mOptions = field.options;
|
|
77
|
-
const mediaManager =
|
|
76
|
+
const mediaManager = req.adminizer.mediaManagerHandler.get(mOptions.id || 'default');
|
|
78
77
|
if (!mediaManager) {
|
|
79
78
|
options = {};
|
|
80
79
|
}
|
package/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./interfaces/MaaterialIcons";
|
|
|
17
17
|
export * from "./lib/model/AbstractModel";
|
|
18
18
|
export * from "./lib/model/adapter/waterline";
|
|
19
19
|
export * from "./lib/model/adapter/sequelize";
|
|
20
|
+
export * from "./lib/media-manager/AbstractMediaManager";
|
|
20
21
|
export * from "./lib/Adminizer";
|
|
21
22
|
export * from "./models/GroupAP";
|
|
22
23
|
export * from "./models/UserAP";
|
|
@@ -25,3 +26,7 @@ export * from "./models/MediaManagerAssociationsAP";
|
|
|
25
26
|
export * from "./models/MediaManagerMetaAP";
|
|
26
27
|
export * from "./models/NavigationAP";
|
|
27
28
|
export * from "./migrations";
|
|
29
|
+
export * from "./system/bindNavigation";
|
|
30
|
+
export * from "./lib/helper/jwt";
|
|
31
|
+
export * from "./lib/notifications/AbstractNotificationService";
|
|
32
|
+
export * from "./lib/POWCaptcha";
|
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./interfaces/MaaterialIcons";
|
|
|
17
17
|
export * from "./lib/model/AbstractModel";
|
|
18
18
|
export * from "./lib/model/adapter/waterline";
|
|
19
19
|
export * from "./lib/model/adapter/sequelize";
|
|
20
|
+
export * from "./lib/media-manager/AbstractMediaManager";
|
|
20
21
|
export * from "./lib/Adminizer";
|
|
21
22
|
export * from "./models/GroupAP";
|
|
22
23
|
export * from "./models/UserAP";
|
|
@@ -25,3 +26,7 @@ export * from "./models/MediaManagerAssociationsAP";
|
|
|
25
26
|
export * from "./models/MediaManagerMetaAP";
|
|
26
27
|
export * from "./models/NavigationAP";
|
|
27
28
|
export * from "./migrations";
|
|
29
|
+
export * from "./system/bindNavigation";
|
|
30
|
+
export * from "./lib/helper/jwt";
|
|
31
|
+
export * from "./lib/notifications/AbstractNotificationService";
|
|
32
|
+
export * from "./lib/POWCaptcha";
|
|
@@ -190,6 +190,15 @@ export interface AdminpanelConfig {
|
|
|
190
190
|
};
|
|
191
191
|
notifications?: {
|
|
192
192
|
enabled: boolean;
|
|
193
|
+
enableGeneral?: boolean;
|
|
194
|
+
};
|
|
195
|
+
cors?: {
|
|
196
|
+
enabled: boolean;
|
|
197
|
+
origin: string[] | string;
|
|
198
|
+
path: string;
|
|
199
|
+
credentials?: boolean;
|
|
200
|
+
methods?: string[];
|
|
201
|
+
allowedHeaders?: string[];
|
|
193
202
|
};
|
|
194
203
|
}
|
|
195
204
|
export interface ModelConfig {
|
|
@@ -347,6 +356,8 @@ export interface TuiEditorFieldConfig extends BaseFieldConfig {
|
|
|
347
356
|
export interface MediaManagerOptionsField {
|
|
348
357
|
id: 'default' | string;
|
|
349
358
|
group: string;
|
|
359
|
+
accept: string[];
|
|
360
|
+
initTab?: 'tile-image' | 'table-video' | 'table-text' | 'table-application' | 'table-all' | 'tile-all';
|
|
350
361
|
config?: Record<string, any>;
|
|
351
362
|
}
|
|
352
363
|
interface RangeType {
|
|
@@ -452,6 +463,7 @@ export interface NavigationConfig {
|
|
|
452
463
|
groupField: {
|
|
453
464
|
name: string;
|
|
454
465
|
required: boolean;
|
|
466
|
+
label: string;
|
|
455
467
|
}[];
|
|
456
468
|
allowContentInGroup?: boolean;
|
|
457
469
|
items: NavigationItemTypeConfig[];
|
package/lib/Adminizer.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ import { ControlsHandler } from "./controls/ControlsHandler";
|
|
|
14
14
|
import { CatalogHandler } from "./catalog/CatalogHandler";
|
|
15
15
|
import { NotificationHandler } from './notifications/NotificationHandler';
|
|
16
16
|
import { INotification } from "../interfaces/types";
|
|
17
|
+
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler";
|
|
18
|
+
import { StorageServices } from "./catalog/Navigation";
|
|
17
19
|
export declare class Adminizer {
|
|
18
20
|
/**
|
|
19
21
|
* If you convey this default Middleware, it will add it to the very top of the router,
|
|
@@ -34,6 +36,8 @@ export declare class Adminizer {
|
|
|
34
36
|
vite: ViteDevServer;
|
|
35
37
|
controlsHandler: ControlsHandler;
|
|
36
38
|
catalogHandler: CatalogHandler;
|
|
39
|
+
mediaManagerHandler: MediaManagerHandler;
|
|
40
|
+
storageServices: StorageServices;
|
|
37
41
|
jwtSecret: string;
|
|
38
42
|
static logger: winston.Logger;
|
|
39
43
|
constructor(ormAdapters: AbstractAdapter[]);
|
|
@@ -46,9 +50,6 @@ export declare class Adminizer {
|
|
|
46
50
|
init(config: AdminpanelConfig): Promise<void>;
|
|
47
51
|
sendNotification(notification: Omit<INotification, 'id' | 'createdAt' | 'icon'>): Promise<boolean>;
|
|
48
52
|
logSystemEvent(title: string, message: string, metadata?: any): Promise<boolean>;
|
|
49
|
-
logSystemCreatedEvent(title: string, message: string, metadata?: any): Promise<boolean>;
|
|
50
|
-
logSystemUpdatedEvent(title: string, message: string, metadata?: any): Promise<boolean>;
|
|
51
|
-
logSystemDeletedEvent(title: string, message: string, metadata?: any): Promise<boolean>;
|
|
52
53
|
get emitter(): EventEmitter;
|
|
53
54
|
getOrmAdapter(ormType: string): AbstractAdapter;
|
|
54
55
|
static get log(): {
|
package/lib/Adminizer.js
CHANGED
|
@@ -8,7 +8,7 @@ import Router from "./../system/Router";
|
|
|
8
8
|
import bindAssets from "../system/bindAssets";
|
|
9
9
|
import bindDev from "../system/bindDev";
|
|
10
10
|
import bindDashboardWidgets from "../system/bindDashboardWidgets";
|
|
11
|
-
import bindNavigation from "../system/bindNavigation";
|
|
11
|
+
import { bindNavigation } from "../system/bindNavigation";
|
|
12
12
|
import bindMediaManager from "../system/bindMediaManager";
|
|
13
13
|
import bindAccessRights from "../system/bindAccessRights";
|
|
14
14
|
import bindAuthorization from "../system/bindAuthorization";
|
|
@@ -30,6 +30,8 @@ import { ControlsHandler } from "./controls/ControlsHandler";
|
|
|
30
30
|
import { CatalogHandler } from "./catalog/CatalogHandler";
|
|
31
31
|
import { v4 as uuid } from "uuid";
|
|
32
32
|
import { bindNotifications } from "../system/bindNotifications";
|
|
33
|
+
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler";
|
|
34
|
+
import { bindCors } from "../system/bindCors";
|
|
33
35
|
export class Adminizer {
|
|
34
36
|
// Preconfigures
|
|
35
37
|
/**
|
|
@@ -52,6 +54,8 @@ export class Adminizer {
|
|
|
52
54
|
vite;
|
|
53
55
|
controlsHandler;
|
|
54
56
|
catalogHandler;
|
|
57
|
+
mediaManagerHandler;
|
|
58
|
+
storageServices;
|
|
55
59
|
// Constants
|
|
56
60
|
jwtSecret = process.env.JWT_SECRET ?? uuid();
|
|
57
61
|
static logger = winston.createLogger({
|
|
@@ -147,16 +151,9 @@ export class Adminizer {
|
|
|
147
151
|
chalk.blue('\nAccess your app at http://localhost:3000'));
|
|
148
152
|
}
|
|
149
153
|
async init(config) {
|
|
150
|
-
// set cookie parser
|
|
151
|
-
this.app.use(cookieParser());
|
|
152
154
|
if (!config || Object.keys(config).length === 0) {
|
|
153
155
|
Adminizer.log.warn(`Adminizer init > Adminizer config is emtpy`);
|
|
154
156
|
}
|
|
155
|
-
// Set vite middleware
|
|
156
|
-
const isViteDev = process.env.VITE_ENV === "dev";
|
|
157
|
-
if (isViteDev)
|
|
158
|
-
await this.viteMiddleware();
|
|
159
|
-
this.emitter.emit('adminizer:init');
|
|
160
157
|
if (this.config && Object.keys(this.config).length > 0) {
|
|
161
158
|
throw new Error("Config has already been initialized");
|
|
162
159
|
}
|
|
@@ -181,6 +178,15 @@ export class Adminizer {
|
|
|
181
178
|
set: configForms.set ?? defaultForms.set
|
|
182
179
|
}
|
|
183
180
|
};
|
|
181
|
+
// Bind cors
|
|
182
|
+
bindCors(this);
|
|
183
|
+
// set cookie parser
|
|
184
|
+
this.app.use(cookieParser());
|
|
185
|
+
// Set vite middleware
|
|
186
|
+
const isViteDev = process.env.VITE_ENV === "dev";
|
|
187
|
+
if (isViteDev)
|
|
188
|
+
await this.viteMiddleware();
|
|
189
|
+
this.emitter.emit('adminizer:init');
|
|
184
190
|
this.modelHandler = new ModelHandler();
|
|
185
191
|
// TODO: 'hot reload' unbind models & unbind forms
|
|
186
192
|
await bindModels(this);
|
|
@@ -195,6 +201,7 @@ export class Adminizer {
|
|
|
195
201
|
this.menuHelper = new MenuHelper(this.config);
|
|
196
202
|
this.widgetHandler = new WidgetHandler(this);
|
|
197
203
|
this.catalogHandler = new CatalogHandler();
|
|
204
|
+
this.mediaManagerHandler = new MediaManagerHandler();
|
|
198
205
|
bindExpressUtils(this.app);
|
|
199
206
|
bindReqFunctions(this);
|
|
200
207
|
// Bind assets
|
|
@@ -205,7 +212,7 @@ export class Adminizer {
|
|
|
205
212
|
}
|
|
206
213
|
}
|
|
207
214
|
await bindDashboardWidgets(this);
|
|
208
|
-
bindNavigation(this);
|
|
215
|
+
await bindNavigation(this);
|
|
209
216
|
bindMediaManager(this);
|
|
210
217
|
await bindAccessRights(this);
|
|
211
218
|
if (I18n.appendLocale) {
|
|
@@ -250,19 +257,6 @@ export class Adminizer {
|
|
|
250
257
|
return Promise.resolve(false);
|
|
251
258
|
}
|
|
252
259
|
}
|
|
253
|
-
// Хелпер для CRUD системных событий
|
|
254
|
-
async logSystemCreatedEvent(title, message, metadata) {
|
|
255
|
-
const systemNotificationService = this.notificationHandler.getService('system');
|
|
256
|
-
return systemNotificationService.logCreatedEvent(title, message, metadata);
|
|
257
|
-
}
|
|
258
|
-
async logSystemUpdatedEvent(title, message, metadata) {
|
|
259
|
-
const systemNotificationService = this.notificationHandler.getService('system');
|
|
260
|
-
return systemNotificationService.logUpdatedEvent(title, message, metadata);
|
|
261
|
-
}
|
|
262
|
-
async logSystemDeletedEvent(title, message, metadata) {
|
|
263
|
-
const systemNotificationService = this.notificationHandler.getService('system');
|
|
264
|
-
return systemNotificationService.logDeletedEvent(title, message, metadata);
|
|
265
|
-
}
|
|
266
260
|
get emitter() {
|
|
267
261
|
return this._emitter;
|
|
268
262
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Adminizer } from "../Adminizer";
|
|
2
|
+
import { StorageServices } from "./Navigation";
|
|
2
3
|
/**
|
|
3
4
|
* Interface `Item` describes the data that the UI will operate on
|
|
4
5
|
* This is a common interface for all data that is linked to the catalog
|
|
@@ -24,6 +25,7 @@ export type _Item_ = {
|
|
|
24
25
|
* General Item structure that will be available for all elements, including groups
|
|
25
26
|
*/
|
|
26
27
|
export declare abstract class BaseItem<T extends Item> {
|
|
28
|
+
storageServices?: StorageServices;
|
|
27
29
|
abstract readonly type: string;
|
|
28
30
|
/**
|
|
29
31
|
* Used for infer T
|
|
@@ -90,7 +92,7 @@ export declare abstract class BaseItem<T extends Item> {
|
|
|
90
92
|
* @param req
|
|
91
93
|
*/
|
|
92
94
|
abstract getAddTemplate(req: ReqType): Promise<{
|
|
93
|
-
type: 'component' | 'navigation.group' | 'navigation.link' | 'model';
|
|
95
|
+
type: 'component' | 'navigation.group' | 'navigation.link' | 'model' | 'model.link';
|
|
94
96
|
data: any;
|
|
95
97
|
}>;
|
|
96
98
|
/**
|
|
@@ -101,7 +103,7 @@ export declare abstract class BaseItem<T extends Item> {
|
|
|
101
103
|
* @param modelId
|
|
102
104
|
*/
|
|
103
105
|
abstract getEditTemplate(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
|
|
104
|
-
type: 'component' | 'navigation.group' | 'navigation.link' | 'model';
|
|
106
|
+
type: 'component' | 'navigation.group' | 'navigation.link' | 'model' | 'model.link';
|
|
105
107
|
data: any;
|
|
106
108
|
}>;
|
|
107
109
|
_getChilds(parentId: string | number, catalogId: string, req?: ReqType): Promise<Item[]>;
|
|
@@ -230,7 +232,7 @@ export declare abstract class AbstractCatalog {
|
|
|
230
232
|
* @param modelId
|
|
231
233
|
*/
|
|
232
234
|
getEditTemplate(item: Item, id: string | number, req: ReqType, modelId?: string | number): Promise<{
|
|
233
|
-
type: "component" | "navigation.group" | "navigation.link" | "model";
|
|
235
|
+
type: "component" | "navigation.group" | "navigation.link" | "model" | "model.link";
|
|
234
236
|
data: any;
|
|
235
237
|
}>;
|
|
236
238
|
/**
|
|
@@ -239,7 +241,7 @@ export declare abstract class AbstractCatalog {
|
|
|
239
241
|
* @param req
|
|
240
242
|
*/
|
|
241
243
|
getAddTemplate(item: Item, req: ReqType): Promise<{
|
|
242
|
-
type: "component" | "navigation.group" | "navigation.link" | "model";
|
|
244
|
+
type: "component" | "navigation.group" | "navigation.link" | "model" | "model.link";
|
|
243
245
|
data: any;
|
|
244
246
|
}>;
|
|
245
247
|
addActionHandler(actionHandler: ActionHandler): void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* General Item structure that will be available for all elements, including groups
|
|
3
3
|
*/
|
|
4
4
|
export class BaseItem {
|
|
5
|
+
storageServices;
|
|
5
6
|
/**
|
|
6
7
|
* Array of all global contexts, which will appear for all elements
|
|
7
8
|
*/
|
|
@@ -253,7 +254,7 @@ export class AbstractCatalog {
|
|
|
253
254
|
* Method for getting group elements
|
|
254
255
|
*/
|
|
255
256
|
getitemTypes() {
|
|
256
|
-
return this.itemTypes.map(({ adminizer, ...rest }) => rest);
|
|
257
|
+
return this.itemTypes.map(({ adminizer, storageServices, ...rest }) => rest);
|
|
257
258
|
}
|
|
258
259
|
;
|
|
259
260
|
async search(s, hasExtras = true, req) {
|
|
@@ -268,7 +269,7 @@ export class AbstractCatalog {
|
|
|
268
269
|
const extras = await this.getChilds(item.id, undefined, req);
|
|
269
270
|
accumulator.push(...extras);
|
|
270
271
|
}
|
|
271
|
-
if (item.parentId ===
|
|
272
|
+
if (item.parentId === null)
|
|
272
273
|
return item;
|
|
273
274
|
const parentItem = await groupType._find(item.parentId, this.id);
|
|
274
275
|
if (parentItem) {
|
|
@@ -284,7 +285,7 @@ export class AbstractCatalog {
|
|
|
284
285
|
foundItems = foundItems.concat(items);
|
|
285
286
|
}
|
|
286
287
|
for (const item of foundItems) {
|
|
287
|
-
if (item.parentId !==
|
|
288
|
+
if (item.parentId !== null) { // changed from 0 to null
|
|
288
289
|
await buildTreeUpwards(item, hasExtras);
|
|
289
290
|
}
|
|
290
291
|
}
|
|
@@ -310,7 +311,7 @@ export class AbstractCatalog {
|
|
|
310
311
|
itemMap[item.id] = item;
|
|
311
312
|
});
|
|
312
313
|
items.forEach(item => {
|
|
313
|
-
if (item.parentId ===
|
|
314
|
+
if (item.parentId === null) {
|
|
314
315
|
tree.push(item);
|
|
315
316
|
}
|
|
316
317
|
else {
|
|
@@ -5,14 +5,15 @@ export interface NavItem extends Item {
|
|
|
5
5
|
urlPath?: string;
|
|
6
6
|
modelId?: string | number;
|
|
7
7
|
targetBlank?: boolean;
|
|
8
|
+
visible?: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare class StorageService {
|
|
10
|
+
export declare class StorageService {
|
|
10
11
|
protected storageMap: Map<string | number, NavItem>;
|
|
11
12
|
protected id: string;
|
|
12
13
|
protected model: string;
|
|
13
14
|
protected readonly adminizer: Adminizer;
|
|
14
15
|
constructor(adminizer: Adminizer, id: string, model: string);
|
|
15
|
-
|
|
16
|
+
initModel(): Promise<void>;
|
|
16
17
|
getId(): string;
|
|
17
18
|
buildTree(): Promise<any>;
|
|
18
19
|
populateFromTree(tree: any[]): Promise<void>;
|
|
@@ -26,10 +27,11 @@ declare class StorageService {
|
|
|
26
27
|
search(s: string, type: string): Promise<NavItem[]>;
|
|
27
28
|
}
|
|
28
29
|
export declare class StorageServices {
|
|
29
|
-
protected
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
protected storages: StorageService[];
|
|
31
|
+
constructor();
|
|
32
|
+
add(storage: StorageService): void;
|
|
33
|
+
get(id: string): StorageService;
|
|
34
|
+
getAll(): StorageService[];
|
|
33
35
|
}
|
|
34
36
|
export declare class Navigation extends AbstractCatalog {
|
|
35
37
|
readonly name: string;
|
|
@@ -37,7 +39,7 @@ export declare class Navigation extends AbstractCatalog {
|
|
|
37
39
|
readonly icon: string;
|
|
38
40
|
readonly actionHandlers: ActionHandler[];
|
|
39
41
|
idList: string[];
|
|
42
|
+
storageServices: StorageServices;
|
|
40
43
|
constructor(adminizer: Adminizer, config: NavigationConfig);
|
|
41
44
|
getIdList(): Promise<string[]>;
|
|
42
45
|
}
|
|
43
|
-
export {};
|