adminizer 4.1.0-commit.ad1476a → 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 (292) hide show
  1. package/Readme.md +46 -0
  2. package/assets/{VanillaJSONEditor-FUe77pIA.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-DMmad2-f.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-BOltB2Hq.css +1 -0
  20. package/assets/dashboard-es9ZT8qk.js +3 -0
  21. package/assets/{date-picker-B__dVVqj.js → date-picker-Dz-d-YWX.js} +2 -2
  22. package/assets/debounce-qdyXyOeG.js +1 -0
  23. package/assets/del-modal-D0mrZvki.js +11 -0
  24. package/assets/dialog-stack-BiMbfm58.js +1 -0
  25. package/assets/dropdown-menu-BSBcRiXx.js +1 -0
  26. package/assets/{field-renderer-CapylJU9.js → field-renderer-B6hFAeiU.js} +3 -3
  27. package/assets/form-Buslty7y.js +1 -0
  28. package/assets/form-aqiRmPix.js +1 -0
  29. package/assets/{geo-json-CwteYDGB.js → geo-json-BKmYmu3d.js} +2 -2
  30. package/assets/{handsontable-BCnjOpBr.js → handsontable-B8xVeMAQ.js} +5 -5
  31. package/assets/home-Dr72Jk-w.js +2 -0
  32. package/assets/icon-B-a7xg54.js +1 -0
  33. package/assets/index-B68_akQe.js +1 -0
  34. package/assets/index-B7-xTDyy.js +1 -0
  35. package/assets/index-BJFFlCSo.js +1 -0
  36. package/assets/{index-DTRTjOmh.js → index-BOuMo_nl.js} +3 -3
  37. package/assets/index-BzOcGsBq.js +1 -0
  38. package/assets/index-CFbQ2Rv0.js +1 -0
  39. package/assets/{index-D5ir9iUV.js → index-Cq31rrfZ.js} +1 -1
  40. package/assets/{index-BcE9FUM6.js → index-D5UDXTFs.js} +1 -1
  41. package/assets/index-oxIQWAdI.js +41 -0
  42. package/assets/init-user-5H689LP0.js +1 -0
  43. package/assets/input-CSJjrf2i.js +1 -0
  44. package/assets/input-error-CK92Shhm.js +1 -0
  45. package/assets/label-Muj0-Efy.js +1 -0
  46. package/assets/list-Cvh7zbyG.js +1 -0
  47. package/assets/list-table-Bs_vbQiV.js +52 -0
  48. package/assets/login-DliJrjMQ.js +6 -0
  49. package/assets/manifest.json +589 -666
  50. package/assets/material-icon-BRS58Qpk.js +1 -0
  51. package/assets/module-CjG21VCT.js +1 -0
  52. package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-9fDiyfuW.js} +2 -2
  53. package/assets/{multi-select-oabtVhUP.js → multi-select-CMQIJ0JT.js} +2 -2
  54. package/assets/nav-footer-IGMn9NiE.js +1 -0
  55. package/assets/nav-main-DBE4rMiZ.js +1 -0
  56. package/assets/nav-user-CjyLRyq-.js +1 -0
  57. package/assets/pagination-render-DUAq2klc.js +1 -0
  58. package/assets/popover-C_cww-4_.js +1 -0
  59. package/assets/register-UzQn3J0g.js +1 -0
  60. package/assets/{select-D1N8zRPY.js → select-DzBno-dc.js} +2 -2
  61. package/assets/{sidebar-4D-sX2l4.js → sidebar-Dc4iqfu-.js} +2 -2
  62. package/assets/skeleton-Dkmj2o2Z.js +1 -0
  63. package/assets/sonner-De1t71Gj.js +1 -0
  64. package/assets/{toast-editor-FbrFd1ft.js → toast-editor-1Pul3oMs.js} +2 -2
  65. package/assets/tooltip-CwPrC-HD.js +1 -0
  66. package/assets/use-appearance-J8J2w43p.js +1 -0
  67. package/assets/use-window-size-DLSEoR6e.js +1 -0
  68. package/assets/{user-info-DBYoAJYJ.js → user-info-8RyDk7qh.js} +2 -2
  69. package/assets/user-menu-content-CpxTLH56.js +6 -0
  70. package/assets/welcome-BYKI6yO-.js +1 -0
  71. package/controllers/add.js +10 -10
  72. package/controllers/addGroup.js +2 -4
  73. package/controllers/addUser.js +4 -6
  74. package/controllers/catalog/Catalog.d.ts +1 -1
  75. package/controllers/catalog/Catalog.js +42 -37
  76. package/controllers/catalog/FrontentCatalogAdapter.d.ts +36 -26
  77. package/controllers/catalog/FrontentCatalogAdapter.js +71 -73
  78. package/controllers/ckeditorUpload.js +2 -3
  79. package/controllers/dashboard.js +16 -2
  80. package/controllers/edit.js +10 -14
  81. package/controllers/editGroup.js +2 -4
  82. package/controllers/editUser.js +3 -5
  83. package/controllers/form.js +2 -3
  84. package/controllers/getAllWidgets.js +3 -3
  85. package/controllers/initUser.js +1 -2
  86. package/controllers/list.js +6 -6
  87. package/controllers/login.js +43 -18
  88. package/controllers/media-manager/mediaManagerAdapter.js +1 -2
  89. package/controllers/media-manager/mediaManagerApi.js +2 -2
  90. package/controllers/navigation/edit.js +2 -2
  91. package/controllers/register.js +1 -4
  92. package/controllers/remove.js +3 -3
  93. package/controllers/timezones.js +1 -1
  94. package/controllers/view.js +3 -3
  95. package/controllers/welcome.js +1 -1
  96. package/controllers/widgets/Action.js +2 -2
  97. package/controllers/widgets/Custom.js +2 -2
  98. package/controllers/widgets/Info.js +2 -2
  99. package/controllers/widgets/switch.js +2 -2
  100. package/controllers/widgetsDB.js +5 -5
  101. package/helpers/JsUtils.d.ts +1 -0
  102. package/helpers/JsUtils.js +3 -0
  103. package/helpers/accessRightsHelper.d.ts +6 -2
  104. package/helpers/accessRightsHelper.js +28 -5
  105. package/helpers/configHelper.js +2 -1
  106. package/helpers/controllerHelper.js +39 -18
  107. package/helpers/fieldsHelper.d.ts +4 -3
  108. package/helpers/fieldsHelper.js +5 -1
  109. package/helpers/inertiaActionsHelper.js +1 -1
  110. package/helpers/inertiaAddHelper.d.ts +3 -4
  111. package/helpers/inertiaAddHelper.js +27 -7
  112. package/helpers/inertiaFromHelper.js +2 -0
  113. package/helpers/inertiaGroupHelper.d.ts +4 -2
  114. package/helpers/inertiaGroupHelper.js +1 -1
  115. package/helpers/inertiaListHelper.js +5 -5
  116. package/helpers/inertiaMenuHelper.d.ts +1 -1
  117. package/helpers/inertiaMenuHelper.js +2 -2
  118. package/helpers/inertiaUserHelper.d.ts +7 -1
  119. package/helpers/inertiaUserHelper.js +5 -1
  120. package/helpers/menuHelper.d.ts +8 -3
  121. package/helpers/menuHelper.js +26 -17
  122. package/index.d.ts +6 -3
  123. package/index.js +9 -3
  124. package/interfaces/adminpanelConfig.d.ts +41 -32
  125. package/interfaces/global.d.ts +10 -28
  126. package/interfaces/types.d.ts +1 -1
  127. package/lib/Adminizer.d.ts +11 -3
  128. package/lib/Adminizer.js +49 -17
  129. package/lib/media-manager/AbstractMediaManager.d.ts +2 -2
  130. package/lib/media-manager/AbstractMediaManager.js +1 -1
  131. package/lib/media-manager/Items.js +0 -3
  132. package/lib/requestProcessor.js +10 -3
  133. package/lib/v4/DataAccessor.d.ts +5 -2
  134. package/lib/v4/DataAccessor.js +44 -19
  135. package/lib/v4/I18n.js +2 -0
  136. package/lib/v4/POWCaptcha.js +0 -1
  137. package/lib/v4/PolicyManager.js +0 -1
  138. package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +89 -60
  139. package/lib/{catalog → v4/catalog}/AbstractCatalog.js +59 -55
  140. package/lib/v4/catalog/Navigation.d.ts +43 -0
  141. package/lib/v4/catalog/Navigation.js +457 -0
  142. package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
  143. package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
  144. package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  145. package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
  146. package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
  147. package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
  148. package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
  149. package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
  150. package/lib/{datatable → v4/datatable}/NodeTable.js +8 -8
  151. package/lib/v4/helper/jwt.d.ts +10 -0
  152. package/lib/v4/helper/jwt.js +18 -0
  153. package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -1
  154. package/lib/v4/model/AbstractModel.d.ts +5 -1
  155. package/lib/v4/model/AbstractModel.js +2 -3
  156. package/lib/v4/model/ModelHandler.js +1 -4
  157. package/lib/v4/model/adapter/sequelize.d.ts +11 -2
  158. package/lib/v4/model/adapter/sequelize.js +451 -118
  159. package/lib/v4/model/adapter/waterline.js +5 -3
  160. package/lib/{widgets → v4/widgets}/abstractAction.d.ts +1 -1
  161. package/lib/v4/widgets/abstractCustom.d.ts +28 -0
  162. package/lib/v4/widgets/abstractCustom.js +9 -0
  163. package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +1 -1
  164. package/lib/{widgets → v4/widgets}/abstractInfo.js +1 -1
  165. package/lib/{widgets → v4/widgets}/abstractLink.d.ts +2 -1
  166. package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +1 -1
  167. package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +2 -2
  168. package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +29 -5
  169. package/lib/{widgets → v4/widgets}/widgetHandler.js +25 -25
  170. package/models/GroupAP.d.ts +8 -0
  171. package/models/NavigationAP.d.ts +7 -3
  172. package/models/NavigationAP.js +5 -6
  173. package/models/UserAP.d.ts +24 -2
  174. package/models/UserAP.js +2 -2
  175. package/package.json +29 -11
  176. package/policies/checkAuth.js +4 -3
  177. package/policies/setLocale.js +2 -2
  178. package/system/Router.js +14 -17
  179. package/system/bindAccessRights.js +0 -4
  180. package/system/bindAuthorization.js +4 -5
  181. package/system/bindControls.js +6 -6
  182. package/system/bindDev.js +1 -0
  183. package/system/bindInertia.js +17 -12
  184. package/system/bindMediaManager.js +0 -1
  185. package/system/bindModels.js +9 -6
  186. package/system/bindNavigation.d.ts +2 -0
  187. package/system/bindNavigation.js +42 -42
  188. package/system/bindReqFunctions.js +15 -0
  189. package/system/defaults.js +13 -6
  190. package/translations/ar.json +70 -1
  191. package/translations/cn.json +70 -1
  192. package/translations/de.json +71 -3
  193. package/translations/en.json +70 -102
  194. package/translations/es.json +70 -1
  195. package/translations/fr.json +70 -1
  196. package/translations/hi.json +70 -1
  197. package/translations/jp.json +70 -1
  198. package/translations/ko.json +70 -1
  199. package/translations/pt.json +70 -1
  200. package/translations/ru.json +71 -94
  201. package/translations/ua.json +70 -1
  202. package/translations/uz.json +72 -0
  203. package/translations/vi.json +70 -1
  204. package/assets/add-ZITr43GJ.js +0 -1
  205. package/assets/add-form-CYOfr0Ef.js +0 -1
  206. package/assets/add-group-B332wN8K.js +0 -1
  207. package/assets/add-group-form-dzadPSfL.js +0 -1
  208. package/assets/add-user-TC-mYdsB.js +0 -1
  209. package/assets/add-user-form-y2f_1_lM.js +0 -1
  210. package/assets/app-layout-D1m9Kvxq.js +0 -1
  211. package/assets/app-shell-BWMRMkHM.js +0 -1
  212. package/assets/app-sidebar-BCtaEFGb.js +0 -1
  213. package/assets/app-sidebar-header-DLAFi13E.js +0 -11
  214. package/assets/breadcrumbs-CQNon4Vl.js +0 -1
  215. package/assets/button-CQ9t1kLz.js +0 -1
  216. package/assets/checkbox-W0nGAXIj.js +0 -1
  217. package/assets/compiler-runtime-tM4jBQ-T.js +0 -9
  218. package/assets/dashboard-BR602KhL.js +0 -1
  219. package/assets/dropdown-menu-SEBnEIiL.js +0 -1
  220. package/assets/form-DOUNk3o2.js +0 -1
  221. package/assets/form-lOKv4Qbw.js +0 -1
  222. package/assets/home-Ch6QfTIt.js +0 -2
  223. package/assets/icon-Bz9BMaD0.js +0 -1
  224. package/assets/index-BC0yfOHo.js +0 -1
  225. package/assets/index-BbXEMx9n.js +0 -1
  226. package/assets/index-C0SL3SHw.js +0 -41
  227. package/assets/index-Cdb9ACvz.js +0 -1
  228. package/assets/index-DEk3sC8d.js +0 -1
  229. package/assets/index-DrWfGwtf.js +0 -1
  230. package/assets/index-K81GbF6O.js +0 -1
  231. package/assets/init-user-D9mW-g14.js +0 -1
  232. package/assets/input-DF7Ue23C.js +0 -1
  233. package/assets/input-error-BBygona6.js +0 -1
  234. package/assets/label-Z506NKsW.js +0 -1
  235. package/assets/list-Qyd7ecQH.js +0 -1
  236. package/assets/list-table-DB1sEQLF.js +0 -62
  237. package/assets/login-DrGaTWhY.js +0 -6
  238. package/assets/material-icon-CItZiB53.js +0 -1
  239. package/assets/module-DBaykv8l.js +0 -1
  240. package/assets/nav-footer-CM-yHiRs.js +0 -1
  241. package/assets/nav-main-Q3xofGRT.js +0 -1
  242. package/assets/nav-user-Ds8i0Pa2.js +0 -1
  243. package/assets/pagination-render-B57pOpFy.js +0 -1
  244. package/assets/popover-I249Gg2O.js +0 -1
  245. package/assets/register-C9FQIDtS.js +0 -1
  246. package/assets/sonner-Dzckw3U3.js +0 -1
  247. package/assets/tooltip-D2ehgLlB.js +0 -1
  248. package/assets/use-appearance-Co6mO0dV.js +0 -1
  249. package/assets/use-window-size-B8l6Bpkf.js +0 -1
  250. package/assets/user-menu-content-qkvdkUVd.js +0 -6
  251. package/assets/utils-DjqsqOe8.js +0 -1
  252. package/assets/welcome-D2adQ8EU.js +0 -1
  253. package/controllers/processInstallFinalize.d.ts +0 -1
  254. package/controllers/processInstallFinalize.js +0 -16
  255. package/controllers/processInstallStep.d.ts +0 -1
  256. package/controllers/processInstallStep.js +0 -132
  257. package/lib/catalog/Navigation.d.ts +0 -0
  258. package/lib/catalog/Navigation.js +0 -532
  259. package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
  260. package/lib/installStepper/InstallStepAbstract.js +0 -69
  261. package/lib/installStepper/finalizeStep.d.ts +0 -21
  262. package/lib/installStepper/finalizeStep.js +0 -48
  263. package/lib/installStepper/installStepper.d.ts +0 -40
  264. package/lib/installStepper/installStepper.js +0 -195
  265. package/lib/widgets/abstractCustom.d.ts +0 -13
  266. package/lib/widgets/abstractCustom.js +0 -3
  267. package/models/MediaManagerAP.d.ts +0 -46
  268. package/models/MediaManagerAP.js +0 -45
  269. package/models/MediaManagerAssociationsAP.d.ts +0 -28
  270. package/models/MediaManagerAssociationsAP.js +0 -27
  271. package/models/MediaManagerMetaAP.d.ts +0 -22
  272. package/models/MediaManagerMetaAP.js +0 -21
  273. package/system/bindInstallStepper.d.ts +0 -2
  274. package/system/bindInstallStepper.js +0 -23
  275. /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
  276. /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
  277. /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
  278. /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
  279. /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
  280. /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
  281. /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
  282. /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
  283. /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
  284. /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
  285. /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
  286. /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
  287. /package/lib/{inertia → v4/inertia}/flash.js +0 -0
  288. /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
  289. /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
  290. /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
  291. /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
  292. /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
@@ -1,48 +0,0 @@
1
- import InstallStepAbstract from "./InstallStepAbstract";
2
- import * as path from "path";
3
- import { InstallStepper } from "./installStepper";
4
- export default class FinalizeStep extends InstallStepAbstract {
5
- canBeSkipped = false;
6
- description = '';
7
- ejsPath = path.resolve(import.meta.dirname, '../../views/ejs/installer/partials/finalize.ejs');
8
- id = 'finalize';
9
- scriptsUrl = '';
10
- sortOrder = 0;
11
- stylesUrl = '';
12
- title = 'Finalize Step';
13
- badge = '';
14
- isSkipped = false;
15
- settingsKeys = [];
16
- renderer = "ejs";
17
- isProcessed = false;
18
- async check() {
19
- if (this.isProcessed) {
20
- return true;
21
- }
22
- else {
23
- let installStepper = InstallStepper.getInstance();
24
- if (!installStepper.hasUnfinalizedSteps()) {
25
- this.canBeSkipped = true;
26
- }
27
- }
28
- return false;
29
- }
30
- async process(data) {
31
- let installStepper = InstallStepper.getInstance();
32
- if (!installStepper.hasUnfinalizedSteps()) {
33
- this.isProcessed = true;
34
- }
35
- }
36
- async skip() {
37
- let installStepper = InstallStepper.getInstance();
38
- if (!installStepper.hasUnfinalizedSteps()) {
39
- this.isProcessed = true;
40
- }
41
- }
42
- finally() {
43
- return Promise.resolve();
44
- }
45
- toFinally() {
46
- return;
47
- }
48
- }
@@ -1,40 +0,0 @@
1
- import InstallStepAbstract from "./InstallStepAbstract";
2
- interface RenderData {
3
- totalStepCount: number;
4
- leftStepsCount: number;
5
- currentStep: InstallStepAbstract;
6
- locale: string;
7
- }
8
- export declare class InstallStepper {
9
- id: string;
10
- private steps;
11
- context: any;
12
- readonly canBeClosed: boolean;
13
- static instances: InstallStepper[];
14
- constructor(id: string, canBeClosed?: boolean);
15
- static addStepper(stepper?: InstallStepper): void;
16
- static getStepper(stepperId: string): InstallStepper;
17
- static deleteStepper(stepperId: string): void;
18
- static getInstance(): InstallStepper;
19
- getSteps(): InstallStepAbstract[];
20
- processStep(stepId: string, data: any): Promise<void>;
21
- private getStepById;
22
- /** Prepares steps array for user interface render */
23
- render(req: ReqType): RenderData;
24
- skipStep(stepId: string): Promise<void>;
25
- /** Add step (replace if it already exists) */
26
- addStep(step: InstallStepAbstract): void;
27
- hasUnprocessedSteps(): boolean;
28
- getNextUnprocessedStep(): InstallStepAbstract;
29
- hasUnfinalizedSteps(): boolean;
30
- getFinalizeStatus(): {
31
- status: string;
32
- finalizeList: {
33
- id: string;
34
- status: "pending" | "fulfilled" | "rejected";
35
- description: string;
36
- info: string;
37
- }[];
38
- };
39
- }
40
- export {};
@@ -1,195 +0,0 @@
1
- import FinalizeStep from "./finalizeStep";
2
- import * as fs from "fs";
3
- import { TranslationHelper } from "../../helpers/translationHelper";
4
- import { Adminizer } from "../Adminizer";
5
- export class InstallStepper {
6
- id;
7
- steps = [];
8
- context = {};
9
- canBeClosed;
10
- // TODO remove static fields for multi adminizer server
11
- static instances = [];
12
- constructor(id, canBeClosed = false) {
13
- this.id = id;
14
- this.canBeClosed = canBeClosed;
15
- }
16
- static addStepper(stepper) {
17
- if (this.instances.find(item => item.id === stepper.id)) {
18
- Adminizer.log.debug(`Stepper with id ${stepper.id} was deleted due to creating new one`);
19
- this.deleteStepper(stepper.id);
20
- }
21
- this.instances.push(stepper);
22
- }
23
- static getStepper(stepperId) {
24
- return this.instances.find(item => item.id === stepperId);
25
- }
26
- static deleteStepper(stepperId) {
27
- let stepper = this.getStepper(stepperId);
28
- if (!stepper.canBeClosed) {
29
- Adminizer.log.error(`Can not delete stepper: Stepper with id ${stepperId} can not be closed.`);
30
- throw `Can not delete stepper: Stepper with id ${stepperId} can not be closed`;
31
- }
32
- const index = this.instances.findIndex(item => item.id === stepperId);
33
- if (index !== -1) {
34
- this.instances.splice(index, 1);
35
- Adminizer.log.info(`Stepper with id ${stepperId} has been deleted.`);
36
- }
37
- else {
38
- Adminizer.log.error(`Can not delete stepper: Stepper with id ${stepperId} not found.`);
39
- throw `Can not delete stepper: Stepper with id ${stepperId} not found.`;
40
- }
41
- }
42
- static getInstance() {
43
- if (!this.instances.length) {
44
- let newStepper = new InstallStepper("project", false);
45
- this.instances.push(newStepper);
46
- }
47
- return this.instances.find(item => item.id === "project");
48
- }
49
- getSteps() {
50
- return this.steps;
51
- }
52
- async processStep(stepId, data) {
53
- try {
54
- /** As we sort steps by sortOrder, we should check that previous steps were processed */
55
- const stepIndex = this.steps.findIndex(item => item.id === stepId);
56
- Adminizer.log.debug("STEP INDEX", stepIndex);
57
- for (let i = 0; i < stepIndex; i++) {
58
- if (this.steps[i].canBeSkipped && this.steps[i].isSkipped) {
59
- continue;
60
- }
61
- let checkResult = await this.steps[i].check();
62
- if (checkResult === false) {
63
- throw `Previous step was not processed`;
64
- }
65
- }
66
- let step = this.getStepById(stepId);
67
- // get context copy and write down information in it on process without damaging source object
68
- let contextCopy = { ...this.context };
69
- await step.process(data, contextCopy);
70
- Object.assign(this.context, contextCopy);
71
- step.isProcessed = true;
72
- Adminizer.log.debug(`STEP ${stepId} was processed`);
73
- // call finalize method only if has description
74
- if (step.finallyToRun) {
75
- contextCopy = { ...this.context };
76
- step.toFinally(data, this.context);
77
- Object.assign(this.context, contextCopy);
78
- }
79
- }
80
- catch (e) {
81
- Adminizer.log.error(`Error processing step: ${e}`);
82
- throw new Error(e);
83
- }
84
- }
85
- getStepById(stepId) {
86
- return this.steps.find(item => item.id === stepId);
87
- }
88
- /** Prepares steps array for user interface render */
89
- render(req) {
90
- let stepToRender = this.getNextUnprocessedStep();
91
- let leftSteps = this.steps.filter(step => !step.isProcessed && !step.isSkipped);
92
- // set locale
93
- if (typeof req.adminizer.config.translation !== "boolean") {
94
- if (!req.session.UserAP.locale || !req.adminizer.config.translation.locales.includes(req.session.UserAP.locale)) {
95
- req.session.UserAP.locale = req.adminizer.config.translation.defaultLocale || "en";
96
- }
97
- }
98
- else {
99
- req.session.UserAP.locale = "en";
100
- }
101
- this.context.locale = req.session.UserAP.locale;
102
- // translate step
103
- stepToRender = TranslationHelper.translateProperties(req.i18n, stepToRender, ["title", "description", "name"]);
104
- return {
105
- totalStepCount: this.steps.length,
106
- leftStepsCount: leftSteps.length,
107
- currentStep: stepToRender,
108
- locale: req.session.UserAP.locale
109
- };
110
- }
111
- async skipStep(stepId) {
112
- try {
113
- let step = this.getStepById(stepId);
114
- await step.skipIt();
115
- step.isSkipped = true;
116
- }
117
- catch (e) {
118
- Adminizer.log.error(`Error skipping step: ${e}`);
119
- }
120
- }
121
- /** Add step (replace if it already exists) */
122
- addStep(step) {
123
- if (step.renderer === "ejs") {
124
- if (!step.ejsPath || !fs.existsSync(step.ejsPath)) {
125
- throw `Step [${step.title}] error: ejs path does not exists`;
126
- }
127
- }
128
- const stepIndex = this.steps.findIndex(item => item.id === step.id);
129
- if (stepIndex !== -1) {
130
- Adminizer.log.warn(`Attention! The step has been replaced\`${step.id}\``);
131
- this.steps[stepIndex] = step;
132
- }
133
- else {
134
- this.steps.push(step);
135
- }
136
- // sort by group, then by renderer and then by sortOrder
137
- this.steps.sort((a, b) => {
138
- if (a.groupSortOrder !== b.groupSortOrder) {
139
- return a.groupSortOrder - b.groupSortOrder;
140
- }
141
- else {
142
- if (a.renderer !== b.renderer) {
143
- return a.renderer === 'ejs' ? -1 : 1;
144
- }
145
- else {
146
- return a.sortOrder - b.sortOrder;
147
- }
148
- }
149
- });
150
- }
151
- hasUnprocessedSteps() {
152
- return this.steps.some(step => !step.isProcessed && !step.isSkipped);
153
- }
154
- getNextUnprocessedStep() {
155
- let nextStep = this.steps.find(step => !step.isProcessed && !step.isSkipped);
156
- if (!nextStep && this.hasUnfinalizedSteps()) {
157
- if (this.getStepById("finalize")) {
158
- nextStep = this.getStepById("finalize");
159
- }
160
- else {
161
- let timer = setInterval(() => {
162
- // clear steps if all of them was processed and finalized
163
- if (!this.hasUnprocessedSteps() && !this.hasUnfinalizedSteps()) {
164
- this.steps = [];
165
- Adminizer.log.debug("CLEARING STEPS", this.steps);
166
- clearInterval(timer);
167
- }
168
- }, 5000);
169
- nextStep = new FinalizeStep();
170
- this.addStep(nextStep);
171
- }
172
- }
173
- return nextStep;
174
- }
175
- hasUnfinalizedSteps() {
176
- return this.steps.some(step => step.finallyPromise?.status === "pending");
177
- }
178
- getFinalizeStatus() {
179
- let stepsWithFinalize = this.steps.filter(step => step.finallyPromise !== null);
180
- let generalStatus = "fulfilled";
181
- let stepFinalizeStatuses = stepsWithFinalize.map(item => {
182
- let info = null;
183
- // if one of them is pending, general status is pending
184
- if (item.finallyPromise.status === "pending") {
185
- generalStatus = "pending";
186
- }
187
- if (item.finallyPromise.status === "rejected") {
188
- generalStatus = "rejected";
189
- info = `Error: ${item.finallyPromise.info}`;
190
- }
191
- return { id: item.id, status: item.finallyPromise.status, description: item.finallyDescription, info: info };
192
- });
193
- return { status: generalStatus, finalizeList: stepFinalizeStatuses ?? [] };
194
- }
195
- }
@@ -1,13 +0,0 @@
1
- import BaseWidget from "./abstractWidgetBase";
2
- export default abstract class CustomBase extends BaseWidget {
3
- /** Widget background css (color, Image) */
4
- abstract readonly backgroundCSS: string | null;
5
- /** Fullpath script for loading in dashboard in browser */
6
- abstract readonly scriptUrl: string;
7
- /** How widgets processor can call constructor of this widget */
8
- abstract readonly constructorName: string;
9
- /** Options to constuctor */
10
- abstract readonly constructorOption: any;
11
- /** Hide title, icon, description */
12
- abstract readonly hideAdminPanelUI: boolean;
13
- }
@@ -1,3 +0,0 @@
1
- import BaseWidget from "./abstractWidgetBase";
2
- export default class CustomBase extends BaseWidget {
3
- }
@@ -1,46 +0,0 @@
1
- declare const _default: {
2
- id: {
3
- type: string;
4
- allowNull: boolean;
5
- uuid: boolean;
6
- primaryKey: boolean;
7
- required: boolean;
8
- };
9
- parent: {
10
- model: string;
11
- };
12
- variants: {
13
- collection: string;
14
- via: string;
15
- };
16
- mimeType: {
17
- type: string;
18
- };
19
- path: {
20
- type: string;
21
- };
22
- size: {
23
- type: string;
24
- };
25
- group: {
26
- type: string;
27
- };
28
- tag: {
29
- type: string;
30
- };
31
- url: {
32
- type: string;
33
- };
34
- filename: {
35
- type: string;
36
- };
37
- meta: {
38
- collection: string;
39
- via: string;
40
- };
41
- modelAssociation: {
42
- collection: string;
43
- via: string;
44
- };
45
- };
46
- export default _default;
@@ -1,45 +0,0 @@
1
- export default {
2
- id: {
3
- type: "string",
4
- allowNull: false,
5
- uuid: true,
6
- primaryKey: true,
7
- required: true
8
- },
9
- parent: {
10
- model: "MediaManagerAP"
11
- },
12
- variants: {
13
- collection: "MediaManagerAP",
14
- via: "parent"
15
- },
16
- mimeType: {
17
- type: "string"
18
- },
19
- path: {
20
- type: "string"
21
- },
22
- size: {
23
- type: "number"
24
- },
25
- group: {
26
- type: "string"
27
- },
28
- tag: {
29
- type: "string"
30
- },
31
- url: {
32
- type: "string"
33
- },
34
- filename: {
35
- type: "string"
36
- },
37
- meta: {
38
- collection: "MediaManagerMetaAP",
39
- via: "parent"
40
- },
41
- modelAssociation: {
42
- collection: "MediaManagerAssociationsAP",
43
- via: "file"
44
- }
45
- };
@@ -1,28 +0,0 @@
1
- declare const _default: {
2
- id: {
3
- type: string;
4
- allowNull: boolean;
5
- uuid: boolean;
6
- primaryKey: boolean;
7
- required: boolean;
8
- };
9
- mediaManagerId: {
10
- type: string;
11
- };
12
- model: {
13
- type: string;
14
- };
15
- modelId: {
16
- type: string;
17
- };
18
- widgetName: {
19
- type: string;
20
- };
21
- sortOrder: {
22
- type: string;
23
- };
24
- file: {
25
- model: string;
26
- };
27
- };
28
- export default _default;
@@ -1,27 +0,0 @@
1
- export default {
2
- id: {
3
- type: "string",
4
- allowNull: false,
5
- uuid: true,
6
- primaryKey: true,
7
- required: true
8
- },
9
- mediaManagerId: {
10
- type: "string"
11
- },
12
- model: {
13
- type: "json"
14
- },
15
- modelId: {
16
- type: "json"
17
- },
18
- widgetName: {
19
- type: "string"
20
- },
21
- sortOrder: {
22
- type: "number"
23
- },
24
- file: {
25
- model: "MediaManagerAP"
26
- }
27
- };
@@ -1,22 +0,0 @@
1
- declare const _default: {
2
- id: {
3
- type: string;
4
- allowNull: boolean;
5
- uuid: boolean;
6
- primaryKey: boolean;
7
- required: boolean;
8
- };
9
- key: {
10
- type: string;
11
- };
12
- value: {
13
- type: string;
14
- };
15
- isPublic: {
16
- type: string;
17
- };
18
- parent: {
19
- model: string;
20
- };
21
- };
22
- export default _default;
@@ -1,21 +0,0 @@
1
- export default {
2
- id: {
3
- type: "string",
4
- allowNull: false,
5
- uuid: true,
6
- primaryKey: true,
7
- required: true
8
- },
9
- key: {
10
- type: "string"
11
- },
12
- value: {
13
- type: "json"
14
- },
15
- isPublic: {
16
- type: "boolean"
17
- },
18
- parent: {
19
- model: "MediaManagerAP"
20
- }
21
- };
@@ -1,2 +0,0 @@
1
- import { Adminizer } from "../lib/Adminizer";
2
- export default function bindInstallStepper(adminizer: Adminizer): void;
@@ -1,23 +0,0 @@
1
- import { InstallStepper } from "../lib/installStepper/installStepper";
2
- import { Adminizer } from "../lib/Adminizer";
3
- let installStepper = InstallStepper.getInstance();
4
- export default function bindInstallStepper(adminizer) {
5
- let installStepperPolicy = function (req, res, proceed) {
6
- if (!req.session.UserAP) {
7
- return proceed();
8
- }
9
- let goingToProcessInstallStep = req._parsedUrl.pathname === `/install/${installStepper.id}`;
10
- let goingToProcessInstallFinalize = req._parsedUrl.pathname === `/install/${installStepper.id}/finalize`;
11
- if (installStepper.hasUnprocessedSteps() && !goingToProcessInstallStep && !goingToProcessInstallFinalize) {
12
- return res.redirect(`${adminizer.config.routePrefix}/install/${installStepper.id}`);
13
- }
14
- return proceed();
15
- };
16
- if (Array.isArray(adminizer.config.policies) && typeof adminizer.config.policies[0] !== "string") {
17
- adminizer.config.policies.push(installStepperPolicy);
18
- }
19
- else {
20
- Adminizer.log.error("Can not bind install stepper. Policies is not array");
21
- }
22
- }
23
- ;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes