Compare commits

...

2 Commits

Author SHA1 Message Date
Copilot
54adbb9588 Fix lint error: Remove unused variable in CopyJobActionMenu (#2336)
* Initial plan

* Fix lint error: Remove unused variable 'updatingAction' in CopyJobActionMenu.tsx

Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>
2026-01-20 22:32:30 +05:30
Bikram Choudhury
3291285765 Fix: Disable Complete action when any job update is in progress
- Updated CopyJobActionMenu to disable Complete button when any action is being performed
- Added comprehensive tests to verify Complete button is disabled during updates
- Improved user experience by preventing concurrent actions on copy jobs

This PR was generated by GitHub Copilot CLI
2026-01-20 22:32:30 +05:30
2 changed files with 29 additions and 4 deletions

View File

@@ -516,7 +516,7 @@ describe("CopyJobActionMenu", () => {
expect(screen.getByText("Cancel")).toBeInTheDocument();
});
it("should handle complete action disabled state for online jobs", () => {
it("should disable complete action when job is being updated", () => {
const job = createMockJob({
Status: CopyJobStatusType.InProgress,
Mode: CopyJobMigrationType.Online,
@@ -530,8 +530,34 @@ describe("CopyJobActionMenu", () => {
const completeButton = screen.getByText("Complete");
fireEvent.click(completeButton);
// Simulate dialog confirmation to trigger state update
const [, , , onOkCallback] = mockShowOkCancelModalDialog.mock.calls[0];
onOkCallback();
fireEvent.click(actionButton);
expect(screen.getByText("Complete")).toBeInTheDocument();
const completeButtonAfterClick = screen.getByText("Complete").closest("button");
expect(completeButtonAfterClick).toBeInTheDocument();
expect(completeButtonAfterClick).toHaveAttribute("aria-disabled", "true");
});
it("should disable complete action when any other action is being performed", () => {
const job = createMockJob({
Status: CopyJobStatusType.InProgress,
Mode: CopyJobMigrationType.Online,
});
render(<TestComponentWrapper job={job} />);
const actionButton = screen.getByRole("button", { name: "Actions" });
fireEvent.click(actionButton);
const pauseButton = screen.getByText("Pause");
fireEvent.click(pauseButton);
fireEvent.click(actionButton);
const completeButtonAfterClick = screen.getByText("Complete").closest("button");
expect(completeButtonAfterClick).toBeInTheDocument();
expect(completeButtonAfterClick).toHaveAttribute("aria-disabled", "true");
});
});

View File

@@ -61,7 +61,6 @@ const CopyJobActionMenu: React.FC<CopyJobActionMenuProps> = ({ job, handleClick
const getMenuItems = (): IContextualMenuProps["items"] => {
const isThisJobUpdating = updatingJobAction?.jobName === job.Name;
const updatingAction = updatingJobAction?.action;
const baseItems = [
{
@@ -105,7 +104,7 @@ const CopyJobActionMenu: React.FC<CopyJobActionMenuProps> = ({ job, handleClick
text: ContainerCopyMessages.MonitorJobs.Actions.complete,
iconProps: { iconName: "CheckMark" },
onClick: () => showActionConfirmationDialog(job, CopyJobActions.complete),
disabled: isThisJobUpdating && updatingAction === CopyJobActions.complete,
disabled: isThisJobUpdating,
});
}
return filteredItems;