mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-01 17:53:11 +00:00
fix(workorders): complete service query wiring
This commit is contained in:
parent
64246db1f0
commit
ffbf60d16a
6 changed files with 71 additions and 16 deletions
|
|
@ -163,21 +163,27 @@ export function AdvancedSearchFilterSections({
|
|||
|
||||
<AdvSection icon={Flame} label="Service" count={draft.pmTypes.size}>
|
||||
{Boolean(serviceQuery?.isLoading && !serviceQuery.hasData) && (
|
||||
<Text as="div" variant="description" role="status" aria-label="Loading services">
|
||||
Loading services…
|
||||
</Text>
|
||||
<div role="status" aria-label="Loading services">
|
||||
<Text as="span" variant="description">
|
||||
Loading services…
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(serviceQuery?.isFetching && serviceQuery.hasData && !serviceQuery.isError) && (
|
||||
<Text as="div" variant="description" role="status" aria-label="Updating services">
|
||||
Updating services…
|
||||
</Text>
|
||||
<div role="status" aria-label="Updating services">
|
||||
<Text as="span" variant="description">
|
||||
Updating services…
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(serviceQuery?.isError) && (
|
||||
<QueryErrorPanel
|
||||
compact
|
||||
message="Service filters couldn't load. Retry to load registry services."
|
||||
onRetry={serviceQuery?.retry}
|
||||
/>
|
||||
<div role="alert" aria-label="Service filters unavailable">
|
||||
<QueryErrorPanel
|
||||
compact
|
||||
message="Service filters couldn't load. Retry to load registry services."
|
||||
onRetry={serviceQuery?.retry}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(
|
||||
serviceRegistryManaged &&
|
||||
|
|
|
|||
|
|
@ -80,11 +80,13 @@ export function PmTypePickerPopover({
|
|||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<QueryErrorPanel
|
||||
compact
|
||||
message="Service options couldn't load. Retry to load registry services."
|
||||
onRetry={onRetry}
|
||||
/>
|
||||
<div role="alert" aria-label="Service options unavailable">
|
||||
<QueryErrorPanel
|
||||
compact
|
||||
message="Service options couldn't load. Retry to load registry services."
|
||||
onRetry={onRetry}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{Boolean(registryManaged && empty) && (
|
||||
<div className="px-2 py-3 text-center text-xs text-muted-foreground">
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ export function WoTableInlineRowCells({
|
|||
vendors,
|
||||
pmTypes,
|
||||
services = [],
|
||||
serviceQuery,
|
||||
allRows,
|
||||
siteCellRef,
|
||||
woCellRef,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ describe("Aveta Service & Notes", () => {
|
|||
|
||||
fireEvent.click(screen.getByRole("button", { name: /Saved service/i }));
|
||||
|
||||
expect(screen.getByRole("alert", { name: /service options unavailable/i })).toBeInTheDocument();
|
||||
expect(screen.getByText(/service options couldn't load/i)).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Leak" })).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Retry" }));
|
||||
|
|
|
|||
|
|
@ -12,6 +12,48 @@ function currentMonthIso(day: number): string {
|
|||
}
|
||||
|
||||
describe("WoTableInlineRowCells — Schedule On range", () => {
|
||||
it("keeps registry failure and retry in the inline Add WO service picker", async () => {
|
||||
const retry = vi.fn();
|
||||
renderWithProviders(
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<WoTableInlineRowCells
|
||||
draft={EMPTY_TABLE_DRAFT}
|
||||
weekDefault={false}
|
||||
users={[]}
|
||||
sites={[]}
|
||||
vendors={[]}
|
||||
pmTypes={["Leak"]}
|
||||
services={[]}
|
||||
serviceQuery={{
|
||||
isLoading: false,
|
||||
isError: true,
|
||||
isFetching: false,
|
||||
hasData: false,
|
||||
retry,
|
||||
}}
|
||||
allRows={[]}
|
||||
siteCellRef={createRef()}
|
||||
woCellRef={createRef()}
|
||||
siteShowError={false}
|
||||
siteError=""
|
||||
woShowError={false}
|
||||
onPatch={vi.fn()}
|
||||
/>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Select …" }));
|
||||
|
||||
expect(screen.getByRole("alert", { name: /service options unavailable/i })).toBeVisible();
|
||||
expect(screen.queryByRole("button", { name: "Leak" })).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Retry" }));
|
||||
expect(retry).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("reopens a company-only inline assignment without inferring its anchor as technician", async () => {
|
||||
renderWithProviders(
|
||||
<table>
|
||||
|
|
|
|||
|
|
@ -277,6 +277,9 @@ describe("WorkOrders Advanced Search page wiring (SH-121)", () => {
|
|||
const sheet = screen.getByRole("dialog", { name: "Advanced Filters" });
|
||||
fireEvent.click(within(sheet).getByRole("button", { name: /^Service/i }));
|
||||
|
||||
expect(
|
||||
within(sheet).getByRole("alert", { name: /service filters unavailable/i }),
|
||||
).toBeInTheDocument();
|
||||
expect(within(sheet).getByText(/service filters couldn't load/i)).toBeInTheDocument();
|
||||
expect(within(sheet).queryByText("Leak")).not.toBeInTheDocument();
|
||||
expect(within(sheet).getByText("Previously selected service")).toBeInTheDocument();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue