adminizer 4.2.0-build.56 → 4.2.0-build.58
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/helpers/accessRightsHelper.js +1 -1
- package/helpers/inertiaAddHelper.js +9 -2
- package/lib/media-manager/MediaManagerHandler.js +1 -1
- package/lib/v4/widgets/abstractAction.d.ts +2 -2
- package/lib/v4/widgets/abstractAction.js +2 -2
- package/lib/v4/widgets/abstractCustom.d.ts +1 -1
- package/lib/v4/widgets/abstractCustom.js +1 -1
- package/lib/v4/widgets/abstractInfo.d.ts +2 -2
- package/lib/v4/widgets/abstractInfo.js +2 -2
- package/lib/v4/widgets/abstractLink.d.ts +2 -2
- package/lib/v4/widgets/abstractLink.js +2 -2
- package/lib/v4/widgets/abstractSwitch.d.ts +2 -2
- package/lib/v4/widgets/abstractSwitch.js +2 -2
- package/lib/v4/widgets/abstractWidgetBase.d.ts +1 -1
- package/lib/v4/widgets/abstractWidgetBase.js +1 -1
- package/lib/v4/widgets/widgetHandler.d.ts +6 -6
- package/lib/v4/widgets/widgetHandler.js +6 -6
- package/package.json +1 -1
- package/system/bindMediaManager.js +2 -0
|
@@ -45,7 +45,7 @@ export class AccessRightsHelper {
|
|
|
45
45
|
}
|
|
46
46
|
hasPermission(tokenId, user) {
|
|
47
47
|
if (!tokenId) {
|
|
48
|
-
Adminizer.log.
|
|
48
|
+
Adminizer.log.warn(`AccessRightsHelper > hasPermission no tokenId: ${tokenId}`);
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
51
|
tokenId = tokenId.toLowerCase();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import inertiaActionsHelper from "./inertiaActionsHelper";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { isObject } from "./JsUtils";
|
|
4
|
+
import { MediaManagerHandler } from "../lib/media-manager/MediaManagerHandler";
|
|
4
5
|
export default function inertiaAddHelper(req, entity, fields, record, view = false) {
|
|
5
6
|
const actionType = 'add';
|
|
6
7
|
let props = {
|
|
@@ -104,8 +105,14 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
|
|
|
104
105
|
options = getControlsOptions(fieldConfig, req, fieldType, 'leaflet');
|
|
105
106
|
}
|
|
106
107
|
if (type === 'mediamanager') {
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
let mediaManager = MediaManagerHandler.get('default');
|
|
109
|
+
if (!mediaManager) {
|
|
110
|
+
options = {};
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
fieldType = 'mediamanager';
|
|
114
|
+
options = field.config.options;
|
|
115
|
+
}
|
|
109
116
|
}
|
|
110
117
|
props.fields.push({
|
|
111
118
|
label: label,
|
|
@@ -14,7 +14,7 @@ export class MediaManagerHandler {
|
|
|
14
14
|
}
|
|
15
15
|
if (!instance) {
|
|
16
16
|
Adminizer.log.debug(`MediaManager list ${JSON.stringify(this.managers, null, 2)}`);
|
|
17
|
-
|
|
17
|
+
Adminizer.log.debug(`MediaManager with id ${id} not found`);
|
|
18
18
|
}
|
|
19
19
|
Adminizer.log.debug(`ins`, instance);
|
|
20
20
|
return instance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseWidget from "./abstractWidgetBase";
|
|
2
|
-
export
|
|
1
|
+
import { BaseWidget } from "./abstractWidgetBase";
|
|
2
|
+
export declare abstract class ActionBase extends BaseWidget {
|
|
3
3
|
readonly widgetType = "action";
|
|
4
4
|
/** Widget background css color */
|
|
5
5
|
abstract readonly backgroundCSS: string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseWidget from "./abstractWidgetBase";
|
|
2
|
-
export
|
|
1
|
+
import { BaseWidget } from "./abstractWidgetBase";
|
|
2
|
+
export declare abstract class InfoBase extends BaseWidget {
|
|
3
3
|
readonly widgetType = "info";
|
|
4
4
|
/** Widget background css color */
|
|
5
5
|
readonly backgroundCSS: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseWidget from "./abstractWidgetBase";
|
|
2
|
-
export
|
|
1
|
+
import { BaseWidget } from "./abstractWidgetBase";
|
|
2
|
+
export class InfoBase extends BaseWidget {
|
|
3
3
|
widgetType = "info";
|
|
4
4
|
/** Widget background css color */
|
|
5
5
|
backgroundCSS;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BaseWidget from "./abstractWidgetBase";
|
|
1
|
+
import { BaseWidget } from "./abstractWidgetBase";
|
|
2
2
|
import { MaterialIcon } from "../../../interfaces/MaaterialIcons";
|
|
3
3
|
export interface Links {
|
|
4
4
|
name: string;
|
|
@@ -8,7 +8,7 @@ export interface Links {
|
|
|
8
8
|
linkType: 'self' | 'blank';
|
|
9
9
|
backgroundCSS: string | null;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export declare abstract class LinkBase extends BaseWidget {
|
|
12
12
|
readonly widgetType = "link";
|
|
13
13
|
readonly abstract links: Links[];
|
|
14
14
|
/** Get info */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseWidget from "./abstractWidgetBase";
|
|
2
|
-
export
|
|
1
|
+
import { BaseWidget } from "./abstractWidgetBase";
|
|
2
|
+
export declare abstract class SwitchBase extends BaseWidget {
|
|
3
3
|
readonly widgetType = "switcher";
|
|
4
4
|
/** Widget background css color */
|
|
5
5
|
abstract readonly backgroundCSS: string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class BaseWidget {
|
|
2
2
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import InfoBase from "./abstractInfo";
|
|
3
|
-
import ActionBase from "./abstractAction";
|
|
4
|
-
import LinkBase from "./abstractLink";
|
|
5
|
-
import CustomBase from "./abstractCustom";
|
|
1
|
+
import { SwitchBase } from "./abstractSwitch";
|
|
2
|
+
import { InfoBase } from "./abstractInfo";
|
|
3
|
+
import { ActionBase } from "./abstractAction";
|
|
4
|
+
import { LinkBase } from "./abstractLink";
|
|
5
|
+
import { CustomBase } from "./abstractCustom";
|
|
6
6
|
import { AdminpanelIcon } from "../../../interfaces/adminpanelConfig";
|
|
7
7
|
import { Adminizer } from "../../Adminizer";
|
|
8
8
|
import { UserAP } from "models/UserAP";
|
|
9
9
|
import { I18n } from "../I18n";
|
|
10
|
-
export type WidgetType = (
|
|
10
|
+
export type WidgetType = (SwitchBase | InfoBase | ActionBase | LinkBase | CustomBase);
|
|
11
11
|
export interface WidgetConfig {
|
|
12
12
|
id: string;
|
|
13
13
|
type: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import InfoBase from "./abstractInfo";
|
|
3
|
-
import ActionBase from "./abstractAction";
|
|
4
|
-
import LinkBase from "./abstractLink";
|
|
5
|
-
import CustomBase from "./abstractCustom";
|
|
1
|
+
import { SwitchBase } from "./abstractSwitch";
|
|
2
|
+
import { InfoBase } from "./abstractInfo";
|
|
3
|
+
import { ActionBase } from "./abstractAction";
|
|
4
|
+
import { LinkBase } from "./abstractLink";
|
|
5
|
+
import { CustomBase } from "./abstractCustom";
|
|
6
6
|
import * as process from "node:process";
|
|
7
7
|
export class WidgetHandler {
|
|
8
8
|
widgets = [];
|
|
@@ -40,7 +40,7 @@ export class WidgetHandler {
|
|
|
40
40
|
if (this.widgets.length) {
|
|
41
41
|
let id_key = 0;
|
|
42
42
|
for (const widget of this.widgets) {
|
|
43
|
-
if (widget instanceof
|
|
43
|
+
if (widget instanceof SwitchBase) {
|
|
44
44
|
if (this.adminizer.accessRightsHelper.hasPermission(`widget-${widget.id}`, user)) {
|
|
45
45
|
widgets.push({
|
|
46
46
|
id: `${widget.id}__${id_key}`,
|
package/package.json
CHANGED
|
@@ -3,6 +3,8 @@ import { MediaManagerHandler } from "../lib/media-manager/MediaManagerHandler";
|
|
|
3
3
|
import serveStatic from "serve-static";
|
|
4
4
|
import path from "path";
|
|
5
5
|
export default function bindMediaManager(adminizer) {
|
|
6
|
+
if (!adminizer.config.mediamanager)
|
|
7
|
+
return;
|
|
6
8
|
adminizer.emitter.on("adminizer:loaded", async () => {
|
|
7
9
|
try {
|
|
8
10
|
let mediaManager = new DefaultMediaManager(adminizer, 'default', 'media-manager', adminizer.config.mediamanager.fileStoragePath);
|