Skip to content

Commit 8b9724e

Browse files
authored
Merge pull request #3643 from sniok/missing-onclose-activity
frontend: Add missing onClose handlers for EditDialog activities
2 parents 0bfdedf + 77e6016 commit 8b9724e

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

frontend/src/components/advancedSearch/ResourceSearch.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,20 @@ function ViewYaml({ item }: { item: KubeObject }) {
306306
variant="contained"
307307
color="secondary"
308308
onClick={() => {
309+
const id = 'view-yaml-' + item.metadata.uid;
309310
Activity.launch({
310-
id: 'view-yaml-' + item.metadata.uid,
311+
id,
311312
location: 'full',
312313
icon: <KubeIcon kind={item.kind} />,
313314
title: item.kind + ': ' + item.metadata.name,
314315
content: (
315-
<EditorDialog noDialog open item={item.jsonData} onClose={() => {}} onSave={null} />
316+
<EditorDialog
317+
noDialog
318+
open
319+
item={item.jsonData}
320+
onClose={() => Activity.close(id)}
321+
onSave={null}
322+
/>
316323
),
317324
});
318325
}}

frontend/src/components/common/Resource/CreateButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,17 @@ export default function CreateButton(props: CreateButtonProps) {
5454
}, [clusters]);
5555

5656
const openActivity = () => {
57+
const id = 'create-button';
5758
Activity.launch({
58-
id: 'create-button',
59+
id: id,
5960
title: t('translation|Create / Apply'),
6061
icon: <Icon icon="mdi:pencil" />,
6162
content: (
6263
<EditorDialog
6364
item={itemRef.current}
6465
open
6566
noDialog
66-
onClose={() => {}}
67+
onClose={() => Activity.close(id)}
6768
setOpen={() => {}}
6869
saveLabel={t('translation|Apply')}
6970
errorMessage={errorMessage}

frontend/src/components/common/Resource/EditButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ export default function EditButton(props: EditButtonProps) {
125125
description={t('translation|Edit')}
126126
buttonStyle={buttonStyle}
127127
onClick={() => {
128+
const id = 'edit-' + item.metadata.uid;
128129
Activity.launch({
129-
id: 'edit-' + item.metadata.uid,
130+
id: id,
130131
title: t('translation|Edit') + ': ' + item.metadata.name,
131132
icon: <Icon icon="mdi:pencil" />,
132133
cluster: item.cluster,
@@ -135,7 +136,7 @@ export default function EditButton(props: EditButtonProps) {
135136
noDialog
136137
item={item.getEditableObject()}
137138
open
138-
onClose={() => {}}
139+
onClose={() => Activity.close(id)}
139140
onSave={handleSave}
140141
allowToHideManagedFields
141142
errorMessage={errorMessage}

0 commit comments

Comments
 (0)