Skip to content

Commit

Permalink
frontend: Don't render Create Resource popup until it's open
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Dubenko <[email protected]>
  • Loading branch information
sniok committed Dec 6, 2024
1 parent 81b37f7 commit 5b5b068
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions frontend/src/components/common/Resource/CreateButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,39 +147,41 @@ export default function CreateButton(props: CreateButtonProps) {
{t('translation|Create')}
</Button>
)}
<EditorDialog
item={{}}
open={openDialog}
onClose={() => setOpenDialog(false)}
onSave={handleSave}
saveLabel={t('translation|Apply')}
errorMessage={errorMessage}
onEditorChanged={() => setErrorMessage('')}
title={t('translation|Create / Apply')}
actions={
clusters.length > 1
? [
<FormControl>
<InputLabel id="edit-dialog-cluster-target">{t('glossary|Cluster')}</InputLabel>
<Select
labelId="edit-dialog-cluster-target"
id="edit-dialog-cluster-target-select"
value={targetCluster}
onChange={event => {
setTargetCluster(event.target.value as string);
}}
>
{clusters.map(cluster => (
<MenuItem key={cluster} value={cluster}>
{cluster}
</MenuItem>
))}
</Select>
</FormControl>,
]
: []
}
/>
{openDialog && (
<EditorDialog
item={{}}
open={openDialog}
onClose={() => setOpenDialog(false)}
onSave={handleSave}
saveLabel={t('translation|Apply')}
errorMessage={errorMessage}
onEditorChanged={() => setErrorMessage('')}
title={t('translation|Create / Apply')}
actions={
clusters.length > 1
? [
<FormControl>
<InputLabel id="edit-dialog-cluster-target">{t('glossary|Cluster')}</InputLabel>
<Select
labelId="edit-dialog-cluster-target"
id="edit-dialog-cluster-target-select"
value={targetCluster}
onChange={event => {
setTargetCluster(event.target.value as string);
}}
>
{clusters.map(cluster => (
<MenuItem key={cluster} value={cluster}>
{cluster}
</MenuItem>
))}
</Select>
</FormControl>,
]
: []
}
/>
)}
</React.Fragment>
);
}

0 comments on commit 5b5b068

Please sign in to comment.