@griddo/ax 10.4.7 → 10.4.9
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/package.json +2 -2
- package/src/__tests__/components/Browser/Browser.test.tsx +4 -4
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/MixableComponentArray.test.tsx +39 -7
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/PasteModuleButton.test.tsx +8 -8
- package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +28 -16
- package/src/components/Browser/index.tsx +5 -5
- package/src/components/BulkSelectionOptions/style.tsx +1 -0
- package/src/components/ConfigPanel/Header/index.tsx +8 -4
- package/src/components/Fields/AsyncCheckGroup/style.tsx +3 -0
- package/src/components/Fields/CheckField/index.tsx +4 -1
- package/src/components/Fields/CheckField/style.tsx +19 -3
- package/src/components/Fields/CheckGroup/index.tsx +3 -2
- package/src/components/Fields/CheckGroup/style.tsx +3 -0
- package/src/components/Fields/ComponentArray/MixableComponentArray/BulkHeader/index.tsx +47 -0
- package/src/components/Fields/ComponentArray/MixableComponentArray/BulkHeader/style.tsx +44 -0
- package/src/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/index.tsx +31 -12
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +153 -59
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +1 -1
- package/src/components/Fields/ComponentArray/helpers.tsx +45 -4
- package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +2 -2
- package/src/components/Fields/ComponentContainer/index.tsx +68 -33
- package/src/components/Fields/ComponentContainer/style.tsx +78 -11
- package/src/components/Fields/ReferenceField/Context/index.tsx +1 -1
- package/src/components/MainWrapper/AppBar/atoms.tsx +5 -8
- package/src/components/SideModal/SideModalOption/index.tsx +5 -3
- package/src/containers/Navigation/Defaults/actions.tsx +86 -55
- package/src/containers/Navigation/Defaults/interfaces.tsx +2 -2
- package/src/containers/Navigation/Defaults/reducer.tsx +3 -3
- package/src/containers/PageEditor/actions.tsx +142 -109
- package/src/containers/PageEditor/interfaces.tsx +1 -1
- package/src/containers/PageEditor/reducer.tsx +2 -2
- package/src/containers/PageEditor/utils.tsx +1 -1
- package/src/containers/Settings/DataPacks/actions.tsx +7 -2
- package/src/forms/elements.tsx +20 -14
- package/src/hooks/bulk.tsx +57 -2
- package/src/hooks/iframe.ts +5 -5
- package/src/modules/Content/index.tsx +10 -1
- package/src/modules/FramePreview/index.tsx +4 -4
- package/src/modules/GlobalEditor/Editor/index.tsx +6 -6
- package/src/modules/GlobalEditor/PageBrowser/index.tsx +2 -2
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +6 -6
- package/src/modules/PageEditor/Editor/index.tsx +7 -7
- package/src/modules/PageEditor/PageBrowser/index.tsx +2 -2
- package/src/modules/Users/UserForm/index.tsx +52 -34
- package/src/types/index.tsx +1 -0
package/src/hooks/bulk.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
1
|
+
import { useState, useEffect, useCallback } from "react";
|
|
2
2
|
|
|
3
3
|
import { areEquals } from "@ax/helpers";
|
|
4
4
|
import { ICheck } from "@ax/types";
|
|
@@ -13,6 +13,7 @@ const useBulkSelection = (itemIDs: any[]) => {
|
|
|
13
13
|
|
|
14
14
|
const [items, setItems] = useState<any[]>([]);
|
|
15
15
|
const [selectedItems, setSelectedItems] = useState(selectedItemsInitialState);
|
|
16
|
+
const [isMultiCheck, setIsMultiCheck] = useState(false);
|
|
16
17
|
const [checkState, setCheckState] = useState<Record<string, boolean>>({
|
|
17
18
|
isAllSelected: false,
|
|
18
19
|
indeterminate: false,
|
|
@@ -35,19 +36,73 @@ const useBulkSelection = (itemIDs: any[]) => {
|
|
|
35
36
|
// eslint-disable-next-line
|
|
36
37
|
}, [itemIDs]);
|
|
37
38
|
|
|
39
|
+
const onWindowKeyDown = useCallback((e: KeyboardEvent) => {
|
|
40
|
+
if (e.defaultPrevented) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (e.key === "Shift") {
|
|
45
|
+
setIsMultiCheck(true);
|
|
46
|
+
}
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
const onWindowKeyUp = useCallback((e: KeyboardEvent) => {
|
|
50
|
+
if (e.defaultPrevented) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (e.key === "Shift") {
|
|
55
|
+
setIsMultiCheck(false);
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
window.addEventListener("keydown", onWindowKeyDown);
|
|
61
|
+
window.addEventListener("keyup", onWindowKeyUp);
|
|
62
|
+
return () => {
|
|
63
|
+
window.removeEventListener("keydown", onWindowKeyDown);
|
|
64
|
+
window.removeEventListener("keyup", onWindowKeyUp);
|
|
65
|
+
};
|
|
66
|
+
}, [onWindowKeyDown, onWindowKeyUp]);
|
|
67
|
+
|
|
38
68
|
const isSelected = (value: any) => selectedItems.all.includes(value);
|
|
69
|
+
|
|
39
70
|
const areAllItemsSelected = (itemsAvailable: any) =>
|
|
40
71
|
selectedItems.all.length > 0 && areEquals(itemsAvailable, selectedItems.all);
|
|
72
|
+
|
|
41
73
|
const areItemsSelected = (itemsAvailable: any) =>
|
|
42
74
|
!!selectedItems.all.find((element: any) => itemsAvailable.includes(element));
|
|
75
|
+
|
|
43
76
|
const resetBulkSelection = () => setSelectedItems(selectedItemsInitialState);
|
|
44
77
|
|
|
78
|
+
const multiSelectTo = (value: any) => {
|
|
79
|
+
const indexOfNew = items.indexOf(value);
|
|
80
|
+
const lastSelected = selectedItems.all[selectedItems.all.length - 1];
|
|
81
|
+
const indexOfLast = items.indexOf(lastSelected);
|
|
82
|
+
|
|
83
|
+
const isSelectingForwards = indexOfNew > indexOfLast;
|
|
84
|
+
const start = isSelectingForwards ? indexOfLast : indexOfNew;
|
|
85
|
+
const end = isSelectingForwards ? indexOfNew : indexOfLast;
|
|
86
|
+
|
|
87
|
+
const inBetween = items.slice(start, end + 1);
|
|
88
|
+
|
|
89
|
+
const toAdd = inBetween.filter((id) => !selectedItems.all.includes(id));
|
|
90
|
+
|
|
91
|
+
const sorted = isSelectingForwards ? toAdd : [...toAdd].reverse();
|
|
92
|
+
const combined = [...selectedItems.all, ...sorted];
|
|
93
|
+
return combined;
|
|
94
|
+
};
|
|
95
|
+
|
|
45
96
|
const addToBulkSelection = (item: ICheck, callback?: any) => {
|
|
46
97
|
const { value, isChecked } = item;
|
|
47
98
|
|
|
48
99
|
let bulkSelection: any = [...selectedItems.all];
|
|
49
100
|
|
|
50
|
-
isChecked
|
|
101
|
+
isChecked && isMultiCheck
|
|
102
|
+
? (bulkSelection = multiSelectTo(value))
|
|
103
|
+
: isChecked
|
|
104
|
+
? bulkSelection.push(value)
|
|
105
|
+
: (bulkSelection = bulkSelection.filter((id: any) => id !== value));
|
|
51
106
|
|
|
52
107
|
if (callback) {
|
|
53
108
|
const filteredItems = callback(bulkSelection);
|
package/src/hooks/iframe.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { useCallback, useEffect } from "react";
|
|
|
2
2
|
|
|
3
3
|
const useOnMessageReceivedFromIframe = (actions?: {
|
|
4
4
|
setSelectedContentAction: any;
|
|
5
|
-
deleteModuleAction(editorID: number): void;
|
|
6
|
-
duplicateModuleAction(editorID: number):
|
|
5
|
+
deleteModuleAction(editorID: number[]): void;
|
|
6
|
+
duplicateModuleAction(editorID: number[]): number;
|
|
7
7
|
}): void => {
|
|
8
8
|
const onMessageReceivedFromIframe = useCallback(
|
|
9
|
-
|
|
9
|
+
(ev: MessageEvent<{ type: string; message: string }>) => {
|
|
10
10
|
if (typeof ev.data !== "object") return;
|
|
11
11
|
if (!ev.data.type) return;
|
|
12
12
|
if (!ev.data.message) return;
|
|
@@ -15,10 +15,10 @@ const useOnMessageReceivedFromIframe = (actions?: {
|
|
|
15
15
|
}
|
|
16
16
|
if (ev.data.type === "module-delete") {
|
|
17
17
|
actions?.setSelectedContentAction(0);
|
|
18
|
-
actions?.deleteModuleAction(parseInt(ev.data.message));
|
|
18
|
+
actions?.deleteModuleAction([parseInt(ev.data.message)]);
|
|
19
19
|
}
|
|
20
20
|
if (ev.data.type === "module-duplicate") {
|
|
21
|
-
const duplicatedEditorID =
|
|
21
|
+
const duplicatedEditorID = actions?.duplicateModuleAction([parseInt(ev.data.message)]);
|
|
22
22
|
actions?.setSelectedContentAction(duplicatedEditorID);
|
|
23
23
|
}
|
|
24
24
|
},
|
|
@@ -120,6 +120,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
120
120
|
deleteAndRemoveFromSiteBulk,
|
|
121
121
|
checkUserSession,
|
|
122
122
|
getDefaults,
|
|
123
|
+
getAvailableSiteDataPacks,
|
|
123
124
|
error,
|
|
124
125
|
} = props;
|
|
125
126
|
|
|
@@ -200,6 +201,8 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
200
201
|
const [pagesSelected, setPagesSelected] = useState<any[]>([]);
|
|
201
202
|
const history = useHistory();
|
|
202
203
|
|
|
204
|
+
const [isDeleting, setIsDeleting] = useState<boolean>(false);
|
|
205
|
+
|
|
203
206
|
const isAllowedToCreatePages = usePermission("content.createPages");
|
|
204
207
|
|
|
205
208
|
const {
|
|
@@ -303,6 +306,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
303
306
|
fetchSitesByLang();
|
|
304
307
|
getIntegrations(currentSiteInfo.id, {}, true);
|
|
305
308
|
getDefaults();
|
|
309
|
+
getAvailableSiteDataPacks(null, false);
|
|
306
310
|
resetForm();
|
|
307
311
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
308
312
|
}, []);
|
|
@@ -447,6 +451,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
447
451
|
|
|
448
452
|
const bulkDelete = async () => {
|
|
449
453
|
let allPageVersions: number[] = [];
|
|
454
|
+
setIsDeleting(true);
|
|
450
455
|
if (deleteAllVersions) {
|
|
451
456
|
const selectedPages = currentSitePages.filter((page) => selectedItems.all.includes(page.id));
|
|
452
457
|
const pageLanguages = selectedPages.map((element) => element.pageLanguages);
|
|
@@ -471,6 +476,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
471
476
|
const previousPage = page - 1;
|
|
472
477
|
page > 1 && (isLastItem || allPageItemsSelected) ? setPage(previousPage) : getSiteContent();
|
|
473
478
|
unselectAllItems();
|
|
479
|
+
setIsDeleting(false);
|
|
474
480
|
};
|
|
475
481
|
|
|
476
482
|
const handleToggleDeleteModal = () => {
|
|
@@ -767,8 +773,9 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
767
773
|
const resetFilter = () => resetFilterQuery();
|
|
768
774
|
|
|
769
775
|
const mainDeleteModalAction = {
|
|
770
|
-
title: "Delete pages",
|
|
776
|
+
title: isDeleting ? "Deleting pages" : "Delete pages",
|
|
771
777
|
onClick: bulkDelete,
|
|
778
|
+
disabled: isDeleting,
|
|
772
779
|
};
|
|
773
780
|
|
|
774
781
|
const secondaryDeleteModalAction = { title: "Cancel", onClick: toggleDeleteModal };
|
|
@@ -977,6 +984,7 @@ interface IDispatchProps {
|
|
|
977
984
|
deleteAndRemoveFromSiteBulk(pageIds: number[], globalPageIds: number[]): Promise<boolean>;
|
|
978
985
|
checkUserSession(): Promise<void>;
|
|
979
986
|
getDefaults(): Promise<void>;
|
|
987
|
+
getAvailableSiteDataPacks(queryParams: string | null, loading?: boolean): Promise<void>;
|
|
980
988
|
}
|
|
981
989
|
|
|
982
990
|
const mapDispatchToProps = {
|
|
@@ -1014,6 +1022,7 @@ const mapDispatchToProps = {
|
|
|
1014
1022
|
deleteAndRemoveFromSiteBulk: sitesActions.deleteAndRemoveFromSiteBulk,
|
|
1015
1023
|
checkUserSession: appActions.checkUserSession,
|
|
1016
1024
|
getDefaults: navigationActions.getDefaults,
|
|
1025
|
+
getAvailableSiteDataPacks: dataPacksActions.getAvailableSiteDataPacks,
|
|
1017
1026
|
};
|
|
1018
1027
|
|
|
1019
1028
|
interface IPagesProps {
|
|
@@ -60,11 +60,11 @@ const FramePreview = (props: IProps) => {
|
|
|
60
60
|
const deleteModuleSelected = (editorID: number) => {
|
|
61
61
|
window.parent.postMessage({ type: "module-delete", message: editorID }, "*");
|
|
62
62
|
setSelectedContent && setSelectedContent(0);
|
|
63
|
-
deleteModule(editorID);
|
|
63
|
+
deleteModule([editorID]);
|
|
64
64
|
};
|
|
65
65
|
const duplicateModuleSelected = (editorID: number) => {
|
|
66
66
|
window.parent.postMessage({ type: "module-duplicate", message: editorID }, "*");
|
|
67
|
-
duplicateModule(editorID);
|
|
67
|
+
duplicateModule([editorID]);
|
|
68
68
|
};
|
|
69
69
|
const moduleActions = {
|
|
70
70
|
deleteModuleAction: deleteModuleSelected,
|
|
@@ -105,8 +105,8 @@ interface IProps {
|
|
|
105
105
|
isLoading: boolean;
|
|
106
106
|
setSelectedContent(editorID: number): void;
|
|
107
107
|
setEditorContent(editorContent: Record<string, unknown>): void;
|
|
108
|
-
deleteModule(editorID: number): void;
|
|
109
|
-
duplicateModule(editorID: number):
|
|
108
|
+
deleteModule(editorID: number[]): void;
|
|
109
|
+
duplicateModule(editorID: number[]): number;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
4
4
|
import { ConfigPanel, ResizePanel } from "@ax/components";
|
|
5
|
-
import { IBreadcrumbItem, INotification, IRootState, ISchema, IUserEditing } from "@ax/types";
|
|
5
|
+
import { IBreadcrumbItem, IModule, INotification, IRootState, ISchema, IUserEditing } from "@ax/types";
|
|
6
6
|
import PageBrowser from "../PageBrowser";
|
|
7
7
|
|
|
8
8
|
const Editor = (props: IProps) => {
|
|
@@ -88,15 +88,15 @@ interface IEditorStateProps {
|
|
|
88
88
|
interface IPageBrowserDispatchProps {
|
|
89
89
|
setSelectedContent(editorID: number): void;
|
|
90
90
|
setSelectedTab(tab: string): void;
|
|
91
|
-
deleteModule(editorID: number, key?: string): void;
|
|
92
|
-
duplicateModule(editorID: number, key?: string):
|
|
91
|
+
deleteModule(editorID: number[], key?: string): void;
|
|
92
|
+
duplicateModule(editorID: number[], key?: string): number;
|
|
93
93
|
addComponent: (componentType: any, key: string) => void;
|
|
94
94
|
addModule: (moduleType: string, key: string, selectedID: number, isComponentModule?: boolean) => void;
|
|
95
|
-
moveElement(moduleID: number, selectedContent: any, newIndex: number, key: string): void;
|
|
95
|
+
moveElement(moduleID: number[], selectedContent: any, newIndex: number, key: string): void;
|
|
96
96
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
97
97
|
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
98
|
-
copyModule(editorID: number): boolean;
|
|
99
|
-
pasteModule(editorID: number, key: string): Promise<{ error?: INotification }>;
|
|
98
|
+
copyModule(editorID: number[]): boolean;
|
|
99
|
+
pasteModule(editorID: number, key: string, modulesToPaste: IModule[]): Promise<{ error?: INotification }>;
|
|
100
100
|
setNotification: (notification: INotification) => void;
|
|
101
101
|
isGlobal: boolean;
|
|
102
102
|
isEditable: boolean;
|
|
@@ -65,8 +65,8 @@ interface IPageBrowserDispatchProps {
|
|
|
65
65
|
isReadOnly: boolean;
|
|
66
66
|
isPreview?: boolean;
|
|
67
67
|
browserRef?: any;
|
|
68
|
-
deleteModule(editorID: number): void;
|
|
69
|
-
duplicateModule(editorID: number):
|
|
68
|
+
deleteModule(editorID: number[]): void;
|
|
69
|
+
duplicateModule(editorID: number[]): number;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
type IProps = IPageBrowserStateProps & IPageBrowserDispatchProps;
|
|
@@ -3,7 +3,7 @@ import { connect } from "react-redux";
|
|
|
3
3
|
import { navigationActions } from "@ax/containers/Navigation/Defaults";
|
|
4
4
|
|
|
5
5
|
import { ResizePanel, ConfigPanel } from "@ax/components";
|
|
6
|
-
import { IBreadcrumbItem, INotification, IRootState, ISchema, ISite } from "@ax/types";
|
|
6
|
+
import { IBreadcrumbItem, IModule, INotification, IRootState, ISchema, ISite } from "@ax/types";
|
|
7
7
|
import DefaultsBrowser from "./DefaultsBrowser";
|
|
8
8
|
|
|
9
9
|
const Editor = (props: IProps) => {
|
|
@@ -85,15 +85,15 @@ interface IEditorStateProps {
|
|
|
85
85
|
interface IPageBrowserDispatchProps {
|
|
86
86
|
setSelectedContent(editorID: number): void;
|
|
87
87
|
setSelectedTab(tab: string): void;
|
|
88
|
-
deleteModule(editorID: number, key?: string): void;
|
|
89
|
-
duplicateModule(editorID: number, key?: string):
|
|
88
|
+
deleteModule(editorID: number[], key?: string): void;
|
|
89
|
+
duplicateModule(editorID: number[], key?: string): number;
|
|
90
90
|
addComponent(componentType: any, key: string): void;
|
|
91
91
|
addModule(type: string, key: string, selectedID: number, isComponentModule?: boolean): void;
|
|
92
92
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
93
93
|
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
94
|
-
moveModule(moduleID: number, selectedContent: any, newIndex: number, key: string): void;
|
|
95
|
-
copyModule(editorID: number): boolean;
|
|
96
|
-
pasteModule(editorID: number, key: string): Promise<{ error?: INotification }>;
|
|
94
|
+
moveModule(moduleID: number[], selectedContent: any, newIndex: number, key: string): void;
|
|
95
|
+
copyModule(editorID: number[]): boolean;
|
|
96
|
+
pasteModule(editorID: number, key: string, modulesToPaste: IModule[]): Promise<{ error?: INotification }>;
|
|
97
97
|
setNotification: (notification: INotification) => void;
|
|
98
98
|
browserRef?: React.RefObject<HTMLDivElement>;
|
|
99
99
|
}
|
|
@@ -5,7 +5,7 @@ import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
|
5
5
|
import { sitesActions } from "@ax/containers/Sites";
|
|
6
6
|
import { appActions } from "@ax/containers/App";
|
|
7
7
|
import { ConfigPanel, ResizePanel } from "@ax/components";
|
|
8
|
-
import { IBreadcrumbItem, INotification, IRootState, ISchema, ISite, IUserEditing } from "@ax/types";
|
|
8
|
+
import { IBreadcrumbItem, IModule, INotification, IRootState, ISchema, ISite, IUserEditing } from "@ax/types";
|
|
9
9
|
import PageBrowser from "../PageBrowser";
|
|
10
10
|
|
|
11
11
|
const Editor = (props: IProps) => {
|
|
@@ -123,18 +123,18 @@ interface IEditorStateProps {
|
|
|
123
123
|
interface IPageBrowserDispatchProps {
|
|
124
124
|
setSelectedContent(editorID: number): void;
|
|
125
125
|
setSelectedTab(tab: string): void;
|
|
126
|
-
deleteModule(editorID: number, key?: string): void;
|
|
127
|
-
duplicateModule(editorID: number, key?: string):
|
|
126
|
+
deleteModule(editorID: number[], key?: string): void;
|
|
127
|
+
duplicateModule(editorID: number[], key?: string): number;
|
|
128
128
|
addComponent: (componentType: any, key: string) => void;
|
|
129
129
|
addModule: (moduleType: string, key: string, selectedID: number, isComponentModule?: boolean) => void;
|
|
130
|
-
moveElement(moduleID: number, selectedContent: any, newIndex: number, key: string): void;
|
|
130
|
+
moveElement(moduleID: number[], selectedContent: any, newIndex: number, key: string): void;
|
|
131
131
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
132
|
-
replaceElementsInCollection(newValue: string, reference
|
|
132
|
+
replaceElementsInCollection(newValue: string, reference?: string): void;
|
|
133
133
|
setHistoryPush(path: string, isEditor: boolean): void;
|
|
134
134
|
getGlobalFromLocalPage(): void;
|
|
135
135
|
saveCurrentSiteInfo(): void;
|
|
136
|
-
copyModule(editorID: number): boolean;
|
|
137
|
-
pasteModule(editorID: number, key: string): Promise<{ error?: INotification }>;
|
|
136
|
+
copyModule(editorID: number[]): boolean;
|
|
137
|
+
pasteModule(editorID: number, key: string, modulesToPaste: IModule[]): Promise<{ error?: INotification }>;
|
|
138
138
|
setNotification: (notification: INotification) => void;
|
|
139
139
|
restorePageNavigation: (key: string) => void;
|
|
140
140
|
isTemplateActivated: boolean;
|
|
@@ -75,8 +75,8 @@ interface IPageBrowserDispatchProps {
|
|
|
75
75
|
isReadOnly: boolean;
|
|
76
76
|
isPreview?: boolean;
|
|
77
77
|
browserRef?: any;
|
|
78
|
-
deleteModule(editorID: number): void;
|
|
79
|
-
duplicateModule(editorID: number):
|
|
78
|
+
deleteModule(editorID: number[]): void;
|
|
79
|
+
duplicateModule(editorID: number[]): number;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
type IProps = IPageBrowserStateProps & IPageBrowserDispatchProps;
|
|
@@ -290,42 +290,60 @@ const UserForm = (props: IProps) => {
|
|
|
290
290
|
disabled={isEditDisabled}
|
|
291
291
|
/>
|
|
292
292
|
{isSiteView ? (
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<S.
|
|
296
|
-
<S.Heading>Roles
|
|
297
|
-
|
|
298
|
-
<
|
|
299
|
-
|
|
293
|
+
isSuperAdmin ? (
|
|
294
|
+
<>
|
|
295
|
+
<S.SettingsWrapper>
|
|
296
|
+
<S.Heading>Roles assigned</S.Heading>
|
|
297
|
+
<S.SettingContent>
|
|
298
|
+
<OptionItem
|
|
299
|
+
name="superadmin"
|
|
300
|
+
title="Super admin"
|
|
301
|
+
description="You can manage all aspects of your site, including inviting people and managing their permissions."
|
|
302
|
+
onChange={toggleSuperAdmin}
|
|
303
|
+
value={isSuperAdmin}
|
|
304
|
+
readOnly={readOnlySites}
|
|
305
|
+
/>
|
|
306
|
+
</S.SettingContent>
|
|
307
|
+
</S.SettingsWrapper>
|
|
308
|
+
</>
|
|
309
|
+
) : (
|
|
310
|
+
<>
|
|
311
|
+
<S.SettingsWrapper>
|
|
312
|
+
<S.HeadingWrapper>
|
|
313
|
+
<S.Heading>Roles Assigned</S.Heading>
|
|
314
|
+
{(!siteSelectedRoles || siteSelectedRoles.roles.length === 0) && (
|
|
315
|
+
<Button type="button" buttonStyle="text" onClick={toggleRoleModal} icon="addCircle">
|
|
316
|
+
Add Role
|
|
317
|
+
</Button>
|
|
318
|
+
)}
|
|
319
|
+
</S.HeadingWrapper>
|
|
320
|
+
<S.SettingContent>
|
|
321
|
+
<S.SettingText>You can add a one or more roles to this user.</S.SettingText>
|
|
322
|
+
</S.SettingContent>
|
|
323
|
+
</S.SettingsWrapper>
|
|
324
|
+
<S.RoleList>
|
|
325
|
+
{siteSelectedRoles &&
|
|
326
|
+
siteSelectedRoles.roles.map((siteRoleId: number) => {
|
|
327
|
+
const role = roles.find((role: IRole) => role.id === siteRoleId);
|
|
328
|
+
return role && <RoleItem key={role.name} role={role} isReadOnly={true} />;
|
|
329
|
+
})}
|
|
330
|
+
{siteSelectedRoles && siteSelectedRoles.roles.length > 0 && (
|
|
331
|
+
<Button type="button" buttonStyle="line" onClick={toggleRoleModal}>
|
|
332
|
+
Manage user roles
|
|
300
333
|
</Button>
|
|
301
334
|
)}
|
|
302
|
-
</S.
|
|
303
|
-
<
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
siteSelectedRoles.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
<Button type="button" buttonStyle="line" onClick={toggleRoleModal}>
|
|
315
|
-
Manage user roles
|
|
316
|
-
</Button>
|
|
317
|
-
)}
|
|
318
|
-
</S.RoleList>
|
|
319
|
-
<RolesModal
|
|
320
|
-
isOpen={isOpenRoleModal}
|
|
321
|
-
toggleModal={toggleRoleModal}
|
|
322
|
-
roles={roles}
|
|
323
|
-
addRoles={handleAddSiteRoles}
|
|
324
|
-
selectedRoles={siteSelectedRoles ? siteSelectedRoles.roles : []}
|
|
325
|
-
allSites={siteSelectedRoles && siteSelectedRoles.siteId === "all"}
|
|
326
|
-
isGlobal={false}
|
|
327
|
-
/>
|
|
328
|
-
</>
|
|
335
|
+
</S.RoleList>
|
|
336
|
+
<RolesModal
|
|
337
|
+
isOpen={isOpenRoleModal}
|
|
338
|
+
toggleModal={toggleRoleModal}
|
|
339
|
+
roles={roles}
|
|
340
|
+
addRoles={handleAddSiteRoles}
|
|
341
|
+
selectedRoles={siteSelectedRoles ? siteSelectedRoles.roles : []}
|
|
342
|
+
allSites={siteSelectedRoles && siteSelectedRoles.siteId === "all"}
|
|
343
|
+
isGlobal={false}
|
|
344
|
+
/>
|
|
345
|
+
</>
|
|
346
|
+
)
|
|
329
347
|
) : (
|
|
330
348
|
<>
|
|
331
349
|
{!readOnlySites && (
|