Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/csm-portal/backend/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7389,15 +7389,15 @@ components:
workaround:
type: string
nullable: true
resolvedAt:
resolvedOn:
type: string
nullable: true
resolvedBy:
$ref: '#/components/schemas/EntityRef'
nullable: true
openedAt:
openedOn:
type: string
nullable: true
closedAt:
closedOn:
type: string
nullable: true
8 changes: 4 additions & 4 deletions apps/csm-portal/webapp/src/api/backend/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ export interface BeTaskDetail {
environment: string | null;
environmentLabel: string | null;
product: BeEntityRef | null;
parentCase: BeCaseNumberRef;
parentCase: BeCaseNumberRef | null;
createdOn: string;
updatedOn: string;
}
Expand Down Expand Up @@ -1975,10 +1975,10 @@ export interface BeProblemDetail {
causeNotes?: string | null;
fixNotes?: string | null;
workaround?: string | null;
resolvedAt?: string | null;
resolvedOn?: string | null;
resolvedBy?: BeEntityRef | null;
openedAt?: string | null;
closedAt?: string | null;
openedOn?: string | null;
closedOn?: string | null;
}

// ---------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function TaskDetailDialog({ taskId, onClose }: TaskDetailDialogProps): JS
>
<DetailCell label="Parent case">
<Typography variant="body2">
{task.parentCase.number ?? task.parentCase.id}
{task.parentCase?.number ?? task.parentCase?.id ?? "—"}
</Typography>
</DetailCell>
<DetailCell label="Assigned to">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,38 @@ describe("TasksWidget", () => {
expect(screen.getByText("Log Extraction")).toBeInTheDocument();
expect(screen.getByText("CS0440062")).toBeInTheDocument();
});

it("renders a dash instead of crashing when the task detail has no parent case", () => {
const list: BeListCaseTasksResponse = {
tasks: [TASK_ROW],
total: 1,
offset: 0,
limit: 20,
};
mockListResult({ data: list });
const detail: BeTaskDetail = {
id: "task-1",
subject: TASK_ROW.subject,
state: "OPEN",
dueDate: null,
visibleToCustomer: false,
assignedTo: TASK_ROW.assignedTo,
requestType: "1",
requestTypeLabel: "Log Extraction",
environment: null,
environmentLabel: null,
product: null,
// ServiceNow can omit the parent-case lookup; this must not throw.
parentCase: null,
createdOn: "2026-07-01T00:00:00Z",
updatedOn: "2026-07-15T10:00:00Z",
};
mockDetailResult({ data: detail });

render(<TasksWidget caseId="case-1" />);
fireEvent.click(screen.getByRole("button", { name: /view task/i }));

expect(screen.getByText("Task details")).toBeInTheDocument();
expect(screen.getAllByText("—").length).toBeGreaterThan(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,22 @@ export default function ProblemsTab(): JSX.Element {
</TableCell>
</TableRow>
) : (
problems.map((problem) => (
problems.map((problem) => {
const detailPath = `/operations/problems/${problem.id}`;
return (
<TableRow
key={problem.id}
hover
onClick={() => navigate(`/operations/problems/${problem.id}`)}
onClick={() => navigate(detailPath)}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
navigate(detailPath);
}
}}
tabIndex={0}
role="button"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
aria-label={`View problem ${problem.number || problem.id}`}
sx={{ cursor: "pointer" }}
>
<TableCell>{problem.number || "—"}</TableCell>
Expand All @@ -151,7 +162,8 @@ export default function ProblemsTab(): JSX.Element {
</Typography>
</TableCell>
</TableRow>
))
);
})
)}
</TableBody>
</Table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ const BASE_PROBLEM: BeProblemDetail = {
causeNotes: "Root cause was a bad config push.",
fixNotes: "Rolled back the config.",
workaround: "Restart the pod.",
resolvedAt: "2026-01-01T00:00:00Z",
resolvedOn: "2026-01-01T00:00:00Z",
resolvedBy: { id: "user-1", name: "Jane Doe" },
openedAt: "2025-12-01T00:00:00Z",
closedAt: "2026-01-02T00:00:00Z",
openedOn: "2025-12-01T00:00:00Z",
closedOn: "2026-01-02T00:00:00Z",
};

