Skip to content

Commit

Permalink
Merge pull request #2202 from avivtur/bug-icon-actions-not-appearing-…
Browse files Browse the repository at this point in the history
…while-vm-stopping

CNV-43588: Start/Restart/Stop icon controls disappear during shutdown
  • Loading branch information
openshift-merge-bot[bot] authored Sep 25, 2024
2 parents fbe898d + d26daaf commit da7789c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { VMActionIconDetails } from '@virtualmachines/actions/components/VMActio

import '../VMActionsIconBar.scss';

const ActionIconButton: FC<VMActionIconDetails> = ({ action, Icon, iconClassname, isHidden }) => {
const ActionIconButton: FC<VMActionIconDetails> = ({
action,
Icon,
iconClassname,
isDisabled,
isHidden,
}) => {
const [actionAllowed] = useAccessReview(action?.accessReview);

const handleClick = () => {
Expand All @@ -23,7 +29,7 @@ const ActionIconButton: FC<VMActionIconDetails> = ({ action, Icon, iconClassname
<Button
className="vm-actions-icon-bar__button"
data-test-id={`${action?.id}-button`}
isDisabled={!actionAllowed}
isDisabled={!actionAllowed || isDisabled}
onClick={handleClick}
variant={ButtonVariant.link}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export type VMActionIconDetails = {
action: Action;
Icon: ComponentClass<SVGIconProps, any>;
iconClassname?: string;
isHidden: boolean;
isDisabled?: boolean;
isHidden?: boolean;
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ export const getVMActionIconsDetails = (vm: V1VirtualMachine): VMActionIconDetai
{
action: VirtualMachineActionFactory.stop(vm),
Icon: SquareIcon,
isHidden: !isRunning(vm) && !isPaused(vm),
isDisabled: !isRunning(vm) && !isPaused(vm),
},
{
action: VirtualMachineActionFactory.restart(vm),
Icon: RedoIcon,
isHidden: !isRunning(vm) && !isPaused(vm),
isDisabled: !isRunning(vm) && !isPaused(vm),
},
{
action: VirtualMachineActionFactory.pause(vm),
Icon: PauseIcon,
isHidden: !isRunning(vm),
isDisabled: !isRunning(vm),
isHidden: isPaused(vm),
},
{
action: VirtualMachineActionFactory.unpause(vm),
Expand All @@ -38,7 +39,7 @@ export const getVMActionIconsDetails = (vm: V1VirtualMachine): VMActionIconDetai
{
action: VirtualMachineActionFactory.start(vm),
Icon: PlayIcon,
isHidden: !isStopped(vm),
isDisabled: !isStopped(vm),
},
];
};

0 comments on commit da7789c

Please sign in to comment.