adminizer 4.1.0-commit.d8a06d3 → 4.1.1
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/Readme.md +46 -0
- package/assets/{VanillaJSONEditor-D-Lx670g.js → VanillaJSONEditor-DfRefswH.js} +104 -104
- package/assets/add-CJ1-zeA1.js +1 -0
- package/assets/add-form-CbNl0wdS.js +1 -0
- package/assets/add-group-form-Bt_Dx9wm.js +1 -0
- package/assets/add-group-pIFJV5qL.js +1 -0
- package/assets/add-user-D2US8hL_.js +1 -0
- package/assets/add-user-form-Bt8Jy6S2.js +1 -0
- package/assets/{app-WTooYWC3.css → app-B6cCPfWk.css} +1 -1
- package/assets/app-layout-B86jl9bH.js +1 -0
- package/assets/app-shell-CiGyzQ0C.js +1 -0
- package/assets/app-sidebar-Bz-SRwBg.js +1 -0
- package/assets/app-sidebar-header-7CNCx7Rs.js +11 -0
- package/assets/app.js +45 -37
- package/assets/breadcrumbs-_jhtTcOi.js +1 -0
- package/assets/catalog-CON6moaA.js +16 -0
- package/assets/catalog-Cc6Mk9sX.css +1 -0
- package/assets/checkbox-CQdZw5mb.js +1 -0
- package/assets/dashboard-es9ZT8qk.js +3 -0
- package/assets/{date-picker-DI1cCO7K.js → date-picker-Dz-d-YWX.js} +2 -2
- package/assets/debounce-qdyXyOeG.js +1 -0
- package/assets/del-modal-D0mrZvki.js +11 -0
- package/assets/dialog-stack-BiMbfm58.js +1 -0
- package/assets/dropdown-menu-BSBcRiXx.js +1 -0
- package/assets/{field-renderer-DVHZF6HS.js → field-renderer-B6hFAeiU.js} +3 -3
- package/assets/form-Buslty7y.js +1 -0
- package/assets/form-aqiRmPix.js +1 -0
- package/assets/{geo-json-BjiyTtMu.js → geo-json-BKmYmu3d.js} +2 -2
- package/assets/{handsontable-4mjU_b0n.js → handsontable-B8xVeMAQ.js} +5 -5
- package/assets/home-Dr72Jk-w.js +2 -0
- package/assets/icon-B-a7xg54.js +1 -0
- package/assets/index-B68_akQe.js +1 -0
- package/assets/index-B7-xTDyy.js +1 -0
- package/assets/index-BJFFlCSo.js +1 -0
- package/assets/{index-Cw5o84pO.js → index-BOuMo_nl.js} +3 -3
- package/assets/index-BzOcGsBq.js +1 -0
- package/assets/index-CFbQ2Rv0.js +1 -0
- package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
- package/assets/{index-Cgp8OfuI.js → index-D5UDXTFs.js} +1 -1
- package/assets/index-oxIQWAdI.js +41 -0
- package/assets/init-user-5H689LP0.js +1 -0
- package/assets/input-CSJjrf2i.js +1 -0
- package/assets/input-error-CK92Shhm.js +1 -0
- package/assets/label-Muj0-Efy.js +1 -0
- package/assets/list-Cvh7zbyG.js +1 -0
- package/assets/list-table-Bs_vbQiV.js +52 -0
- package/assets/login-DliJrjMQ.js +6 -0
- package/assets/manifest.json +575 -673
- package/assets/material-icon-BRS58Qpk.js +1 -0
- package/assets/module-CjG21VCT.js +1 -0
- package/assets/{monaco-editor-CJs0_GlD.js → monaco-editor-9fDiyfuW.js} +2 -2
- package/assets/{multi-select-BvRpAW8r.js → multi-select-CMQIJ0JT.js} +2 -2
- package/assets/nav-footer-IGMn9NiE.js +1 -0
- package/assets/nav-main-DBE4rMiZ.js +1 -0
- package/assets/nav-user-CjyLRyq-.js +1 -0
- package/assets/pagination-render-DUAq2klc.js +1 -0
- package/assets/popover-C_cww-4_.js +1 -0
- package/assets/register-UzQn3J0g.js +1 -0
- package/assets/{select-BWepUw-9.js → select-DzBno-dc.js} +2 -2
- package/assets/{sidebar-CAHsHdjM.js → sidebar-Dc4iqfu-.js} +2 -2
- package/assets/skeleton-Dkmj2o2Z.js +1 -0
- package/assets/sonner-De1t71Gj.js +1 -0
- package/assets/{toast-editor-CMK7QtF1.js → toast-editor-1Pul3oMs.js} +2 -2
- package/assets/tooltip-CwPrC-HD.js +1 -0
- package/assets/use-appearance-J8J2w43p.js +1 -0
- package/assets/use-window-size-DLSEoR6e.js +1 -0
- package/assets/{user-info-DFrmpJ4y.js → user-info-8RyDk7qh.js} +2 -2
- package/assets/user-menu-content-CpxTLH56.js +6 -0
- package/assets/welcome-BYKI6yO-.js +1 -0
- package/controllers/add.js +8 -8
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +40 -35
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
- package/controllers/catalog/FrontentCatalogAdapter.js +71 -72
- package/controllers/edit.js +8 -11
- package/controllers/list.js +2 -2
- package/controllers/login.js +16 -7
- package/controllers/navigation/edit.js +1 -1
- package/controllers/remove.js +1 -1
- package/controllers/view.js +1 -1
- package/helpers/JsUtils.d.ts +1 -0
- package/helpers/JsUtils.js +3 -0
- package/helpers/accessRightsHelper.d.ts +3 -0
- package/helpers/accessRightsHelper.js +27 -4
- package/helpers/controllerHelper.js +39 -18
- package/helpers/fieldsHelper.d.ts +3 -2
- package/helpers/fieldsHelper.js +5 -1
- package/helpers/inertiaAddHelper.d.ts +4 -5
- package/helpers/inertiaAddHelper.js +25 -7
- package/helpers/inertiaFromHelper.js +1 -1
- package/helpers/inertiaMenuHelper.d.ts +1 -1
- package/helpers/inertiaMenuHelper.js +1 -1
- package/helpers/menuHelper.d.ts +8 -3
- package/helpers/menuHelper.js +26 -17
- package/index.d.ts +2 -6
- package/index.js +5 -6
- package/interfaces/adminpanelConfig.d.ts +35 -30
- package/interfaces/global.d.ts +5 -2
- package/interfaces/types.d.ts +1 -1
- package/lib/Adminizer.d.ts +9 -3
- package/lib/Adminizer.js +32 -16
- package/lib/media-manager/Items.js +0 -3
- package/lib/requestProcessor.js +10 -3
- package/lib/v4/DataAccessor.d.ts +3 -1
- package/lib/v4/DataAccessor.js +43 -18
- package/lib/v4/I18n.js +2 -0
- package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +89 -60
- package/lib/{catalog → v4/catalog}/AbstractCatalog.js +59 -54
- package/lib/v4/catalog/Navigation.d.ts +43 -0
- package/lib/v4/catalog/Navigation.js +457 -0
- package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
- package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
- package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
- package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
- package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
- package/lib/{datatable → v4/datatable}/NodeTable.js +8 -5
- package/lib/v4/model/AbstractModel.d.ts +5 -1
- package/lib/v4/model/AbstractModel.js +2 -1
- package/lib/v4/model/ModelHandler.js +1 -3
- package/lib/v4/model/adapter/sequelize.d.ts +8 -0
- package/lib/v4/model/adapter/sequelize.js +274 -133
- package/lib/v4/model/adapter/waterline.js +5 -2
- package/lib/{widgets → v4/widgets}/abstractLink.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +1 -1
- package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +11 -4
- package/lib/{widgets → v4/widgets}/widgetHandler.js +1 -1
- package/models/NavigationAP.d.ts +2 -3
- package/models/NavigationAP.js +5 -6
- package/models/UserAP.d.ts +2 -3
- package/package.json +17 -6
- package/system/Router.js +8 -11
- package/system/bindAccessRights.js +0 -4
- package/system/bindControls.js +6 -6
- package/system/bindDev.js +1 -0
- package/system/bindInertia.js +9 -4
- package/system/bindMediaManager.js +0 -1
- package/system/bindModels.js +9 -6
- package/system/bindNavigation.d.ts +2 -0
- package/system/bindNavigation.js +42 -42
- package/system/bindReqFunctions.js +0 -1
- package/system/defaults.js +13 -6
- package/translations/ar.json +70 -1
- package/translations/cn.json +70 -1
- package/translations/de.json +71 -3
- package/translations/en.json +70 -102
- package/translations/es.json +70 -1
- package/translations/fr.json +70 -1
- package/translations/hi.json +70 -1
- package/translations/jp.json +70 -1
- package/translations/ko.json +70 -1
- package/translations/pt.json +70 -1
- package/translations/ru.json +71 -103
- package/translations/ua.json +70 -1
- package/translations/uz.json +72 -0
- package/translations/vi.json +70 -1
- package/assets/add-BP_u3Tjl.js +0 -1
- package/assets/add-form-nffmiYTh.js +0 -1
- package/assets/add-group-D4vcHlm-.js +0 -1
- package/assets/add-group-form-gNJW11-q.js +0 -1
- package/assets/add-user-DWh3Nas0.js +0 -1
- package/assets/add-user-form-BJ0FsZYJ.js +0 -1
- package/assets/app-layout-DYsRFUuP.js +0 -1
- package/assets/app-shell-Dd9Eknik.js +0 -1
- package/assets/app-sidebar-BOmu6-Sl.js +0 -1
- package/assets/app-sidebar-header-CoXSzWxk.js +0 -11
- package/assets/breadcrumbs-BmAq4fHT.js +0 -1
- package/assets/button-C9B_5Jf_.js +0 -1
- package/assets/checkbox-Fg27sL_1.js +0 -1
- package/assets/compiler-runtime-hB6dAw2d.js +0 -9
- package/assets/dashboard-BACj996r.js +0 -3
- package/assets/dropdown-menu-Bhj17ENm.js +0 -1
- package/assets/form-BgWdwvz1.js +0 -1
- package/assets/form-DgtErfln.js +0 -1
- package/assets/home-CHntBHJa.js +0 -2
- package/assets/icon-Dt0vBgDO.js +0 -1
- package/assets/index-B8BS9wMC.js +0 -1
- package/assets/index-BC0yfOHo.js +0 -1
- package/assets/index-BKCgnGj_.js +0 -1
- package/assets/index-BbXEMx9n.js +0 -1
- package/assets/index-BykbU6Ee.js +0 -41
- package/assets/index-CaJgc5EZ.js +0 -1
- package/assets/index-DrWfGwtf.js +0 -1
- package/assets/init-user-JfCKJ5Ce.js +0 -1
- package/assets/input-CvRbIbk4.js +0 -1
- package/assets/input-error-DMK7cAt7.js +0 -1
- package/assets/label-CSLFe9Bz.js +0 -1
- package/assets/list-B2Oa5O_Q.js +0 -1
- package/assets/list-table-DA9MhywL.js +0 -62
- package/assets/login-DQwGtdis.js +0 -6
- package/assets/material-icon-BJg8o_fs.js +0 -1
- package/assets/module-DWXp59Vg.js +0 -1
- package/assets/nav-footer-Bs4dmN1d.js +0 -1
- package/assets/nav-main-Bq3IMk4C.js +0 -1
- package/assets/nav-user-CbB22J5O.js +0 -1
- package/assets/pagination-render-DuXDDbC_.js +0 -1
- package/assets/popover-DtoGI2b1.js +0 -1
- package/assets/register-BSogVF0h.js +0 -1
- package/assets/skeleton-COOcAA8f.js +0 -1
- package/assets/sonner-BI0IFOQN.js +0 -1
- package/assets/tooltip-DHwpLKOI.js +0 -1
- package/assets/use-appearance-DRfIqTgw.js +0 -1
- package/assets/use-window-size-h0Sh_NvX.js +0 -1
- package/assets/user-menu-content-DPXQdERj.js +0 -6
- package/assets/utils-DjqsqOe8.js +0 -1
- package/assets/welcome-B4WCIXKf.js +0 -1
- package/controllers/processInstallFinalize.d.ts +0 -1
- package/controllers/processInstallFinalize.js +0 -16
- package/controllers/processInstallStep.d.ts +0 -0
- package/controllers/processInstallStep.js +0 -122
- package/lib/catalog/Navigation.d.ts +0 -0
- package/lib/catalog/Navigation.js +0 -532
- package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
- package/lib/installStepper/InstallStepAbstract.js +0 -69
- package/lib/installStepper/finalizeStep.d.ts +0 -21
- package/lib/installStepper/finalizeStep.js +0 -48
- package/lib/installStepper/installStepper.d.ts +0 -40
- package/lib/installStepper/installStepper.js +0 -195
- package/models/MediaManagerAP.d.ts +0 -62
- package/models/MediaManagerAP.js +0 -45
- package/models/MediaManagerAssociationsAP.d.ts +0 -38
- package/models/MediaManagerAssociationsAP.js +0 -27
- package/models/MediaManagerMetaAP.d.ts +0 -30
- package/models/MediaManagerMetaAP.js +0 -21
- package/system/bindInstallStepper.d.ts +0 -2
- package/system/bindInstallStepper.js +0 -23
- /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
- /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
- /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
- /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
- /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
- /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
- /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
- /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
- /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
- /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
- /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
- /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
- /package/lib/{inertia → v4/inertia}/flash.js +0 -0
- /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
- /package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractAction.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractCustom.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractCustom.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractInfo.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +0 -0
- /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
- /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
|
@@ -1,532 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import {AbstractCatalog, AbstractGroup, AbstractItem, ActionHandler, Item} from "./AbstractCatalog";
|
|
3
|
-
// import {ModelConfig, NavigationConfig} from "../../interfaces/adminpanelConfig";
|
|
4
|
-
// import * as fs from "node:fs";
|
|
5
|
-
//
|
|
6
|
-
// import ejs from 'ejs';
|
|
7
|
-
// import {v4 as uuid} from "uuid";
|
|
8
|
-
// import {ViewsHelper} from "../../helpers/viewsHelper";
|
|
9
|
-
// import {Adminizer} from "../Adminizer";
|
|
10
|
-
//
|
|
11
|
-
// export interface NavItem extends Item {
|
|
12
|
-
// urlPath?: any;
|
|
13
|
-
// modelId?: string | number;
|
|
14
|
-
// targetBlank?: boolean
|
|
15
|
-
// }
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// class StorageService {
|
|
19
|
-
// protected storageMap: Map<string | number, NavItem> = new Map();
|
|
20
|
-
// protected id: string
|
|
21
|
-
// protected model: string
|
|
22
|
-
// protected readonly adminizer: Adminizer
|
|
23
|
-
//
|
|
24
|
-
// constructor(adminizer: Adminizer, id: string, model: string) {
|
|
25
|
-
// this.adminizer = adminizer;
|
|
26
|
-
// this.id = id
|
|
27
|
-
// this.model = model.toLowerCase()
|
|
28
|
-
// this.initModel()
|
|
29
|
-
// }
|
|
30
|
-
//
|
|
31
|
-
// protected async initModel() {
|
|
32
|
-
// try {
|
|
33
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
34
|
-
// const navigation = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ label: this.id });
|
|
35
|
-
//
|
|
36
|
-
// if (navigation) {
|
|
37
|
-
// Adminizer.log.info(`Found existing navigation: ${this.id}`);
|
|
38
|
-
// await this.populateFromTree(navigation.tree);
|
|
39
|
-
// } else {
|
|
40
|
-
// const newNavigation = { label: this.id, tree: [] as any };
|
|
41
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
42
|
-
// await this.adminizer.modelHandler.model.get(this.model)["_create"](newNavigation);
|
|
43
|
-
// Adminizer.log.info(`Created a new navigation: ${this.id}`);
|
|
44
|
-
// }
|
|
45
|
-
// } catch (error) {
|
|
46
|
-
// throw error;
|
|
47
|
-
// }
|
|
48
|
-
// }
|
|
49
|
-
//
|
|
50
|
-
// public getId() {
|
|
51
|
-
// return this.id
|
|
52
|
-
// }
|
|
53
|
-
//
|
|
54
|
-
// public async buildTree(): Promise<any> {
|
|
55
|
-
// const rootElements: NavItem[] = await this.findElementsByParentId(null, null);
|
|
56
|
-
// const buildSubTree = async (elements: NavItem[]): Promise<any[]> => {
|
|
57
|
-
// const tree = [];
|
|
58
|
-
// for (const element of elements) {
|
|
59
|
-
// const children = await this.findElementsByParentId(element.id, null);
|
|
60
|
-
// tree.push({
|
|
61
|
-
// ...element,
|
|
62
|
-
// children: await buildSubTree(children)
|
|
63
|
-
// });
|
|
64
|
-
// }
|
|
65
|
-
// return tree;
|
|
66
|
-
// };
|
|
67
|
-
//
|
|
68
|
-
// let tree = await buildSubTree(rootElements);
|
|
69
|
-
//
|
|
70
|
-
// function sortTree(items: any[]) {
|
|
71
|
-
// items.sort((a, b) => a.sortOrder - b.sortOrder);
|
|
72
|
-
//
|
|
73
|
-
// for (let i = 0; i < items.length; i++) {
|
|
74
|
-
// const item = items[i];
|
|
75
|
-
// if (item.children) {
|
|
76
|
-
// sortTree(item.children);
|
|
77
|
-
// }
|
|
78
|
-
// }
|
|
79
|
-
// }
|
|
80
|
-
//
|
|
81
|
-
// sortTree(tree)
|
|
82
|
-
// return tree
|
|
83
|
-
// }
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
// public async populateFromTree(tree: any[]): Promise<void> {
|
|
87
|
-
// const traverseTree = async (node: any, parentId: string | number | null = null): Promise<void> => {
|
|
88
|
-
// const {children, ...itemData} = node;
|
|
89
|
-
// const item = {...itemData, parentId} as NavItem;
|
|
90
|
-
// await this.setElement(item.id, item);
|
|
91
|
-
//
|
|
92
|
-
// if (children && children.length > 0) {
|
|
93
|
-
// for (const child of children) {
|
|
94
|
-
// await traverseTree(child, item.id);
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
|
-
// };
|
|
98
|
-
//
|
|
99
|
-
// for (const node of tree) {
|
|
100
|
-
// await traverseTree(node);
|
|
101
|
-
// }
|
|
102
|
-
// }
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
// public async setElement(id: string | number, item: NavItem): Promise<NavItem> {
|
|
106
|
-
// this.storageMap.set(item.id, item);
|
|
107
|
-
// await this.saveToDB()
|
|
108
|
-
// // This like fetch in DB
|
|
109
|
-
// return this.findElementById(item.id);
|
|
110
|
-
// }
|
|
111
|
-
//
|
|
112
|
-
// public async removeElementById(id: string | number): Promise<void> {
|
|
113
|
-
// this.storageMap.delete(id);
|
|
114
|
-
// setTimeout(async () => {
|
|
115
|
-
// await this.saveToDB()
|
|
116
|
-
// }, 500)
|
|
117
|
-
//
|
|
118
|
-
// }
|
|
119
|
-
//
|
|
120
|
-
// public async findElementById(id: string | number): Promise<NavItem | undefined> {
|
|
121
|
-
// return this.storageMap.get(id);
|
|
122
|
-
// }
|
|
123
|
-
//
|
|
124
|
-
// public async findElementByModelId(modelId: string | number): Promise<NavItem[] | undefined> {
|
|
125
|
-
// const elements: NavItem[] = [];
|
|
126
|
-
// for (const item of this.storageMap.values()) {
|
|
127
|
-
// if (item.modelId === modelId) {
|
|
128
|
-
// elements.push(item)
|
|
129
|
-
// }
|
|
130
|
-
// }
|
|
131
|
-
// return elements;
|
|
132
|
-
// }
|
|
133
|
-
//
|
|
134
|
-
// public async saveToDB() {
|
|
135
|
-
// let tree = await this.buildTree()
|
|
136
|
-
// try {
|
|
137
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
138
|
-
// await this.adminizer.modelHandler.model.get(this.model)["_update"](
|
|
139
|
-
// {label: this.id},
|
|
140
|
-
// {tree: tree}
|
|
141
|
-
// )
|
|
142
|
-
// } catch (e) {
|
|
143
|
-
// console.log(e)
|
|
144
|
-
// throw 'navigation model update error'
|
|
145
|
-
// }
|
|
146
|
-
// }
|
|
147
|
-
//
|
|
148
|
-
// public async findElementsByParentId(parentId: string | number, type: string | null): Promise<NavItem[]> {
|
|
149
|
-
// const elements: NavItem[] = [];
|
|
150
|
-
// for (const item of this.storageMap.values()) {
|
|
151
|
-
// // Assuming each item has a parentId property
|
|
152
|
-
// if (type === null && item.parentId === parentId) {
|
|
153
|
-
// elements.push(item)
|
|
154
|
-
// continue
|
|
155
|
-
// }
|
|
156
|
-
// if (item.parentId === parentId && item.type === type) {
|
|
157
|
-
// elements.push(item);
|
|
158
|
-
// }
|
|
159
|
-
// }
|
|
160
|
-
//
|
|
161
|
-
// return elements;
|
|
162
|
-
// }
|
|
163
|
-
//
|
|
164
|
-
// public async getAllElements(): Promise<NavItem[]> {
|
|
165
|
-
// return Array.from(this.storageMap.values());
|
|
166
|
-
// }
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
// public async search(s: string, type: string): Promise<NavItem[]> {
|
|
170
|
-
// const lowerCaseQuery = s.toLowerCase(); // Convert query to lowercase for case-insensitive search
|
|
171
|
-
// const matchedElements: NavItem[] = [];
|
|
172
|
-
//
|
|
173
|
-
// for (const item of this.storageMap.values()) {
|
|
174
|
-
// // Check if item type matches the specified type
|
|
175
|
-
// if (item.type === type) {
|
|
176
|
-
// // Search by name
|
|
177
|
-
// if (item.name.toLowerCase().includes(lowerCaseQuery)) {
|
|
178
|
-
// matchedElements.push(item);
|
|
179
|
-
// }
|
|
180
|
-
// }
|
|
181
|
-
// }
|
|
182
|
-
//
|
|
183
|
-
// return matchedElements;
|
|
184
|
-
// }
|
|
185
|
-
// }
|
|
186
|
-
//
|
|
187
|
-
// export class StorageServices {
|
|
188
|
-
// protected static storages: StorageService[] = []
|
|
189
|
-
//
|
|
190
|
-
// public static add(storage: StorageService) {
|
|
191
|
-
// this.storages.push(storage)
|
|
192
|
-
// }
|
|
193
|
-
//
|
|
194
|
-
// public static get(id: string) {
|
|
195
|
-
// return this.storages.find(storage => storage.getId() === id)
|
|
196
|
-
// }
|
|
197
|
-
//
|
|
198
|
-
// public static getAll() {
|
|
199
|
-
// return this.storages
|
|
200
|
-
// }
|
|
201
|
-
// }
|
|
202
|
-
//
|
|
203
|
-
// export class Navigation extends AbstractCatalog {
|
|
204
|
-
// readonly name: string = 'Navigation';
|
|
205
|
-
// readonly slug: string = 'navigation';
|
|
206
|
-
// public readonly icon: string = "box";
|
|
207
|
-
// public readonly actionHandlers: ActionHandler[] = []
|
|
208
|
-
// public idList: string[] = []
|
|
209
|
-
//
|
|
210
|
-
// constructor(adminizer: Adminizer, config: NavigationConfig) {
|
|
211
|
-
// let items = []
|
|
212
|
-
// for (const configElement of config.items) {
|
|
213
|
-
// items.push(new NavigationItem(
|
|
214
|
-
// adminizer,
|
|
215
|
-
// configElement.title,
|
|
216
|
-
// configElement.model,
|
|
217
|
-
// config.model,
|
|
218
|
-
// configElement.urlPath
|
|
219
|
-
// ))
|
|
220
|
-
// }
|
|
221
|
-
// items.push(new NavigationGroup(adminizer, config.groupField))
|
|
222
|
-
// items.push(new LinkItem(adminizer))
|
|
223
|
-
// for (const section of config.sections) {
|
|
224
|
-
// StorageServices.add(new StorageService(adminizer, section, config.model))
|
|
225
|
-
// }
|
|
226
|
-
// super(adminizer, items);
|
|
227
|
-
// this.movingGroupsRootOnly = config.movingGroupsRootOnly
|
|
228
|
-
// this.idList = config.sections ?? []
|
|
229
|
-
// }
|
|
230
|
-
//
|
|
231
|
-
// async getIdList(){
|
|
232
|
-
// return this.idList
|
|
233
|
-
// }
|
|
234
|
-
// }
|
|
235
|
-
//
|
|
236
|
-
// class NavigationItem extends AbstractItem<NavItem> {
|
|
237
|
-
// readonly allowedRoot: boolean = true;
|
|
238
|
-
// readonly icon: string;
|
|
239
|
-
// readonly name: string;
|
|
240
|
-
// readonly type: string;
|
|
241
|
-
// protected model: string;
|
|
242
|
-
// protected navigationModel: string;
|
|
243
|
-
// public readonly actionHandlers: ActionHandler[] = []
|
|
244
|
-
// public readonly urlPath: any;
|
|
245
|
-
// protected readonly adminizer: Adminizer
|
|
246
|
-
//
|
|
247
|
-
// constructor(adminizer: Adminizer, name: string, model: string, navigationModel: string, urlPath: any) {
|
|
248
|
-
// super();
|
|
249
|
-
// this.name = name
|
|
250
|
-
// this.navigationModel = navigationModel
|
|
251
|
-
// this.model = model.toLowerCase()
|
|
252
|
-
// this.type = model.toLowerCase()
|
|
253
|
-
// this.urlPath = urlPath
|
|
254
|
-
// let configModel = adminizer.config.models[this.model] as ModelConfig
|
|
255
|
-
// this.icon = configModel.icon ?? 'file'
|
|
256
|
-
// this.adminizer = adminizer;
|
|
257
|
-
// }
|
|
258
|
-
//
|
|
259
|
-
// async create(data: any, catalogId: string): Promise<NavItem> {
|
|
260
|
-
// let storage = StorageServices.get(catalogId)
|
|
261
|
-
// let storageData = null
|
|
262
|
-
// if (data._method === 'select') {
|
|
263
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
264
|
-
// let record = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({id: data.record})
|
|
265
|
-
// storageData = await this.dataPreparation({
|
|
266
|
-
// record: record,
|
|
267
|
-
// parentId: data.parentId,
|
|
268
|
-
// targetBlank: data.targetBlank
|
|
269
|
-
// }, catalogId)
|
|
270
|
-
// } else {
|
|
271
|
-
// storageData = await this.dataPreparation(data, catalogId)
|
|
272
|
-
// }
|
|
273
|
-
// return await storage.setElement(data.id, storageData) as NavItem;
|
|
274
|
-
// }
|
|
275
|
-
//
|
|
276
|
-
// protected async dataPreparation(data: any, catalogId: string, sortOrder?: number) {
|
|
277
|
-
// let storage = StorageServices.get(catalogId)
|
|
278
|
-
// let urlPath = eval('`' + this.urlPath + '`')
|
|
279
|
-
// let parentId = data.parentId ? data.parentId : null
|
|
280
|
-
// return {
|
|
281
|
-
// id: uuid(),
|
|
282
|
-
// modelId: data.record.id,
|
|
283
|
-
// targetBlank: data.targetBlank ?? data.record.targetBlank,
|
|
284
|
-
// name: data.record.name ?? data.record.title ?? data.record.id,
|
|
285
|
-
// parentId: parentId,
|
|
286
|
-
// sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
|
|
287
|
-
// icon: this.icon,
|
|
288
|
-
// type: this.type,
|
|
289
|
-
// urlPath: urlPath
|
|
290
|
-
// }
|
|
291
|
-
// }
|
|
292
|
-
//
|
|
293
|
-
// async updateModelItems(modelId: string | number, data: any, catalogId: string): Promise<NavItem> {
|
|
294
|
-
// let storage = StorageServices.get(catalogId)
|
|
295
|
-
// let items = await storage.findElementByModelId(modelId)
|
|
296
|
-
// let urlPath = eval('`' + this.urlPath + '`')
|
|
297
|
-
// for (const item of items) {
|
|
298
|
-
// item.name = data.record.name
|
|
299
|
-
// item.urlPath = urlPath
|
|
300
|
-
// if (item.id === data.record.treeId) {
|
|
301
|
-
// item.targetBlank = data.record.targetBlank
|
|
302
|
-
// }
|
|
303
|
-
// await storage.setElement(item.id, item);
|
|
304
|
-
// }
|
|
305
|
-
// return Promise.resolve(undefined)
|
|
306
|
-
// }
|
|
307
|
-
//
|
|
308
|
-
// async update(itemId: string | number, data: any, catalogId: string): Promise<NavItem> {
|
|
309
|
-
// let storage = StorageServices.get(catalogId)
|
|
310
|
-
// return await storage.setElement(itemId, data);
|
|
311
|
-
// }
|
|
312
|
-
//
|
|
313
|
-
// async deleteItem(itemId: string | number, catalogId: string): Promise<void> {
|
|
314
|
-
// let storage = StorageServices.get(catalogId)
|
|
315
|
-
// return await storage.removeElementById(itemId);
|
|
316
|
-
// }
|
|
317
|
-
//
|
|
318
|
-
// async find(itemId: string | number, catalogId: string): Promise<NavItem> {
|
|
319
|
-
// let storage = StorageServices.get(catalogId)
|
|
320
|
-
// return await storage.findElementById(itemId);
|
|
321
|
-
// }
|
|
322
|
-
//
|
|
323
|
-
// async getAddHTML(req: ReqType): Promise<{ type: "link" | "html" | "jsonForm"; data: string }> {
|
|
324
|
-
// let type: 'html' = 'html'
|
|
325
|
-
// // TODO refactor CRUD functions for DataAccessor usage
|
|
326
|
-
// let items = await this.adminizer.modelHandler.model.get(this.model)["_find"]({})
|
|
327
|
-
//
|
|
328
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
329
|
-
// req.i18n.setLocale(req.user.locale);
|
|
330
|
-
// const __ = (s: string) => {
|
|
331
|
-
// return req.i18n.__(s)
|
|
332
|
-
// }
|
|
333
|
-
//
|
|
334
|
-
// return {
|
|
335
|
-
// type: type,
|
|
336
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/itemHTMLAdd.ejs'), 'utf8'), {
|
|
337
|
-
// items: items,
|
|
338
|
-
// item: {name: this.name, type: this.type, model: this.model},
|
|
339
|
-
// __: __
|
|
340
|
-
// }),
|
|
341
|
-
// }
|
|
342
|
-
// }
|
|
343
|
-
//
|
|
344
|
-
// async getChilds(parentId: string | number | null, catalogId: string): Promise<NavItem[]> {
|
|
345
|
-
// let storage = StorageServices.get(catalogId)
|
|
346
|
-
// return await storage.findElementsByParentId(parentId, this.type);
|
|
347
|
-
// }
|
|
348
|
-
//
|
|
349
|
-
// async getEditHTML(id: string | number, catalogId: string, req: ReqType, modelId: string | number): Promise<{
|
|
350
|
-
// type: "link" | "html" | "jsonForm";
|
|
351
|
-
// data: string
|
|
352
|
-
// }> {
|
|
353
|
-
// let item = await this.find(id, catalogId)
|
|
354
|
-
// let type: 'html' = 'html'
|
|
355
|
-
//
|
|
356
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
357
|
-
// req.i18n.setLocale(req.user.locale);
|
|
358
|
-
// const __ = (s: string) => {
|
|
359
|
-
// return req.i18n.__(s)
|
|
360
|
-
// }
|
|
361
|
-
//
|
|
362
|
-
// return Promise.resolve({
|
|
363
|
-
// type: type,
|
|
364
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/itemHTMLEdit.ejs'), 'utf8'), {item: item, __: __})
|
|
365
|
-
// })
|
|
366
|
-
// }
|
|
367
|
-
//
|
|
368
|
-
// async search(s: string, catalogId: string): Promise<NavItem[]> {
|
|
369
|
-
// let storage = StorageServices.get(catalogId)
|
|
370
|
-
// return await storage.search(s, this.type);
|
|
371
|
-
// }
|
|
372
|
-
//
|
|
373
|
-
// }
|
|
374
|
-
//
|
|
375
|
-
// class NavigationGroup extends AbstractGroup<NavItem> {
|
|
376
|
-
// readonly allowedRoot: boolean = true;
|
|
377
|
-
// readonly name: string = "Group";
|
|
378
|
-
// readonly groupField: object[]
|
|
379
|
-
// protected readonly adminizer: Adminizer
|
|
380
|
-
//
|
|
381
|
-
// constructor(adminizer: Adminizer, groupField: object[]) {
|
|
382
|
-
// super();
|
|
383
|
-
// this.groupField = groupField
|
|
384
|
-
// this.adminizer = adminizer;
|
|
385
|
-
// }
|
|
386
|
-
//
|
|
387
|
-
// async create(data: any, catalogId: string): Promise<NavItem> {
|
|
388
|
-
// let storage = StorageServices.get(catalogId)
|
|
389
|
-
//
|
|
390
|
-
// let storageData = await this.dataPreparation(data, catalogId)
|
|
391
|
-
// delete data.name
|
|
392
|
-
// delete data.parentId
|
|
393
|
-
// storageData = {...storageData, ...data}
|
|
394
|
-
//
|
|
395
|
-
// return await storage.setElement(storageData.id, storageData) as NavItem;
|
|
396
|
-
// }
|
|
397
|
-
//
|
|
398
|
-
// protected async dataPreparation(data: any, catalogId: string, sortOrder?: number) {
|
|
399
|
-
// let storage = StorageServices.get(catalogId)
|
|
400
|
-
// let parentId = data.parentId ? data.parentId : null
|
|
401
|
-
// return {
|
|
402
|
-
// id: uuid(),
|
|
403
|
-
// name: data.name,
|
|
404
|
-
// targetBlank: data.targetBlank,
|
|
405
|
-
// parentId: parentId,
|
|
406
|
-
// sortOrder: sortOrder ?? (await storage.findElementsByParentId(parentId, null)).length,
|
|
407
|
-
// icon: this.icon,
|
|
408
|
-
// type: this.type
|
|
409
|
-
// }
|
|
410
|
-
// }
|
|
411
|
-
//
|
|
412
|
-
// async deleteItem(itemId: string | number, catalogId: string): Promise<void> {
|
|
413
|
-
// let storage = StorageServices.get(catalogId)
|
|
414
|
-
// return await storage.removeElementById(itemId);
|
|
415
|
-
// }
|
|
416
|
-
//
|
|
417
|
-
// async find(itemId: string | number, catalogId: string): Promise<NavItem> {
|
|
418
|
-
// let storage = StorageServices.get(catalogId)
|
|
419
|
-
// return await storage.findElementById(itemId);
|
|
420
|
-
// }
|
|
421
|
-
//
|
|
422
|
-
// async update(itemId: string | number, data: any, catalogId: string): Promise<NavItem> {
|
|
423
|
-
// let storage = StorageServices.get(catalogId)
|
|
424
|
-
// return await storage.setElement(itemId, data);
|
|
425
|
-
// }
|
|
426
|
-
//
|
|
427
|
-
// async updateModelItems(modelId: string | number, data: NavItem, catalogId: string): Promise<NavItem> {
|
|
428
|
-
// let storage = StorageServices.get(catalogId)
|
|
429
|
-
// return await storage.setElement(modelId, data);
|
|
430
|
-
// }
|
|
431
|
-
//
|
|
432
|
-
// getAddHTML(req: ReqType): Promise<{ type: "link" | "html" | "jsonForm"; data: string }> {
|
|
433
|
-
// let type: 'html' = 'html'
|
|
434
|
-
//
|
|
435
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
436
|
-
// req.i18n.setLocale(req.user.locale);
|
|
437
|
-
// const __ = (s: string) => {
|
|
438
|
-
// return req.i18n.__(s)
|
|
439
|
-
// }
|
|
440
|
-
//
|
|
441
|
-
// return Promise.resolve({
|
|
442
|
-
// type: type,
|
|
443
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/GroupHTMLAdd.ejs'), 'utf8'), {
|
|
444
|
-
// fields: this.groupField,
|
|
445
|
-
// __: __
|
|
446
|
-
// }),
|
|
447
|
-
// })
|
|
448
|
-
// }
|
|
449
|
-
//
|
|
450
|
-
// async getChilds(parentId: string | number | null, catalogId: string): Promise<NavItem[]> {
|
|
451
|
-
// let storage = StorageServices.get(catalogId)
|
|
452
|
-
// return await storage.findElementsByParentId(parentId, this.type);
|
|
453
|
-
// }
|
|
454
|
-
//
|
|
455
|
-
// async getEditHTML(id: string | number, catalogId: string, req: ReqType, modelId?: string | number): Promise<{
|
|
456
|
-
// type: "link" | "html" | "jsonForm";
|
|
457
|
-
// data: string
|
|
458
|
-
// }> {
|
|
459
|
-
// let type: 'html' = 'html'
|
|
460
|
-
// let item = await this.find(id, catalogId)
|
|
461
|
-
//
|
|
462
|
-
// // This dirty hack is here because the field of view is disappearing
|
|
463
|
-
// req.i18n.setLocale(req.user.locale);
|
|
464
|
-
// const __ = (s: string) => {
|
|
465
|
-
// return req.i18n.__(s)
|
|
466
|
-
// }
|
|
467
|
-
//
|
|
468
|
-
// return Promise.resolve({
|
|
469
|
-
// type: type,
|
|
470
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/GroupHTMLEdit.ejs'), 'utf8'), {
|
|
471
|
-
// fields: this.groupField,
|
|
472
|
-
// item: item,
|
|
473
|
-
// __: __
|
|
474
|
-
// }),
|
|
475
|
-
// })
|
|
476
|
-
// }
|
|
477
|
-
//
|
|
478
|
-
// async search(s: string, catalogId: string): Promise<NavItem[]> {
|
|
479
|
-
// let storage = StorageServices.get(catalogId)
|
|
480
|
-
// return await storage.search(s, this.type);
|
|
481
|
-
// }
|
|
482
|
-
//
|
|
483
|
-
//
|
|
484
|
-
// }
|
|
485
|
-
//
|
|
486
|
-
// class LinkItem extends NavigationGroup {
|
|
487
|
-
// readonly allowedRoot: boolean = true;
|
|
488
|
-
// readonly icon: string = 'external-link-alt';
|
|
489
|
-
// readonly name: string = 'Link';
|
|
490
|
-
// readonly type: string = 'link';
|
|
491
|
-
// readonly isGroup: boolean = false;
|
|
492
|
-
//
|
|
493
|
-
// constructor(adminizer: Adminizer) {
|
|
494
|
-
// super(adminizer, []);
|
|
495
|
-
// }
|
|
496
|
-
//
|
|
497
|
-
// getAddHTML(req: ReqType): Promise<{ type: "link" | "html" | "jsonForm"; data: string }> {
|
|
498
|
-
// let type: 'html' = 'html'
|
|
499
|
-
// req.i18n.setLocale(req.user.locale);
|
|
500
|
-
//
|
|
501
|
-
// const __ = (s: string) => {
|
|
502
|
-
// return req.i18n.__(s)
|
|
503
|
-
// }
|
|
504
|
-
// return Promise.resolve({
|
|
505
|
-
// type: type,
|
|
506
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/LinkItemAdd.ejs'), 'utf8'), {__: __}),
|
|
507
|
-
// })
|
|
508
|
-
// }
|
|
509
|
-
//
|
|
510
|
-
// async getEditHTML(id: string | number, catalogId: string, req: ReqType): Promise<{
|
|
511
|
-
// type: "link" | "html" | "jsonForm";
|
|
512
|
-
// data: string
|
|
513
|
-
// }> {
|
|
514
|
-
// let type: 'html' = 'html'
|
|
515
|
-
// let item = await this.find(id, catalogId)
|
|
516
|
-
//
|
|
517
|
-
// req.i18n.setLocale(req.user.locale);
|
|
518
|
-
// const __ = (s: string) => {
|
|
519
|
-
// return req.i18n.__(s)
|
|
520
|
-
// }
|
|
521
|
-
//
|
|
522
|
-
// return Promise.resolve({
|
|
523
|
-
// type: type,
|
|
524
|
-
// data: ejs.render(fs.readFileSync(ViewsHelper.getViewPath('./../../views/ejs/navigation/LinkItemEdit.ejs'), 'utf8'), {
|
|
525
|
-
// fields: this.groupField,
|
|
526
|
-
// item: item,
|
|
527
|
-
// __: __
|
|
528
|
-
// }),
|
|
529
|
-
// })
|
|
530
|
-
// }
|
|
531
|
-
//
|
|
532
|
-
// }
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ObservablePromise } from "../observablePromise";
|
|
2
|
-
export default abstract class InstallStepAbstract {
|
|
3
|
-
abstract id: string;
|
|
4
|
-
abstract title: string;
|
|
5
|
-
abstract badge: string;
|
|
6
|
-
abstract sortOrder: number;
|
|
7
|
-
/** Step can be skipped. For this option you should do realization for skip handler */
|
|
8
|
-
abstract canBeSkipped: boolean;
|
|
9
|
-
abstract description: string;
|
|
10
|
-
abstract scriptsUrl: string;
|
|
11
|
-
abstract stylesUrl: string;
|
|
12
|
-
/** For custom modules to set the list of settings wanted to set in this step */
|
|
13
|
-
settingsKeys: string[];
|
|
14
|
-
/** Absolute path to ejs template */
|
|
15
|
-
abstract ejsPath: string;
|
|
16
|
-
abstract renderer: "ejs" | "jsonforms";
|
|
17
|
-
isSkipped: boolean;
|
|
18
|
-
isProcessed: boolean;
|
|
19
|
-
/** Data that will be given to browser */
|
|
20
|
-
payload: any;
|
|
21
|
-
groupSortOrder: number;
|
|
22
|
-
finallyPromise: ObservablePromise<void>;
|
|
23
|
-
finallyDescription: string;
|
|
24
|
-
/**
|
|
25
|
-
* A sign that finalization should be started
|
|
26
|
-
*/
|
|
27
|
-
finallyToRun: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The time it takes for finally to complete
|
|
30
|
-
*
|
|
31
|
-
* default: 15 seconds
|
|
32
|
-
*
|
|
33
|
-
* maximum: 10 minutes;
|
|
34
|
-
*/
|
|
35
|
-
finallyTimeout: number;
|
|
36
|
-
/** Action that will be run when saving data to storage */
|
|
37
|
-
abstract process(data: any, context?: any): Promise<void>;
|
|
38
|
-
/** Method will be called after processing step (both process or skip) */
|
|
39
|
-
finally(data: any, context?: any): Promise<void>;
|
|
40
|
-
/** This method will be called by InstallStepper and is a wrapper for "finally" method */
|
|
41
|
-
toFinally(data?: any, context?: any, timeout?: number): void;
|
|
42
|
-
/** Action that will be run when skipping the step */
|
|
43
|
-
protected abstract skip(): Promise<void>;
|
|
44
|
-
/** This method will be called by InstallStepper and is a wrapper for "skip" method */
|
|
45
|
-
skipIt(): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Checks that step should be processed during install
|
|
48
|
-
* `true` means that the step has been completed and does not need to be shown
|
|
49
|
-
*/
|
|
50
|
-
abstract check(): Promise<boolean>;
|
|
51
|
-
onInit(): Promise<void>;
|
|
52
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ObservablePromise } from "../observablePromise";
|
|
2
|
-
import { Adminizer } from "../Adminizer";
|
|
3
|
-
export default class InstallStepAbstract {
|
|
4
|
-
/** For custom modules to set the list of settings wanted to set in this step */
|
|
5
|
-
settingsKeys = [];
|
|
6
|
-
isSkipped = false;
|
|
7
|
-
isProcessed = false;
|
|
8
|
-
/** Data that will be given to browser */
|
|
9
|
-
payload = {};
|
|
10
|
-
groupSortOrder = 1;
|
|
11
|
-
finallyPromise = null;
|
|
12
|
-
finallyDescription = null;
|
|
13
|
-
/**
|
|
14
|
-
* A sign that finalization should be started
|
|
15
|
-
*/
|
|
16
|
-
finallyToRun = false;
|
|
17
|
-
/**
|
|
18
|
-
* The time it takes for finally to complete
|
|
19
|
-
*
|
|
20
|
-
* default: 15 seconds
|
|
21
|
-
*
|
|
22
|
-
* maximum: 10 minutes;
|
|
23
|
-
*/
|
|
24
|
-
finallyTimeout = 15 * 60 * 1000;
|
|
25
|
-
/** Method will be called after processing step (both process or skip) */
|
|
26
|
-
finally(data, context) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
/** This method will be called by InstallStepper and is a wrapper for "finally" method */
|
|
30
|
-
toFinally(data, context, timeout) {
|
|
31
|
-
Adminizer.log.debug(`To finally [${this.id}]`);
|
|
32
|
-
if (!timeout) {
|
|
33
|
-
timeout = this.finallyTimeout;
|
|
34
|
-
}
|
|
35
|
-
if (!timeout || typeof timeout !== "number") {
|
|
36
|
-
timeout = 15 * 60 * 1000;
|
|
37
|
-
}
|
|
38
|
-
if (timeout > 10 * 60 * 60 * 1000) {
|
|
39
|
-
timeout = 10 * 60 * 60 * 1000;
|
|
40
|
-
}
|
|
41
|
-
if (typeof arguments[0] === "number") {
|
|
42
|
-
timeout = arguments[0];
|
|
43
|
-
}
|
|
44
|
-
if (this.finallyPromise && this.finallyPromise.status === "pending") {
|
|
45
|
-
Adminizer.log.warn(`Method "finally" was already executed and won't be executed again`);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
try {
|
|
49
|
-
this.finallyPromise = new ObservablePromise(this.finally(data, context), timeout);
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
Adminizer.log.error(`Step [${this.id}] finally error:`, error);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
this.finallyPromise.promise;
|
|
56
|
-
}
|
|
57
|
-
/** This method will be called by InstallStepper and is a wrapper for "skip" method */
|
|
58
|
-
async skipIt() {
|
|
59
|
-
if (this.canBeSkipped === false) {
|
|
60
|
-
throw `Step [${this.title}] can not be skipped`;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
await this.skip();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async onInit() {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import InstallStepAbstract from "./InstallStepAbstract";
|
|
2
|
-
export default class FinalizeStep extends InstallStepAbstract {
|
|
3
|
-
canBeSkipped: boolean;
|
|
4
|
-
description: string;
|
|
5
|
-
ejsPath: string;
|
|
6
|
-
id: string;
|
|
7
|
-
scriptsUrl: string;
|
|
8
|
-
sortOrder: number;
|
|
9
|
-
stylesUrl: string;
|
|
10
|
-
title: string;
|
|
11
|
-
badge: string;
|
|
12
|
-
isSkipped: boolean;
|
|
13
|
-
settingsKeys: string[];
|
|
14
|
-
renderer: "ejs";
|
|
15
|
-
isProcessed: boolean;
|
|
16
|
-
check(): Promise<boolean>;
|
|
17
|
-
process(data: any): Promise<void>;
|
|
18
|
-
skip(): Promise<void>;
|
|
19
|
-
finally(): Promise<void>;
|
|
20
|
-
toFinally(): void;
|
|
21
|
-
}
|