Skip to content

Commit 283f10c

Browse files
Merge pull request #206 from zenml-io/QA-Fixes
Qa fixes
2 parents 5257b37 + d714e8e commit 283f10c

File tree

2 files changed

+33
-12
lines changed
  • src/ui/layouts

2 files changed

+33
-12
lines changed

src/ui/layouts/NonEditableRunConfig/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Box, EditField, Paragraph } from '../../components';
2+
import { Box, EditField, FlexBox, Paragraph } from '../../components';
33
import styles from './index.module.scss';
44
import { titleCase } from '../../../utils';
55
import { ToggleField } from '../common/FormElement';
@@ -64,11 +64,11 @@ export const NonEditableRunConfig: React.FC<{ runConfiguration: any }> = ({
6464
<span className={`${styles.slider} ${styles.round}`}></span>
6565
</label>
6666
</FlexBox.Row> */}
67-
<ToggleField
68-
value={elementSchema}
69-
onHandleChange={() => {}}
70-
label={titleCase(elementName)}
71-
disabled={true}
67+
<ToggleField
68+
value={elementSchema}
69+
onHandleChange={() => {}}
70+
label={titleCase(elementName)}
71+
disabled={true}
7272
/>
7373
</Box>
7474
</Box>
@@ -77,12 +77,12 @@ export const NonEditableRunConfig: React.FC<{ runConfiguration: any }> = ({
7777
};
7878

7979
return (
80-
<>
80+
<FlexBox.Column marginLeft="md">
8181
{Object.keys(runConfiguration).map((key, ind) => (
8282
// <Col xs={6} key={ind}>
8383
<>{getFormElement(key, runConfiguration[key])}</>
8484
// </Col>
8585
))}
86-
</>
86+
</FlexBox.Column>
8787
);
8888
};

src/ui/layouts/stackComponents/ConfigureComponent/CreateComponent/index.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import axios from 'axios';
2323
import { routePaths } from '../../../../../routes/routePaths';
2424
import { SidePopup } from '../SidePopup';
2525
import { callActionForStackComponentsForPagination } from '../../Stacks/useService';
26+
// import { keys } from 'lodash';
2627

2728
export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
2829
const {
@@ -86,7 +87,7 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
8687

8788
const handleRemoveFields = (parentIndex: any, childIndex: any, name: any) => {
8889
const values = [...inputFields];
89-
debugger;
90+
// debugger;
9091
values[parentIndex][name].splice(childIndex, 1);
9192
setInputFields(values);
9293
};
@@ -322,15 +323,15 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
322323
const { id }: any = workspaces.find(
323324
(item) => item.name === selectedWorkspace,
324325
);
325-
326+
// debugger;
326327
const final: any = {};
327328
inputFields.forEach((ar: any) => {
328329
const keys = Object.keys(ar);
329330
keys.forEach((key) => {
330331
final[key] = {};
331332

332333
ar[key].forEach((nestedArr: any) => {
333-
if (nestedArr.key && nestedArr.value) {
334+
if (nestedArr.key || nestedArr.value) {
334335
final[key] = {
335336
...final[key],
336337
[nestedArr.key]: nestedArr.value,
@@ -343,7 +344,27 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
343344
});
344345
});
345346
});
346-
347+
for (const [key] of Object.entries(final)) {
348+
// console.log(`${key}: ${value}`);
349+
for (const [innerKey, innerValue] of Object.entries(final[key])) {
350+
if (!innerKey && innerValue) {
351+
return dispatch(
352+
showToasterAction({
353+
description: 'Key cannot be Empty.',
354+
type: toasterTypes.failure,
355+
}),
356+
);
357+
}
358+
if (!innerValue && innerKey) {
359+
return dispatch(
360+
showToasterAction({
361+
description: 'Value cannot be Empty.',
362+
type: toasterTypes.failure,
363+
}),
364+
);
365+
}
366+
}
367+
}
347368
const body = {
348369
user: user?.id,
349370
workspace: id,

0 commit comments

Comments
 (0)