Skip to content

Commit c056dcb

Browse files
Merge pull request #185 from zenml-io/create-stack-flow
added modal to view config
2 parents 22535cd + baa9b80 commit c056dcb

File tree

1 file changed

+35
-34
lines changed
  • src/ui/layouts/stacks/CreateStack/ListForAll/GetList

1 file changed

+35
-34
lines changed

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

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { stackComponentsActions } from '../../../../../../redux/actions';
1313
import { titleCase } from '../../../../../../utils';
1414
import { useHistory, useLocation } from '../../../../../hooks';
1515
import { routePaths } from '../../../../../../routes/routePaths';
16+
import { NonEditableConfig } from '../../../../NonEditableConfig';
1617

1718
interface Props {
1819
type: string;
@@ -33,6 +34,7 @@ export const GetList: React.FC<Props> = ({
3334
const [fetching, setFetching] = useState(false);
3435
const [list, setlist] = useState([]);
3536
const [showPopup, setShowPopup] = useState<boolean>(false);
37+
const [selectedStackBox, setSelectedStackBox] = useState<any>();
3638
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
3739

3840
useEffect(() => {
@@ -108,55 +110,54 @@ export const GetList: React.FC<Props> = ({
108110
</div>
109111
</Box>
110112
{list?.map((item: any) => {
111-
112113
const checkboxValue = selectedStack.filter((s: any) => {
113114
return s.id === item.id;
114115
});
115-
116-
return (
117-
<Box marginLeft="md" style={{ cursor: 'pointer' }} onClick={() => setShowPopup(true)}>
118-
<CustomStackBox
119-
image={item?.logoUrl}
120-
stackName={item.name}
121-
stackDesc={item?.flavor.name}
122-
value={checkboxValue?.length > 0 ? true : false}
123-
onCheck={(e: any) => {
124-
e.stopPropagation()
125-
var index = selectedStack.findIndex(function (s: any) {
126-
return s.id === item.id;
127-
});
128-
if (index !== -1) {
129-
selectedStack.splice(index, 1);
130-
setSelectedStack([...selectedStack]);
131-
} else {
132-
setSelectedStack([...selectedStack, item]);
133-
}
116+
117+
return (
118+
<Box
119+
marginLeft="md"
120+
style={{ cursor: 'pointer' }}
121+
onClick={() => {
122+
setShowPopup(true);
123+
setSelectedStackBox(item);
134124
}}
135-
/>
136-
</Box>
137-
)
125+
>
126+
<CustomStackBox
127+
image={item?.logoUrl}
128+
stackName={item.name}
129+
stackDesc={item?.flavor.name}
130+
value={checkboxValue?.length > 0 ? true : false}
131+
onCheck={(e: any) => {
132+
e.stopPropagation();
133+
var index = selectedStack.findIndex(function (s: any) {
134+
return s.id === item.id;
135+
});
136+
if (index !== -1) {
137+
selectedStack.splice(index, 1);
138+
setSelectedStack([...selectedStack]);
139+
} else {
140+
setSelectedStack([...selectedStack, item]);
141+
}
142+
}}
143+
/>
144+
</Box>
145+
);
138146
})}
139147
</FlexBox.Row>
140-
141-
148+
142149
{showPopup && (
143150
<SidePopup
144151
isCreate={false}
145152
onSeeExisting={() => {}}
146153
onClose={() => setShowPopup(false)}
147154
>
148-
<Box marginTop="md">
149-
{/* <FormTextField
150-
onChange={(e: any) => {}}
151-
placeholder=""
152-
label='Stack Name'
153-
value={selectedStackBox.name}
154-
/> */}
155+
<Box marginTop="md" paddingBottom={'xxxl'}>
156+
<NonEditableConfig details={selectedStackBox}></NonEditableConfig>
157+
{console.log(selectedStackBox, 'selectedStackBox')}
155158
</Box>
156159
</SidePopup>
157160
)}
158-
159-
160161
</>
161162
);
162163
};

0 commit comments

Comments
 (0)