Skip to content

Commit 0203ebd

Browse files
committed
flux: Fix suspend and resume actions
Signed-off-by: ashu8912 <aghildiyal@microsoft.com>
1 parent c677ea6 commit 0203ebd

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

flux/src/actions/index.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,14 @@ function SuspendAction(props) {
88
const { resource } = props;
99
const [open, setOpen] = React.useState<boolean>(false);
1010

11+
if(resource?.jsonData?.spec?.suspend) {
12+
return null;
13+
}
1114
return (
1215
<>
1316
<ActionButton
1417
description="Suspend"
1518
icon={'mdi:pause'}
16-
iconButtonProps={{
17-
style: {
18-
display: resource?.jsonData.spec.hasOwnProperty('suspend')
19-
? resource.jsonData.spec.suspend
20-
? 'none'
21-
: 'inline-flex'
22-
: 'inline-flex',
23-
},
24-
}}
2519
onClick={() => {
2620
setOpen(true);
2721
}}
@@ -32,7 +26,6 @@ function SuspendAction(props) {
3226
handleClose={() => setOpen(false)}
3327
onConfirm={() => {
3428
setOpen(false);
35-
resource.jsonData.spec['suspend'] = true;
3629
const patch = resource.constructor.apiEndpoint.patch;
3730
patch(
3831
{
@@ -72,17 +65,11 @@ function SuspendAction(props) {
7265
function ResumeAction(props) {
7366
const { resource } = props;
7467
const { enqueueSnackbar } = useSnackbar();
68+
if(!resource.jsonData.spec.suspend) {
69+
return null;
70+
}
7571
return (
7672
<ActionButton
77-
iconButtonProps={{
78-
style: {
79-
display: resource?.jsonData.spec.hasOwnProperty('suspend')
80-
? resource.jsonData.spec.suspend
81-
? 'inline-flex'
82-
: 'none'
83-
: 'none',
84-
},
85-
}}
8673
description="Resume"
8774
icon={'mdi:play'}
8875
onClick={() => {

0 commit comments

Comments
 (0)