mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-29 14:44:22 +00:00
Add search/filter support to Copy Jobs list with pagination updates (#2343)
* search the copy job * remove timeout * Update src/Explorer/ContainerCopy/MonitorCopyJobs/Components/CopyJobsList.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix pagination race condition when filtering copy jobs (#2351) * Initial plan * Fix pagination race condition by resetting startIndex synchronously 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> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: BChoudhury-ms <201893606+BChoudhury-ms@users.noreply.github.com>
This commit is contained in:
@@ -11,9 +11,17 @@ jest.mock("../../Actions/CopyJobActions", () => ({
|
|||||||
|
|
||||||
jest.mock("./CopyJobColumns", () => ({
|
jest.mock("./CopyJobColumns", () => ({
|
||||||
getColumns: jest.fn(() => [
|
getColumns: jest.fn(() => [
|
||||||
|
{
|
||||||
|
key: "LastUpdatedTime",
|
||||||
|
name: "Date & time",
|
||||||
|
fieldName: "LastUpdatedTime",
|
||||||
|
minWidth: 140,
|
||||||
|
maxWidth: 300,
|
||||||
|
isResizable: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "Name",
|
key: "Name",
|
||||||
name: "Name",
|
name: "Job name",
|
||||||
fieldName: "Name",
|
fieldName: "Name",
|
||||||
minWidth: 140,
|
minWidth: 140,
|
||||||
maxWidth: 300,
|
maxWidth: 300,
|
||||||
@@ -165,6 +173,165 @@ describe("CopyJobsList", () => {
|
|||||||
expect(screen.getByTestId("action-menu-job-2")).toBeInTheDocument();
|
expect(screen.getByTestId("action-menu-job-2")).toBeInTheDocument();
|
||||||
expect(screen.getByTestId("action-menu-job-3")).toBeInTheDocument();
|
expect(screen.getByTestId("action-menu-job-3")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders filter TextField with data-test attribute", () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterTextField = document.querySelector('[data-test="CopyJobsList/FilterTextField"]');
|
||||||
|
expect(filterTextField).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("renders search TextField with correct placeholder", () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const searchInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
expect(searchInput).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Filtering", () => {
|
||||||
|
it("filters jobs by Name when text is entered", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Job 1" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("filters jobs case-insensitively", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "test job 1" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows all jobs when filter text is empty", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Job 1" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
fireEvent.change(filterInput, { target: { value: "" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Test Job 2")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Test Job 3")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("filters jobs by Status across all columns", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: CopyJobStatusType.Running } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("filters jobs by Mode across all columns", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Offline" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.queryByText("Test Job 1")).not.toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Test Job 2")).toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows no results when filter matches no jobs", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "NonExistentJob" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.queryByText("Test Job 1")).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 2")).not.toBeInTheDocument();
|
||||||
|
expect(screen.queryByText("Test Job 3")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("filters by partial text match", async () => {
|
||||||
|
render(<CopyJobsList jobs={mockJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Test" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Test Job 2")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Test Job 3")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("resets pagination when filter changes", async () => {
|
||||||
|
const manyJobs: CopyJobType[] = Array.from({ length: 25 }, (_, i) => ({
|
||||||
|
...mockJobs[0],
|
||||||
|
ID: `job-${i + 1}`,
|
||||||
|
Name: `Test Job ${i + 1}`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} pageSize={10} />);
|
||||||
|
|
||||||
|
// Navigate to page 2
|
||||||
|
fireEvent.click(screen.getByLabelText("Go to next page"));
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Showing 11 - 20 of 25 items")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Apply filter - should reset to page 1
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Job 1" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
// Filtered results show from the beginning
|
||||||
|
expect(screen.getByText("Test Job 1")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("updates filtered count in pager", async () => {
|
||||||
|
const manyJobs: CopyJobType[] = Array.from({ length: 25 }, (_, i) => ({
|
||||||
|
...mockJobs[0],
|
||||||
|
ID: `job-${i + 1}`,
|
||||||
|
Name: i < 5 ? `Alpha Job ${i + 1}` : `Beta Job ${i + 1}`,
|
||||||
|
}));
|
||||||
|
|
||||||
|
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} pageSize={10} />);
|
||||||
|
|
||||||
|
expect(screen.getByText("Showing 1 - 10 of 25 items")).toBeInTheDocument();
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Alpha" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.queryByText("Showing 1 - 10 of 25 items")).not.toBeInTheDocument();
|
||||||
|
// Pager should not be visible since filtered results (5) are less than page size (10)
|
||||||
|
expect(screen.queryByLabelText("Go to next page")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Pagination", () => {
|
describe("Pagination", () => {
|
||||||
@@ -342,7 +509,7 @@ describe("CopyJobsList", () => {
|
|||||||
|
|
||||||
describe("Component Props", () => {
|
describe("Component Props", () => {
|
||||||
it("uses default page size when not provided", () => {
|
it("uses default page size when not provided", () => {
|
||||||
const manyJobs: CopyJobType[] = Array.from({ length: 12 }, (_, i) => ({
|
const manyJobs: CopyJobType[] = Array.from({ length: 20 }, (_, i) => ({
|
||||||
...mockJobs[0],
|
...mockJobs[0],
|
||||||
ID: `job-${i + 1}`,
|
ID: `job-${i + 1}`,
|
||||||
Name: `Test Job ${i + 1}`,
|
Name: `Test Job ${i + 1}`,
|
||||||
@@ -351,7 +518,7 @@ describe("CopyJobsList", () => {
|
|||||||
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} />);
|
render(<CopyJobsList jobs={manyJobs} handleActionClick={mockHandleActionClick} />);
|
||||||
|
|
||||||
expect(screen.getByLabelText("Go to next page")).toBeInTheDocument();
|
expect(screen.getByLabelText("Go to next page")).toBeInTheDocument();
|
||||||
expect(screen.getByText("Showing 1 - 10 of 12 items")).toBeInTheDocument();
|
expect(screen.getByText("Showing 1 - 15 of 20 items")).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("passes correct props to getColumns function", async () => {
|
it("passes correct props to getColumns function", async () => {
|
||||||
@@ -440,7 +607,33 @@ describe("CopyJobsList", () => {
|
|||||||
render(<CopyJobsList jobs={largeJobsList} handleActionClick={mockHandleActionClick} />);
|
render(<CopyJobsList jobs={largeJobsList} handleActionClick={mockHandleActionClick} />);
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
|
|
||||||
expect(screen.getByText("Showing 1 - 10 of 1000 items")).toBeInTheDocument();
|
expect(screen.getByText("Showing 1 - 15 of 1000 items")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("handles filtering with null or undefined values gracefully", async () => {
|
||||||
|
const jobsWithNullValues: CopyJobType[] = [
|
||||||
|
{
|
||||||
|
...mockJobs[0],
|
||||||
|
ID: "job-with-values",
|
||||||
|
Name: "Valid Job",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
...mockJobs[1],
|
||||||
|
ID: "job-null-name",
|
||||||
|
Name: undefined as unknown as string,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
render(<CopyJobsList jobs={jobsWithNullValues} handleActionClick={mockHandleActionClick} />);
|
||||||
|
}).not.toThrow();
|
||||||
|
|
||||||
|
const filterInput = screen.getByPlaceholderText("Search jobs...");
|
||||||
|
fireEvent.change(filterInput, { target: { value: "Valid" } });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("Valid Job")).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ import {
|
|||||||
Stack,
|
Stack,
|
||||||
Sticky,
|
Sticky,
|
||||||
StickyPositionType,
|
StickyPositionType,
|
||||||
|
TextField,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect, useMemo } from "react";
|
||||||
import Pager from "../../../../Common/Pager";
|
import Pager from "../../../../Common/Pager";
|
||||||
import { useThemeStore } from "../../../../hooks/useTheme";
|
import { useThemeStore } from "../../../../hooks/useTheme";
|
||||||
import { getThemeTokens } from "../../../Theme/ThemeUtil";
|
import { getThemeTokens } from "../../../Theme/ThemeUtil";
|
||||||
@@ -30,9 +31,15 @@ interface CopyJobsListProps {
|
|||||||
const styles = {
|
const styles = {
|
||||||
container: { height: "100%" } as React.CSSProperties,
|
container: { height: "100%" } as React.CSSProperties,
|
||||||
stackItem: { position: "relative", marginBottom: "20px" } as React.CSSProperties,
|
stackItem: { position: "relative", marginBottom: "20px" } as React.CSSProperties,
|
||||||
|
filterContainer: {
|
||||||
|
margin: "15px 5px",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const PAGE_SIZE = 10;
|
const PAGE_SIZE = 15;
|
||||||
|
|
||||||
|
// Columns to search across
|
||||||
|
const searchableFields = ["Name", "Status", "LastUpdatedTime", "Mode"];
|
||||||
|
|
||||||
const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pageSize = PAGE_SIZE }) => {
|
const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pageSize = PAGE_SIZE }) => {
|
||||||
const isDarkMode = useThemeStore((state) => state.isDarkMode);
|
const isDarkMode = useThemeStore((state) => state.isDarkMode);
|
||||||
@@ -41,6 +48,23 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
const [sortedJobs, setSortedJobs] = React.useState<CopyJobType[]>(jobs);
|
const [sortedJobs, setSortedJobs] = React.useState<CopyJobType[]>(jobs);
|
||||||
const [sortedColumnKey, setSortedColumnKey] = React.useState<string | undefined>(undefined);
|
const [sortedColumnKey, setSortedColumnKey] = React.useState<string | undefined>(undefined);
|
||||||
const [isSortedDescending, setIsSortedDescending] = React.useState<boolean>(false);
|
const [isSortedDescending, setIsSortedDescending] = React.useState<boolean>(false);
|
||||||
|
const [filterText, setFilterText] = React.useState<string>("");
|
||||||
|
|
||||||
|
const filteredJobs = useMemo(() => {
|
||||||
|
if (!filterText) {
|
||||||
|
return sortedJobs;
|
||||||
|
}
|
||||||
|
const lowerFilterText = filterText.toLowerCase();
|
||||||
|
return sortedJobs.filter((job: any) => {
|
||||||
|
return searchableFields.some((field) => {
|
||||||
|
const value = job[field];
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return String(value).toLowerCase().includes(lowerFilterText);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}, [sortedJobs, filterText]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSortedJobs(jobs);
|
setSortedJobs(jobs);
|
||||||
@@ -64,7 +88,15 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
setStartIndex(0);
|
setStartIndex(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns: IColumn[] = getColumns(handleSort, handleActionClick, sortedColumnKey, isSortedDescending);
|
const sortableColumns: IColumn[] = getColumns(handleSort, handleActionClick, sortedColumnKey, isSortedDescending);
|
||||||
|
|
||||||
|
const handleFilterTextChange = (
|
||||||
|
_event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>,
|
||||||
|
newValue?: string,
|
||||||
|
) => {
|
||||||
|
setFilterText(newValue || "");
|
||||||
|
setStartIndex(0);
|
||||||
|
};
|
||||||
|
|
||||||
const _handleRowClick = (job: CopyJobType) => {
|
const _handleRowClick = (job: CopyJobType) => {
|
||||||
openCopyJobDetailsPanel(job);
|
openCopyJobDetailsPanel(job);
|
||||||
@@ -81,14 +113,25 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
return (
|
return (
|
||||||
<div style={styles.container}>
|
<div style={styles.container}>
|
||||||
<Stack verticalFill={true}>
|
<Stack verticalFill={true}>
|
||||||
|
<Stack.Item>
|
||||||
|
<div style={styles.filterContainer}>
|
||||||
|
<TextField
|
||||||
|
data-test="CopyJobsList/FilterTextField"
|
||||||
|
placeholder="Search jobs..."
|
||||||
|
ariaLabel="Search jobs"
|
||||||
|
value={filterText}
|
||||||
|
onChange={handleFilterTextChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Stack.Item>
|
||||||
<Stack.Item verticalFill={true} grow={1} shrink={1} style={styles.stackItem}>
|
<Stack.Item verticalFill={true} grow={1} shrink={1} style={styles.stackItem}>
|
||||||
<ScrollablePane scrollbarVisibility={ScrollbarVisibility.auto}>
|
<ScrollablePane scrollbarVisibility={ScrollbarVisibility.auto}>
|
||||||
<ShimmeredDetailsList
|
<ShimmeredDetailsList
|
||||||
className="CopyJobListContainer"
|
className="CopyJobListContainer"
|
||||||
onRenderRow={_onRenderRow}
|
onRenderRow={_onRenderRow}
|
||||||
checkboxVisibility={2}
|
checkboxVisibility={2}
|
||||||
columns={columns}
|
columns={sortableColumns}
|
||||||
items={sortedJobs.slice(startIndex, startIndex + pageSize)}
|
items={filteredJobs.slice(startIndex, startIndex + pageSize)}
|
||||||
enableShimmer={false}
|
enableShimmer={false}
|
||||||
constrainMode={ConstrainMode.unconstrained}
|
constrainMode={ConstrainMode.unconstrained}
|
||||||
layoutMode={DetailsListLayoutMode.justified}
|
layoutMode={DetailsListLayoutMode.justified}
|
||||||
@@ -117,12 +160,12 @@ const CopyJobsList: React.FC<CopyJobsListProps> = ({ jobs, handleActionClick, pa
|
|||||||
/>
|
/>
|
||||||
</ScrollablePane>
|
</ScrollablePane>
|
||||||
</Stack.Item>
|
</Stack.Item>
|
||||||
{sortedJobs.length > pageSize && (
|
{filteredJobs.length > pageSize && (
|
||||||
<Stack.Item>
|
<Stack.Item>
|
||||||
<Pager
|
<Pager
|
||||||
disabled={false}
|
disabled={false}
|
||||||
startIndex={startIndex}
|
startIndex={startIndex}
|
||||||
totalCount={sortedJobs.length}
|
totalCount={filteredJobs.length}
|
||||||
pageSize={pageSize}
|
pageSize={pageSize}
|
||||||
onLoadPage={(startIdx /* pageSize */) => {
|
onLoadPage={(startIdx /* pageSize */) => {
|
||||||
setStartIndex(startIdx);
|
setStartIndex(startIdx);
|
||||||
|
|||||||
@@ -1,5 +1,27 @@
|
|||||||
@import "../../../less/Common/Constants.less";
|
@import "../../../less/Common/Constants.less";
|
||||||
|
|
||||||
|
.themedTextFieldStyles() {
|
||||||
|
.ms-TextField {
|
||||||
|
.ms-TextField-fieldGroup {
|
||||||
|
background-color: var(--colorNeutralBackground1);
|
||||||
|
border-color: var(--colorNeutralStroke1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-TextField-field {
|
||||||
|
color: var(--colorNeutralForeground1);
|
||||||
|
background-color: var(--colorNeutralBackground1);
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
color: var(--colorNeutralForeground4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ms-Label {
|
||||||
|
color: var(--colorNeutralForeground1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Common theme-aware classes
|
// Common theme-aware classes
|
||||||
.themeText {
|
.themeText {
|
||||||
color: var(--colorNeutralForeground1);
|
color: var(--colorNeutralForeground1);
|
||||||
@@ -119,25 +141,8 @@
|
|||||||
filter: invert(1);
|
filter: invert(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-TextField {
|
.themedTextFieldStyles();
|
||||||
.ms-TextField-fieldGroup {
|
|
||||||
background-color: var(--colorNeutralBackground1);
|
|
||||||
border-color: var(--colorNeutralStroke1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ms-TextField-field {
|
|
||||||
color: var(--colorNeutralForeground1);
|
|
||||||
background-color: var(--colorNeutralBackground1);
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
color: var(--colorNeutralForeground4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ms-Label {
|
|
||||||
color: var(--colorNeutralForeground1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.migrationTypeDescription {
|
.migrationTypeDescription {
|
||||||
p {
|
p {
|
||||||
color: var(--colorNeutralForeground1);
|
color: var(--colorNeutralForeground1);
|
||||||
@@ -173,6 +178,11 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
|
body.isDarkMode & {
|
||||||
|
.themedTextFieldStyles();
|
||||||
|
}
|
||||||
|
|
||||||
.ms-DetailsList {
|
.ms-DetailsList {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|||||||
@@ -246,13 +246,17 @@ test.describe("Container Copy - Offline Migration", () => {
|
|||||||
expect(response.ok()).toBe(true);
|
expect(response.ok()).toBe(true);
|
||||||
|
|
||||||
// Verify panel closes and job appears in the list
|
// Verify panel closes and job appears in the list
|
||||||
await expect(panel).not.toBeVisible({ timeout: 5000 });
|
await expect(panel).not.toBeVisible();
|
||||||
|
|
||||||
|
const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
||||||
|
await filterTextField.waitFor({ state: "visible" });
|
||||||
|
await filterTextField.fill(validJobName);
|
||||||
|
|
||||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||||
await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
await jobsListContainer.waitFor({ state: "visible" });
|
||||||
|
|
||||||
const jobItem = jobsListContainer.getByText(validJobName);
|
const jobItem = jobsListContainer.getByText(validJobName);
|
||||||
await jobItem.waitFor({ state: "visible", timeout: 5000 });
|
await jobItem.waitFor({ state: "visible" });
|
||||||
await expect(jobItem).toBeVisible();
|
await expect(jobItem).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -120,18 +120,22 @@ test.describe("Container Copy - Online Migration", () => {
|
|||||||
expect(response.ok()).toBe(true);
|
expect(response.ok()).toBe(true);
|
||||||
|
|
||||||
// Verify panel closes and job appears in the list
|
// Verify panel closes and job appears in the list
|
||||||
await expect(panel).not.toBeVisible({ timeout: 5000 });
|
await expect(panel).not.toBeVisible();
|
||||||
|
|
||||||
|
const filterTextField = wrapper.getByTestId("CopyJobsList/FilterTextField");
|
||||||
|
await filterTextField.waitFor({ state: "visible" });
|
||||||
|
await filterTextField.fill(onlineMigrationJobName);
|
||||||
|
|
||||||
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
const jobsListContainer = wrapper.locator(".CopyJobListContainer .ms-DetailsList-contentWrapper .ms-List-page");
|
||||||
await jobsListContainer.waitFor({ state: "visible", timeout: 5000 });
|
await jobsListContainer.waitFor({ state: "visible" });
|
||||||
|
|
||||||
let jobRow, statusCell, actionMenuButton;
|
let jobRow, statusCell, actionMenuButton;
|
||||||
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
jobRow = jobsListContainer.locator(".ms-DetailsRow", { hasText: onlineMigrationJobName });
|
||||||
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
statusCell = jobRow.locator("[data-automationid='DetailsRowCell'][data-automation-key='CopyJobStatus']");
|
||||||
await jobRow.waitFor({ state: "visible", timeout: 5000 });
|
await jobRow.waitFor({ state: "visible" });
|
||||||
|
|
||||||
// Verify job status changes to queued state
|
// Verify job status changes to queued state
|
||||||
await expect(statusCell).toContainText(/running|queued|pending/i, { timeout: 5000 });
|
await expect(statusCell).toContainText(/running|queued|pending/i);
|
||||||
|
|
||||||
// Test job lifecycle management through action menu
|
// Test job lifecycle management through action menu
|
||||||
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
actionMenuButton = wrapper.getByTestId(`CopyJobActionMenu/Button:${onlineMigrationJobName}`);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
|
|
||||||
const pitrBtn = accordionPanel.getByTestId("pointInTimeRestore:PrimaryBtn");
|
const pitrBtn = accordionPanel.getByTestId("pointInTimeRestore:PrimaryBtn");
|
||||||
await expect(pitrBtn).toBeVisible();
|
await expect(pitrBtn).toBeVisible();
|
||||||
await pitrBtn.click();
|
await pitrBtn.click({ force: true });
|
||||||
|
|
||||||
// Verify new page opens with correct URL pattern
|
// Verify new page opens with correct URL pattern
|
||||||
page.context().on("page", async (newPage) => {
|
page.context().on("page", async (newPage) => {
|
||||||
@@ -246,7 +246,7 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
|
|
||||||
const toggleButton = crossAccordionPanel.getByTestId("btn-toggle");
|
const toggleButton = crossAccordionPanel.getByTestId("btn-toggle");
|
||||||
await expect(toggleButton).toBeVisible();
|
await expect(toggleButton).toBeVisible();
|
||||||
await toggleButton.click();
|
await toggleButton.click({ force: true });
|
||||||
|
|
||||||
// Verify popover functionality
|
// Verify popover functionality
|
||||||
const popover = frame.locator("[data-test='popover-container']");
|
const popover = frame.locator("[data-test='popover-container']");
|
||||||
@@ -257,7 +257,7 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
await expect(yesButton).toBeVisible();
|
await expect(yesButton).toBeVisible();
|
||||||
await expect(noButton).toBeVisible();
|
await expect(noButton).toBeVisible();
|
||||||
|
|
||||||
await yesButton.click();
|
await yesButton.click({ force: true });
|
||||||
|
|
||||||
// Verify loading states
|
// Verify loading states
|
||||||
await expect(loadingOverlay).toBeVisible();
|
await expect(loadingOverlay).toBeVisible();
|
||||||
@@ -265,6 +265,6 @@ test.describe("Container Copy - Permission Screen Verification", () => {
|
|||||||
await expect(popover).toBeHidden({ timeout: 10 * 1000 });
|
await expect(popover).toBeHidden({ timeout: 10 * 1000 });
|
||||||
|
|
||||||
// Cancel the panel to clean up
|
// Cancel the panel to clean up
|
||||||
await panel.getByRole("button", { name: "Cancel" }).click();
|
await panel.getByRole("button", { name: "Cancel" }).click({ force: true });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user