@griddo/ax 11.13.2 → 11.13.3-rc.1
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/jest/setup.js +10 -0
- package/package.json +2 -2
- package/src/GlobalStore.tsx +1 -1
- package/src/__tests__/components/Fields/AsyncCheckGroup/AsyncCheckGroup.test.tsx +276 -66
- package/src/__tests__/components/FloatingMenu/FloatingMenu.test.tsx +300 -99
- package/src/__tests__/modules/Settings/Social/Social.test.tsx +12 -4
- package/src/api/checkgroups.tsx +4 -3
- package/src/api/selects.tsx +12 -5
- package/src/components/ActionMenu/index.tsx +1 -3
- package/src/components/Browser/index.tsx +12 -3
- package/src/components/Browser/style.tsx +7 -0
- package/src/components/ConfigPanel/Form/index.tsx +47 -53
- package/src/components/Fields/AnalyticsField/PageAnalytics/atoms.tsx +9 -13
- package/src/components/Fields/AnalyticsField/PageAnalytics/index.tsx +37 -29
- package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/atoms.tsx +9 -13
- package/src/components/Fields/AnalyticsField/StructuredDataAnalytics/index.tsx +17 -11
- package/src/components/Fields/AnalyticsField/index.tsx +1 -2
- package/src/components/Fields/AnalyticsField/utils.tsx +4 -4
- package/src/components/Fields/AsyncCheckGroup/index.tsx +97 -79
- package/src/components/Fields/AsyncSelect/index.tsx +33 -22
- package/src/components/Fields/DateField/DatePickerInput/index.tsx +2 -2
- package/src/components/Fields/DateField/index.tsx +3 -3
- package/src/components/Fields/IntegrationsField/SideModal/index.tsx +2 -2
- package/src/components/Fields/IntegrationsField/index.tsx +14 -10
- package/src/components/Fields/MultiCheckSelect/index.tsx +6 -6
- package/src/components/Fields/MultiCheckSelectGroup/index.tsx +39 -37
- package/src/components/Fields/MultiCheckSelectGroup/style.tsx +1 -1
- package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +0 -2
- package/src/components/Fields/RichText/index.tsx +15 -7
- package/src/components/Fields/TextArea/index.tsx +9 -6
- package/src/components/FloatingMenu/index.tsx +32 -31
- package/src/components/FloatingMenu/style.tsx +23 -5
- package/src/components/Loader/components/SmallCircle.js +3 -3
- package/src/components/MainWrapper/AppBar/style.tsx +1 -0
- package/src/components/SideModal/index.tsx +1 -1
- package/src/components/TableFilters/CategoryFilter/index.tsx +14 -15
- package/src/containers/App/actions.tsx +7 -1
- package/src/containers/App/constants.tsx +2 -0
- package/src/containers/App/interfaces.tsx +5 -0
- package/src/containers/App/reducer.tsx +11 -2
- package/src/containers/Forms/actions.tsx +5 -7
- package/src/containers/Integrations/actions.tsx +1 -3
- package/src/containers/Navigation/Menu/actions.tsx +2 -2
- package/src/containers/PageEditor/actions.tsx +3 -2
- package/src/containers/Settings/DataPacks/actions.tsx +35 -29
- package/src/containers/Sites/actions.tsx +40 -33
- package/src/containers/StructuredData/actions.tsx +3 -9
- package/src/modules/ActivityLog/LogFilters/DateFilter/index.tsx +5 -4
- package/src/modules/Content/NewContentModal/PageImporter/index.tsx +1 -2
- package/src/modules/Content/index.tsx +8 -3
- package/src/modules/Content/style.tsx +7 -0
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +58 -45
- package/src/modules/Navigation/Defaults/index.tsx +103 -104
- package/src/modules/PageEditor/index.tsx +9 -1
- package/src/modules/PublicPreview/index.tsx +2 -1
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/index.tsx +60 -44
- package/src/modules/Settings/ContentTypes/DataPacks/Config/index.tsx +32 -37
- package/src/modules/Sites/index.tsx +3 -3
- package/src/modules/Users/UserList/index.tsx +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dispatch } from "redux";
|
|
1
|
+
import type { Dispatch } from "redux";
|
|
2
2
|
|
|
3
3
|
import { filterThemeDatapacks, handleRequest, sortBy } from "@ax/helpers";
|
|
4
4
|
import { dataPack } from "@ax/api";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
ERROR_CODE,
|
|
17
17
|
} from "./constants";
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import type {
|
|
20
20
|
ISetActivated,
|
|
21
21
|
ISetSelected,
|
|
22
22
|
ISetConfigFormData,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
ISetModules,
|
|
26
26
|
ISetTemplates,
|
|
27
27
|
} from "./interfaces";
|
|
28
|
-
import { IDataPack, IDataPackCategory, IRootState } from "@ax/types";
|
|
28
|
+
import type { IDataPack, IDataPackCategory, IRootState } from "@ax/types";
|
|
29
29
|
import { dataPacksInitialState } from "./reducer";
|
|
30
30
|
|
|
31
31
|
function setActivated(activated: any): ISetActivated {
|
|
@@ -78,13 +78,13 @@ function getAllDataPacks(queryParams?: string): (dispatch: Dispatch) => Promise<
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function getSiteDataPacks(queryParams?: string): (dispatch: Dispatch, getState:
|
|
81
|
+
function getSiteDataPacks(queryParams?: string): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
82
82
|
return async (dispatch, getState) => {
|
|
83
83
|
try {
|
|
84
84
|
const {
|
|
85
85
|
sites: { currentSiteInfo },
|
|
86
86
|
} = getState();
|
|
87
|
-
const currentSiteID = currentSiteInfo
|
|
87
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
88
88
|
|
|
89
89
|
const getDataPacks = (data: any) => {
|
|
90
90
|
const orderedData = data.sort(sortBy("title", false));
|
|
@@ -107,17 +107,17 @@ function getSiteDataPacks(queryParams?: string): (dispatch: Dispatch, getState:
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
function getSiteDataPack(packID: string): (dispatch: Dispatch, getState:
|
|
110
|
+
function getSiteDataPack(packID: string): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
111
111
|
return async (dispatch, getState) => {
|
|
112
112
|
try {
|
|
113
113
|
const {
|
|
114
114
|
sites: { currentSiteInfo },
|
|
115
115
|
} = getState();
|
|
116
|
-
const currentSiteID = currentSiteInfo
|
|
116
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
117
117
|
|
|
118
118
|
const setDataPack = (pack: IDataPack) => {
|
|
119
119
|
dispatch(setSelected(pack));
|
|
120
|
-
const config = pack
|
|
120
|
+
const config = pack?.config;
|
|
121
121
|
const isEmptyConfig = !config || Object.keys(config).length === 0;
|
|
122
122
|
|
|
123
123
|
if (isEmptyConfig) {
|
|
@@ -141,16 +141,18 @@ function getSiteDataPack(packID: string): (dispatch: Dispatch, getState: any) =>
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
function getActivatedDataPack(
|
|
144
|
+
function getActivatedDataPack(
|
|
145
|
+
packID: string | null,
|
|
146
|
+
): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
145
147
|
return async (dispatch, getState) => {
|
|
146
148
|
try {
|
|
147
149
|
const {
|
|
148
150
|
dataPacks: { activated },
|
|
149
151
|
} = getState();
|
|
150
|
-
const selectedDataPack = packID ? activated
|
|
152
|
+
const selectedDataPack = packID ? activated?.find((pack: any) => pack.id === packID) : null;
|
|
151
153
|
|
|
152
154
|
dispatch(setSelected(selectedDataPack));
|
|
153
|
-
const config = selectedDataPack
|
|
155
|
+
const config = selectedDataPack?.config;
|
|
154
156
|
const isEmptyConfig = !config || Object.keys(config).length === 0;
|
|
155
157
|
|
|
156
158
|
if (isEmptyConfig) {
|
|
@@ -168,13 +170,13 @@ function deleteSiteDataPack(
|
|
|
168
170
|
dataPackID: string,
|
|
169
171
|
errorAction: any,
|
|
170
172
|
force?: boolean,
|
|
171
|
-
): (dispatch: Dispatch, getState:
|
|
173
|
+
): (dispatch: Dispatch, getState: () => IRootState) => Promise<boolean> {
|
|
172
174
|
return async (dispatch, getState) => {
|
|
173
175
|
try {
|
|
174
176
|
const {
|
|
175
177
|
sites: { currentSiteInfo },
|
|
176
178
|
} = getState();
|
|
177
|
-
const currentSiteID = currentSiteInfo
|
|
179
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
178
180
|
const getActivatedQuery = "?status=activated";
|
|
179
181
|
|
|
180
182
|
const handleSuccess = () => {
|
|
@@ -203,17 +205,17 @@ function deleteSiteDataPack(
|
|
|
203
205
|
};
|
|
204
206
|
}
|
|
205
207
|
|
|
206
|
-
function updateDataPack(dataPackID: string): (dispatch: Dispatch, getState:
|
|
208
|
+
function updateDataPack(dataPackID: string): (dispatch: Dispatch, getState: () => IRootState) => Promise<boolean> {
|
|
207
209
|
return async (dispatch, getState) => {
|
|
208
210
|
try {
|
|
209
211
|
const {
|
|
210
212
|
sites: { currentSiteInfo },
|
|
211
213
|
dataPacks: { configFormData },
|
|
212
214
|
} = getState();
|
|
213
|
-
const currentSiteID = currentSiteInfo
|
|
215
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
214
216
|
|
|
215
217
|
const setUpdatedPack = (selectedPack: any) => {
|
|
216
|
-
const config = selectedPack
|
|
218
|
+
const config = selectedPack?.config;
|
|
217
219
|
const getActivatedQuery = "?status=activated";
|
|
218
220
|
|
|
219
221
|
dispatch(setSelected(selectedPack));
|
|
@@ -239,7 +241,7 @@ function updateDataPack(dataPackID: string): (dispatch: Dispatch, getState: any)
|
|
|
239
241
|
};
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
function updateFormValue(valueObj: any): (dispatch: Dispatch, getState:
|
|
244
|
+
function updateFormValue(valueObj: any): (dispatch: Dispatch, getState: () => IRootState) => void {
|
|
243
245
|
return (dispatch, getState) => {
|
|
244
246
|
const {
|
|
245
247
|
dataPacks: { configFormData },
|
|
@@ -259,7 +261,7 @@ function resetForm(): (dispatch: Dispatch) => void {
|
|
|
259
261
|
function getAvailableSiteDataPacks(
|
|
260
262
|
queryParams: string | null,
|
|
261
263
|
loading = true,
|
|
262
|
-
): (dispatch: Dispatch, getState:
|
|
264
|
+
): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
263
265
|
return async (dispatch, getState) => {
|
|
264
266
|
try {
|
|
265
267
|
const {
|
|
@@ -293,13 +295,13 @@ function getAvailableSiteDataPacks(
|
|
|
293
295
|
function addSiteDataPack(
|
|
294
296
|
dataPackID: string,
|
|
295
297
|
fromConfig?: boolean,
|
|
296
|
-
): (dispatch: Dispatch, getState:
|
|
298
|
+
): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
297
299
|
return async (dispatch, getState) => {
|
|
298
300
|
try {
|
|
299
301
|
const {
|
|
300
302
|
sites: { currentSiteInfo },
|
|
301
303
|
} = getState();
|
|
302
|
-
const currentSiteID = currentSiteInfo
|
|
304
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
303
305
|
const getActivatedQuery = "?status=activated";
|
|
304
306
|
|
|
305
307
|
const getPacks = () => {
|
|
@@ -339,17 +341,19 @@ function getDataPacksCategories(): (dispatch: Dispatch) => Promise<void> {
|
|
|
339
341
|
};
|
|
340
342
|
}
|
|
341
343
|
|
|
342
|
-
function getSiteModules(): (dispatch: Dispatch, getState:
|
|
344
|
+
function getSiteModules(): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
343
345
|
return async (dispatch, getState) => {
|
|
344
346
|
try {
|
|
345
347
|
const {
|
|
346
348
|
sites: { currentSiteInfo },
|
|
347
349
|
} = getState();
|
|
348
|
-
const currentSiteID = currentSiteInfo
|
|
350
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
349
351
|
|
|
350
352
|
const modulesIds: string[] = [];
|
|
351
353
|
const setModulesID = (data: any) => {
|
|
352
|
-
data.forEach((module: any) =>
|
|
354
|
+
data.forEach((module: any) => {
|
|
355
|
+
modulesIds.push(module.id);
|
|
356
|
+
});
|
|
353
357
|
dispatch(setModules(modulesIds));
|
|
354
358
|
};
|
|
355
359
|
const responseActions = {
|
|
@@ -366,13 +370,13 @@ function getSiteModules(): (dispatch: Dispatch, getState: any) => Promise<void>
|
|
|
366
370
|
};
|
|
367
371
|
}
|
|
368
372
|
|
|
369
|
-
function getSiteTemplates(): (dispatch: Dispatch, getState:
|
|
373
|
+
function getSiteTemplates(): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
370
374
|
return async (dispatch, getState) => {
|
|
371
375
|
try {
|
|
372
376
|
const {
|
|
373
377
|
sites: { currentSiteInfo },
|
|
374
378
|
} = getState();
|
|
375
|
-
const currentSiteID = currentSiteInfo
|
|
379
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
376
380
|
|
|
377
381
|
const responseActions = {
|
|
378
382
|
handleSuccess: (data: any) => {
|
|
@@ -390,13 +394,15 @@ function getSiteTemplates(): (dispatch: Dispatch, getState: any) => Promise<void
|
|
|
390
394
|
};
|
|
391
395
|
}
|
|
392
396
|
|
|
393
|
-
function getSiteDataPackbyTemplate(
|
|
397
|
+
function getSiteDataPackbyTemplate(
|
|
398
|
+
templateType: string,
|
|
399
|
+
): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
394
400
|
return async (dispatch, getState) => {
|
|
395
401
|
try {
|
|
396
402
|
const {
|
|
397
403
|
sites: { currentSiteInfo },
|
|
398
404
|
} = getState();
|
|
399
|
-
const currentSiteID = currentSiteInfo
|
|
405
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
400
406
|
const getQuery = "?status=deactivated";
|
|
401
407
|
|
|
402
408
|
const setDataPack = (data: IDataPack[]) => {
|
|
@@ -422,13 +428,13 @@ function getSiteDataPackbyTemplate(templateType: string): (dispatch: Dispatch, g
|
|
|
422
428
|
};
|
|
423
429
|
}
|
|
424
430
|
|
|
425
|
-
function getSiteDataPackbyModule(module: string): (dispatch: Dispatch, getState:
|
|
431
|
+
function getSiteDataPackbyModule(module: string): (dispatch: Dispatch, getState: () => IRootState) => Promise<void> {
|
|
426
432
|
return async (dispatch, getState) => {
|
|
427
433
|
try {
|
|
428
434
|
const {
|
|
429
435
|
sites: { currentSiteInfo },
|
|
430
436
|
} = getState();
|
|
431
|
-
const currentSiteID = currentSiteInfo
|
|
437
|
+
const currentSiteID = currentSiteInfo!.id;
|
|
432
438
|
const getQuery = "?status=deactivated";
|
|
433
439
|
|
|
434
440
|
const setDataPack = (data: IDataPack[]) => {
|
|
@@ -9,7 +9,7 @@ import { socialActions } from "@ax/containers/Settings/Social";
|
|
|
9
9
|
import { structuredDataActions } from "@ax/containers/StructuredData";
|
|
10
10
|
import { usersActions } from "@ax/containers/Users";
|
|
11
11
|
import { getDefaultTheme, getThemeElements, handleRequest, isReqOk, sortBy } from "@ax/helpers";
|
|
12
|
-
import {
|
|
12
|
+
import type {
|
|
13
13
|
IGetGlobalPagesParams,
|
|
14
14
|
IGetSitePagesParams,
|
|
15
15
|
IGetSitesParams,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
IThemeElements,
|
|
23
23
|
} from "@ax/types";
|
|
24
24
|
|
|
25
|
-
import { Dispatch } from "redux";
|
|
25
|
+
import type { Dispatch } from "redux";
|
|
26
26
|
|
|
27
27
|
import {
|
|
28
28
|
DEFAULT_PARAMS,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
SET_THEME_ELEMENTS,
|
|
45
45
|
SET_TOTAL_ITEMS,
|
|
46
46
|
} from "./constants";
|
|
47
|
-
import {
|
|
47
|
+
import type {
|
|
48
48
|
ISetAllSitePagesAction,
|
|
49
49
|
ISetConfig,
|
|
50
50
|
ISetContentFilters,
|
|
@@ -270,7 +270,8 @@ function setSiteInfo(currentSiteInfo: ISite): (dispatch: Dispatch, getState: ()
|
|
|
270
270
|
resetSiteValues(currentSiteInfo.id)(dispatch);
|
|
271
271
|
structuredDataActions.resetStructuredData()(dispatch);
|
|
272
272
|
dispatch(setCurrentSiteInfo(currentSiteInfo));
|
|
273
|
-
|
|
273
|
+
|
|
274
|
+
await getRoles({ siteId: currentSiteInfo.id })(dispatch);
|
|
274
275
|
|
|
275
276
|
const themeElements = getThemeElements(currentSiteInfo.theme) || null;
|
|
276
277
|
dispatch(setThemeElements(themeElements));
|
|
@@ -341,6 +342,8 @@ function setSiteInfo(currentSiteInfo: ISite): (dispatch: Dispatch, getState: ()
|
|
|
341
342
|
getUserCurrentPermissions()(dispatch, getState);
|
|
342
343
|
|
|
343
344
|
await sites.setSiteActivity(currentSiteInfo.id);
|
|
345
|
+
|
|
346
|
+
dispatch(appActions.setIsLoading(false));
|
|
344
347
|
} catch (e) {
|
|
345
348
|
console.log(e);
|
|
346
349
|
}
|
|
@@ -388,19 +391,21 @@ function getSitePages(
|
|
|
388
391
|
): (dispatch: Dispatch) => Promise<void> {
|
|
389
392
|
return async (dispatch) => {
|
|
390
393
|
try {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
394
|
+
const responseActions = {
|
|
395
|
+
handleSuccess: (response: any) => {
|
|
396
|
+
const { items, totalItems } = response;
|
|
397
|
+
dispatch(setCurrentSitePages(items));
|
|
398
|
+
dispatch(setTotalItems(totalItems));
|
|
399
|
+
},
|
|
400
|
+
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
401
|
+
};
|
|
395
402
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
dispatch(appActions.setIsLoading(false));
|
|
403
|
+
const callback = async () =>
|
|
404
|
+
structuredData
|
|
405
|
+
? await sites.getStructuredSitePages(params, structuredData, filterQuery)
|
|
406
|
+
: await sites.getSitePages(params, filterQuery);
|
|
407
|
+
|
|
408
|
+
await handleRequest(callback, responseActions, [appActions.setIsLoading])(dispatch);
|
|
404
409
|
} catch (e) {
|
|
405
410
|
console.log(e);
|
|
406
411
|
}
|
|
@@ -430,26 +435,28 @@ function getAllSitePages(params: IGetSitePagesParams): (dispatch: Dispatch) => P
|
|
|
430
435
|
function getSiteLanguages(siteID: number): (dispatch: Dispatch) => Promise<void> {
|
|
431
436
|
return async (dispatch) => {
|
|
432
437
|
try {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (isReqOk(response.status)) {
|
|
437
|
-
const siteLanguages = response.data.items;
|
|
438
|
+
const responseActions = {
|
|
439
|
+
handleSuccess: (response: any) => {
|
|
440
|
+
const siteLanguages = response.items;
|
|
438
441
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
const defaultLanguage = siteLanguages.find((language: any) => language.isDefault);
|
|
443
|
+
const { locale, id } = defaultLanguage;
|
|
444
|
+
const lang = {
|
|
445
|
+
locale,
|
|
446
|
+
id,
|
|
447
|
+
};
|
|
445
448
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
449
|
+
dispatch(setLanguage(lang));
|
|
450
|
+
dispatch(setCurrentSiteLanguages(siteLanguages));
|
|
451
|
+
},
|
|
452
|
+
handleError: (response: any) => appActions.handleError(response)(dispatch),
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
const callback = async () => await languages.getSiteLanguages(siteID);
|
|
456
|
+
|
|
457
|
+
await handleRequest(callback, responseActions, [appActions.setIsLoading])(dispatch);
|
|
451
458
|
} catch (e) {
|
|
452
|
-
console.log(e);
|
|
459
|
+
console.log(e);
|
|
453
460
|
}
|
|
454
461
|
};
|
|
455
462
|
}
|
|
@@ -401,8 +401,6 @@ function deleteStructuredDataContent(
|
|
|
401
401
|
): (dispatch: Dispatch, getState: () => IRootState) => Promise<boolean> {
|
|
402
402
|
return async (dispatch, getState) => {
|
|
403
403
|
try {
|
|
404
|
-
dispatch(setIsLoading(true));
|
|
405
|
-
|
|
406
404
|
const {
|
|
407
405
|
structuredData: { currentFilter, currentStructuredData },
|
|
408
406
|
sites: { currentSiteInfo, currentFilter: currentSiteFilter },
|
|
@@ -431,7 +429,7 @@ function deleteStructuredDataContent(
|
|
|
431
429
|
const callback = async () =>
|
|
432
430
|
Array.isArray(id) ? structuredData.deleteDataContentBulk(id) : structuredData.deleteDataContent(id);
|
|
433
431
|
|
|
434
|
-
return await handleRequest(callback, responseActions, [])(dispatch);
|
|
432
|
+
return await handleRequest(callback, responseActions, [setIsLoading])(dispatch);
|
|
435
433
|
} catch (e) {
|
|
436
434
|
console.log(e);
|
|
437
435
|
return false;
|
|
@@ -444,8 +442,6 @@ function restoreStructuredDataContent(
|
|
|
444
442
|
): (dispatch: Dispatch, getState: () => IRootState) => Promise<boolean> {
|
|
445
443
|
return async (dispatch, getState) => {
|
|
446
444
|
try {
|
|
447
|
-
dispatch(setIsLoading(true));
|
|
448
|
-
|
|
449
445
|
const {
|
|
450
446
|
structuredData: { currentFilter },
|
|
451
447
|
sites: { currentSiteInfo, currentFilter: currentSiteFilter },
|
|
@@ -472,7 +468,7 @@ function restoreStructuredDataContent(
|
|
|
472
468
|
? structuredData.restoreDataContentBulk(dataID)
|
|
473
469
|
: structuredData.restoreDataContent(dataID);
|
|
474
470
|
|
|
475
|
-
return await handleRequest(callback, responseActions, [])(dispatch);
|
|
471
|
+
return await handleRequest(callback, responseActions, [setIsLoading])(dispatch);
|
|
476
472
|
} catch (e) {
|
|
477
473
|
console.log(e);
|
|
478
474
|
return false;
|
|
@@ -711,8 +707,6 @@ function deleteCategoryGroup(
|
|
|
711
707
|
|
|
712
708
|
if (!currentStructuredData) return false;
|
|
713
709
|
|
|
714
|
-
dispatch(setIsLoading(true));
|
|
715
|
-
|
|
716
710
|
const params = { ...DEFAULT_PARAMS, dataID: currentFilter, groupingCategories: true };
|
|
717
711
|
|
|
718
712
|
const siteID = currentSiteInfo ? currentSiteInfo.id : "global";
|
|
@@ -734,7 +728,7 @@ function deleteCategoryGroup(
|
|
|
734
728
|
? structuredData.deleteGroupBulk(currentStructuredData.id, siteID, id, deleteChildren)
|
|
735
729
|
: structuredData.deleteGroup(currentStructuredData.id, siteID, id, deleteChildren);
|
|
736
730
|
|
|
737
|
-
return await handleRequest(callback, responseActions, [])(dispatch);
|
|
731
|
+
return await handleRequest(callback, responseActions, [setIsLoading])(dispatch);
|
|
738
732
|
} catch (e) {
|
|
739
733
|
console.log(e);
|
|
740
734
|
return false;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
import DatePicker, { registerLocale } from "react-datepicker";
|
|
3
3
|
import "react-datepicker/dist/react-datepicker.css";
|
|
4
|
-
import en from "date-fns/locale/en-GB";
|
|
5
4
|
|
|
6
|
-
import { IQueryValue } from "@ax/types";
|
|
7
5
|
import { Button, FloatingMenu, Icon } from "@ax/components";
|
|
8
6
|
import { dateToString, stringToDate } from "@ax/helpers";
|
|
7
|
+
import type { IQueryValue } from "@ax/types";
|
|
8
|
+
|
|
9
|
+
import en from "date-fns/locale/en-GB";
|
|
9
10
|
|
|
10
11
|
import * as S from "./style";
|
|
11
12
|
|
|
@@ -74,7 +75,7 @@ const ContentFilter = (props: IContentFilterProps): JSX.Element => {
|
|
|
74
75
|
</S.DatePickerWrapper>
|
|
75
76
|
{!!startDate && (
|
|
76
77
|
<S.ButtonWrapper>
|
|
77
|
-
<Button type="button" onClick={handleClick} buttonStyle="minimal">
|
|
78
|
+
<Button type="button" onClick={handleClick} buttonStyle="minimal" data-close-menu>
|
|
78
79
|
Apply
|
|
79
80
|
</Button>
|
|
80
81
|
</S.ButtonWrapper>
|
|
@@ -49,11 +49,10 @@ const PageImporter = (props: IPageImporterProps) => {
|
|
|
49
49
|
} = response;
|
|
50
50
|
setPages(items);
|
|
51
51
|
if (!allPages) setAllPages(items);
|
|
52
|
-
setIsLoading(false);
|
|
53
52
|
}
|
|
53
|
+
setIsLoading(false);
|
|
54
54
|
} catch (error) {
|
|
55
55
|
console.log(error);
|
|
56
|
-
setIsLoading(false);
|
|
57
56
|
}
|
|
58
57
|
};
|
|
59
58
|
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
EmptyState,
|
|
7
7
|
ErrorToast,
|
|
8
8
|
FilterTagsBar,
|
|
9
|
+
Loading,
|
|
9
10
|
MainWrapper,
|
|
10
11
|
Notification,
|
|
11
12
|
SearchTagsBar,
|
|
@@ -941,12 +942,16 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
941
942
|
labels={filterLabels}
|
|
942
943
|
/>
|
|
943
944
|
</S.SearchTags>
|
|
944
|
-
{
|
|
945
|
-
|
|
946
|
-
|
|
945
|
+
{isLoading ? (
|
|
946
|
+
<S.LoadingWrapper>
|
|
947
|
+
<Loading />
|
|
948
|
+
</S.LoadingWrapper>
|
|
949
|
+
) : isEmpty ? (
|
|
947
950
|
<S.EmptyWrapper>
|
|
948
951
|
<EmptyState {...emptyStateProps} />
|
|
949
952
|
</S.EmptyWrapper>
|
|
953
|
+
) : (
|
|
954
|
+
<>{content}</>
|
|
950
955
|
)}
|
|
951
956
|
</TableList>
|
|
952
957
|
</S.TableWrapper>
|
|
@@ -55,11 +55,18 @@ const SearchTags = styled.div`
|
|
|
55
55
|
}
|
|
56
56
|
`;
|
|
57
57
|
|
|
58
|
+
const LoadingWrapper = styled.div`
|
|
59
|
+
position: relative;
|
|
60
|
+
width: 100%;
|
|
61
|
+
height: 100%;
|
|
62
|
+
`;
|
|
63
|
+
|
|
58
64
|
export {
|
|
59
65
|
ContentListWrapper,
|
|
60
66
|
TableWrapper,
|
|
61
67
|
PaginationWrapper,
|
|
62
68
|
EmptyWrapper,
|
|
69
|
+
LoadingWrapper,
|
|
63
70
|
ModalContent,
|
|
64
71
|
SelectWrapper,
|
|
65
72
|
NotificationWrapper,
|