@griddo/ax 10.1.7 → 10.1.8
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/ConfigPanel/Form/ConnectedField/PageConnectedField/PageConnectedField.test.tsx +0 -125
- package/src/__tests__/components/ConfigPanel/NavigationForm/Field/Field.test.tsx +1 -1
- package/src/__tests__/components/ConfigPanel/NavigationForm/NavigationForm.test.tsx +1 -1
- package/src/__tests__/components/ConfigPanel/PreviewForm/PreviewForm.test.tsx +1 -1
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +6 -11
- package/src/forms/editor.tsx +0 -2
- package/src/helpers/index.tsx +0 -2
- package/src/helpers/structuredData.tsx +0 -18
- package/src/modules/Categories/CategoriesList/index.tsx +1 -3
- package/src/modules/Content/OptionTable/index.tsx +3 -1
- package/src/modules/Content/atoms.tsx +2 -1
- package/src/modules/Content/index.tsx +20 -8
- package/src/modules/Content/style.tsx +5 -1
- package/src/modules/Content/utils.tsx +7 -4
- package/src/modules/StructuredData/StructuredDataList/StructuredDataItem/index.tsx +1 -1
- package/src/schemas/pages/Page.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "10.1.
|
|
4
|
+
"version": "10.1.8",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -230,5 +230,5 @@
|
|
|
230
230
|
"publishConfig": {
|
|
231
231
|
"access": "public"
|
|
232
232
|
},
|
|
233
|
-
"gitHead": "
|
|
233
|
+
"gitHead": "beece9baa3c2f75bc75623566056e4b162a94178"
|
|
234
234
|
}
|
|
@@ -177,73 +177,6 @@ describe("PageConnectedField component rendering", () => {
|
|
|
177
177
|
expect(templateText).toBeInTheDocument();
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
it("should call updateEditorContent and overWriteHeaderConfig if isOverride", () => {
|
|
181
|
-
const initialStore = {
|
|
182
|
-
pageEditor: {
|
|
183
|
-
selectedEditorID: 1,
|
|
184
|
-
selectedContent: {
|
|
185
|
-
type: "header",
|
|
186
|
-
isHome: true,
|
|
187
|
-
title: {
|
|
188
|
-
component: "Page",
|
|
189
|
-
templateType: "default",
|
|
190
|
-
},
|
|
191
|
-
template: {
|
|
192
|
-
type: "template",
|
|
193
|
-
templateType: "BasicTemplate",
|
|
194
|
-
heroSection: {
|
|
195
|
-
component: "Section",
|
|
196
|
-
name: "Hero Section",
|
|
197
|
-
modules: [],
|
|
198
|
-
sectionPosition: 1,
|
|
199
|
-
editorID: 2,
|
|
200
|
-
parentEditorID: 1,
|
|
201
|
-
key: "heroSection",
|
|
202
|
-
},
|
|
203
|
-
editorID: 1,
|
|
204
|
-
parentEditorID: 0,
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
editorContent: {
|
|
208
|
-
isHome: true,
|
|
209
|
-
setAsHome: true,
|
|
210
|
-
editorContent: {
|
|
211
|
-
headerConfig: {},
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
errors: [{}],
|
|
215
|
-
},
|
|
216
|
-
sites: {
|
|
217
|
-
currentSitePages: [
|
|
218
|
-
{
|
|
219
|
-
editorID: 1,
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
},
|
|
223
|
-
app: {
|
|
224
|
-
lang: { locale: "es-ES", id: 0 },
|
|
225
|
-
},
|
|
226
|
-
dataPacks: {
|
|
227
|
-
templates: [{ id: "default" }, { id: "BasicTemplate" }],
|
|
228
|
-
activated: [],
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const store = mockStore(initialStore);
|
|
233
|
-
|
|
234
|
-
render(
|
|
235
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
236
|
-
<PageConnectedField {...defaultProps} />
|
|
237
|
-
</ThemeProvider>,
|
|
238
|
-
{ store }
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
expect(store.getActions()).toContainEqual({
|
|
242
|
-
payload: { editorContent: initialStore.pageEditor.editorContent },
|
|
243
|
-
type: "pageEditor/SET_EDITOR_CONTENT",
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
|
|
247
180
|
it("should call getPageBreadCrumb", () => {
|
|
248
181
|
defaultProps.field.key = "parent";
|
|
249
182
|
const initialStore = {
|
|
@@ -256,61 +189,6 @@ describe("PageConnectedField component rendering", () => {
|
|
|
256
189
|
},
|
|
257
190
|
editorContent: {
|
|
258
191
|
isHome: false,
|
|
259
|
-
setAsHome: false,
|
|
260
|
-
editorContent: {
|
|
261
|
-
headerConfig: {},
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
errors: [{}],
|
|
265
|
-
},
|
|
266
|
-
sites: {
|
|
267
|
-
currentSitePages: [
|
|
268
|
-
{
|
|
269
|
-
editorID: 1,
|
|
270
|
-
},
|
|
271
|
-
],
|
|
272
|
-
},
|
|
273
|
-
app: {
|
|
274
|
-
lang: { locale: "es-ES", id: 0 },
|
|
275
|
-
},
|
|
276
|
-
dataPacks: {
|
|
277
|
-
templates: [{ id: "default" }, { id: "BasicTemplate" }],
|
|
278
|
-
activated: [],
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
const store = mockStore(initialStore);
|
|
283
|
-
const component = (
|
|
284
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
285
|
-
<PageConnectedField {...defaultProps} />
|
|
286
|
-
</ThemeProvider>
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
render(component, { store });
|
|
290
|
-
|
|
291
|
-
// It's loading Field -> FieldContainer with a TextField
|
|
292
|
-
const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
|
|
293
|
-
expect(inputComponent).toBeTruthy();
|
|
294
|
-
fireEvent.change(inputComponent, { target: { value: "value" } });
|
|
295
|
-
expect(store.getActions()).toContainEqual({
|
|
296
|
-
payload: { editorContent: initialStore.pageEditor.editorContent },
|
|
297
|
-
type: "pageEditor/SET_EDITOR_CONTENT",
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it("should call updateEditorContent if key is setAsHome", () => {
|
|
302
|
-
defaultProps.field.key = "setAsHome";
|
|
303
|
-
const initialStore = {
|
|
304
|
-
pageEditor: {
|
|
305
|
-
selectedEditorID: 1,
|
|
306
|
-
selectedContent: {
|
|
307
|
-
type: "TextField",
|
|
308
|
-
isHome: false,
|
|
309
|
-
component: "Image",
|
|
310
|
-
},
|
|
311
|
-
editorContent: {
|
|
312
|
-
isHome: false,
|
|
313
|
-
setAsHome: false,
|
|
314
192
|
editorContent: {
|
|
315
193
|
headerConfig: {},
|
|
316
194
|
},
|
|
@@ -364,7 +242,6 @@ describe("PageConnectedField component rendering", () => {
|
|
|
364
242
|
},
|
|
365
243
|
editorContent: {
|
|
366
244
|
isHome: false,
|
|
367
|
-
setAsHome: false,
|
|
368
245
|
editorContent: {
|
|
369
246
|
headerConfig: {},
|
|
370
247
|
},
|
|
@@ -418,7 +295,6 @@ describe("PageConnectedField component rendering", () => {
|
|
|
418
295
|
},
|
|
419
296
|
editorContent: {
|
|
420
297
|
isHome: false,
|
|
421
|
-
setAsHome: false,
|
|
422
298
|
editorContent: {
|
|
423
299
|
headerConfig: {},
|
|
424
300
|
},
|
|
@@ -474,7 +350,6 @@ describe("PageConnectedField component rendering", () => {
|
|
|
474
350
|
},
|
|
475
351
|
editorContent: {
|
|
476
352
|
isHome: false,
|
|
477
|
-
setAsHome: false,
|
|
478
353
|
editorContent: {
|
|
479
354
|
headerConfig: {},
|
|
480
355
|
},
|
|
@@ -45,7 +45,7 @@ const PageConnectedField = (props: any) => {
|
|
|
45
45
|
const overrideableFields = ["header", "footer"];
|
|
46
46
|
const isOverride = selectedContent.type && overrideableFields.includes(selectedContent.type);
|
|
47
47
|
const isPageHome = componentType === "page" && selectedContent.isHome;
|
|
48
|
-
const allowModifySlug = !selectedContent.id && !selectedContent.
|
|
48
|
+
const allowModifySlug = !selectedContent.id && !selectedContent.isHome;
|
|
49
49
|
const isNewPage = componentType === "page" && !selectedContent.id;
|
|
50
50
|
const error = errors.find((err: any) => err.editorID === selectedEditorID && err.key === objKey);
|
|
51
51
|
|
|
@@ -70,7 +70,7 @@ const PageConnectedField = (props: any) => {
|
|
|
70
70
|
const hasDefaultIndex = isTemplateActivated && templateConfig && templateConfig.indexDefault !== undefined;
|
|
71
71
|
|
|
72
72
|
const isFieldReadOnly =
|
|
73
|
-
(["parent", "slug"].includes(objKey) &&
|
|
73
|
+
(["parent", "slug"].includes(objKey) && isPageHome) || parentIsReadOnly;
|
|
74
74
|
|
|
75
75
|
const isDisabled =
|
|
76
76
|
(!isGlobal &&
|
|
@@ -85,10 +85,6 @@ const PageConnectedField = (props: any) => {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
useEffect(() => {
|
|
88
|
-
if (isPageHome) {
|
|
89
|
-
updateValue("setAsHome", true);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
88
|
isNewPage && setDefaultValues(defaultParent, hasDefaultIndex);
|
|
93
89
|
// eslint-disable-next-line
|
|
94
90
|
}, [isPageHome]);
|
|
@@ -98,13 +94,9 @@ const PageConnectedField = (props: any) => {
|
|
|
98
94
|
getPageBreadcrumb(value);
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
if (key === "
|
|
97
|
+
if (key === "isHome") {
|
|
102
98
|
updateEditorContent(selectedEditorID, "parent", null);
|
|
103
99
|
updateEditorContent(selectedEditorID, "slug", value ? "/" : slugify(selectedContent.title));
|
|
104
|
-
updateEditorContent(selectedEditorID, "isHome", value);
|
|
105
|
-
} else {
|
|
106
|
-
const editorID = templateID ? templateID : selectedEditorID;
|
|
107
|
-
updateEditorContent(editorID, key, value);
|
|
108
100
|
}
|
|
109
101
|
|
|
110
102
|
if (slugTo) {
|
|
@@ -112,6 +104,9 @@ const PageConnectedField = (props: any) => {
|
|
|
112
104
|
updateEditorContent(selectedEditorID, slugTo, slugify(slugValue));
|
|
113
105
|
}
|
|
114
106
|
|
|
107
|
+
const editorID = templateID ? templateID : selectedEditorID;
|
|
108
|
+
updateEditorContent(editorID, key, value);
|
|
109
|
+
|
|
115
110
|
const isPageTitle = ["Page", "GlobalPage"].includes(selectedContent.component) && key === "title";
|
|
116
111
|
if (isPageTitle) {
|
|
117
112
|
setCurrentPageName(value);
|
package/src/forms/editor.tsx
CHANGED
|
@@ -109,7 +109,6 @@ const setIsSavedData = (isSaved: boolean) => localStorage.setItem("isSaved", `${
|
|
|
109
109
|
const getIsSavedData = () => localStorage.getItem("isSaved");
|
|
110
110
|
|
|
111
111
|
const cleanPageValues = (updatedValues: any, originalValues: any) => {
|
|
112
|
-
delete updatedValues["setAsHome"];
|
|
113
112
|
delete updatedValues["modified"];
|
|
114
113
|
delete updatedValues["entity"];
|
|
115
114
|
delete updatedValues["structuredDataContent"];
|
|
@@ -123,7 +122,6 @@ const cleanPageValues = (updatedValues: any, originalValues: any) => {
|
|
|
123
122
|
delete updatedValues["availableSites"];
|
|
124
123
|
delete updatedValues["fullUrl"];
|
|
125
124
|
|
|
126
|
-
delete originalValues["setAsHome"];
|
|
127
125
|
delete originalValues["modified"];
|
|
128
126
|
delete originalValues["entity"];
|
|
129
127
|
delete originalValues["structuredDataContent"];
|
package/src/helpers/index.tsx
CHANGED
|
@@ -62,7 +62,6 @@ import {
|
|
|
62
62
|
import {
|
|
63
63
|
getStructuredDataFromPage,
|
|
64
64
|
getCurrentPageStructuredData,
|
|
65
|
-
getFilteredStructuredData,
|
|
66
65
|
getStructuredDataTitle,
|
|
67
66
|
isStructuredDataFromPage,
|
|
68
67
|
isGlobalStructuredData,
|
|
@@ -138,7 +137,6 @@ export {
|
|
|
138
137
|
filterByCategory,
|
|
139
138
|
getStructuredDataFromPage,
|
|
140
139
|
getCurrentPageStructuredData,
|
|
141
|
-
getFilteredStructuredData,
|
|
142
140
|
getThumbnailProps,
|
|
143
141
|
slugify,
|
|
144
142
|
getFieldByPath,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getActivatedDataPacksIds, sortBy } from "@ax/helpers";
|
|
2
|
-
import { IDataPack } from "@ax/types";
|
|
3
1
|
import { schemas } from "components";
|
|
4
2
|
|
|
5
3
|
const getStructuredDataFromPage = (site: any) => site.filter((data: any) => data.fromPage);
|
|
@@ -9,21 +7,6 @@ const getCurrentPageStructuredData = (template: string, structuredDataFromPage:
|
|
|
9
7
|
(data: any) => !!data.schema.templates.find((relatedTemplate: string) => relatedTemplate === template)
|
|
10
8
|
);
|
|
11
9
|
|
|
12
|
-
const getFilteredStructuredData = (activatedDataPacks: IDataPack[], structuredData: any) => {
|
|
13
|
-
const filteredStructuredData: any[] = [];
|
|
14
|
-
const clonedData = [...structuredData];
|
|
15
|
-
const activatedDataPacksIds = getActivatedDataPacksIds(activatedDataPacks);
|
|
16
|
-
clonedData.forEach(
|
|
17
|
-
(data: any) =>
|
|
18
|
-
data.dataPacks &&
|
|
19
|
-
data.dataPacks.forEach((id: string) => activatedDataPacksIds.includes(id) && filteredStructuredData.push(data))
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const orderedStructuredData = filteredStructuredData.sort(sortBy("title", false));
|
|
23
|
-
|
|
24
|
-
return orderedStructuredData;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
10
|
const getStructuredDataTitle = (name: string): string => schemas.structuredData[name]?.title;
|
|
28
11
|
|
|
29
12
|
const isStructuredDataFromPage = (name: string): boolean => schemas.structuredData[name]?.fromPage;
|
|
@@ -44,7 +27,6 @@ const getGlobalPageTypes = (): Record<string, string>[] => {
|
|
|
44
27
|
export {
|
|
45
28
|
getStructuredDataFromPage,
|
|
46
29
|
getCurrentPageStructuredData,
|
|
47
|
-
getFilteredStructuredData,
|
|
48
30
|
getStructuredDataTitle,
|
|
49
31
|
isGlobalStructuredData,
|
|
50
32
|
isStructuredDataFromPage,
|
|
@@ -5,7 +5,6 @@ import { structuredDataActions } from "@ax/containers/StructuredData";
|
|
|
5
5
|
import { appActions } from "@ax/containers/App";
|
|
6
6
|
import { IRootState, IStructuredData, IStructuredDataContent, IGetStructuredDataParams, IDataPack } from "@ax/types";
|
|
7
7
|
import { useBulkSelection, useModal, useToast } from "@ax/hooks";
|
|
8
|
-
import { getFilteredStructuredData } from "@ax/helpers";
|
|
9
8
|
import { MainWrapper, TableList, ErrorToast, Toast, EmptyState } from "@ax/components";
|
|
10
9
|
|
|
11
10
|
import CategoryItem from "./CategoryItem";
|
|
@@ -43,8 +42,7 @@ const CategoriesList = (props: IProps): JSX.Element => {
|
|
|
43
42
|
const tableRef = useRef<HTMLDivElement>(null);
|
|
44
43
|
|
|
45
44
|
const scope = currentSiteID ? "site" : "global";
|
|
46
|
-
const currentCategories =
|
|
47
|
-
scope === "site" ? getFilteredStructuredData(activatedDataPacks, categories[scope]) : categories[scope];
|
|
45
|
+
const currentCategories = categories[scope];
|
|
48
46
|
|
|
49
47
|
const catIds = currentDataContent && currentDataContent.map((cat: any) => cat.id);
|
|
50
48
|
|
|
@@ -26,11 +26,13 @@ const OptionTable = (props: IOptionTableProps): JSX.Element => {
|
|
|
26
26
|
} = props;
|
|
27
27
|
|
|
28
28
|
const filterOptions = (value: string, objKey: string) => values.filter((item: any) => item[objKey] === value);
|
|
29
|
+
|
|
29
30
|
const filterOptionsByDataPack = (value: string) => {
|
|
30
31
|
return values.filter((item: any) => {
|
|
31
|
-
return item.dataPacks ? item.dataPacks.includes(value.toUpperCase()) : item.type === value;
|
|
32
|
+
return item.editable !== false && (item.dataPacks ? item.dataPacks.includes(value.toUpperCase()) : item.type === value);
|
|
32
33
|
});
|
|
33
34
|
};
|
|
35
|
+
|
|
34
36
|
const currentOption = filterOptions(selectedValue, "value");
|
|
35
37
|
const currentType = currentOption[0] ? currentOption[0].type : "static";
|
|
36
38
|
|
|
@@ -69,7 +69,7 @@ const DeleteModal = (props: IDeleteModal): JSX.Element => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
const MainActionButton = (props: IActionButton): JSX.Element => (
|
|
72
|
-
<Button type="button" onClick={props.onClick}>
|
|
72
|
+
<Button type="button" onClick={props.onClick} disabled={props.disabled}>
|
|
73
73
|
{props.title}
|
|
74
74
|
</Button>
|
|
75
75
|
);
|
|
@@ -124,6 +124,7 @@ interface IDeleteModal extends IModal {
|
|
|
124
124
|
interface IActionButton {
|
|
125
125
|
onClick: () => void;
|
|
126
126
|
title: string;
|
|
127
|
+
disabled?: boolean;
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
interface ICopyModal extends IModal {
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
IGetSitesParams,
|
|
21
21
|
} from "@ax/types";
|
|
22
22
|
import { MainWrapper, Modal, TableList, ErrorToast, Toast, EmptyState, Notification } from "@ax/components";
|
|
23
|
-
import {
|
|
23
|
+
import { isGlobalStructuredData, isStructuredDataFromPage } from "@ax/helpers";
|
|
24
24
|
|
|
25
25
|
import { appActions } from "@ax/containers/App";
|
|
26
26
|
import { sitesActions } from "@ax/containers/Sites";
|
|
@@ -149,11 +149,11 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
149
149
|
: [];
|
|
150
150
|
|
|
151
151
|
const defaultColumns: Record<string, IColumn> = {
|
|
152
|
-
type: { title: "Types", show: true },
|
|
152
|
+
...(!isStructuredData && { type: { title: "Types", show: true } }),
|
|
153
153
|
live: { title: "Live", show: true },
|
|
154
154
|
status: { title: "Status", show: true },
|
|
155
155
|
translation: { title: "Trans.", show: true },
|
|
156
|
-
seo: { title: "SEO", show: true },
|
|
156
|
+
...(!isStructuredData && { seo: { title: "SEO", show: true } }),
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
const extraColumns = categoryColumns.reduce((acc: Record<string, IColumn>, cur: any) => {
|
|
@@ -656,11 +656,9 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
656
656
|
|
|
657
657
|
const title = currentSiteInfo ? `${currentSiteInfo.name} - Content` : `Content`;
|
|
658
658
|
|
|
659
|
-
const filteredStructuredData = getFilteredStructuredData(activatedDataPacks, structuredData);
|
|
660
|
-
|
|
661
659
|
const options = {
|
|
662
|
-
filters: getOptionFilters(
|
|
663
|
-
values: getOptionValues(
|
|
660
|
+
filters: getOptionFilters(structuredData, activatedDataPacks),
|
|
661
|
+
values: getOptionValues(structuredData),
|
|
664
662
|
};
|
|
665
663
|
|
|
666
664
|
const selectedOption = isStructuredData ? filter : template;
|
|
@@ -731,13 +729,22 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
731
729
|
? "These pages contains some errors, so you can not publish them yet. Please, review the errors on the pages."
|
|
732
730
|
: "This page contains some errors, so you can not publish it yet. Please, review the errors on the page.";
|
|
733
731
|
|
|
732
|
+
const rightButtonProps = {
|
|
733
|
+
label: "New",
|
|
734
|
+
action: addNewAction,
|
|
735
|
+
disabled: !isDataEditable,
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
const notEditableText =
|
|
739
|
+
"Sorry, this content cannot be edited because it comes from an external source or belongs to a preconfigured system.";
|
|
740
|
+
|
|
734
741
|
return (
|
|
735
742
|
<MainWrapper
|
|
736
743
|
title={title}
|
|
737
744
|
language={lang}
|
|
738
745
|
languageActions={languageActions}
|
|
739
746
|
availableLanguages={siteLanguages}
|
|
740
|
-
rightButton={
|
|
747
|
+
rightButton={rightButtonProps}
|
|
741
748
|
searchAction={setSearchQuery}
|
|
742
749
|
errors={errors}
|
|
743
750
|
>
|
|
@@ -745,6 +752,11 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
745
752
|
<ContentFilters current={filter} dynamicValues={structuredData} resetFilter={resetFilter} />
|
|
746
753
|
<S.TableWrapper>
|
|
747
754
|
<ErrorToast />
|
|
755
|
+
{!isDataEditable && (
|
|
756
|
+
<S.NotificationWrapper>
|
|
757
|
+
<Notification type="info" text={notEditableText} closeButton={false} />
|
|
758
|
+
</S.NotificationWrapper>
|
|
759
|
+
)}
|
|
748
760
|
{templateInstanceError.error && (
|
|
749
761
|
<Notification
|
|
750
762
|
type="error"
|
|
@@ -42,4 +42,8 @@ const SelectWrapper = styled.div`
|
|
|
42
42
|
}
|
|
43
43
|
`;
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
const NotificationWrapper = styled.div`
|
|
46
|
+
width: 100%;
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
export { ContentListWrapper, TableWrapper, PaginationWrapper, EmptyWrapper, ModalContent, SelectWrapper, NotificationWrapper };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { schemas } from "components";
|
|
2
2
|
import { filterDuplicatedValues, getActivatedDataPacksIds } from "@ax/helpers";
|
|
3
3
|
import { pageStatus } from "@ax/containers/PageEditor/interfaces";
|
|
4
|
-
import { IPage } from "@ax/types";
|
|
4
|
+
import { IPage, IStructuredDataContent } from "@ax/types";
|
|
5
5
|
|
|
6
6
|
const getTemplatesFilters = (activatedDataPacks: any) => {
|
|
7
7
|
const filters: any[] = [];
|
|
@@ -37,7 +37,7 @@ const mapStructuredOptions = (options: any[]) => {
|
|
|
37
37
|
const pureOptions = options.filter((option: any) => !option.fromPage);
|
|
38
38
|
|
|
39
39
|
return pureOptions.map((option: any) => {
|
|
40
|
-
const { id, title, dataPacks } = option;
|
|
40
|
+
const { id, title, dataPacks, editable } = option;
|
|
41
41
|
return {
|
|
42
42
|
name: id,
|
|
43
43
|
value: id,
|
|
@@ -45,6 +45,7 @@ const mapStructuredOptions = (options: any[]) => {
|
|
|
45
45
|
type: id,
|
|
46
46
|
isData: true,
|
|
47
47
|
dataPacks,
|
|
48
|
+
editable
|
|
48
49
|
};
|
|
49
50
|
});
|
|
50
51
|
};
|
|
@@ -73,12 +74,14 @@ const getOptionValues = (options: any) => {
|
|
|
73
74
|
return [...templatesOptionsValues, ...mapStructuredOptions(options)];
|
|
74
75
|
};
|
|
75
76
|
|
|
76
|
-
const getOptionFilters = (options:
|
|
77
|
+
const getOptionFilters = (options: IStructuredDataContent[], activatedDataPacks: any) => {
|
|
77
78
|
const pureOptions = options.filter((option: any) => !option.fromPage);
|
|
78
79
|
const templateFilters = getTemplatesFilters(activatedDataPacks);
|
|
80
|
+
const activatedDataPacksIds = getActivatedDataPacksIds(activatedDataPacks);
|
|
81
|
+
|
|
79
82
|
|
|
80
83
|
const mappedOptions = pureOptions.flatMap((option: any) =>
|
|
81
|
-
option.dataPacks.map((dataPack: string) => {
|
|
84
|
+
option.dataPacks.filter((dataPack: string) => activatedDataPacksIds.includes(dataPack)).map((dataPack: string) => {
|
|
82
85
|
const currentDataPack = activatedDataPacks.find((activatedDataPack: any) => dataPack === activatedDataPack.id);
|
|
83
86
|
return {
|
|
84
87
|
label: currentDataPack.title,
|
|
@@ -43,7 +43,7 @@ const StructuredDataItem = (props: IStructuredDataItemProps): JSX.Element => {
|
|
|
43
43
|
|
|
44
44
|
const activeColumns = currentStructuredDataColumns
|
|
45
45
|
? Object.keys(currentStructuredDataColumns).filter((col: string) => currentStructuredDataColumns[col].show)
|
|
46
|
-
: [];
|
|
46
|
+
: Object.keys(columns).filter((col: string) => columns[col].show);
|
|
47
47
|
|
|
48
48
|
const publishedTooltip: Record<string, string> = {
|
|
49
49
|
active: "Live",
|
|
@@ -31,7 +31,7 @@ export default {
|
|
|
31
31
|
fields: [
|
|
32
32
|
{
|
|
33
33
|
type: "UniqueCheck",
|
|
34
|
-
key: "
|
|
34
|
+
key: "isHome",
|
|
35
35
|
options: [
|
|
36
36
|
{
|
|
37
37
|
title: "Set as home",
|
|
@@ -254,7 +254,7 @@ export default {
|
|
|
254
254
|
],
|
|
255
255
|
default: {
|
|
256
256
|
component: "Page",
|
|
257
|
-
|
|
257
|
+
isHome: false,
|
|
258
258
|
slug: "new-page",
|
|
259
259
|
title: "New Page",
|
|
260
260
|
headerConfig: "{}",
|