Refactor Container Copy dropdowns with integrated state management (#2279)

This commit is contained in:
BChoudhury-ms
2025-12-15 12:25:05 +05:30
committed by GitHub
parent d67c1a0464
commit bc7e8a71ca
22 changed files with 955 additions and 2707 deletions

View File

@@ -52,7 +52,7 @@ describe("CopyJobStatusWithIcon", () => {
const spinner = container.querySelector('[class*="ms-Spinner"]');
expect(spinner).toBeInTheDocument();
expect(container).toHaveTextContent("In Progress");
expect(container).toHaveTextContent("Running");
expect(container.firstChild).toMatchSnapshot();
});
});
@@ -83,18 +83,18 @@ describe("CopyJobStatusWithIcon", () => {
it("provides meaningful text content for screen readers", () => {
const { container } = render(<CopyJobStatusWithIcon status={CopyJobStatusType.InProgress} />);
expect(container).toHaveTextContent("In Progress");
expect(container).toHaveTextContent("Running");
});
});
describe("Icon and Status Mapping", () => {
it("renders correct status text based on mapping", () => {
const statusMappings = [
{ status: CopyJobStatusType.Pending, expectedText: "Pending" },
{ status: CopyJobStatusType.Pending, expectedText: "Queued" },
{ status: CopyJobStatusType.Paused, expectedText: "Paused" },
{ status: CopyJobStatusType.Failed, expectedText: "Failed" },
{ status: CopyJobStatusType.Completed, expectedText: "Completed" },
{ status: CopyJobStatusType.Running, expectedText: "In Progress" },
{ status: CopyJobStatusType.Running, expectedText: "Running" },
];
statusMappings.forEach(({ status, expectedText }) => {

View File

@@ -15,7 +15,7 @@ exports[`CopyJobStatusWithIcon Spinner Status Types renders InProgress with spin
<span
class="css-112"
>
In Progress
Running
</span>
</div>
`;
@@ -35,7 +35,7 @@ exports[`CopyJobStatusWithIcon Spinner Status Types renders Partitioning with sp
<span
class="css-112"
>
In Progress
Running
</span>
</div>
`;
@@ -55,7 +55,7 @@ exports[`CopyJobStatusWithIcon Spinner Status Types renders Running with spinner
<span
class="css-112"
>
In Progress
Running
</span>
</div>
`;
@@ -181,7 +181,7 @@ exports[`CopyJobStatusWithIcon Static Icon Status Types - Snapshot Tests renders
<span
class="css-112"
>
Pending
Queued
</span>
</div>
`;

View File

@@ -44,7 +44,9 @@ const MonitorCopyJobs = forwardRef<MonitorCopyJobsRef, MonitorCopyJobsProps>(({
return isEqual(prevJobs, normalizedResponse) ? prevJobs : normalizedResponse;
});
} catch (error) {
setError(error.message || "Failed to load copy jobs. Please try again later.");
if (error.message !== "Previous copy job request was cancelled.") {
setError(error.message || "Failed to load copy jobs. Please try again later.");
}
} finally {
if (isFirstFetchRef.current) {
setLoading(false);