Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit 880742f

Browse files
authored
Merge pull request #64 from scale8/ingest-wizard-ui-fixes
Fixed ui issues for actions and macros
2 parents 2b74771 + 3cb9248 commit 880742f

File tree

4 files changed

+48
-17
lines changed

4 files changed

+48
-17
lines changed

ui/src/components/atoms/InputTypes/TextInputWithMacros.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,18 @@ const TextInputWithMacros: FC<TextInputWithMacrosProps> = (props: TextInputWithM
9999
horizontal: 'right',
100100
}}
101101
>
102-
<Box width={250} height={330} p={1} display="flex" flexDirection="column">
103-
<Box flex={1}>
102+
<Box width={250} height={400} p={1} display="flex" flexDirection="column">
103+
<Box
104+
flex={1}
105+
sx={{
106+
display: 'flex',
107+
flexDirection: 'column',
108+
'& .DrawerFormField': {
109+
width: '100%',
110+
margin: (theme) => theme.spacing(0, 0, 3),
111+
},
112+
}}
113+
>
104114
<PlatformValueEdit
105115
availableDataContainers={getAvailableDataContainers(
106116
appPlatformRevisions,

ui/src/components/atoms/PlatformValueEdit.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,17 @@ const PlatformValueEdit: FC<PlatformValueEditProps> = (props: PlatformValueEditP
4040
const match = value.match(/^{{([^}]+)}}$/);
4141
const path = match === null ? '' : match[1];
4242

43-
const [initialDataContainerId, initialDataElement, initialObjectKey] = splitTwice(path, '.');
43+
const [initialDataContainerPersistingId, initialDataElement, initialObjectKey] = splitTwice(
44+
path,
45+
'.',
46+
);
47+
48+
const initialDataContainer = availableDataContainers.find(
49+
(dataContainer) => dataContainer.persisting_id === initialDataContainerPersistingId,
50+
);
51+
52+
const initialDataContainerId = initialDataContainer?.id ?? '';
53+
4454
const [useCustom, setUseCustom] = useState(false);
4555

4656
const [values, setValues] = useState({
@@ -49,10 +59,14 @@ const PlatformValueEdit: FC<PlatformValueEditProps> = (props: PlatformValueEditP
4959
objectKey: initialObjectKey ?? '',
5060
});
5161

62+
const currentDataContainer = availableDataContainers.find(
63+
(dataContainer) => dataContainer.id === values.dataContainerId,
64+
);
65+
5266
useEffect(() => {
53-
if (values.dataElement !== '') {
67+
if (values.dataElement !== '' && currentDataContainer) {
5468
setValue(
55-
`{{${values.dataContainerId}.${values.dataElement}${
69+
`{{${currentDataContainer.persisting_id}.${values.dataElement}${
5670
values.objectKey === '' ? '' : '.'
5771
}${values.objectKey}}}`,
5872
);
@@ -61,10 +75,6 @@ const PlatformValueEdit: FC<PlatformValueEditProps> = (props: PlatformValueEditP
6175
}
6276
}, [values]);
6377

64-
const currentDataContainer = availableDataContainers.find(
65-
(dataContainer) => dataContainer.id === values.dataContainerId,
66-
);
67-
6878
const noContainers = availableDataContainers.length < 1;
6979

7080
const notAvailable =
@@ -130,7 +140,7 @@ const PlatformValueEdit: FC<PlatformValueEditProps> = (props: PlatformValueEditP
130140
}, [currentDataContainer]);
131141

132142
const currentDataElement = (currentDataContainer?.platform_data_maps ?? []).find(
133-
(_) => _.id === values.dataElement,
143+
(_) => _.key === values.dataElement,
134144
);
135145

136146
const isDataElementObject =
@@ -213,6 +223,7 @@ const PlatformValueEdit: FC<PlatformValueEditProps> = (props: PlatformValueEditP
213223
name="dataElement"
214224
values={platformDataMapsToSelectValues(
215225
currentDataContainer.platform_data_maps,
226+
true,
216227
)}
217228
formProps={formProps}
218229
required

ui/src/components/molecules/IngestEndpointPayloadInputType.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Box } from '@mui/material';
1111
import { SelectValueWithSub } from '../../hooks/form/useFormValidation';
1212
import FormWarning from '../atoms/FormWarning';
1313
import { AlertWarning } from '../atoms/AlertWarning';
14+
import CopyBlock from '../atoms/CopyBlock';
1415

1516
type SelectIngestEndpointProps = {
1617
ingestEndpointId: string;
@@ -207,6 +208,16 @@ const IngestEndpointPayloadInputType: FC<IngestEndpointPayloadInputTypeProps> =
207208
ingestEndpoints={ingestEndpoints}
208209
disabled={props.disabled}
209210
/>
211+
{ingestEndpointEnvironment !== undefined && (
212+
<>
213+
<AlertWarning>
214+
Any changes to the Data Manager Endpoint environment will not be
215+
automatically updated here. You will need to update the revision and
216+
redeploy manually.
217+
</AlertWarning>
218+
<Box mt={2} />
219+
</>
220+
)}
210221
<SelectIngestEndpointEnvironment
211222
ingestEndpointId={ingestEndpointId}
212223
environmentId={environmentId}
@@ -217,12 +228,10 @@ const IngestEndpointPayloadInputType: FC<IngestEndpointPayloadInputTypeProps> =
217228
{ingestEndpointEnvironment !== undefined && (
218229
<>
219230
<small>Endpoint</small>
220-
<Box sx={{ color: '#777777', fontWeight: 'bold' }}>{endpoint}</Box>
231+
<Box fontSize={12}>
232+
<CopyBlock text={endpoint} language="html" flat />
233+
</Box>
221234
<Box mt={2} />
222-
<AlertWarning>
223-
Any changes to the endpoint environment will not be automatically updated
224-
here. You will need to update the revision and redeploy manually.
225-
</AlertWarning>
226235
<DataMapsPayloadBuilder
227236
appPlatformRevisions={appPlatformRevisions}
228237
initialPayload={initialPayload}

ui/src/utils/DataContainersUtils.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,20 @@ export const buildDataContainersSelectValues = (
4141

4242
export const platformDataMapsToSelectValues = (
4343
platformDataMaps: PlatformDataMap[],
44+
useKeys = false,
4445
): SelectValueWithSub[] => {
4546
return platformDataMapsToSubAndDeeper(platformDataMaps).map((subAndDeeper) => {
4647
const MainIcon = getDataMapsIcon(subAndDeeper.icon);
4748

4849
return {
49-
key: subAndDeeper.id,
50+
key: useKeys ? subAndDeeper.keys.join('.') : subAndDeeper.id,
5051
text: subAndDeeper.keys.join('.'),
5152
iconType: subAndDeeper.sub === undefined ? subAndDeeper.icon ?? undefined : undefined,
5253
icon: subAndDeeper.sub === undefined ? <MainIcon /> : undefined,
5354
sub: subAndDeeper.sub?.map((sub) => {
5455
const SubIcon = getDataMapsIcon(sub.icon);
5556
return {
56-
key: sub.id,
57+
key: useKeys ? sub.key : sub.id,
5758
text: sub.key,
5859
iconType: sub.icon ?? undefined,
5960
icon: <SubIcon />,

0 commit comments

Comments
 (0)