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.
Files changed (253) hide show
  1. package/Readme.md +46 -0
  2. package/assets/{VanillaJSONEditor-D-Lx670g.js → VanillaJSONEditor-DfRefswH.js} +104 -104
  3. package/assets/add-CJ1-zeA1.js +1 -0
  4. package/assets/add-form-CbNl0wdS.js +1 -0
  5. package/assets/add-group-form-Bt_Dx9wm.js +1 -0
  6. package/assets/add-group-pIFJV5qL.js +1 -0
  7. package/assets/add-user-D2US8hL_.js +1 -0
  8. package/assets/add-user-form-Bt8Jy6S2.js +1 -0
  9. package/assets/{app-WTooYWC3.css → app-B6cCPfWk.css} +1 -1
  10. package/assets/app-layout-B86jl9bH.js +1 -0
  11. package/assets/app-shell-CiGyzQ0C.js +1 -0
  12. package/assets/app-sidebar-Bz-SRwBg.js +1 -0
  13. package/assets/app-sidebar-header-7CNCx7Rs.js +11 -0
  14. package/assets/app.js +45 -37
  15. package/assets/breadcrumbs-_jhtTcOi.js +1 -0
  16. package/assets/catalog-CON6moaA.js +16 -0
  17. package/assets/catalog-Cc6Mk9sX.css +1 -0
  18. package/assets/checkbox-CQdZw5mb.js +1 -0
  19. package/assets/dashboard-es9ZT8qk.js +3 -0
  20. package/assets/{date-picker-DI1cCO7K.js → date-picker-Dz-d-YWX.js} +2 -2
  21. package/assets/debounce-qdyXyOeG.js +1 -0
  22. package/assets/del-modal-D0mrZvki.js +11 -0
  23. package/assets/dialog-stack-BiMbfm58.js +1 -0
  24. package/assets/dropdown-menu-BSBcRiXx.js +1 -0
  25. package/assets/{field-renderer-DVHZF6HS.js → field-renderer-B6hFAeiU.js} +3 -3
  26. package/assets/form-Buslty7y.js +1 -0
  27. package/assets/form-aqiRmPix.js +1 -0
  28. package/assets/{geo-json-BjiyTtMu.js → geo-json-BKmYmu3d.js} +2 -2
  29. package/assets/{handsontable-4mjU_b0n.js → handsontable-B8xVeMAQ.js} +5 -5
  30. package/assets/home-Dr72Jk-w.js +2 -0
  31. package/assets/icon-B-a7xg54.js +1 -0
  32. package/assets/index-B68_akQe.js +1 -0
  33. package/assets/index-B7-xTDyy.js +1 -0
  34. package/assets/index-BJFFlCSo.js +1 -0
  35. package/assets/{index-Cw5o84pO.js → index-BOuMo_nl.js} +3 -3
  36. package/assets/index-BzOcGsBq.js +1 -0
  37. package/assets/index-CFbQ2Rv0.js +1 -0
  38. package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
  39. package/assets/{index-Cgp8OfuI.js → index-D5UDXTFs.js} +1 -1
  40. package/assets/index-oxIQWAdI.js +41 -0
  41. package/assets/init-user-5H689LP0.js +1 -0
  42. package/assets/input-CSJjrf2i.js +1 -0
  43. package/assets/input-error-CK92Shhm.js +1 -0
  44. package/assets/label-Muj0-Efy.js +1 -0
  45. package/assets/list-Cvh7zbyG.js +1 -0
  46. package/assets/list-table-Bs_vbQiV.js +52 -0
  47. package/assets/login-DliJrjMQ.js +6 -0
  48. package/assets/manifest.json +575 -673
  49. package/assets/material-icon-BRS58Qpk.js +1 -0
  50. package/assets/module-CjG21VCT.js +1 -0
  51. package/assets/{monaco-editor-CJs0_GlD.js → monaco-editor-9fDiyfuW.js} +2 -2
  52. package/assets/{multi-select-BvRpAW8r.js → multi-select-CMQIJ0JT.js} +2 -2
  53. package/assets/nav-footer-IGMn9NiE.js +1 -0
  54. package/assets/nav-main-DBE4rMiZ.js +1 -0
  55. package/assets/nav-user-CjyLRyq-.js +1 -0
  56. package/assets/pagination-render-DUAq2klc.js +1 -0
  57. package/assets/popover-C_cww-4_.js +1 -0
  58. package/assets/register-UzQn3J0g.js +1 -0
  59. package/assets/{select-BWepUw-9.js → select-DzBno-dc.js} +2 -2
  60. package/assets/{sidebar-CAHsHdjM.js → sidebar-Dc4iqfu-.js} +2 -2
  61. package/assets/skeleton-Dkmj2o2Z.js +1 -0
  62. package/assets/sonner-De1t71Gj.js +1 -0
  63. package/assets/{toast-editor-CMK7QtF1.js → toast-editor-1Pul3oMs.js} +2 -2
  64. package/assets/tooltip-CwPrC-HD.js +1 -0
  65. package/assets/use-appearance-J8J2w43p.js +1 -0
  66. package/assets/use-window-size-DLSEoR6e.js +1 -0
  67. package/assets/{user-info-DFrmpJ4y.js → user-info-8RyDk7qh.js} +2 -2
  68. package/assets/user-menu-content-CpxTLH56.js +6 -0
  69. package/assets/welcome-BYKI6yO-.js +1 -0
  70. package/controllers/add.js +8 -8
  71. package/controllers/catalog/Catalog.d.ts +1 -1
  72. package/controllers/catalog/Catalog.js +40 -35
  73. package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
  74. package/controllers/catalog/FrontentCatalogAdapter.js +71 -72
  75. package/controllers/edit.js +8 -11
  76. package/controllers/list.js +2 -2
  77. package/controllers/login.js +16 -7
  78. package/controllers/navigation/edit.js +1 -1
  79. package/controllers/remove.js +1 -1
  80. package/controllers/view.js +1 -1
  81. package/helpers/JsUtils.d.ts +1 -0
  82. package/helpers/JsUtils.js +3 -0
  83. package/helpers/accessRightsHelper.d.ts +3 -0
  84. package/helpers/accessRightsHelper.js +27 -4
  85. package/helpers/controllerHelper.js +39 -18
  86. package/helpers/fieldsHelper.d.ts +3 -2
  87. package/helpers/fieldsHelper.js +5 -1
  88. package/helpers/inertiaAddHelper.d.ts +4 -5
  89. package/helpers/inertiaAddHelper.js +25 -7
  90. package/helpers/inertiaFromHelper.js +1 -1
  91. package/helpers/inertiaMenuHelper.d.ts +1 -1
  92. package/helpers/inertiaMenuHelper.js +1 -1
  93. package/helpers/menuHelper.d.ts +8 -3
  94. package/helpers/menuHelper.js +26 -17
  95. package/index.d.ts +2 -6
  96. package/index.js +5 -6
  97. package/interfaces/adminpanelConfig.d.ts +35 -30
  98. package/interfaces/global.d.ts +5 -2
  99. package/interfaces/types.d.ts +1 -1
  100. package/lib/Adminizer.d.ts +9 -3
  101. package/lib/Adminizer.js +32 -16
  102. package/lib/media-manager/Items.js +0 -3
  103. package/lib/requestProcessor.js +10 -3
  104. package/lib/v4/DataAccessor.d.ts +3 -1
  105. package/lib/v4/DataAccessor.js +43 -18
  106. package/lib/v4/I18n.js +2 -0
  107. package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +89 -60
  108. package/lib/{catalog → v4/catalog}/AbstractCatalog.js +59 -54
  109. package/lib/v4/catalog/Navigation.d.ts +43 -0
  110. package/lib/v4/catalog/Navigation.js +457 -0
  111. package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
  112. package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
  113. package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  114. package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
  115. package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
  116. package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
  117. package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
  118. package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
  119. package/lib/{datatable → v4/datatable}/NodeTable.js +8 -5
  120. package/lib/v4/model/AbstractModel.d.ts +5 -1
  121. package/lib/v4/model/AbstractModel.js +2 -1
  122. package/lib/v4/model/ModelHandler.js +1 -3
  123. package/lib/v4/model/adapter/sequelize.d.ts +8 -0
  124. package/lib/v4/model/adapter/sequelize.js +274 -133
  125. package/lib/v4/model/adapter/waterline.js +5 -2
  126. package/lib/{widgets → v4/widgets}/abstractLink.d.ts +1 -1
  127. package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +1 -1
  128. package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +11 -4
  129. package/lib/{widgets → v4/widgets}/widgetHandler.js +1 -1
  130. package/models/NavigationAP.d.ts +2 -3
  131. package/models/NavigationAP.js +5 -6
  132. package/models/UserAP.d.ts +2 -3
  133. package/package.json +17 -6
  134. package/system/Router.js +8 -11
  135. package/system/bindAccessRights.js +0 -4
  136. package/system/bindControls.js +6 -6
  137. package/system/bindDev.js +1 -0
  138. package/system/bindInertia.js +9 -4
  139. package/system/bindMediaManager.js +0 -1
  140. package/system/bindModels.js +9 -6
  141. package/system/bindNavigation.d.ts +2 -0
  142. package/system/bindNavigation.js +42 -42
  143. package/system/bindReqFunctions.js +0 -1
  144. package/system/defaults.js +13 -6
  145. package/translations/ar.json +70 -1
  146. package/translations/cn.json +70 -1
  147. package/translations/de.json +71 -3
  148. package/translations/en.json +70 -102
  149. package/translations/es.json +70 -1
  150. package/translations/fr.json +70 -1
  151. package/translations/hi.json +70 -1
  152. package/translations/jp.json +70 -1
  153. package/translations/ko.json +70 -1
  154. package/translations/pt.json +70 -1
  155. package/translations/ru.json +71 -103
  156. package/translations/ua.json +70 -1
  157. package/translations/uz.json +72 -0
  158. package/translations/vi.json +70 -1
  159. package/assets/add-BP_u3Tjl.js +0 -1
  160. package/assets/add-form-nffmiYTh.js +0 -1
  161. package/assets/add-group-D4vcHlm-.js +0 -1
  162. package/assets/add-group-form-gNJW11-q.js +0 -1
  163. package/assets/add-user-DWh3Nas0.js +0 -1
  164. package/assets/add-user-form-BJ0FsZYJ.js +0 -1
  165. package/assets/app-layout-DYsRFUuP.js +0 -1
  166. package/assets/app-shell-Dd9Eknik.js +0 -1
  167. package/assets/app-sidebar-BOmu6-Sl.js +0 -1
  168. package/assets/app-sidebar-header-CoXSzWxk.js +0 -11
  169. package/assets/breadcrumbs-BmAq4fHT.js +0 -1
  170. package/assets/button-C9B_5Jf_.js +0 -1
  171. package/assets/checkbox-Fg27sL_1.js +0 -1
  172. package/assets/compiler-runtime-hB6dAw2d.js +0 -9
  173. package/assets/dashboard-BACj996r.js +0 -3
  174. package/assets/dropdown-menu-Bhj17ENm.js +0 -1
  175. package/assets/form-BgWdwvz1.js +0 -1
  176. package/assets/form-DgtErfln.js +0 -1
  177. package/assets/home-CHntBHJa.js +0 -2
  178. package/assets/icon-Dt0vBgDO.js +0 -1
  179. package/assets/index-B8BS9wMC.js +0 -1
  180. package/assets/index-BC0yfOHo.js +0 -1
  181. package/assets/index-BKCgnGj_.js +0 -1
  182. package/assets/index-BbXEMx9n.js +0 -1
  183. package/assets/index-BykbU6Ee.js +0 -41
  184. package/assets/index-CaJgc5EZ.js +0 -1
  185. package/assets/index-DrWfGwtf.js +0 -1
  186. package/assets/init-user-JfCKJ5Ce.js +0 -1
  187. package/assets/input-CvRbIbk4.js +0 -1
  188. package/assets/input-error-DMK7cAt7.js +0 -1
  189. package/assets/label-CSLFe9Bz.js +0 -1
  190. package/assets/list-B2Oa5O_Q.js +0 -1
  191. package/assets/list-table-DA9MhywL.js +0 -62
  192. package/assets/login-DQwGtdis.js +0 -6
  193. package/assets/material-icon-BJg8o_fs.js +0 -1
  194. package/assets/module-DWXp59Vg.js +0 -1
  195. package/assets/nav-footer-Bs4dmN1d.js +0 -1
  196. package/assets/nav-main-Bq3IMk4C.js +0 -1
  197. package/assets/nav-user-CbB22J5O.js +0 -1
  198. package/assets/pagination-render-DuXDDbC_.js +0 -1
  199. package/assets/popover-DtoGI2b1.js +0 -1
  200. package/assets/register-BSogVF0h.js +0 -1
  201. package/assets/skeleton-COOcAA8f.js +0 -1
  202. package/assets/sonner-BI0IFOQN.js +0 -1
  203. package/assets/tooltip-DHwpLKOI.js +0 -1
  204. package/assets/use-appearance-DRfIqTgw.js +0 -1
  205. package/assets/use-window-size-h0Sh_NvX.js +0 -1
  206. package/assets/user-menu-content-DPXQdERj.js +0 -6
  207. package/assets/utils-DjqsqOe8.js +0 -1
  208. package/assets/welcome-B4WCIXKf.js +0 -1
  209. package/controllers/processInstallFinalize.d.ts +0 -1
  210. package/controllers/processInstallFinalize.js +0 -16
  211. package/controllers/processInstallStep.d.ts +0 -0
  212. package/controllers/processInstallStep.js +0 -122
  213. package/lib/catalog/Navigation.d.ts +0 -0
  214. package/lib/catalog/Navigation.js +0 -532
  215. package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
  216. package/lib/installStepper/InstallStepAbstract.js +0 -69
  217. package/lib/installStepper/finalizeStep.d.ts +0 -21
  218. package/lib/installStepper/finalizeStep.js +0 -48
  219. package/lib/installStepper/installStepper.d.ts +0 -40
  220. package/lib/installStepper/installStepper.js +0 -195
  221. package/models/MediaManagerAP.d.ts +0 -62
  222. package/models/MediaManagerAP.js +0 -45
  223. package/models/MediaManagerAssociationsAP.d.ts +0 -38
  224. package/models/MediaManagerAssociationsAP.js +0 -27
  225. package/models/MediaManagerMetaAP.d.ts +0 -30
  226. package/models/MediaManagerMetaAP.js +0 -21
  227. package/system/bindInstallStepper.d.ts +0 -2
  228. package/system/bindInstallStepper.js +0 -23
  229. /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
  230. /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
  231. /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
  232. /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
  233. /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
  234. /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
  235. /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
  236. /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
  237. /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
  238. /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
  239. /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
  240. /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
  241. /package/lib/{inertia → v4/inertia}/flash.js +0 -0
  242. /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
  243. /package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -0
  244. /package/lib/{widgets → v4/widgets}/abstractAction.d.ts +0 -0
  245. /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
  246. /package/lib/{widgets → v4/widgets}/abstractCustom.d.ts +0 -0
  247. /package/lib/{widgets → v4/widgets}/abstractCustom.js +0 -0
  248. /package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +0 -0
  249. /package/lib/{widgets → v4/widgets}/abstractInfo.js +0 -0
  250. /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
  251. /package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +0 -0
  252. /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
  253. /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
- }