@griddo/ax 11.10.41 → 11.10.42
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/config/griddo-config/index.js +1 -0
- package/package.json +2 -2
- package/src/components/BulkSelectionOptions/index.tsx +78 -28
- package/src/components/BulkSelectionOptions/style.tsx +7 -1
- package/src/components/BulkSelectionOptions/utils.tsx +25 -0
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +2 -2
- package/src/components/ConfigPanel/GlobalPageForm/index.tsx +14 -4
- package/src/components/ConfigPanel/index.tsx +6 -0
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +9 -9
- package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +5 -6
- package/src/components/Fields/ReferenceField/ItemList/Item/style.tsx +16 -10
- package/src/components/Fields/ReferenceField/ManualPanel/Item/index.tsx +3 -4
- package/src/components/Fields/ReferenceField/ManualPanel/Item/style.tsx +7 -1
- package/src/components/Fields/VisualUniqueSelection/ScrollableSelection/index.tsx +3 -3
- package/src/components/Fields/VisualUniqueSelection/index.tsx +2 -4
- package/src/components/FloatingMenu/index.tsx +5 -5
- package/src/components/Loader/components/SmallCircle.js +29 -0
- package/src/components/Loader/index.tsx +3 -2
- package/src/components/MainWrapper/AppBar/atoms.tsx +4 -6
- package/src/components/MainWrapper/AppBar/index.tsx +14 -12
- package/src/components/MainWrapper/AppBar/style.tsx +23 -18
- package/src/components/MainWrapper/index.tsx +3 -3
- package/src/components/OcassionalToast/index.tsx +1 -1
- package/src/components/OcassionalToast/style.tsx +6 -0
- package/src/components/PageFinder/SelectionListItem/index.tsx +5 -4
- package/src/components/PageFinder/SelectionListItem/style.tsx +7 -1
- package/src/components/PageFinder/index.tsx +1 -0
- package/src/constants/index.ts +27 -0
- package/src/forms/elements.tsx +8 -24
- package/src/forms/index.tsx +0 -2
- package/src/helpers/containerEvaluations.tsx +5 -0
- package/src/helpers/content.ts +35 -0
- package/src/helpers/index.tsx +91 -89
- package/src/helpers/strings.tsx +19 -0
- package/src/helpers/types.ts +1 -0
- package/src/hooks/forms.tsx +2 -1
- package/src/locales/en-US.ts +29 -0
- package/src/locales/es-ES.ts +29 -0
- package/src/locales/index.ts +11 -0
- package/src/modules/Categories/CategoriesList/BulkHeader/index.tsx +5 -0
- package/src/modules/Categories/CategoriesList/index.tsx +10 -4
- package/src/modules/Content/BulkHeader/index.tsx +11 -0
- package/src/modules/Content/PageItem/index.tsx +1 -0
- package/src/modules/Content/atoms.tsx +1 -1
- package/src/modules/Content/index.tsx +27 -2
- package/src/modules/FileDrive/BulkGridHeader/index.tsx +6 -1
- package/src/modules/FileDrive/BulkListHeader/index.tsx +5 -0
- package/src/modules/FileDrive/index.tsx +10 -0
- package/src/modules/Forms/FormCategoriesList/BulkHeader/index.tsx +15 -2
- package/src/modules/Forms/FormCategoriesList/index.tsx +8 -0
- package/src/modules/Forms/FormEditor/index.tsx +10 -1
- package/src/modules/Forms/FormList/BulkHeader/index.tsx +5 -0
- package/src/modules/Forms/FormList/index.tsx +12 -3
- package/src/modules/Forms/FormUseModal/FormUseItem/index.tsx +1 -2
- package/src/modules/Forms/FormUseModal/index.tsx +3 -3
- package/src/modules/GlobalEditor/index.tsx +1 -0
- package/src/modules/MediaGallery/BulkGridHeader/index.tsx +6 -1
- package/src/modules/MediaGallery/BulkListHeader/index.tsx +15 -2
- package/src/modules/MediaGallery/index.tsx +47 -36
- package/src/modules/Navigation/Defaults/BulkHeader/index.tsx +5 -0
- package/src/modules/Navigation/Defaults/index.tsx +26 -23
- package/src/modules/PageEditor/Editor/index.tsx +6 -0
- package/src/modules/PageEditor/index.tsx +52 -0
- package/src/modules/Redirects/BulkHeader/index.tsx +6 -1
- package/src/modules/Redirects/index.tsx +7 -2
- package/src/modules/Settings/Integrations/BulkHeader/index.tsx +5 -0
- package/src/modules/Settings/Integrations/index.tsx +7 -1
- package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +5 -0
- package/src/modules/Sites/SitesList/index.tsx +7 -2
- package/src/modules/StructuredData/Form/index.tsx +1 -0
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/index.tsx +5 -0
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/atoms.tsx +3 -2
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +17 -11
- package/src/modules/StructuredData/StructuredDataList/index.tsx +6 -0
- package/src/modules/Users/Roles/BulkHeader/index.tsx +5 -0
- package/src/modules/Users/Roles/index.tsx +6 -1
- package/src/modules/Users/UserList/BulkHeader/index.tsx +5 -0
- package/src/modules/Users/UserList/index.tsx +12 -7
- package/tsconfig.paths.json +4 -1
|
@@ -35,9 +35,10 @@ import BulkHeader from "./ListView/BulkHeader";
|
|
|
35
35
|
import ListSiteItem from "./ListView/ListSiteItem";
|
|
36
36
|
import RecentSiteItem from "./RecentSiteItem";
|
|
37
37
|
import SiteModal from "./SiteModal";
|
|
38
|
-
import * as S from "./style";
|
|
39
38
|
import { filterByStatus, getSortedListStatus } from "./utils";
|
|
40
39
|
|
|
40
|
+
import * as S from "./style";
|
|
41
|
+
|
|
41
42
|
const SitesList = (props: ISitesListProps): JSX.Element => {
|
|
42
43
|
const {
|
|
43
44
|
token,
|
|
@@ -79,6 +80,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
|
|
|
79
80
|
);
|
|
80
81
|
const [displayMode, setDisplayMode] = useState<string | "list" | "grid">(currentConfig.mode);
|
|
81
82
|
const [searchQuery, setSearchQuery] = useState<string>("");
|
|
83
|
+
const [isBulkLoading, setIsBulkLoading] = useState(false);
|
|
82
84
|
const tableRef = useRef<HTMLDivElement>(null);
|
|
83
85
|
const errorRef = useRef<HTMLDivElement>(null);
|
|
84
86
|
|
|
@@ -147,7 +149,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
|
|
|
147
149
|
}, [page, searchQuery, filterValues]);
|
|
148
150
|
|
|
149
151
|
useEffect(() => {
|
|
150
|
-
const errorCode =
|
|
152
|
+
const errorCode = error?.code;
|
|
151
153
|
if (errorCode === 400 && errorRef.current) {
|
|
152
154
|
errorRef.current.scrollIntoView();
|
|
153
155
|
}
|
|
@@ -271,6 +273,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
|
|
|
271
273
|
const selectItems = () => (checkState.isAllSelected ? unselectAllItems() : handleSelectAll());
|
|
272
274
|
|
|
273
275
|
const bulkPublishAction = async (isPublish: boolean) => {
|
|
276
|
+
setIsBulkLoading(true);
|
|
274
277
|
const { notPublished, published } = selectedItems;
|
|
275
278
|
const params = getParams();
|
|
276
279
|
|
|
@@ -281,6 +284,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
|
|
|
281
284
|
await unpublishSitesBulk(published, params);
|
|
282
285
|
}
|
|
283
286
|
unselectAllItems();
|
|
287
|
+
setIsBulkLoading(false);
|
|
284
288
|
};
|
|
285
289
|
|
|
286
290
|
const bulkPublish = () => bulkPublishAction(true);
|
|
@@ -301,6 +305,7 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
|
|
|
301
305
|
filterValues={currentConfig.filterValues}
|
|
302
306
|
setHoverCheck={setHoverCheck}
|
|
303
307
|
selectedItems={selectedItems}
|
|
308
|
+
isLoading={isBulkLoading}
|
|
304
309
|
/>
|
|
305
310
|
);
|
|
306
311
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BulkSelectionOptions } from "@ax/components";
|
|
2
|
+
import { itemLabel } from "@ax/constants";
|
|
2
3
|
import type { IBulkSelectedItems } from "@ax/hooks";
|
|
3
4
|
import { usePermission } from "@ax/hooks";
|
|
4
5
|
import type { IColumn, IQueryValue, ISchemaField, IStructuredDataSortedInitialState } from "@ax/types";
|
|
@@ -30,6 +31,7 @@ const BulkHeader = (props: IProps): JSX.Element => {
|
|
|
30
31
|
exportAction,
|
|
31
32
|
setHoverCheck,
|
|
32
33
|
selectedItems,
|
|
34
|
+
isLoading,
|
|
33
35
|
} = props;
|
|
34
36
|
|
|
35
37
|
const isAllowedToPublishPages = usePermission("global.globalData.publishUnpublishAllGlobalData");
|
|
@@ -67,6 +69,8 @@ const BulkHeader = (props: IProps): JSX.Element => {
|
|
|
67
69
|
totalItems={totalItems}
|
|
68
70
|
exportAction={exportAction}
|
|
69
71
|
selectedItems={selectedItems}
|
|
72
|
+
isLoading={isLoading}
|
|
73
|
+
itemLabel={isFromPage ? itemLabel.PAGE_CONTENT_TYPE : itemLabel.SIMPLE_CONTENT_TYPE}
|
|
70
74
|
/>
|
|
71
75
|
) : (
|
|
72
76
|
<TableHeader
|
|
@@ -113,6 +117,7 @@ interface IProps {
|
|
|
113
117
|
exportAction?(formats: (number | string)[]): void;
|
|
114
118
|
setHoverCheck: (state: boolean) => void;
|
|
115
119
|
selectedItems: IBulkSelectedItems;
|
|
120
|
+
isLoading: boolean;
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
export default BulkHeader;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import { IModal } from "@ax/types";
|
|
4
|
-
import { Modal, FieldsBehavior } from "@ax/components";
|
|
3
|
+
import type { IModal } from "@ax/types";
|
|
4
|
+
import { Modal, FieldsBehavior, ErrorToast } from "@ax/components";
|
|
5
5
|
import { slugify } from "@ax/helpers";
|
|
6
6
|
|
|
7
7
|
import * as S from "./style";
|
|
@@ -87,6 +87,7 @@ const DuplicateModal = (props: IDuplicateModal): JSX.Element => {
|
|
|
87
87
|
mainAction={mainModalAction}
|
|
88
88
|
size="M"
|
|
89
89
|
>
|
|
90
|
+
<ErrorToast />
|
|
90
91
|
<S.ModalContent>
|
|
91
92
|
<FieldsBehavior
|
|
92
93
|
fieldType="TextField"
|
|
@@ -2,7 +2,7 @@ import React, { useRef, useState } from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
import { useTheme } from "styled-components";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type {
|
|
6
6
|
ICheck,
|
|
7
7
|
IAvailableSites,
|
|
8
8
|
ISavePageParams,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "@ax/types";
|
|
16
16
|
import { getHumanLastModifiedDate, getScheduleFormatDate, getStructuredDataTitle, trimText } from "@ax/helpers";
|
|
17
17
|
import { appActions } from "@ax/containers/App";
|
|
18
|
-
import { pageStatus, ISetCurrentPageIDAction } from "@ax/containers/PageEditor/interfaces";
|
|
18
|
+
import { pageStatus, type ISetCurrentPageIDAction } from "@ax/containers/PageEditor/interfaces";
|
|
19
19
|
import {
|
|
20
20
|
CheckField,
|
|
21
21
|
FloatingMenu,
|
|
@@ -204,9 +204,11 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
204
204
|
};
|
|
205
205
|
|
|
206
206
|
const handleDuplicatePage = async () => {
|
|
207
|
-
await duplicatePage(globalPage.id, duplicateModalState);
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
const isDuplicated = await duplicatePage(globalPage.id, duplicateModalState);
|
|
208
|
+
if (isDuplicated) {
|
|
209
|
+
toggleDuplicateModal();
|
|
210
|
+
setHistoryPush("data/pages/editor", true);
|
|
211
|
+
}
|
|
210
212
|
};
|
|
211
213
|
|
|
212
214
|
let menuOptions = [];
|
|
@@ -286,12 +288,18 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
286
288
|
|
|
287
289
|
menuOptions = globalPage.liveStatus?.status === pageStatus.PUBLISHED ? [viewOption, ...menuOptions] : menuOptions;
|
|
288
290
|
|
|
291
|
+
const handleCloseDuplicate = () => {
|
|
292
|
+
toggleDuplicateModal();
|
|
293
|
+
setDuplicateModalState({ title: "", slug: "" });
|
|
294
|
+
};
|
|
295
|
+
|
|
289
296
|
const mainDuplicateModalAction = {
|
|
290
297
|
title: "Duplicate",
|
|
291
298
|
onClick: handleDuplicatePage,
|
|
292
299
|
disabled: !duplicateModalState.title.trim() || !duplicateModalState.slug.trim() || isSaving,
|
|
293
300
|
};
|
|
294
|
-
|
|
301
|
+
|
|
302
|
+
const secondaryDuplicateModalAction = { title: "Cancel", onClick: handleCloseDuplicate };
|
|
295
303
|
|
|
296
304
|
const isTranslated = globalPage.pageLanguages.length > 1;
|
|
297
305
|
|
|
@@ -331,9 +339,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
331
339
|
|
|
332
340
|
const selectedPageLanguage = getSelectedPageLanguage(language);
|
|
333
341
|
|
|
334
|
-
selectedPageLanguage
|
|
335
|
-
? setCurrentPageID(selectedPageLanguage.pageId)
|
|
336
|
-
: languageActions.createNewTranslation && languageActions.createNewTranslation(true);
|
|
342
|
+
selectedPageLanguage ? setCurrentPageID(selectedPageLanguage.pageId) : languageActions.createNewTranslation?.(true);
|
|
337
343
|
|
|
338
344
|
setHistoryPush("data/pages/editor", true);
|
|
339
345
|
};
|
|
@@ -362,7 +368,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
362
368
|
"Not translatable"
|
|
363
369
|
);
|
|
364
370
|
|
|
365
|
-
const availableSiteNames = availableSites
|
|
371
|
+
const availableSiteNames = availableSites?.map((site: IAvailableSites) => site.name);
|
|
366
372
|
|
|
367
373
|
const getLiveStatus = () => (isScheduledPub ? "scheduled" : haveDraftPage ? "modified" : liveStatus.status);
|
|
368
374
|
|
|
@@ -373,7 +379,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
373
379
|
return <React.Fragment key={col.key} />;
|
|
374
380
|
}
|
|
375
381
|
|
|
376
|
-
const type: any = structuredDataContent
|
|
382
|
+
const type: any = structuredDataContent?.[col.key];
|
|
377
383
|
|
|
378
384
|
if (typeof type !== "object") {
|
|
379
385
|
return (
|
|
@@ -128,6 +128,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
128
128
|
const [structuredDataType, setStructuredDataType] = useState("all");
|
|
129
129
|
|
|
130
130
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
131
|
+
const [isBulkLoading, setIsBulkLoading] = useState(false);
|
|
131
132
|
const [deletedItem, setDeletedItem] = useState<number | number[] | null>(null);
|
|
132
133
|
const { isVisible: isDataToast, toggleToast: toggleDataToast, setIsVisible: setIsDataToast } = useToast();
|
|
133
134
|
const { isVisible: isPageToast, toggleToast: togglePageToast, setIsVisible: setIsPageToast } = useToast();
|
|
@@ -392,6 +393,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
392
393
|
};
|
|
393
394
|
|
|
394
395
|
const bulkPublishPage = async (isPublish: boolean) => {
|
|
396
|
+
setIsBulkLoading(true);
|
|
395
397
|
const { notPublished, published, drafts } = selectedItems;
|
|
396
398
|
|
|
397
399
|
if (drafts && drafts.length > 0) {
|
|
@@ -420,11 +422,14 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
420
422
|
|
|
421
423
|
handleGetGlobalPages();
|
|
422
424
|
unselectAllItems();
|
|
425
|
+
setIsBulkLoading(false);
|
|
423
426
|
};
|
|
424
427
|
|
|
425
428
|
const bulkPublishData = (status: string) => {
|
|
429
|
+
setIsBulkLoading(true);
|
|
426
430
|
setDataStatus(selectedItems.all, status);
|
|
427
431
|
unselectAllItems();
|
|
432
|
+
setIsBulkLoading(false);
|
|
428
433
|
};
|
|
429
434
|
|
|
430
435
|
const bulkFilter = (bulkSelection: number[]) => filterByStatus(bulkSelection, currentSitePages);
|
|
@@ -496,6 +501,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
496
501
|
checkState={checkState}
|
|
497
502
|
isScrolling={isScrolling}
|
|
498
503
|
isEditable={isDataEditable}
|
|
504
|
+
isLoading={isBulkLoading}
|
|
499
505
|
isFromPage={isStructuredDataFromPage}
|
|
500
506
|
sortItems={sortItems}
|
|
501
507
|
sortedListStatus={sortedListStatus}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BulkSelectionOptions } from "@ax/components";
|
|
2
|
+
import { itemLabel } from "@ax/constants";
|
|
2
3
|
import type { IBulkSelectedItems } from "@ax/hooks";
|
|
3
4
|
import type { IQueryValue, IRole } from "@ax/types";
|
|
4
5
|
|
|
@@ -21,6 +22,7 @@ const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
|
21
22
|
selectedRoles,
|
|
22
23
|
setHoverCheck,
|
|
23
24
|
selectedItems,
|
|
25
|
+
isLoading,
|
|
24
26
|
} = props;
|
|
25
27
|
|
|
26
28
|
const deactivatedSelectedRoles = roles.filter((role: IRole) => selectedRoles.includes(role.id) && !role.active);
|
|
@@ -42,6 +44,8 @@ const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
|
42
44
|
selectItems={selectItems}
|
|
43
45
|
totalItems={totalItems}
|
|
44
46
|
selectedItems={selectedItems}
|
|
47
|
+
isLoading={isLoading}
|
|
48
|
+
itemLabel={itemLabel.ROL}
|
|
45
49
|
/>
|
|
46
50
|
) : (
|
|
47
51
|
<TableHeader
|
|
@@ -74,6 +78,7 @@ export interface IBulkHeaderProps {
|
|
|
74
78
|
selectedRoles: number[];
|
|
75
79
|
setHoverCheck: (state: boolean) => void;
|
|
76
80
|
selectedItems: IBulkSelectedItems;
|
|
81
|
+
isLoading: boolean;
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
export default BulkHeader;
|
|
@@ -11,15 +11,17 @@ import BulkHeader from "./BulkHeader";
|
|
|
11
11
|
import { useFilterQuery, useSortedListStatus } from "./hooks";
|
|
12
12
|
import RoleItem from "./RoleItem";
|
|
13
13
|
import SideModal from "./SideModal";
|
|
14
|
-
import * as S from "./style";
|
|
15
14
|
import { getSortedListStatus } from "./utils";
|
|
16
15
|
|
|
16
|
+
import * as S from "./style";
|
|
17
|
+
|
|
17
18
|
const Roles = (props: IRolesProps): JSX.Element => {
|
|
18
19
|
const { currentSiteInfo, roles, getRoles, navItems, currentNavItem, setHistoryPush, activateRoles } = props;
|
|
19
20
|
|
|
20
21
|
const itemsPerPage = 50;
|
|
21
22
|
const firstPage = 1;
|
|
22
23
|
|
|
24
|
+
const [isBulkLoading, setIsBulkLoading] = useState(false);
|
|
23
25
|
const [page, setPage] = useState(1);
|
|
24
26
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
25
27
|
const [activatedItems, setActivatedItems] = useState<number[]>([]);
|
|
@@ -106,6 +108,7 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
106
108
|
};
|
|
107
109
|
|
|
108
110
|
const handleActivateRoles = async (roleIds: number[], active: boolean) => {
|
|
111
|
+
setIsBulkLoading(true);
|
|
109
112
|
const params = {
|
|
110
113
|
id: roleIds,
|
|
111
114
|
siteId,
|
|
@@ -117,6 +120,7 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
117
120
|
setActivatedItems(roleIds);
|
|
118
121
|
toggleToast();
|
|
119
122
|
}
|
|
123
|
+
setIsBulkLoading(false);
|
|
120
124
|
};
|
|
121
125
|
|
|
122
126
|
const restorePreviousRoleStatus = async () => {
|
|
@@ -156,6 +160,7 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
156
160
|
selectedRoles={selectedItems.all}
|
|
157
161
|
setHoverCheck={setHoverCheck}
|
|
158
162
|
selectedItems={selectedItems}
|
|
163
|
+
isLoading={isBulkLoading}
|
|
159
164
|
/>
|
|
160
165
|
);
|
|
161
166
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BulkSelectionOptions } from "@ax/components";
|
|
2
|
+
import { itemLabel } from "@ax/constants";
|
|
2
3
|
import type { IBulkSelectedItems } from "@ax/hooks";
|
|
3
4
|
import { usePermission } from "@ax/hooks";
|
|
4
5
|
import type { IQueryValue, IRole } from "@ax/types";
|
|
@@ -22,6 +23,7 @@ const BulkHeader = (props: IProps): JSX.Element => {
|
|
|
22
23
|
roles,
|
|
23
24
|
setHoverCheck,
|
|
24
25
|
selectedItems,
|
|
26
|
+
isLoading,
|
|
25
27
|
} = props;
|
|
26
28
|
|
|
27
29
|
const isAllowedToRemoveUsers = usePermission("usersRoles.removeUsers");
|
|
@@ -43,6 +45,8 @@ const BulkHeader = (props: IProps): JSX.Element => {
|
|
|
43
45
|
selectItems={selectItems}
|
|
44
46
|
totalItems={totalItems}
|
|
45
47
|
selectedItems={selectedItems}
|
|
48
|
+
isLoading={isLoading}
|
|
49
|
+
itemLabel={itemLabel.USER}
|
|
46
50
|
/>
|
|
47
51
|
) : (
|
|
48
52
|
<TableHeader
|
|
@@ -77,6 +81,7 @@ interface IProps {
|
|
|
77
81
|
roles: IRole[];
|
|
78
82
|
setHoverCheck: (state: boolean) => void;
|
|
79
83
|
selectedItems: IBulkSelectedItems;
|
|
84
|
+
isLoading: boolean;
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
export default BulkHeader;
|
|
@@ -20,10 +20,11 @@ import type { IGetRoles, IGetSitesParams, IQueryValue, IRole, IRootState, ISite,
|
|
|
20
20
|
|
|
21
21
|
import BulkHeader from "./BulkHeader";
|
|
22
22
|
import { useFilterQuery, useSortedListStatus } from "./hooks";
|
|
23
|
-
import * as S from "./style";
|
|
24
23
|
import UserItem from "./UserItem";
|
|
25
24
|
import { getSortedListStatus } from "./utils";
|
|
26
25
|
|
|
26
|
+
import * as S from "./style";
|
|
27
|
+
|
|
27
28
|
const UserList = (props: IUserListProps): JSX.Element => {
|
|
28
29
|
const {
|
|
29
30
|
currentSiteInfo,
|
|
@@ -44,6 +45,7 @@ const UserList = (props: IUserListProps): JSX.Element => {
|
|
|
44
45
|
const itemsPerPage = 50;
|
|
45
46
|
const firstPage = 1;
|
|
46
47
|
|
|
48
|
+
const [isBulkLoading, setIsBulkLoading] = useState(false);
|
|
47
49
|
const [page, setPage] = useState(1);
|
|
48
50
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
49
51
|
const [searchQuery, setSearchQuery] = useState<string>("");
|
|
@@ -140,16 +142,19 @@ const UserList = (props: IUserListProps): JSX.Element => {
|
|
|
140
142
|
currPage: page,
|
|
141
143
|
};
|
|
142
144
|
|
|
143
|
-
const bulkDelete = () => {
|
|
145
|
+
const bulkDelete = async () => {
|
|
146
|
+
setIsBulkLoading(true);
|
|
144
147
|
if (isSiteView) {
|
|
145
148
|
const siteId = currentSiteInfo.id;
|
|
146
|
-
removeUsersBulk(siteId, selectedItems.all);
|
|
149
|
+
await removeUsersBulk(siteId, selectedItems.all);
|
|
147
150
|
} else {
|
|
148
|
-
deleteUser(selectedItems.all);
|
|
151
|
+
await deleteUser(selectedItems.all);
|
|
149
152
|
}
|
|
150
153
|
setUSersDeleted(selectedItems.all.length);
|
|
151
154
|
toggleModal();
|
|
152
155
|
toggleToast();
|
|
156
|
+
resetBulkSelection();
|
|
157
|
+
setIsBulkLoading(false);
|
|
153
158
|
};
|
|
154
159
|
|
|
155
160
|
const rightButtonProps = allowedToCreateUsers
|
|
@@ -200,6 +205,7 @@ const UserList = (props: IUserListProps): JSX.Element => {
|
|
|
200
205
|
roles={roles}
|
|
201
206
|
setHoverCheck={setHoverCheck}
|
|
202
207
|
selectedItems={selectedItems}
|
|
208
|
+
isLoading={isBulkLoading}
|
|
203
209
|
/>
|
|
204
210
|
);
|
|
205
211
|
|
|
@@ -256,8 +262,7 @@ const UserList = (props: IUserListProps): JSX.Element => {
|
|
|
256
262
|
<EmptyState message="No users found" />
|
|
257
263
|
</S.EmptyWrapper>
|
|
258
264
|
) : (
|
|
259
|
-
pageUsers
|
|
260
|
-
pageUsers.map((user) => {
|
|
265
|
+
pageUsers?.map((user) => {
|
|
261
266
|
const isItemSelected = isSelected(user.id);
|
|
262
267
|
return (
|
|
263
268
|
<UserItem
|
|
@@ -329,7 +334,7 @@ interface IDispatchProps {
|
|
|
329
334
|
getUser(id: number): Promise<void>;
|
|
330
335
|
setHistoryPush(route: string): void;
|
|
331
336
|
deleteUser(id: number[]): Promise<boolean>;
|
|
332
|
-
removeUsersBulk(siteId: number, users: number[]): void
|
|
337
|
+
removeUsersBulk(siteId: number, users: number[]): Promise<void>;
|
|
333
338
|
getRoles(params: IGetRoles, token?: string, hasLoading?: boolean): Promise<void>;
|
|
334
339
|
getSites(params: IGetSitesParams): Promise<void>;
|
|
335
340
|
}
|
package/tsconfig.paths.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"@ax/forms": ["src/forms"],
|
|
11
11
|
"@ax/guards": ["src/guards"],
|
|
12
12
|
"@ax/helpers": ["src/helpers"],
|
|
13
|
+
"@ax/helpers/*": ["src/helpers/*"],
|
|
13
14
|
"@ax/hooks": ["src/hooks"],
|
|
14
15
|
"@ax/locales": ["src/locales"],
|
|
15
16
|
"@ax/modules": ["src/modules"],
|
|
@@ -18,7 +19,9 @@
|
|
|
18
19
|
"@ax/types": ["src/types"],
|
|
19
20
|
"@ax/schemas": ["src/schemas"],
|
|
20
21
|
"@ax/services": ["src/services"],
|
|
21
|
-
"@ax/themes/*": ["src/themes/*"]
|
|
22
|
+
"@ax/themes/*": ["src/themes/*"],
|
|
23
|
+
"@ax/constants": ["src/constants"],
|
|
24
|
+
"@ax/constants/*": ["src/constants/*"]
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|