adminizer 4.2.0-build.60 → 4.2.0-build.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controllers/catalog/Catalog.js +1 -2
- package/controllers/edit.js +1 -2
- package/lib/Adminizer.d.ts +2 -0
- package/lib/Adminizer.js +3 -0
- package/lib/v4/catalog/CatalogHandler.d.ts +4 -4
- package/lib/v4/catalog/CatalogHandler.js +4 -4
- package/package.json +1 -1
- package/system/bindNavigation.js +1 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CatalogHandler } from "../../lib/v4/catalog/CatalogHandler";
|
|
2
1
|
import { VueCatalog } from "./FrontentCatalogAdapter";
|
|
3
2
|
import { Adminizer } from "../../lib/Adminizer";
|
|
4
3
|
export async function catalogController(req, res) {
|
|
@@ -16,7 +15,7 @@ export async function catalogController(req, res) {
|
|
|
16
15
|
if (slug === 'navigation' && !id) {
|
|
17
16
|
return res.sendStatus(404);
|
|
18
17
|
}
|
|
19
|
-
const _catalog =
|
|
18
|
+
const _catalog = req.adminizer.catalogHandler.getCatalog(slug);
|
|
20
19
|
if (_catalog === undefined)
|
|
21
20
|
return res.sendStatus(404);
|
|
22
21
|
const idList = await _catalog.getIdList();
|
package/controllers/edit.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ControllerHelper } from "../helpers/controllerHelper";
|
|
2
2
|
import { RequestProcessor } from "../lib/requestProcessor";
|
|
3
3
|
import { FieldsHelper } from "../helpers/fieldsHelper";
|
|
4
|
-
import { CatalogHandler } from "../lib/v4/catalog/CatalogHandler";
|
|
5
4
|
import { getRelationsMediaManager, saveRelationsMediaManager } from "../lib/media-manager/helpers/MediaManagerHelper";
|
|
6
5
|
import { DataAccessor } from "../lib/v4/DataAccessor";
|
|
7
6
|
import { Adminizer } from "../lib/Adminizer";
|
|
@@ -122,7 +121,7 @@ export default async function edit(req, res) {
|
|
|
122
121
|
// update navigation tree after model updated
|
|
123
122
|
if (req.adminizer.config.navigation) {
|
|
124
123
|
for (const section of req.adminizer.config.navigation.sections) {
|
|
125
|
-
let navigation =
|
|
124
|
+
let navigation = req.adminizer.catalogHandler.getCatalog('navigation');
|
|
126
125
|
navigation.setId(section);
|
|
127
126
|
let navItem = navigation.itemTypes.find(item => item.type === entity.name.toLowerCase());
|
|
128
127
|
if (navItem) {
|
package/lib/Adminizer.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { AbstractAdapter } from "./v4/model/AbstractModel";
|
|
|
11
11
|
import type { ViteDevServer } from 'vite';
|
|
12
12
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
13
13
|
import { ControlsHandler } from "./v4/controls/ControlsHandler";
|
|
14
|
+
import { CatalogHandler } from "./v4/catalog/CatalogHandler";
|
|
14
15
|
export declare class Adminizer {
|
|
15
16
|
/**
|
|
16
17
|
* If you convey this default Middleware, it will add it to the very top of the router,
|
|
@@ -29,6 +30,7 @@ export declare class Adminizer {
|
|
|
29
30
|
widgetHandler: WidgetHandler;
|
|
30
31
|
vite: ViteDevServer;
|
|
31
32
|
controlsHandler: ControlsHandler;
|
|
33
|
+
catalogHandler: CatalogHandler;
|
|
32
34
|
jwtSecret: string;
|
|
33
35
|
static logger: winston.Logger;
|
|
34
36
|
constructor(ormAdapters: AbstractAdapter[]);
|
package/lib/Adminizer.js
CHANGED
|
@@ -27,6 +27,7 @@ import { bindInertia } from "../system/bindInertia";
|
|
|
27
27
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
28
28
|
import { bindControls } from "../system/bindControls";
|
|
29
29
|
import { ControlsHandler } from "./v4/controls/ControlsHandler";
|
|
30
|
+
import { CatalogHandler } from "./v4/catalog/CatalogHandler";
|
|
30
31
|
import { v4 as uuid } from "uuid";
|
|
31
32
|
export class Adminizer {
|
|
32
33
|
// Preconfigures
|
|
@@ -48,6 +49,7 @@ export class Adminizer {
|
|
|
48
49
|
widgetHandler;
|
|
49
50
|
vite;
|
|
50
51
|
controlsHandler;
|
|
52
|
+
catalogHandler;
|
|
51
53
|
// Constants
|
|
52
54
|
jwtSecret = process.env.JWT_SECRET ?? uuid();
|
|
53
55
|
static logger = winston.createLogger({
|
|
@@ -145,6 +147,7 @@ export class Adminizer {
|
|
|
145
147
|
this.configHelper = new ConfigHelper(this);
|
|
146
148
|
this.menuHelper = new MenuHelper(this.config);
|
|
147
149
|
this.widgetHandler = new WidgetHandler(this);
|
|
150
|
+
this.catalogHandler = new CatalogHandler();
|
|
148
151
|
bindExpressUtils(this.app);
|
|
149
152
|
bindReqFunctions(this);
|
|
150
153
|
// Bind assets
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractCatalog } from "./AbstractCatalog";
|
|
2
2
|
export declare class CatalogHandler {
|
|
3
|
-
private
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
private catalog;
|
|
4
|
+
add(catalog: AbstractCatalog): AbstractCatalog;
|
|
5
|
+
getAll(): AbstractCatalog[];
|
|
6
|
+
getCatalog(slug: string): AbstractCatalog;
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export class CatalogHandler {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
catalog = [];
|
|
3
|
+
add(catalog) {
|
|
4
4
|
this.catalog.push(catalog);
|
|
5
5
|
return catalog;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
getAll() {
|
|
8
8
|
return this.catalog;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
getCatalog(slug) {
|
|
11
11
|
return this.catalog.find((catalog) => catalog.slug === slug);
|
|
12
12
|
}
|
|
13
13
|
}
|
package/package.json
CHANGED
package/system/bindNavigation.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Navigation } from "../lib/v4/catalog/Navigation";
|
|
2
|
-
import { CatalogHandler } from "../lib/v4/catalog/CatalogHandler";
|
|
3
2
|
export default function bindNavigation(adminizer) {
|
|
4
3
|
adminizer.emitter.on("adminizer:loaded", async () => {
|
|
5
4
|
if (adminizer.config.navigation) {
|
|
6
5
|
try {
|
|
7
6
|
adminizer.config.navigation.model = adminizer.config.navigation.model ? adminizer.config.navigation.model : 'NavigationAP';
|
|
8
7
|
let navigation = new Navigation(adminizer, adminizer.config.navigation);
|
|
9
|
-
|
|
8
|
+
adminizer.catalogHandler.add(navigation);
|
|
10
9
|
adminizer.config.models[adminizer.config.navigation.model.toLowerCase()] = {
|
|
11
10
|
add: false,
|
|
12
11
|
edit: {
|