Skip to content

Commit b44e1ec

Browse files
committed
Merge branch 'dev' into stack-creation-fixes
2 parents facb77f + 1733d40 commit b44e1ec

File tree

9 files changed

+170
-117
lines changed

9 files changed

+170
-117
lines changed

src/ui/layouts/common/FormElement/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export function TextField(props: any) {
5252

5353
export function ToggleField(props: any) {
5454
const { value, onHandleChange, label, disabled } = props;
55+
5556
return (
5657
<Box style={{ height: '68px' }}>
5758
<FlexBox.Row justifyContent="space-between" flexDirection="column">
@@ -61,11 +62,14 @@ export function ToggleField(props: any) {
6162
</Paragraph>
6263
</Box>
6364
<FlexBox.Row className={styles.switchContainer}>
64-
<div className={styles.switchLabel}><span>{value ? <>Yes</> : <>No</>}</span></div>
65+
<div className={styles.switchLabel}>
66+
<span>{value ? <>Yes</> : <>No</>}</span>
67+
</div>
6568
<label className={styles.switch}>
6669
<input
6770
type="checkbox"
68-
checked={value}
71+
defaultChecked={value}
72+
// checked={value}
6973
onChange={onHandleChange}
7074
disabled={disabled}
7175
/>

src/ui/layouts/pipelines/RunDetail/Configuration/index.tsx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22

3-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4-
import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
5-
import { Box, FlexBox, H4, GhostButton, icons } from '../../../../components';
3+
// import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4+
// import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
5+
import {
6+
// Box,
7+
FlexBox,
8+
// H4, GhostButton, icons
9+
} from '../../../../components';
610

7-
import { useDispatch } from '../../../../hooks';
8-
import { showToasterAction } from '../../../../../redux/actions';
9-
import { toasterTypes } from '../../../../../constants';
10-
import { iconColors, iconSizes } from '../../../../../constants';
11+
// import { useDispatch } from '../../../../hooks';
12+
// import { showToasterAction } from '../../../../../redux/actions';
13+
// import { toasterTypes } from '../../../../../constants';
14+
// import { iconColors, iconSizes } from '../../../../../constants';
1115

12-
import styles from './index.module.scss';
16+
// import styles from './index.module.scss';
1317
import { useService } from './useService';
1418
import { NonEditableRunConfig } from '../../../NonEditableRunConfig';
1519

1620
export const Configuration: React.FC<{ runId: TId }> = ({ runId }) => {
17-
const { downloadYamlFile, pipelineConfig, run } = useService({ runId });
18-
const [hover, setHover] = useState(false);
19-
const dispatch = useDispatch();
20-
const handleCopy = () => {
21-
navigator.clipboard.writeText(pipelineConfig);
22-
dispatch(
23-
showToasterAction({
24-
description: 'Config copied to clipboard',
25-
type: toasterTypes.success,
26-
}),
27-
);
28-
};
21+
const { run } = useService({ runId });
22+
// const [hover, setHover] = useState(false);
23+
// const dispatch = useDispatch();
24+
// const handleCopy = () => {
25+
// navigator.clipboard.writeText(pipelineConfig);
26+
// dispatch(
27+
// showToasterAction({
28+
// description: 'Config copied to clipboard',
29+
// type: toasterTypes.success,
30+
// }),
31+
// );
32+
// };
2933

3034
return (
3135
<FlexBox.Column fullWidth>
3236
<NonEditableRunConfig
3337
runConfiguration={run.pipelineConfiguration}
3438
></NonEditableRunConfig>
35-
<FlexBox
39+
{/* <FlexBox
3640
marginBottom="md"
3741
alignItems="center"
3842
justifyContent="space-between"
@@ -71,7 +75,7 @@ export const Configuration: React.FC<{ runId: TId }> = ({ runId }) => {
7175
>
7276
{pipelineConfig}
7377
</SyntaxHighlighter>
74-
</FlexBox>
78+
</FlexBox> */}
7579
</FlexBox.Column>
7680
);
7781
};

src/ui/layouts/runs/RunDetail/Configuration/index.tsx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22

3-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4-
import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
5-
import { Box, FlexBox, H4, GhostButton, icons } from '../../../../components';
3+
// import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4+
// import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
5+
import {
6+
// Box,
7+
FlexBox,
8+
// H4, GhostButton, icons
9+
} from '../../../../components';
610

7-
import { useDispatch } from '../../../../hooks';
8-
import { showToasterAction } from '../../../../../redux/actions';
9-
import { toasterTypes } from '../../../../../constants';
10-
import { iconColors, iconSizes } from '../../../../../constants';
11+
// import { useDispatch } from '../../../../hooks';
12+
// import { showToasterAction } from '../../../../../redux/actions';
13+
// import { toasterTypes } from '../../../../../constants';
14+
// import { iconColors, iconSizes } from '../../../../../constants';
1115

12-
import styles from './index.module.scss';
16+
// import styles from './index.module.scss';
1317
import { useService } from './useService';
1418

1519
import { NonEditableRunConfig } from '../../../NonEditableRunConfig';
1620

1721
export const Configuration: React.FC<{ runId: TId }> = ({ runId }) => {
18-
const { downloadYamlFile, pipelineConfig, run } = useService({ runId });
19-
const [hover, setHover] = useState(false);
20-
const dispatch = useDispatch();
21-
const handleCopy = () => {
22-
navigator.clipboard.writeText(pipelineConfig);
23-
dispatch(
24-
showToasterAction({
25-
description: 'Config copied to clipboard',
26-
type: toasterTypes.success,
27-
}),
28-
);
29-
};
22+
const { run } = useService({ runId });
23+
// const [hover, setHover] = useState(false);
24+
// const dispatch = useDispatch();
25+
// const handleCopy = () => {
26+
// navigator.clipboard.writeText(pipelineConfig);
27+
// dispatch(
28+
// showToasterAction({
29+
// description: 'Config copied to clipboard',
30+
// type: toasterTypes.success,
31+
// }),
32+
// );
33+
// };
3034

3135
return (
3236
<FlexBox.Column fullWidth>
3337
<NonEditableRunConfig
3438
runConfiguration={run.pipelineConfiguration}
3539
></NonEditableRunConfig>
36-
<FlexBox
40+
{/* <FlexBox
3741
marginBottom="md"
3842
alignItems="center"
3943
justifyContent="space-between"
@@ -72,7 +76,7 @@ export const Configuration: React.FC<{ runId: TId }> = ({ runId }) => {
7276
>
7377
{pipelineConfig}
7478
</SyntaxHighlighter>
75-
</FlexBox>
79+
</FlexBox> */}
7680
</FlexBox.Column>
7781
);
7882
};

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,19 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
277277
}
278278
if (elementSchema.type === 'boolean' && elementSchema.title) {
279279
return (
280-
<Box marginTop='md'>
280+
<Box marginTop="md">
281281
<ToggleField
282282
{...props}
283-
onHandleChange={(key: any, value: any) =>
284-
setInputData({ ...inputData, [key]: value })
283+
value={
284+
inputData[props.name] ? inputData[props.name] : props.default
285285
}
286+
onHandleChange={(event: any, value: any) => {
287+
// debugger;
288+
setInputData({
289+
...inputData,
290+
[props.name]: !inputData[props.name],
291+
});
292+
}}
286293
/>
287294
</Box>
288295
);
@@ -406,12 +413,13 @@ export const CreateComponent: React.FC<{ flavor: any }> = ({ flavor }) => {
406413
label={'Component Name'}
407414
value={componentName}
408415
/>
409-
<Box marginTop='md'>
416+
<Box marginTop="md">
410417
<ToggleField
411418
label={'Share Component with public'}
412419
default={isShared}
420+
value={isShared}
413421
onHandleChange={
414-
(key: any, value: any) => setIsShared(value)
422+
(key: any, value: any) => setIsShared(!isShared)
415423
// setInputData({ ...inputData, ['is_shared']: value })
416424
}
417425
/>

src/ui/layouts/stackComponents/RunDetail/Configuration/index.tsx

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
import React, { useState } from 'react';
1+
import React from 'react';
22

3-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4-
import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
5-
import { Box, FlexBox, H4, GhostButton, icons } from '../../../../components';
3+
// import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4+
// import { okaidia } from 'react-syntax-highlighter/dist/esm/styles/prism';
5+
import {
6+
// Box,
7+
FlexBox,
8+
// H4, GhostButton, icons
9+
} from '../../../../components';
610

7-
import { useDispatch } from '../../../../hooks';
8-
import { showToasterAction } from '../../../../../redux/actions';
9-
import { toasterTypes } from '../../../../../constants';
10-
import { iconColors, iconSizes } from '../../../../../constants';
11+
// import { useDispatch } from '../../../../hooks';
12+
// import { showToasterAction } from '../../../../../redux/actions';
13+
// import { toasterTypes } from '../../../../../constants';
14+
// import { iconColors, iconSizes } from '../../../../../constants';
1115

12-
import styles from './index.module.scss';
16+
// import styles from './index.module.scss';
1317
import { useService } from './useService';
1418

1519
import { NonEditableRunConfig } from '../../../NonEditableRunConfig';
1620
export const Configuration: React.FC<{ runId: TId }> = ({ runId }) => {
17-
const [hover, setHover] = useState(false);
18-
const { downloadYamlFile, pipelineConfig, run } = useService({ runId });
21+
// const [hover, setHover] = useState(false);
22+
const { run } = useService({ runId });
1923

20-
const dispatch = useDispatch();
21-
const handleCopy = () => {
22-
navigator.clipboard.writeText(pipelineConfig);
23-
dispatch(
24-
showToasterAction({
25-
description: 'Config copied to clipboard',
26-
type: toasterTypes.success,
27-
}),
28-
);
29-
};
24+
// const dispatch = useDispatch();
25+
// const handleCopy = () => {
26+
// navigator.clipboard.writeText(pipelineConfig);
27+
// dispatch(
28+
// showToasterAction({
29+
// description: 'Config copied to clipboard',
30+
// type: toasterTypes.success,
31+
// }),
32+
// );
33+
// };
3034

3135
return (
3236
<FlexBox.Column fullWidth>
3337
<NonEditableRunConfig
3438
runConfiguration={run.pipelineConfiguration}
3539
></NonEditableRunConfig>
36-
<FlexBox
40+
{/* <FlexBox
3741
marginBottom="md"
3842
alignItems="center"
3943
justifyContent="space-between"
@@ -72,7 +76,7 @@ export const Configuration: React.FC<{ runId: TId }> = ({ runId }) => {
7276
>
7377
{pipelineConfig}
7478
</SyntaxHighlighter>
75-
</FlexBox>
79+
</FlexBox> */}
7680
</FlexBox.Column>
7781
);
7882
};

src/ui/layouts/stacks/CreateStack/ListForAll/SidePopup/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,7 @@ export const SidePopup: React.FC<{
7373
<Paragraph>Goto Component</Paragraph>
7474
</LinkBox>
7575
</Box>
76-
{isCreate && (
77-
<Box>
78-
<PrimaryButton onClick={registerStack}>
79-
Register Stack
80-
</PrimaryButton>
81-
</Box>
82-
)}
76+
8377
{canSelect && (
8478
<Box>
8579
<PrimaryButton onClick={onSelect}>

src/ui/layouts/stacks/CreateStack/ListForAll/index.tsx

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import React, { useState } from 'react';
22
import styles from './index.module.scss';
3-
import { Box, FlexBox, H2, FormTextField, PrimaryButton } from '../../../../components';
3+
import {
4+
Box,
5+
FlexBox,
6+
H2,
7+
FormTextField,
8+
PrimaryButton,
9+
} from '../../../../components';
410
import { ToggleField } from '../../../common/FormElement';
511

612
import {
@@ -259,14 +265,39 @@ export const ListForAll: React.FC<Props> = () => {
259265
</FlexBox.Column>
260266

261267
<Box className={styles.stackFooter}>
262-
<PrimaryButton className={styles.stackFooterButton}>Register</PrimaryButton>
268+
<PrimaryButton
269+
className={styles.stackFooterButton}
270+
onClick={() => onCreateStack()}
271+
>
272+
Register Stack
273+
</PrimaryButton>
263274
</Box>
264275

265276
{showPopup && (
266277
<SidePopup
267-
isCreate={true}
268-
registerStack={() => {
269-
onCreateStack();
278+
canSelect={true}
279+
selectedStackBox={selectedStackBox}
280+
selectedStack={selectedStack}
281+
onSelect={() => {
282+
var index = selectedStack.findIndex(function (s: any) {
283+
return s.id === selectedStackBox.id;
284+
});
285+
if (index !== -1) {
286+
selectedStack.splice(index, 1);
287+
setSelectedStack([...selectedStack]);
288+
} else {
289+
if (
290+
selectedStack.map((t: any) => t.type === selectedStackBox.type)
291+
) {
292+
let filterSelectedStack = selectedStack.filter(
293+
(st: any) => st.type !== selectedStackBox.type,
294+
);
295+
setSelectedStack([...filterSelectedStack, selectedStackBox]);
296+
} else {
297+
setSelectedStack([...selectedStack, selectedStackBox]);
298+
}
299+
}
300+
setShowPopup(false);
270301
}}
271302
onSeeExisting={() => {
272303
dispatch(

0 commit comments

Comments
 (0)