@griddo/ax 11.1.0 → 11.1.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/env.js +2 -1
- package/package.json +2 -2
- package/src/api/config.tsx +1 -1
- package/src/components/BrowserContent/index.tsx +2 -2
- package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +5 -5
- package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +62 -19
- package/src/components/Fields/ReferenceField/Context/index.tsx +4 -2
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +3 -3
- package/src/components/Fields/ReferenceField/index.tsx +4 -4
- package/src/components/Fields/Wysiwyg/config.tsx +3 -9
- package/src/containers/StructuredData/utils.tsx +2 -2
- package/src/forms/editor.tsx +2 -2
- package/src/helpers/schemas.tsx +6 -6
- package/src/modules/Content/PageItem/index.tsx +1 -1
- package/src/modules/StructuredData/Form/ConnectedField/index.tsx +6 -3
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
package/config/env.js
CHANGED
|
@@ -55,10 +55,11 @@ process.env.NODE_PATH = (process.env.NODE_PATH || "")
|
|
|
55
55
|
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
|
|
56
56
|
// injected into the application via DefinePlugin in webpack configuration.
|
|
57
57
|
const REACT_APP = /^REACT_APP_/i;
|
|
58
|
+
const GRIDDO = /^GRIDDO_/i;
|
|
58
59
|
|
|
59
60
|
function getClientEnvironment(publicUrl) {
|
|
60
61
|
const raw = Object.keys(process.env)
|
|
61
|
-
.filter((key) => REACT_APP.test(key))
|
|
62
|
+
.filter((key) => REACT_APP.test(key) || GRIDDO.test(key))
|
|
62
63
|
.reduce(
|
|
63
64
|
(env, key) => {
|
|
64
65
|
env[key] = process.env[key];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "11.1.
|
|
4
|
+
"version": "11.1.1",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -225,5 +225,5 @@
|
|
|
225
225
|
"publishConfig": {
|
|
226
226
|
"access": "public"
|
|
227
227
|
},
|
|
228
|
-
"gitHead": "
|
|
228
|
+
"gitHead": "54be62448614043e86f35762e4972facb2dc902d"
|
|
229
229
|
}
|
package/src/api/config.tsx
CHANGED
|
@@ -23,8 +23,8 @@ const BrowserContent = (props: IProps) => {
|
|
|
23
23
|
selectHoverEditorID,
|
|
24
24
|
} = props;
|
|
25
25
|
|
|
26
|
-
const API_URL = process.env.REACT_APP_API_ENDPOINT;
|
|
27
|
-
const PUBLIC_API_URL = process.env.REACT_APP_PUBLIC_API_ENDPOINT;
|
|
26
|
+
const API_URL = process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT;
|
|
27
|
+
const PUBLIC_API_URL = process.env.GRIDDO_PUBLIC_API_URL || process.env.REACT_APP_PUBLIC_API_ENDPOINT;
|
|
28
28
|
const INSTANCE = process.env.REACT_APP_INSTANCE || process.env.GRIDDO_REACT_APP_INSTANCE;
|
|
29
29
|
|
|
30
30
|
const useInstanceExternalAssets = useCallback(() => {
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { structuredData, selects } from "@ax/api";
|
|
4
4
|
import { isReqOk } from "@ax/helpers";
|
|
5
|
-
import { IGetStructuredDataParams, IDataSource, ISite, IStructuredData } from "@ax/types";
|
|
5
|
+
import { IGetStructuredDataParams, IDataSource, ISite, IStructuredData, ICheck } from "@ax/types";
|
|
6
6
|
import { Button, FieldsBehavior, IconAction, Select, SearchField, Tag, Tooltip } from "@ax/components";
|
|
7
7
|
import { useCategoryColors } from "@ax/hooks";
|
|
8
8
|
|
|
@@ -55,7 +55,7 @@ const AutoItem = (props: IProps): JSX.Element => {
|
|
|
55
55
|
];
|
|
56
56
|
|
|
57
57
|
const getIsGlobal = (id: string): boolean => {
|
|
58
|
-
const data = structuredDataSite && structuredDataSite.find((elem
|
|
58
|
+
const data = structuredDataSite && structuredDataSite.find((elem) => elem.id === id);
|
|
59
59
|
return data && data.local ? false : true;
|
|
60
60
|
};
|
|
61
61
|
|
|
@@ -98,9 +98,9 @@ const AutoItem = (props: IProps): JSX.Element => {
|
|
|
98
98
|
return false;
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
const getFiltersCategories = (filters:
|
|
101
|
+
const getFiltersCategories = (filters: IFilter[], categories: ICategory[]) => {
|
|
102
102
|
let filterCategories: ICategory[] = [];
|
|
103
|
-
filters.forEach((filter
|
|
103
|
+
filters.forEach((filter) => {
|
|
104
104
|
const filterCategory = categories.find((cat: ICategory) => cat.label === filter.category);
|
|
105
105
|
filterCategories =
|
|
106
106
|
filterCategory && !filterCategories.includes(filterCategory)
|
|
@@ -124,7 +124,7 @@ const AutoItem = (props: IProps): JSX.Element => {
|
|
|
124
124
|
return result;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
const handleCheckChange = (checkValue:
|
|
127
|
+
const handleCheckChange = (checkValue: ICheck) => {
|
|
128
128
|
if (checkValue.isChecked) {
|
|
129
129
|
const newFilter = find(state.options, checkValue.value);
|
|
130
130
|
if (newFilter) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
|
-
import { IDataSource, ILanguage, IRootState, ISite, IStructuredData } from "@ax/types";
|
|
4
|
+
import { IDataSource, ILanguage, IRootState, ISchemaField, ISite, IStructuredData } from "@ax/types";
|
|
5
5
|
import {
|
|
6
6
|
Button,
|
|
7
7
|
FloatingMenu,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
UniqueCheck,
|
|
15
15
|
} from "@ax/components";
|
|
16
16
|
|
|
17
|
-
import { IReferenceState, ISource, useReference } from "../Context";
|
|
17
|
+
import { IReferenceState, IRefField, ISource, useReference } from "../Context";
|
|
18
18
|
import AutoItem from "./AutoItem";
|
|
19
19
|
|
|
20
20
|
import * as S from "./style";
|
|
@@ -32,11 +32,13 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
32
32
|
isDataOpen: true,
|
|
33
33
|
isAllLangOpen: true,
|
|
34
34
|
isCustomLangOpen: true,
|
|
35
|
+
isGlobalOpen: true,
|
|
35
36
|
};
|
|
36
37
|
const [configState, setConfigState] = useState<IConfigState>(initConfig);
|
|
37
38
|
const initToggle = {
|
|
38
|
-
isSiteActive: state.site ? true : false,
|
|
39
|
+
isSiteActive: state.site && state.site !== "global" ? true : false,
|
|
39
40
|
isLangActive: state.lang ? true : false,
|
|
41
|
+
isGlobalActive: state.site && state.site === "global" ? true : false,
|
|
40
42
|
errorSite: false,
|
|
41
43
|
errorLang: false,
|
|
42
44
|
errorMsg: "",
|
|
@@ -49,8 +51,10 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
49
51
|
|
|
50
52
|
const currentLang = globalLangs.find((language) => lang.id === language.id)?.language;
|
|
51
53
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
+
const hasGlobalContent = structuredData.global.length > 0;
|
|
55
|
+
|
|
56
|
+
const structuredDataValues: IStructuredData[] = [];
|
|
57
|
+
for (const [, dataType] of Object.entries(structuredData) as [string, IStructuredData[]][]) {
|
|
54
58
|
structuredDataValues.push(...dataType);
|
|
55
59
|
}
|
|
56
60
|
|
|
@@ -69,15 +73,19 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
69
73
|
|
|
70
74
|
const sourcesFields = state.sources.map((source: ISource) => {
|
|
71
75
|
const foundData = structuredDataValues.find((value) => value.id === source.structuredData);
|
|
72
|
-
const indexableFields
|
|
76
|
+
const indexableFields: ISchemaField[] =
|
|
77
|
+
foundData?.schema.fields.filter((field: ISchemaField) => field.indexable) || [];
|
|
73
78
|
return indexableFields;
|
|
74
79
|
});
|
|
75
80
|
|
|
76
81
|
const indexableFields =
|
|
77
82
|
!!sourcesFields.length &&
|
|
78
|
-
sourcesFields[0].filter((field:
|
|
83
|
+
sourcesFields[0].filter((field: ISchemaField) =>
|
|
84
|
+
sourcesFields.every((f: ISchemaField) => f.some((_f: ISchemaField) => _f.key === field.key))
|
|
85
|
+
);
|
|
86
|
+
|
|
79
87
|
if (indexableFields) {
|
|
80
|
-
indexableFields.forEach((field:
|
|
88
|
+
indexableFields.forEach((field: ISchemaField) => {
|
|
81
89
|
const newField = {
|
|
82
90
|
title: field.title,
|
|
83
91
|
value: field.key,
|
|
@@ -181,8 +189,8 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
181
189
|
);
|
|
182
190
|
};
|
|
183
191
|
|
|
184
|
-
const sourceMenu = (menu:
|
|
185
|
-
<S.SourceMenu>{menu.map((option
|
|
192
|
+
const sourceMenu = (menu: IDataSource[]) => (
|
|
193
|
+
<S.SourceMenu>{menu.map((option) => sourceMenuOption(option))}</S.SourceMenu>
|
|
186
194
|
);
|
|
187
195
|
|
|
188
196
|
const addSourceButton = () => (
|
|
@@ -231,13 +239,14 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
231
239
|
}
|
|
232
240
|
};
|
|
233
241
|
|
|
234
|
-
const handleAllLanguagesChange = (value:
|
|
242
|
+
const handleAllLanguagesChange = (value: boolean) => {
|
|
235
243
|
const preferenceLanguage = value ? state.preferenceLanguage : false;
|
|
236
244
|
setState((state: IReferenceState) => ({ ...state, allLanguages: value, preferenceLanguage }));
|
|
237
245
|
};
|
|
238
246
|
|
|
239
|
-
const handlePreferenceLanguageChange = (value:
|
|
247
|
+
const handlePreferenceLanguageChange = (value: boolean) => {
|
|
240
248
|
setState((state: IReferenceState) => ({ ...state, preferenceLanguage: value }));
|
|
249
|
+
};
|
|
241
250
|
|
|
242
251
|
const toggleConfig = (value: keyof IConfigState) => setConfigState({ ...configState, [value]: !configState[value] });
|
|
243
252
|
|
|
@@ -264,10 +273,13 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
264
273
|
};
|
|
265
274
|
|
|
266
275
|
const handleSiteToggleChange = (value: boolean) => {
|
|
267
|
-
setToggleState({ ...toggleState, isSiteActive: value });
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
276
|
+
setToggleState({ ...toggleState, isSiteActive: value, isGlobalActive: value ? false : toggleState.isGlobalActive });
|
|
277
|
+
setState((state: IReferenceState) => ({ ...state, site: value ? null : undefined }));
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const handleGlobalToggleChange = (value: boolean) => {
|
|
281
|
+
setToggleState({ ...toggleState, isGlobalActive: value, isSiteActive: value ? false : toggleState.isSiteActive });
|
|
282
|
+
setState((state: IReferenceState) => ({ ...state, site: value ? "global" : null }));
|
|
271
283
|
};
|
|
272
284
|
|
|
273
285
|
return (
|
|
@@ -392,10 +404,10 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
392
404
|
</S.OptionLabel>
|
|
393
405
|
|
|
394
406
|
<S.ConfigWrapper>
|
|
395
|
-
<S.SubConfigContent hasMargin={
|
|
407
|
+
<S.SubConfigContent hasMargin={true}>
|
|
396
408
|
<S.OptionDescription isOpen={configState.isDataOpen}>
|
|
397
409
|
Data is retrieved from the site you are on.{" "}
|
|
398
|
-
<strong>If you prefer to display content from another site
|
|
410
|
+
<strong>If you prefer to display content from another site, </strong>
|
|
399
411
|
enable this option to select the specific site.
|
|
400
412
|
</S.OptionDescription>
|
|
401
413
|
{toggleState.isSiteActive && (
|
|
@@ -411,6 +423,35 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
411
423
|
)}
|
|
412
424
|
</S.SubConfigContent>
|
|
413
425
|
</S.ConfigWrapper>
|
|
426
|
+
|
|
427
|
+
{hasGlobalContent && (
|
|
428
|
+
<>
|
|
429
|
+
<S.OptionLabel
|
|
430
|
+
onClick={() => toggleConfig("isGlobalOpen")}
|
|
431
|
+
isOpen={configState.isGlobalOpen}
|
|
432
|
+
data-testid="advanced-config-label"
|
|
433
|
+
>
|
|
434
|
+
<S.LabelContent>
|
|
435
|
+
<S.SubOptionText>Data from Global Content</S.SubOptionText>
|
|
436
|
+
<ToggleField
|
|
437
|
+
name="global-toggle"
|
|
438
|
+
value={toggleState.isGlobalActive}
|
|
439
|
+
onChange={handleGlobalToggleChange}
|
|
440
|
+
size="s"
|
|
441
|
+
/>
|
|
442
|
+
</S.LabelContent>
|
|
443
|
+
</S.OptionLabel>
|
|
444
|
+
|
|
445
|
+
<S.ConfigWrapper>
|
|
446
|
+
<S.SubConfigContent hasMargin={toggleState.isSiteActive}>
|
|
447
|
+
<S.OptionDescription isOpen={configState.isGlobalOpen}>
|
|
448
|
+
Data is retrieved from the site you are on.{" "}
|
|
449
|
+
<strong>If you prefer to display Global content,</strong> enable this option.
|
|
450
|
+
</S.OptionDescription>
|
|
451
|
+
</S.SubConfigContent>
|
|
452
|
+
</S.ConfigWrapper>
|
|
453
|
+
</>
|
|
454
|
+
)}
|
|
414
455
|
</S.ConfigContent>
|
|
415
456
|
</S.ConfigWrapper>
|
|
416
457
|
|
|
@@ -467,7 +508,7 @@ const AutoPanel = (props: IProps): JSX.Element => {
|
|
|
467
508
|
interface IProps {
|
|
468
509
|
structuredData: { global: IStructuredData[]; site: IStructuredData[] };
|
|
469
510
|
categories: { global: IStructuredData[]; site: IStructuredData[] };
|
|
470
|
-
onChange: (value:
|
|
511
|
+
onChange: (value: IRefField) => void;
|
|
471
512
|
site: ISite | null;
|
|
472
513
|
validators?: Record<string, unknown>;
|
|
473
514
|
globalLangs: ILanguage[];
|
|
@@ -480,11 +521,13 @@ interface IConfigState {
|
|
|
480
521
|
isDataOpen: boolean;
|
|
481
522
|
isAllLangOpen: boolean;
|
|
482
523
|
isCustomLangOpen: boolean;
|
|
524
|
+
isGlobalOpen: boolean;
|
|
483
525
|
}
|
|
484
526
|
|
|
485
527
|
interface IToggleState {
|
|
486
528
|
isSiteActive: boolean;
|
|
487
529
|
isLangActive: boolean;
|
|
530
|
+
isGlobalActive: boolean;
|
|
488
531
|
errorSite: boolean;
|
|
489
532
|
errorLang: boolean;
|
|
490
533
|
errorMsg: string;
|
|
@@ -95,7 +95,8 @@ export interface IReferenceState {
|
|
|
95
95
|
allLanguages: boolean;
|
|
96
96
|
preferenceLanguage: boolean;
|
|
97
97
|
lang?: number;
|
|
98
|
-
site?: number;
|
|
98
|
+
site?: number | "global";
|
|
99
|
+
fields?: string[];
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
export interface IRefField {
|
|
@@ -108,7 +109,8 @@ export interface IRefField {
|
|
|
108
109
|
allLanguages?: boolean;
|
|
109
110
|
preferenceLanguage?: boolean;
|
|
110
111
|
lang?: number;
|
|
111
|
-
site?: number;
|
|
112
|
+
site?: number | "global";
|
|
113
|
+
fields?: string[];
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
export interface IFilter {
|
|
@@ -50,8 +50,8 @@ const ItemList = (props: IProps) => {
|
|
|
50
50
|
const langItem = item.dataLanguages?.length
|
|
51
51
|
? item.dataLanguages.find((lang) => fixed.includes(lang.id))
|
|
52
52
|
: fixed.includes(item.id)
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
? item
|
|
54
|
+
: null;
|
|
55
55
|
|
|
56
56
|
if (langItem) {
|
|
57
57
|
const newSelIds: number[] = fixed.filter((id: number) => id !== langItem.id);
|
|
@@ -120,7 +120,7 @@ interface IProps {
|
|
|
120
120
|
currentSite: number | null;
|
|
121
121
|
handleListDelete(value: number[]): void;
|
|
122
122
|
handleListMove(value: number[]): void;
|
|
123
|
-
site?: number;
|
|
123
|
+
site?: number | "global";
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -124,7 +124,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
|
|
|
124
124
|
{ label: "Automatic", value: "auto" },
|
|
125
125
|
];
|
|
126
126
|
|
|
127
|
-
const handleOnChange = (newValue:
|
|
127
|
+
const handleOnChange = (newValue: IRefField) => {
|
|
128
128
|
onChange(newValue);
|
|
129
129
|
toggleModal();
|
|
130
130
|
};
|
|
@@ -150,7 +150,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
|
|
|
150
150
|
|
|
151
151
|
const icon = isAuto ? "edit" : "add";
|
|
152
152
|
|
|
153
|
-
const defaultOrders:
|
|
153
|
+
const defaultOrders: Record<string, string> = {
|
|
154
154
|
alpha: "Alphabetical order",
|
|
155
155
|
recent: "Most recent",
|
|
156
156
|
};
|
|
@@ -175,7 +175,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
|
|
|
175
175
|
<S.TypeContainer key={singleSource.structuredData}>
|
|
176
176
|
<S.Title>{srcTitle?.title}</S.Title>
|
|
177
177
|
<div>
|
|
178
|
-
{singleSource.filters?.map((f
|
|
178
|
+
{singleSource.filters?.map((f) => (
|
|
179
179
|
<Tag key={f.label} text={f.category ? `${f.category}: ${f.label}` : f.label} color={f.color} />
|
|
180
180
|
))}
|
|
181
181
|
</div>
|
|
@@ -265,7 +265,7 @@ const ReferenceField = (props: IReferenceFieldProps) => {
|
|
|
265
265
|
export interface IReferenceFieldProps {
|
|
266
266
|
sources: ISource[];
|
|
267
267
|
value?: IRefField;
|
|
268
|
-
onChange: (value:
|
|
268
|
+
onChange: (value: IRefField) => void;
|
|
269
269
|
disabled?: boolean;
|
|
270
270
|
site: ISite | null;
|
|
271
271
|
selectionType?: string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getRichTextConfig, parseClassNames } from "./helpers";
|
|
2
2
|
|
|
3
|
+
const API_URL = process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT;
|
|
3
4
|
const richTextConfig = getRichTextConfig();
|
|
4
5
|
const paragraphStyles = richTextConfig?.paragraphStyles ? parseClassNames(richTextConfig.paragraphStyles) : undefined;
|
|
5
6
|
const tableStyles = richTextConfig?.tableStyles ? parseClassNames(richTextConfig.tableStyles) : undefined;
|
|
@@ -41,14 +42,7 @@ const buttonsFull = {
|
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
const buttons = [
|
|
44
|
-
[
|
|
45
|
-
"bold",
|
|
46
|
-
"italic",
|
|
47
|
-
"formatUL",
|
|
48
|
-
"insertLink",
|
|
49
|
-
"paragraphFormat",
|
|
50
|
-
paragraphStyles ? "paragraphStyle" : undefined,
|
|
51
|
-
],
|
|
45
|
+
["bold", "italic", "formatUL", "insertLink", "paragraphFormat", paragraphStyles ? "paragraphStyle" : undefined],
|
|
52
46
|
];
|
|
53
47
|
|
|
54
48
|
const wysiwygConfig = {
|
|
@@ -83,7 +77,7 @@ const wysiwygConfig = {
|
|
|
83
77
|
videoInsertButtons: ["videoBack", "|", "videoByURL", "videoEmbed"],
|
|
84
78
|
imageAllowedTypes: ["jpeg", "jpg", "png", "svg"],
|
|
85
79
|
imageMaxSize: 20 * 1024 * 1024,
|
|
86
|
-
imageManagerLoadURL: `${
|
|
80
|
+
imageManagerLoadURL: `${API_URL}/images/wysiwyg`,
|
|
87
81
|
requestWithCORS: false,
|
|
88
82
|
paragraphStyles,
|
|
89
83
|
tableStyles,
|
|
@@ -36,8 +36,8 @@ const evaluateDataComputedFields = async (structuredData: any, fields: ISchemaFi
|
|
|
36
36
|
const updatedData = deepClone(structuredData);
|
|
37
37
|
const data = {
|
|
38
38
|
operation: "save",
|
|
39
|
-
apiUrl: process.env.REACT_APP_API_ENDPOINT,
|
|
40
|
-
publicApiUrl: process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
39
|
+
apiUrl: process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT,
|
|
40
|
+
publicApiUrl: process.env.GRIDDO_PUBLIC_API_URL || process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
for (const field of fields) {
|
package/src/forms/editor.tsx
CHANGED
|
@@ -206,8 +206,8 @@ const evaluateComputedFields = async (page: IPage, operation: "save" | "refresh"
|
|
|
206
206
|
const pageSchemaContent = getTemplate(page.template.templateType).content;
|
|
207
207
|
const data = {
|
|
208
208
|
operation,
|
|
209
|
-
apiUrl: process.env.REACT_APP_API_ENDPOINT,
|
|
210
|
-
publicApiUrl: process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
209
|
+
apiUrl: process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT,
|
|
210
|
+
publicApiUrl: process.env.GRIDDO_PUBLIC_API_URL || process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
211
211
|
};
|
|
212
212
|
for (const field of pageSchemaContent) {
|
|
213
213
|
if (Object.prototype.hasOwnProperty.call(field, "computed")) {
|
package/src/helpers/schemas.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const moduleCategories = config.schemas.config.moduleCategories;
|
|
|
11
11
|
const allSchemas = {
|
|
12
12
|
...schemas.modules,
|
|
13
13
|
...schemas.components,
|
|
14
|
-
...formSchemas
|
|
14
|
+
...formSchemas?.fields,
|
|
15
15
|
...pageSchemas,
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -54,13 +54,13 @@ const getTemplate = (name: string) => schemas.templates[name];
|
|
|
54
54
|
|
|
55
55
|
const getDefaultTemplate = (name: string) => schemas.templates[name].default;
|
|
56
56
|
|
|
57
|
-
const getFormTemplates = (): Record<string, ISchema> => formSchemas
|
|
57
|
+
const getFormTemplates = (): Record<string, ISchema> => formSchemas?.templates || {};
|
|
58
58
|
|
|
59
|
-
const getFormTemplate = (name: string) => formSchemas
|
|
59
|
+
const getFormTemplate = (name: string) => formSchemas?.templates[name];
|
|
60
60
|
|
|
61
|
-
const getDefaultFormTemplate = (name: string) => formSchemas
|
|
61
|
+
const getDefaultFormTemplate = (name: string) => formSchemas?.templates[name].default;
|
|
62
62
|
|
|
63
|
-
const getSchemaFormCategories = (): { label: string; value: string }[] => formSchemas
|
|
63
|
+
const getSchemaFormCategories = (): { label: string; value: string }[] => formSchemas?.categories || [];
|
|
64
64
|
|
|
65
65
|
const getTemplateThumbnails = (name: string, theme?: string) => {
|
|
66
66
|
if (!schemas.templates[name]?.thumbnails) return null;
|
|
@@ -71,7 +71,7 @@ const getTemplateThumbnails = (name: string, theme?: string) => {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
const getFormTemplateThumbnails = (name: string): Record<string, string> | null =>
|
|
74
|
-
formSchemas
|
|
74
|
+
formSchemas?.templates[name]?.thumbnails ? formSchemas?.templates[name].thumbnails : null;
|
|
75
75
|
|
|
76
76
|
const getDataPackSchema = (name: string) => contentTypesSchemas.dataPacks[name];
|
|
77
77
|
|
|
@@ -111,7 +111,7 @@ const PageItem = (props: IPageItemProps): JSX.Element => {
|
|
|
111
111
|
const isGlobal = origin === "GLOBAL";
|
|
112
112
|
const isTranslated = pageLanguages.length > 1;
|
|
113
113
|
const activeColumns = columns.filter((col) => col.show).map((col) => col.id);
|
|
114
|
-
const API_URL = process.env.REACT_APP_API_ENDPOINT;
|
|
114
|
+
const API_URL = process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT;
|
|
115
115
|
const isPublished = liveStatus.status === pageStatus.PUBLISHED || liveStatus.status === pageStatus.UPLOAD_PENDING;
|
|
116
116
|
const isAllowedToDelete = (isPublished && isAllowedToDeletePublishedPage) || (!isPublished && isAllowedToDeletePage);
|
|
117
117
|
const isScheduledPub = !!publicationScheduled && (liveStatus.status === pageStatus.SCHEDULED || haveDraftPage);
|
|
@@ -24,8 +24,8 @@ const ConnectedField = (props: IProps) => {
|
|
|
24
24
|
const evaluateDataComputedFields = async () => {
|
|
25
25
|
const data = {
|
|
26
26
|
operation: "refresh",
|
|
27
|
-
apiUrl: process.env.REACT_APP_API_ENDPOINT,
|
|
28
|
-
publicApiUrl: process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
27
|
+
apiUrl: process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT,
|
|
28
|
+
publicApiUrl: process.env.GRIDDO_PUBLIC_API_URL || process.env.REACT_APP_PUBLIC_API_ENDPOINT,
|
|
29
29
|
};
|
|
30
30
|
const computedFunction = eval(`(${field.computed})`);
|
|
31
31
|
const value = await computedFunction(form.content, data);
|
|
@@ -45,7 +45,10 @@ const ConnectedField = (props: IProps) => {
|
|
|
45
45
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
46
|
}, [form?.content]);
|
|
47
47
|
|
|
48
|
-
const handleChange = (newValue: any) =>
|
|
48
|
+
const handleChange = (newValue: any) => {
|
|
49
|
+
setValue(newValue);
|
|
50
|
+
updateFormValue({ [fieldKey]: newValue });
|
|
51
|
+
};
|
|
49
52
|
|
|
50
53
|
let innerFields: JSX.Element[] = [];
|
|
51
54
|
|
|
@@ -86,7 +86,7 @@ const GlobalPageItem = (props: IGlobalPageItemProps): JSX.Element => {
|
|
|
86
86
|
const nameCellPadding = Number(theme.spacing.s.slice(0, -2));
|
|
87
87
|
const title = useAdaptiveText(nameCellRef, globalPage.title, nameCellPadding);
|
|
88
88
|
const path = useAdaptiveText(nameCellRef, fullPath.page, nameCellPadding);
|
|
89
|
-
const API_URL = process.env.REACT_APP_API_ENDPOINT;
|
|
89
|
+
const API_URL = process.env.GRIDDO_API_URL || process.env.REACT_APP_API_ENDPOINT;
|
|
90
90
|
|
|
91
91
|
const isAllowedToDuplicatePages = usePermission("global.globalData.duplicateGlobalData");
|
|
92
92
|
const isAllowedToPublishPages = usePermission("global.globalData.publishUnpublishAllGlobalData");
|