@griddo/ax 10.3.23 → 10.3.25
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/Gallery/GalleryFilters/Orientation/Orientation.test.tsx +5 -2
- package/src/__tests__/components/Gallery/GalleryFilters/SortBy/SortBy.test.tsx +5 -4
- package/src/__tests__/components/Gallery/GalleryFilters/Type/Type.test.tsx +5 -2
- package/src/__tests__/components/TableFilters/CategoryFilter/CategoryFilter.test.tsx +12 -11
- package/src/__tests__/components/TableFilters/DateFilter/DateFilter.test.tsx +17 -16
- package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +14 -13
- package/src/__tests__/components/TableFilters/NameFilter/NameFilter.test.tsx +21 -20
- package/src/__tests__/components/TableFilters/RoleFilter/RoleFilter.test.tsx +6 -5
- package/src/__tests__/components/TableFilters/SiteFilter/SiteFilter.test.tsx +8 -7
- package/src/__tests__/components/TableFilters/StatusFilter/StatusFilter.test.tsx +21 -20
- package/src/__tests__/components/TableFilters/TranslationsFilter/TranslationsFilter.test.tsx +24 -23
- package/src/__tests__/components/TableFilters/TypeFilter/TypeFilter.test.tsx +6 -5
- package/src/__tests__/components/TableFilters/UsersFilter/UsersFilter.test.tsx +17 -16
- package/src/api/sites.tsx +5 -9
- package/src/components/Button/index.tsx +3 -1
- package/src/components/Button/style.tsx +6 -0
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +2 -2
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +1 -1
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldInline/index.tsx +3 -2
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/index.tsx +3 -1
- package/src/components/Fields/ArrayFieldGroup/index.tsx +5 -2
- package/src/components/Fields/CheckField/style.tsx +2 -2
- package/src/components/Fields/ColorPicker/index.tsx +4 -2
- package/src/components/Fields/ColorPicker/style.tsx +4 -0
- package/src/components/Fields/DateField/DatePickerInput/index.tsx +1 -1
- package/src/components/Fields/FileField/index.tsx +3 -1
- package/src/components/Fields/FileField/style.tsx +9 -4
- package/src/components/Fields/SliderField/index.tsx +4 -2
- package/src/components/Fields/SliderField/style.tsx +53 -4
- package/src/components/Fields/TimeField/style.tsx +6 -5
- package/src/components/FileGallery/index.tsx +26 -16
- package/src/components/FileGallery/style.tsx +12 -1
- package/src/components/FilterTagsBar/index.tsx +61 -0
- package/src/components/FilterTagsBar/style.tsx +30 -0
- package/src/components/FloatingMenu/index.tsx +5 -1
- package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +14 -6
- package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +24 -8
- package/src/components/Gallery/GalleryFilters/Type/index.tsx +22 -9
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/style.tsx +2 -1
- package/src/components/Gallery/hooks.tsx +37 -23
- package/src/components/Gallery/index.tsx +38 -20
- package/src/components/Gallery/style.tsx +15 -2
- package/src/components/MainWrapper/AppBar/index.tsx +3 -0
- package/src/components/MainWrapper/index.tsx +1 -0
- package/src/components/SearchTagsBar/index.tsx +43 -0
- package/src/components/SearchTagsBar/style.tsx +30 -0
- package/src/components/TableFilters/CategoryFilter/index.tsx +17 -10
- package/src/components/TableFilters/CheckGroupFilter/index.tsx +12 -9
- package/src/components/TableFilters/DateFilter/index.tsx +3 -2
- package/src/components/TableFilters/LastAccessFilter/index.tsx +4 -4
- package/src/components/TableFilters/LiveFilter/index.tsx +26 -22
- package/src/components/TableFilters/NameFilter/index.tsx +4 -3
- package/src/components/TableFilters/PermissionsFilter/index.tsx +4 -3
- package/src/components/TableFilters/RoleFilter/index.tsx +17 -7
- package/src/components/TableFilters/SiteFilter/index.tsx +23 -8
- package/src/components/TableFilters/StateFilter/index.tsx +15 -6
- package/src/components/TableFilters/StatusFilter/index.tsx +3 -2
- package/src/components/TableFilters/TranslationsFilter/index.tsx +19 -11
- package/src/components/TableFilters/TypeFilter/index.tsx +9 -5
- package/src/components/TableFilters/UsersFilter/index.tsx +4 -3
- package/src/components/Tag/index.tsx +5 -4
- package/src/components/index.tsx +4 -0
- package/src/containers/Navigation/Menu/actions.tsx +1 -13
- package/src/containers/Navigation/Menu/constants.tsx +0 -1
- package/src/containers/Navigation/Menu/interfaces.tsx +1 -7
- package/src/containers/Navigation/Menu/reducer.tsx +0 -4
- package/src/containers/Sites/actions.tsx +2 -1
- package/src/containers/Sites/interfaces.tsx +2 -2
- package/src/containers/Sites/reducer.tsx +2 -2
- package/src/containers/StructuredData/actions.tsx +2 -1
- package/src/forms/editor.tsx +1 -1
- package/src/modules/Categories/CategoriesList/CategoryItem/style.tsx +2 -0
- package/src/modules/Content/BulkHeader/TableHeader/index.tsx +26 -14
- package/src/modules/Content/BulkHeader/index.tsx +3 -3
- package/src/modules/Content/PageItem/index.tsx +21 -23
- package/src/modules/Content/PageItem/style.tsx +2 -0
- package/src/modules/Content/hooks.tsx +23 -13
- package/src/modules/Content/index.tsx +44 -11
- package/src/modules/Content/style.tsx +19 -1
- package/src/modules/FileDrive/Breadcrumb/style.tsx +1 -1
- package/src/modules/FileDrive/FileDragAndDrop/index.tsx +7 -6
- package/src/modules/FileDrive/FileDragAndDrop/style.tsx +2 -0
- package/src/modules/FileDrive/FileFilters/SortBy/index.tsx +24 -8
- package/src/modules/FileDrive/FileFilters/Type/index.tsx +26 -22
- package/src/modules/FileDrive/hooks.tsx +28 -13
- package/src/modules/FileDrive/index.tsx +31 -18
- package/src/modules/FileDrive/style.tsx +20 -1
- package/src/modules/Navigation/Defaults/Item/style.tsx +2 -0
- package/src/modules/Navigation/Menus/List/Nav/index.tsx +10 -12
- package/src/modules/Navigation/Menus/List/Table/SidePanel/index.tsx +0 -2
- package/src/modules/Navigation/Menus/List/index.tsx +8 -5
- package/src/modules/Redirects/BulkHeader/TableHeader/index.tsx +4 -2
- package/src/modules/Redirects/BulkHeader/index.tsx +3 -2
- package/src/modules/Redirects/hooks.tsx +23 -15
- package/src/modules/Redirects/index.tsx +61 -44
- package/src/modules/Redirects/style.tsx +10 -0
- package/src/modules/Settings/Integrations/BulkHeader/TableHeader/index.tsx +7 -11
- package/src/modules/Settings/Integrations/BulkHeader/index.tsx +4 -8
- package/src/modules/Settings/Integrations/hooks.tsx +23 -19
- package/src/modules/Settings/Integrations/index.tsx +22 -26
- package/src/modules/Settings/Integrations/style.tsx +7 -0
- package/src/modules/Sites/SitesList/GridView/GridHeaderFilter/index.tsx +8 -7
- package/src/modules/Sites/SitesList/ListView/BulkHeader/TableHeader/index.tsx +10 -5
- package/src/modules/Sites/SitesList/ListView/BulkHeader/index.tsx +4 -3
- package/src/modules/Sites/SitesList/hooks.tsx +26 -20
- package/src/modules/Sites/SitesList/index.tsx +53 -22
- package/src/modules/Sites/SitesList/style.tsx +16 -0
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/TableHeader/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/BulkHeader/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +3 -3
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/style.tsx +2 -0
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/style.tsx +2 -0
- package/src/modules/StructuredData/StructuredDataList/hooks.tsx +25 -15
- package/src/modules/StructuredData/StructuredDataList/index.tsx +57 -14
- package/src/modules/StructuredData/StructuredDataList/style.tsx +10 -1
- package/src/modules/Users/Roles/BulkHeader/TableHeader/index.tsx +2 -2
- package/src/modules/Users/Roles/BulkHeader/index.tsx +2 -5
- package/src/modules/Users/Roles/hooks.tsx +24 -15
- package/src/modules/Users/Roles/index.tsx +7 -18
- package/src/modules/Users/UserList/BulkHeader/TableHeader/index.tsx +5 -18
- package/src/modules/Users/UserList/BulkHeader/index.tsx +15 -13
- package/src/modules/Users/UserList/hooks.tsx +27 -25
- package/src/modules/Users/UserList/index.tsx +69 -43
- package/src/modules/Users/UserList/style.tsx +10 -1
- package/src/types/index.tsx +19 -13
|
@@ -150,6 +150,7 @@ const GridList = styled.div<{ isEmpty: boolean; fullWidth: boolean }>`
|
|
|
150
150
|
|
|
151
151
|
const EmptyStateWrapper = styled.div`
|
|
152
152
|
text-align: center;
|
|
153
|
+
margin-top: 100px;
|
|
153
154
|
`;
|
|
154
155
|
|
|
155
156
|
const ImageWrapper = styled.div<{ borderRadius?: boolean }>`
|
|
@@ -184,6 +185,19 @@ const AllSitesListWrapper = styled.div`
|
|
|
184
185
|
}
|
|
185
186
|
`;
|
|
186
187
|
|
|
188
|
+
const SearchTags = styled.div`
|
|
189
|
+
& > div:nth-child(1) {
|
|
190
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
191
|
+
}
|
|
192
|
+
& > div:nth-child(2) {
|
|
193
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
|
|
197
|
+
const SearchTagsGrid = styled.div`
|
|
198
|
+
margin: ${(p) => `${p.theme.spacing.xs} ${p.theme.spacing.m}`};
|
|
199
|
+
`;
|
|
200
|
+
|
|
187
201
|
export {
|
|
188
202
|
SectionHeader,
|
|
189
203
|
CollapseButton,
|
|
@@ -202,4 +216,6 @@ export {
|
|
|
202
216
|
ItemName,
|
|
203
217
|
PaginationWrapper,
|
|
204
218
|
AllSitesListWrapper,
|
|
219
|
+
SearchTags,
|
|
220
|
+
SearchTagsGrid,
|
|
205
221
|
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
LiveFilter,
|
|
13
13
|
TranslationsFilter,
|
|
14
14
|
} from "@ax/components";
|
|
15
|
-
import { IColumn, IStructuredDataQueryValues } from "@ax/types";
|
|
15
|
+
import { IColumn, IQueryValue, IStructuredDataQueryValues } from "@ax/types";
|
|
16
16
|
import { getGlobalPageTypes } from "@ax/helpers";
|
|
17
17
|
|
|
18
18
|
import * as S from "./style";
|
|
@@ -134,8 +134,8 @@ interface IProps {
|
|
|
134
134
|
isScrolling: boolean;
|
|
135
135
|
selectAllItems: () => void;
|
|
136
136
|
isFromPage: boolean;
|
|
137
|
-
sortItems: (orderPointer:
|
|
138
|
-
filterItems: (filterPointer: string, filtersSelected:
|
|
137
|
+
sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
|
|
138
|
+
filterItems: (filterPointer: string, filtersSelected: IQueryValue[]) => void;
|
|
139
139
|
sortedListStatus: { isAscending: boolean; sortedByDate: boolean; sortedByTitle: boolean; sortedByURL: boolean };
|
|
140
140
|
isAllPages: boolean;
|
|
141
141
|
filterValues: IStructuredDataQueryValues;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BulkSelectionOptions } from "@ax/components";
|
|
3
|
-
import { IColumn, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
|
|
3
|
+
import { IColumn, IQueryValue, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
|
|
4
4
|
import { usePermission } from "@ax/hooks";
|
|
5
5
|
import TableHeader from "./TableHeader";
|
|
6
6
|
|
|
@@ -90,8 +90,8 @@ interface IProps {
|
|
|
90
90
|
isScrolling: boolean;
|
|
91
91
|
isEditable: boolean | null;
|
|
92
92
|
isFromPage: boolean;
|
|
93
|
-
sortItems: (orderPointer:
|
|
94
|
-
filterItems: (filterPointer: string, filtersSelected:
|
|
93
|
+
sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
|
|
94
|
+
filterItems: (filterPointer: string, filtersSelected: IQueryValue[]) => void;
|
|
95
95
|
sortedListStatus: IStructuredDataSortedInitialState;
|
|
96
96
|
isAllPages: boolean;
|
|
97
97
|
filterValues: IStructuredDataQueryValues;
|
|
@@ -379,11 +379,11 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
379
379
|
<S.NameCell role="cell" onClick={_handleClick} ref={nameCellRef}>
|
|
380
380
|
<Tooltip
|
|
381
381
|
content={[
|
|
382
|
-
|
|
382
|
+
<React.Fragment key="page-title">
|
|
383
383
|
<strong>{globalPage.title}</strong>
|
|
384
384
|
<br />
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
</React.Fragment>,
|
|
386
|
+
<React.Fragment key="page-slug">{fullPath.page}</React.Fragment>,
|
|
387
387
|
]}
|
|
388
388
|
left={0}
|
|
389
389
|
top={1}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { IStructuredData, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
|
|
2
|
+
import { IQueryValue, IStructuredData, IStructuredDataQueryValues, IStructuredDataSortedInitialState } from "@ax/types";
|
|
3
3
|
|
|
4
4
|
const useSortedListStatus = (): IUseSortedListStatus => {
|
|
5
5
|
const sortedInitialState: IStructuredDataSortedInitialState = {
|
|
@@ -21,23 +21,32 @@ const useFilterQuery = (
|
|
|
21
21
|
currentStructuredData: IStructuredData | null,
|
|
22
22
|
values: Record<string, IStructuredDataQueryValues> | null
|
|
23
23
|
): IUseFilterQuery => {
|
|
24
|
+
|
|
24
25
|
const structuredDataType = currentStructuredData ? currentStructuredData.id : "all";
|
|
25
|
-
const initialQueryValues = {
|
|
26
|
-
types: "all",
|
|
27
|
-
translated: "all",
|
|
28
|
-
liveStatus: "all",
|
|
29
|
-
order:
|
|
30
|
-
filterSites: "all",
|
|
31
|
-
categories: "all",
|
|
32
|
-
related: "all",
|
|
26
|
+
const initialQueryValues: IStructuredDataQueryValues = {
|
|
27
|
+
types: [{value: "all", label: "All"}],
|
|
28
|
+
translated: [{value: "all", label: "All"}],
|
|
29
|
+
liveStatus: [{value: "all", label: "All"}],
|
|
30
|
+
order: [],
|
|
31
|
+
filterSites: [{value: "all", label: "All"}],
|
|
32
|
+
categories: [{value: "all", label: "All"}],
|
|
33
|
+
related: [{value: "all", label: "All"}],
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
const getFilterQuery = (filterValues: IStructuredDataQueryValues) => {
|
|
36
|
+
const getFilterQuery = (filterValues: IStructuredDataQueryValues): string => {
|
|
36
37
|
const { types, translated, liveStatus, order, filterSites, categories, related } = filterValues;
|
|
37
38
|
let filterQuery = "";
|
|
38
39
|
|
|
39
|
-
const currentQuery = (pointer: string, values:
|
|
40
|
-
|
|
40
|
+
const currentQuery = (pointer: string, values: IQueryValue[]): string => {
|
|
41
|
+
const stringValues = Array.isArray(values) && values.length
|
|
42
|
+
? values.map((value) => (value.value !== "all" ? value.value : "")).join(",")
|
|
43
|
+
: "";
|
|
44
|
+
|
|
45
|
+
return !stringValues.length
|
|
46
|
+
? filterQuery
|
|
47
|
+
: filterQuery.length
|
|
48
|
+
? filterQuery.concat(`&${pointer}=${stringValues}`)
|
|
49
|
+
: `&${pointer}=${stringValues}`;
|
|
41
50
|
};
|
|
42
51
|
|
|
43
52
|
const isNotInitialValue = (pointer: keyof IStructuredDataQueryValues) => {
|
|
@@ -68,15 +77,16 @@ const useFilterQuery = (
|
|
|
68
77
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
78
|
}, [structuredDataType]);
|
|
70
79
|
|
|
71
|
-
const setFiltersSelection = (pointer: string, filter:
|
|
80
|
+
const setFiltersSelection = (pointer: string, filter: IQueryValue[], isAscendent?: boolean) => {
|
|
72
81
|
const { types, translated, liveStatus, order, filterSites, categories, related } =
|
|
73
82
|
state[structuredDataType] || initialQueryValues;
|
|
83
|
+
|
|
74
84
|
const orderMethod = isAscendent ? "asc" : "desc";
|
|
75
85
|
const filterValues = {
|
|
76
86
|
types: pointer === "types" ? filter : types,
|
|
77
87
|
translated: pointer === "translated" ? filter : translated,
|
|
78
88
|
liveStatus: pointer === "liveStatus" ? filter : liveStatus,
|
|
79
|
-
order: pointer === "order" ? `${filter}-${orderMethod}
|
|
89
|
+
order: pointer === "order" ? [{value: `${filter[0].value}-${orderMethod}`, label: filter[0].label}] : order,
|
|
80
90
|
filterSites: pointer === "filterSites" ? filter : filterSites,
|
|
81
91
|
categories: pointer === "categories" ? filter : categories,
|
|
82
92
|
related: pointer === "related" ? filter : related,
|
|
@@ -106,7 +116,7 @@ interface IUseSortedListStatus {
|
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
interface IUseFilterQuery {
|
|
109
|
-
setFiltersSelection(pointer: string, filter:
|
|
119
|
+
setFiltersSelection(pointer: string, filter: IQueryValue[], isAscendent?: boolean): void;
|
|
110
120
|
resetFilterQuery(): void;
|
|
111
121
|
filterValues: Record<string, IStructuredDataQueryValues>;
|
|
112
122
|
query: string;
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
ICheck,
|
|
18
18
|
IColumn,
|
|
19
19
|
IStructuredDataQueryValues,
|
|
20
|
+
ISite,
|
|
21
|
+
IQueryValue,
|
|
20
22
|
} from "@ax/types";
|
|
21
23
|
import {
|
|
22
24
|
ISetCurrentPageIDAction,
|
|
@@ -30,7 +32,17 @@ import { structuredDataActions } from "@ax/containers/StructuredData";
|
|
|
30
32
|
import { sitesActions } from "@ax/containers/Sites";
|
|
31
33
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
32
34
|
import { analyticsActions } from "@ax/containers/Analytics";
|
|
33
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
MainWrapper,
|
|
37
|
+
TableList,
|
|
38
|
+
ErrorToast,
|
|
39
|
+
Toast,
|
|
40
|
+
Notification,
|
|
41
|
+
EmptyState,
|
|
42
|
+
Modal,
|
|
43
|
+
SearchTagsBar,
|
|
44
|
+
FilterTagsBar,
|
|
45
|
+
} from "@ax/components";
|
|
34
46
|
|
|
35
47
|
import StructuredDataItem from "./StructuredDataItem";
|
|
36
48
|
import BulkHeader from "./BulkHeader";
|
|
@@ -90,6 +102,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
90
102
|
setContentFilters,
|
|
91
103
|
contentFilters,
|
|
92
104
|
checkUserSession,
|
|
105
|
+
sites,
|
|
93
106
|
} = props;
|
|
94
107
|
|
|
95
108
|
const itemsPerPage = 50;
|
|
@@ -150,7 +163,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
150
163
|
live: { title: "Live", show: true },
|
|
151
164
|
status: { title: "Status", show: true },
|
|
152
165
|
translation: { title: "Trans.", show: true },
|
|
153
|
-
...((isStructuredDataFromPage || currentStructuredData === null)
|
|
166
|
+
...((isStructuredDataFromPage || currentStructuredData === null) && { seo: { title: "SEO", show: true } }),
|
|
154
167
|
};
|
|
155
168
|
|
|
156
169
|
const extraColumns = categoryColumns.reduce((acc: Record<string, IColumn>, cur: any) => {
|
|
@@ -240,9 +253,9 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
240
253
|
const type = currentStructuredData && isGlobalData ? currentStructuredData.id : "all";
|
|
241
254
|
setStructuredDataType(type);
|
|
242
255
|
|
|
243
|
-
filterItems("types", "all");
|
|
256
|
+
filterItems("types", [{ value: "all", label: "All" }]);
|
|
244
257
|
if (filter === "all-pages" || !isStructuredDataFromPage) {
|
|
245
|
-
filterItems("filterSites", "all");
|
|
258
|
+
filterItems("filterSites", [{ value: "all", label: "All" }]);
|
|
246
259
|
setColumnsState({ all: allColumns });
|
|
247
260
|
}
|
|
248
261
|
unselectAllItems();
|
|
@@ -289,8 +302,14 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
289
302
|
} else {
|
|
290
303
|
emptyState.message = isAllPages
|
|
291
304
|
? "You don’t have pages with this content type yet."
|
|
292
|
-
: allowedToCreatePages && isDataEditable
|
|
293
|
-
|
|
305
|
+
: allowedToCreatePages && isDataEditable
|
|
306
|
+
? "To start using pages in your site, create as many pages as you need."
|
|
307
|
+
: undefined;
|
|
308
|
+
emptyState.button = isAllPages
|
|
309
|
+
? "View all content"
|
|
310
|
+
: allowedToCreatePages && isDataEditable
|
|
311
|
+
? "Create the first page"
|
|
312
|
+
: undefined;
|
|
294
313
|
emptyState.action = isAllPages ? resetFilterValues : isDataEditable ? addNewAction : undefined;
|
|
295
314
|
}
|
|
296
315
|
const isEmpty = isStructuredDataFromPage ? !currentSitePages.length : !currentDataContent.length;
|
|
@@ -426,15 +445,15 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
426
445
|
}
|
|
427
446
|
};
|
|
428
447
|
|
|
429
|
-
const sortItems = async (orderPointer:
|
|
448
|
+
const sortItems = async (orderPointer: IQueryValue[], isAscending: boolean) => {
|
|
430
449
|
setPage(firstPage);
|
|
431
|
-
const sortedState = getSortedListStatus(orderPointer, isAscending);
|
|
450
|
+
const sortedState = getSortedListStatus(orderPointer[0].value.toString(), isAscending);
|
|
432
451
|
setSortedListStatus(sortedState);
|
|
433
452
|
|
|
434
453
|
setFiltersSelection("order", orderPointer, isAscending);
|
|
435
454
|
};
|
|
436
455
|
|
|
437
|
-
const filterItems = async (filterPointer: string, filtersSelected:
|
|
456
|
+
const filterItems = async (filterPointer: string, filtersSelected: IQueryValue[]) => {
|
|
438
457
|
setPage(firstPage);
|
|
439
458
|
if (!isStructuredDataFromPage && filterPointer === "categories") filterPointer = "related";
|
|
440
459
|
setFiltersSelection(filterPointer, filtersSelected);
|
|
@@ -486,11 +505,13 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
486
505
|
|
|
487
506
|
const addNewAction = isAllPages || isStructuredDataFromPage ? toggleNewModal : createNewData;
|
|
488
507
|
|
|
489
|
-
const rightButtonProps = allowedToCreatePages
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
508
|
+
const rightButtonProps = allowedToCreatePages
|
|
509
|
+
? {
|
|
510
|
+
label: "New",
|
|
511
|
+
action: addNewAction,
|
|
512
|
+
disabled: !isDataEditable,
|
|
513
|
+
}
|
|
514
|
+
: undefined;
|
|
494
515
|
|
|
495
516
|
const options: { filters: IStructuredDataFilter[]; values: IStructuredDataValue[] } = {
|
|
496
517
|
filters: getOptionFilters(structuredData),
|
|
@@ -574,6 +595,16 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
574
595
|
? "These pages contains some errors, so you can not publish them yet. Please, review the errors on the pages."
|
|
575
596
|
: "This page contains some errors, so you can not publish it yet. Please, review the errors on the page.";
|
|
576
597
|
|
|
598
|
+
const labelCategory = isStructuredDataFromPage ? { categories: "Category" } : { related: "Category " };
|
|
599
|
+
|
|
600
|
+
let filterLabels = {
|
|
601
|
+
types: "Type",
|
|
602
|
+
liveStatus: "Live",
|
|
603
|
+
translated: "Translated",
|
|
604
|
+
filterSites: "Site",
|
|
605
|
+
...labelCategory,
|
|
606
|
+
};
|
|
607
|
+
|
|
577
608
|
return (
|
|
578
609
|
<MainWrapper
|
|
579
610
|
title="Global Data"
|
|
@@ -582,6 +613,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
582
613
|
language={languageProps.lang}
|
|
583
614
|
languageActions={languageProps.languageActions}
|
|
584
615
|
searchAction={setSearchQuery}
|
|
616
|
+
searchValue={searchQuery}
|
|
585
617
|
>
|
|
586
618
|
<S.StructuredDataWrapper ref={wrapperRef}>
|
|
587
619
|
<ContentFilters
|
|
@@ -615,6 +647,15 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
615
647
|
tableRef={tableRef}
|
|
616
648
|
>
|
|
617
649
|
<>
|
|
650
|
+
<S.SearchTags>
|
|
651
|
+
<SearchTagsBar query={searchQuery} setQuery={setSearchQuery} />
|
|
652
|
+
<FilterTagsBar
|
|
653
|
+
filters={filterValues[currentStructuredData?.id || "all"]}
|
|
654
|
+
setFilters={setFiltersSelection}
|
|
655
|
+
labels={filterLabels}
|
|
656
|
+
resetFilters={resetFilterQuery}
|
|
657
|
+
/>
|
|
658
|
+
</S.SearchTags>
|
|
618
659
|
{!isEmpty ? (
|
|
619
660
|
content
|
|
620
661
|
) : (
|
|
@@ -671,6 +712,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
671
712
|
currentSiteErrorPages: state.sites.currentSiteErrorPages,
|
|
672
713
|
skipReviewOnPublish: state.app.globalSettings.skipReviewOnPublish,
|
|
673
714
|
contentFilters: state.structuredData.contentFilters,
|
|
715
|
+
sites: state.sites.sites,
|
|
674
716
|
});
|
|
675
717
|
|
|
676
718
|
const mapDispatchToProps = {
|
|
@@ -741,6 +783,7 @@ interface ICategoriesProps {
|
|
|
741
783
|
currentSiteErrorPages: number[];
|
|
742
784
|
skipReviewOnPublish?: boolean;
|
|
743
785
|
contentFilters: Record<string, IStructuredDataQueryValues> | null;
|
|
786
|
+
sites: ISite[];
|
|
744
787
|
}
|
|
745
788
|
|
|
746
789
|
type IProps = ICategoriesProps & IDispatchProps;
|
|
@@ -29,4 +29,13 @@ const ModalContent = styled.div`
|
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const SearchTags = styled.div`
|
|
33
|
+
& > div:nth-child(1) {
|
|
34
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
35
|
+
}
|
|
36
|
+
& > div:nth-child(2) {
|
|
37
|
+
margin-bottom: ${(p) => p.theme.spacing.xs};
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export { StructuredDataWrapper, NotificationWrapper, TableListWrapper, EmptyWrapper, ModalContent, SearchTags };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { CheckField, TableCounter, NameFilter, PermissionsFilter, UsersFilter } from "@ax/components";
|
|
4
|
+
import { IQueryValue } from "@ax/types";
|
|
4
5
|
|
|
5
6
|
import * as S from "./style";
|
|
6
7
|
|
|
@@ -42,8 +43,7 @@ interface IProps {
|
|
|
42
43
|
totalItems: number;
|
|
43
44
|
isScrolling: boolean;
|
|
44
45
|
selectAllItems: () => void;
|
|
45
|
-
|
|
46
|
-
sortItems: any;
|
|
46
|
+
sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
|
|
47
47
|
sortedListStatus: any;
|
|
48
48
|
filterValues: any;
|
|
49
49
|
isSiteView: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BulkSelectionOptions } from "@ax/components";
|
|
3
3
|
import TableHeader from "./TableHeader";
|
|
4
|
-
import { IRole } from "@ax/types";
|
|
4
|
+
import { IQueryValue, IRole } from "@ax/types";
|
|
5
5
|
|
|
6
6
|
const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
7
7
|
const {
|
|
@@ -13,7 +13,6 @@ const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
|
13
13
|
totalItems,
|
|
14
14
|
isScrolling,
|
|
15
15
|
sortItems,
|
|
16
|
-
filterItems,
|
|
17
16
|
sortedListStatus,
|
|
18
17
|
filterValues,
|
|
19
18
|
isSiteView,
|
|
@@ -45,7 +44,6 @@ const BulkHeader = (props: IBulkHeaderProps): JSX.Element => {
|
|
|
45
44
|
filterValues={filterValues}
|
|
46
45
|
totalItems={totalItems}
|
|
47
46
|
selectAllItems={selectAllItems}
|
|
48
|
-
filterItems={filterItems}
|
|
49
47
|
isScrolling={isScrolling}
|
|
50
48
|
sortItems={sortItems}
|
|
51
49
|
sortedListStatus={sortedListStatus}
|
|
@@ -62,10 +60,9 @@ export interface IBulkHeaderProps {
|
|
|
62
60
|
selectAllItems: () => void;
|
|
63
61
|
totalItems: number;
|
|
64
62
|
isScrolling: boolean;
|
|
65
|
-
sortItems: (orderPointer:
|
|
63
|
+
sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
|
|
66
64
|
sortedListStatus: any;
|
|
67
65
|
filterValues: any;
|
|
68
|
-
filterItems: (filterPointer: string, filtersSelected: string) => void;
|
|
69
66
|
isSiteView: boolean;
|
|
70
67
|
roles: IRole[];
|
|
71
68
|
selectedRoles: number[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import { IRolesQueryValues } from "@ax/types";
|
|
2
|
+
import { IQueryValue, IRolesQueryValues } from "@ax/types";
|
|
3
3
|
|
|
4
4
|
const useSortedListStatus = (): any => {
|
|
5
5
|
const sortedInitialState: {
|
|
@@ -23,18 +23,25 @@ const useSortedListStatus = (): any => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const useFilterQuery = (): IRolesFilterQuery => {
|
|
26
|
-
const initialQueryValues = {
|
|
27
|
-
order:
|
|
26
|
+
const initialQueryValues: Record<string, IQueryValue[]> = {
|
|
27
|
+
order: [],
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const [query, setQuery] = useState(initialQueryValues);
|
|
31
|
+
const [currentFilterQuery, setCurrentFilterQuery] = useState("");
|
|
31
32
|
|
|
32
33
|
const setFilterQuery = (filterValues: IRolesQueryValues) => {
|
|
33
34
|
const { order } = filterValues;
|
|
34
35
|
let filterQuery = "";
|
|
35
36
|
|
|
36
|
-
const currentQuery = (pointer: string, values:
|
|
37
|
-
|
|
37
|
+
const currentQuery = (pointer: string, values: IQueryValue[]): string => {
|
|
38
|
+
const stringValues = Array.isArray(values) ? values.map((value) => value.value).join(",") : "";
|
|
39
|
+
|
|
40
|
+
return !stringValues.length
|
|
41
|
+
? filterQuery
|
|
42
|
+
: filterQuery.length
|
|
43
|
+
? filterQuery.concat(`&${pointer}=${stringValues}`)
|
|
44
|
+
: `?${pointer}=${stringValues}`;
|
|
38
45
|
};
|
|
39
46
|
|
|
40
47
|
const isNotInitialValue = (pointer: keyof IRolesQueryValues) => {
|
|
@@ -43,36 +50,38 @@ const useFilterQuery = (): IRolesFilterQuery => {
|
|
|
43
50
|
|
|
44
51
|
if (isNotInitialValue("order")) filterQuery = currentQuery("order", order);
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
setCurrentFilterQuery(filterQuery);
|
|
47
54
|
};
|
|
48
55
|
|
|
49
|
-
const setFiltersSelection = (pointer: string, filter:
|
|
56
|
+
const setFiltersSelection = (pointer: string, filter: IQueryValue[], isAscendent?: boolean) => {
|
|
50
57
|
const { order } = query;
|
|
51
58
|
const orderMethod = isAscendent ? "asc" : "desc";
|
|
52
59
|
const filterValues = {
|
|
53
|
-
order: pointer === "order" ? `${filter}-${orderMethod}
|
|
60
|
+
order: pointer === "order" ? [{ value: `${filter[0].value}-${orderMethod}`, label: filter[0].label }] : order,
|
|
54
61
|
};
|
|
55
62
|
|
|
56
63
|
setQuery(filterValues);
|
|
57
|
-
|
|
58
|
-
return filterValues;
|
|
64
|
+
setFilterQuery(filterValues);
|
|
59
65
|
};
|
|
60
66
|
|
|
61
|
-
const resetFilterQuery = () =>
|
|
67
|
+
const resetFilterQuery = () => {
|
|
68
|
+
setQuery(initialQueryValues);
|
|
69
|
+
setCurrentFilterQuery("");
|
|
70
|
+
}
|
|
62
71
|
|
|
63
72
|
return {
|
|
64
73
|
setFiltersSelection,
|
|
65
|
-
setFilterQuery,
|
|
66
74
|
resetFilterQuery,
|
|
67
75
|
filterValues: query,
|
|
76
|
+
filterQuery: currentFilterQuery,
|
|
68
77
|
};
|
|
69
78
|
};
|
|
70
79
|
|
|
71
80
|
interface IRolesFilterQuery {
|
|
72
|
-
setFiltersSelection(pointer: string, filter:
|
|
73
|
-
setFilterQuery(filterValues: IRolesQueryValues): string;
|
|
81
|
+
setFiltersSelection(pointer: string, filter: IQueryValue[], isAscendent?: boolean): void;
|
|
74
82
|
resetFilterQuery(): void;
|
|
75
|
-
filterValues:
|
|
83
|
+
filterValues: Record<string, IQueryValue[]>;
|
|
84
|
+
filterQuery: string;
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
export { useSortedListStatus, useFilterQuery };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
|
-
import { IRootState, IRole, IGetRoles, IActivateRole, ISite } from "@ax/types";
|
|
4
|
+
import { IRootState, IRole, IGetRoles, IActivateRole, ISite, IQueryValue } from "@ax/types";
|
|
5
5
|
import { useBulkSelection, useToast } from "@ax/hooks";
|
|
6
6
|
import { appActions } from "@ax/containers/App";
|
|
7
7
|
import { usersActions } from "@ax/containers/Users";
|
|
@@ -23,14 +23,13 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
23
23
|
|
|
24
24
|
const [page, setPage] = useState(1);
|
|
25
25
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
26
|
-
const [currentFilterQuery, setCurrentFilterQuery] = useState("");
|
|
27
26
|
const [activatedItems, setActivatedItems] = useState<number[]>([]);
|
|
28
27
|
const [undoToastActionValue, setUndoToastActionValue] = useState<boolean>(false);
|
|
29
28
|
const [isOpen, setIsOpen] = useState(false);
|
|
30
29
|
const [selectedRole, setSelectedRole] = useState<IRole | null>(null);
|
|
31
30
|
|
|
32
31
|
const { sortedListStatus, setSortedListStatus } = useSortedListStatus();
|
|
33
|
-
const { setFiltersSelection,
|
|
32
|
+
const { setFiltersSelection, filterValues } = useFilterQuery();
|
|
34
33
|
|
|
35
34
|
const tableRef = useRef<HTMLDivElement>(null);
|
|
36
35
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
|
@@ -52,10 +51,10 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
52
51
|
|
|
53
52
|
useEffect(() => {
|
|
54
53
|
const { order } = filterValues;
|
|
55
|
-
const handleGetRoles = async () => await getRoles({ siteId, order });
|
|
54
|
+
const handleGetRoles = async () => await getRoles({ siteId, order: order[0]?.value.toString() });
|
|
56
55
|
handleGetRoles();
|
|
57
56
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
-
}, [
|
|
57
|
+
}, [filterValues]);
|
|
59
58
|
|
|
60
59
|
useEffect(() => {
|
|
61
60
|
if (wrapperRef.current) {
|
|
@@ -86,20 +85,11 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
86
85
|
currPage: page,
|
|
87
86
|
};
|
|
88
87
|
|
|
89
|
-
const sortItems = async (orderPointer:
|
|
88
|
+
const sortItems = async (orderPointer: IQueryValue[], isAscending: boolean) => {
|
|
90
89
|
setPage(firstPage);
|
|
91
|
-
const sortedState = getSortedListStatus(orderPointer, isAscending);
|
|
90
|
+
const sortedState = getSortedListStatus(orderPointer[0].value.toString(), isAscending);
|
|
92
91
|
setSortedListStatus(sortedState);
|
|
93
|
-
|
|
94
|
-
const filterQuery = setFilterQuery(filtersSelection);
|
|
95
|
-
setCurrentFilterQuery(filterQuery);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const filterItems = async (filterPointer: string, filtersSelected: string) => {
|
|
99
|
-
setPage(firstPage);
|
|
100
|
-
const filtersSelection = setFiltersSelection(filterPointer, filtersSelected);
|
|
101
|
-
const filterQuery = setFilterQuery(filtersSelection);
|
|
102
|
-
setCurrentFilterQuery(filterQuery);
|
|
92
|
+
setFiltersSelection("order", orderPointer, isAscending);
|
|
103
93
|
};
|
|
104
94
|
|
|
105
95
|
const activateCurrentRoles = (active: boolean) => {
|
|
@@ -153,7 +143,6 @@ const Roles = (props: IRolesProps): JSX.Element => {
|
|
|
153
143
|
checkState={checkState}
|
|
154
144
|
isScrolling={isScrolling}
|
|
155
145
|
sortItems={sortItems}
|
|
156
|
-
filterItems={filterItems}
|
|
157
146
|
sortedListStatus={sortedListStatus}
|
|
158
147
|
isSiteView={isSiteView}
|
|
159
148
|
roles={roles}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import { CheckField, TableCounter, SiteFilter, NameFilter, RoleFilter } from "@ax/components";
|
|
4
|
-
import { IRole } from "@ax/types";
|
|
4
|
+
import { IQueryValue, IRole } from "@ax/types";
|
|
5
5
|
|
|
6
6
|
import * as S from "./style";
|
|
7
7
|
|
|
@@ -69,19 +69,6 @@ const TableHeader = (props: IProps): JSX.Element => {
|
|
|
69
69
|
pointer="filterSites"
|
|
70
70
|
center={false}
|
|
71
71
|
label="Sites"
|
|
72
|
-
selectAllOption="noFilter"
|
|
73
|
-
filters={[
|
|
74
|
-
{
|
|
75
|
-
name: "noFilter",
|
|
76
|
-
value: "noFilter",
|
|
77
|
-
title: "All",
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "all",
|
|
81
|
-
value: "all",
|
|
82
|
-
title: "Access to all sites",
|
|
83
|
-
},
|
|
84
|
-
]}
|
|
85
72
|
/>
|
|
86
73
|
</S.SiteWrapper>
|
|
87
74
|
<S.StatusHeader />
|
|
@@ -99,10 +86,10 @@ interface IProps {
|
|
|
99
86
|
isScrolling: boolean;
|
|
100
87
|
isSiteView: boolean;
|
|
101
88
|
selectAllItems: () => void;
|
|
102
|
-
filterItems: (filterPointer: string, filtersSelected:
|
|
103
|
-
sortItems:
|
|
104
|
-
sortedListStatus:
|
|
105
|
-
filterValues:
|
|
89
|
+
filterItems: (filterPointer: string, filtersSelected: IQueryValue[]) => void;
|
|
90
|
+
sortItems: (orderPointer: IQueryValue[], isAscending: boolean) => void;
|
|
91
|
+
sortedListStatus: { isAscending: boolean; sortedByName: boolean; sortedByDateCreated: boolean };
|
|
92
|
+
filterValues: Record<string, IQueryValue[]>;
|
|
106
93
|
roles: IRole[];
|
|
107
94
|
}
|
|
108
95
|
|