function mockQueryResult(
Expand Down Expand Up @@ -98,7 +98,7 @@ describe("ProblemDetailPage", () => {
render(<ProblemDetailPage />);
expect(screen.getByText("Intermittent 502s on the gateway")).toBeInTheDocument();
expect(screen.getByText("PRB0040157")).toBeInTheDocument();
// "Closed" also appears as the (unrelated) label of the closedAt
// "Closed" also appears as the (unrelated) label of the closedOn
// MetaCell, so scope the assertion to the state Chip specifically.
expect(screen.getByText("Closed", { selector: ".MuiChip-label" })).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default function ProblemDetailPage(): JSX.Element {
problem.causeNotes ||
problem.fixNotes ||
problem.workaround ||
problem.resolvedAt ||
problem.resolvedOn ||
problem.resolvedBy
);

Expand Down Expand Up @@ -207,10 +207,10 @@ export default function ProblemDetailPage(): JSX.Element {
</MetaCell>
<MetaCell label="Assigned to"><RefText value={problem.assignedTo} /></MetaCell>
<MetaCell label="Opened">
<Typography variant="body2">{formatDateTime(problem.openedAt)}</Typography>
<Typography variant="body2">{formatDateTime(problem.openedOn)}</Typography>
</MetaCell>
<MetaCell label="Closed">
<Typography variant="body2">{formatDateTime(problem.closedAt)}</Typography>
<Typography variant="body2">{formatDateTime(problem.closedOn)}</Typography>
</MetaCell>
</Box>
</Card>
Expand Down Expand Up @@ -285,7 +285,7 @@ export default function ProblemDetailPage(): JSX.Element {
</MetaCell>
<MetaCell label="Resolved by"><RefText value={problem.resolvedBy} /></MetaCell>
<MetaCell label="Resolved">
<Typography variant="body2">{formatDateTime(problem.resolvedAt)}</Typography>
<Typography variant="body2">{formatDateTime(problem.resolvedOn)}</Typography>
</MetaCell>
</Box>
{problem.causeNotes && (
Expand Down
6 changes: 3 additions & 3 deletions entity-service/internal/domain/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -2812,10 +2812,10 @@ type ProblemDetail struct {
CauseNotes *string `json:"causeNotes"`
FixNotes *string `json:"fixNotes"`
Workaround *string `json:"workaround"`
ResolvedAt *string `json:"resolvedAt"`
ResolvedOn *string `json:"resolvedOn"`
ResolvedBy *EntityRef `json:"resolvedBy"`
OpenedAt *string `json:"openedAt"`
ClosedAt *string `json:"closedAt"`
OpenedOn *string `json:"openedOn"`
ClosedOn *string `json:"closedOn"`
}

// ConversationState represents the state of a conversation.
Expand Down
12 changes: 6 additions & 6 deletions entity-service/internal/service/sn_problem_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ type snProblemDetailResponse struct {
CauseNotes *string `json:"causeNotes"`
FixNotes *string `json:"fixNotes"`
Workaround *string `json:"workaround"`
ResolvedAt *string `json:"resolvedAt"`
ResolvedOn *string `json:"resolvedOn"`
ResolvedBy *snProblemUserRef `json:"resolvedBy"`
OpenedAt *string `json:"openedAt"`
ClosedAt *string `json:"closedAt"`
OpenedOn *string `json:"openedOn"`
ClosedOn *string `json:"closedOn"`
}

// GetProblem implements ProblemService for the ServiceNow data source.
Expand Down Expand Up @@ -183,9 +183,9 @@ func (s *snProblemService) GetProblem(ctx context.Context, id string) (domain.Pr
CauseNotes: p.CauseNotes,
FixNotes: p.FixNotes,
Workaround: p.Workaround,
ResolvedAt: p.ResolvedAt,
OpenedAt: p.OpenedAt,
ClosedAt: p.ClosedAt,
ResolvedOn: p.ResolvedOn,
OpenedOn: p.OpenedOn,
ClosedOn: p.ClosedOn,
}
if p.OriginCase != nil {
view.OriginCase = &domain.CaseNumberRef{ID: sysidToUUID(p.OriginCase.ID), Number: p.OriginCase.Number}
Expand Down
7 changes: 4 additions & 3 deletions entity-service/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6501,6 +6501,7 @@ components:
nullable: true
linkedIncidents:
type: array
nullable: true
items:
$ref: '#/components/schemas/CaseNumberRef'
linkedChangeRequest:
Expand All @@ -6521,16 +6522,16 @@ components:
workaround:
type: string
nullable: true
resolvedAt:
resolvedOn:
type: string
nullable: true
resolvedBy:
$ref: '#/components/schemas/EntityRef'
nullable: true
openedAt:
openedOn:
type: string
nullable: true
closedAt:
closedOn:
type: string
nullable: true

Expand Down