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,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.user.locale || !req.adminizer.config.translation.locales.includes(req.user.locale)) {
95
- req.user.locale = req.adminizer.config.translation.defaultLocale || "en";
96
- }
97
- }
98
- else {
99
- req.user.locale = "en";
100
- }
101
- this.context.locale = req.user.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.user.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,62 +0,0 @@
1
- import { MediaManagerAssociationsAP } from "./MediaManagerAssociationsAP";
2
- import { MediaManagerMetaAP } from "./MediaManagerMetaAP";
3
- declare const _default: {
4
- id: {
5
- type: string;
6
- allowNull: boolean;
7
- uuid: boolean;
8
- primaryKey: boolean;
9
- required: boolean;
10
- };
11
- parent: {
12
- model: string;
13
- };
14
- variants: {
15
- collection: string;
16
- via: string;
17
- };
18
- mimeType: {
19
- type: string;
20
- };
21
- path: {
22
- type: string;
23
- };
24
- size: {
25
- type: string;
26
- };
27
- group: {
28
- type: string;
29
- };
30
- tag: {
31
- type: string;
32
- };
33
- url: {
34
- type: string;
35
- };
36
- filename: {
37
- type: string;
38
- };
39
- meta: {
40
- collection: string;
41
- via: string;
42
- };
43
- modelAssociation: {
44
- collection: string;
45
- via: string;
46
- };
47
- };
48
- export default _default;
49
- export interface MediaManagerAP {
50
- id: string;
51
- parent?: MediaManagerAP;
52
- variants?: MediaManagerAP[];
53
- mimeType?: string;
54
- path?: string;
55
- size?: number;
56
- group?: string;
57
- tag?: string;
58
- url?: string;
59
- filename?: string;
60
- meta?: MediaManagerMetaAP[];
61
- modelAssociation?: MediaManagerAssociationsAP[];
62
- }
@@ -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,38 +0,0 @@
1
- import { MediaManagerAP } from "./MediaManagerAP";
2
- declare const _default: {
3
- id: {
4
- type: string;
5
- allowNull: boolean;
6
- uuid: boolean;
7
- primaryKey: boolean;
8
- required: boolean;
9
- };
10
- mediaManagerId: {
11
- type: string;
12
- };
13
- model: {
14
- type: string;
15
- };
16
- modelId: {
17
- type: string;
18
- };
19
- widgetName: {
20
- type: string;
21
- };
22
- sortOrder: {
23
- type: string;
24
- };
25
- file: {
26
- model: string;
27
- };
28
- };
29
- export default _default;
30
- export interface MediaManagerAssociationsAP {
31
- id: string;
32
- mediaManagerId?: string;
33
- model?: Record<string, unknown>;
34
- modelId?: Record<string, unknown>;
35
- widgetName?: string;
36
- sortOrder?: number;
37
- file?: MediaManagerAP;
38
- }
@@ -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,30 +0,0 @@
1
- import { MediaManagerAP } from "./MediaManagerAP";
2
- declare const _default: {
3
- id: {
4
- type: string;
5
- allowNull: boolean;
6
- uuid: boolean;
7
- primaryKey: boolean;
8
- required: boolean;
9
- };
10
- key: {
11
- type: string;
12
- };
13
- value: {
14
- type: string;
15
- };
16
- isPublic: {
17
- type: string;
18
- };
19
- parent: {
20
- model: string;
21
- };
22
- };
23
- export default _default;
24
- export interface MediaManagerMetaAP {
25
- id: string;
26
- key?: string;
27
- value?: Record<string, unknown>;
28
- isPublic?: boolean;
29
- parent?: MediaManagerAP;
30
- }
@@ -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.user) {
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes