Skip to content

Commit f09cf4f

Browse files
authored
Merge pull request #1273 from microsoft/astaykov/infra-pillar-ux-changes
Infrastructure pillar UX updates: description and Severity labeling
2 parents 194de86 + f4e5b63 commit f09cf4f

5 files changed

Lines changed: 35 additions & 19 deletions

File tree

SampleReport.html

Lines changed: 13 additions & 7 deletions
Large diffs are not rendered by default.

src/powershell/assets/ReportTemplate.html

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

src/report/src/components/test-table/columns.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,11 @@ export const columns: ColumnDef<Test>[] = [
203203
const b = RISK_ORDER[rowB.getValue(columnId) as string] ?? Number.POSITIVE_INFINITY
204204
return a - b
205205
},
206-
header: ({ column }) => {
206+
header: ({ column, table }) => {
207+
const riskLabel = (table.options.meta as { riskLabel?: string } | undefined)?.riskLabel ?? "Risk"
207208
return (
208209
<Button variant="ghost" onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}>
209-
Risk
210+
{riskLabel}
210211
<ArrowUpDown className="ml-2 h-4 w-4" />
211212
</Button>
212213
)

src/report/src/components/test-table/data-table.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export function DataTable<TData extends Test, TValue>({
5757
data,
5858
pillar,
5959
}: DataTableProps<TData, TValue>) {
60+
const riskLabel = pillar === "Infrastructure" ? "Severity" : "Risk";
61+
6062
const [sorting, setSorting] = React.useState<SortingState>([
6163
{ id: "TestRisk", desc: false },
6264
{ id: "TestStatus", desc: false },
@@ -95,9 +97,9 @@ export function DataTable<TData extends Test, TValue>({
9597
return data;
9698
}, [data, pillar]);
9799

98-
// Default to High risk filter for Infrastructure pillar; reset on pillar switch
100+
// Reset risk filter on pillar switch; do not auto-select any risk/severity value
99101
React.useEffect(() => {
100-
setSelectedRisks(pillar === "Infrastructure" ? ["High"] : []);
102+
setSelectedRisks([]);
101103
}, [pillar]);
102104

103105
// Filter the data by pillar, selected SFI pillars, risks, and statuses if any are selected
@@ -215,6 +217,9 @@ export function DataTable<TData extends Test, TValue>({
215217
const table = useReactTable({
216218
data: filteredData,
217219
columns,
220+
meta: {
221+
riskLabel,
222+
},
218223
enableRowSelection: true,
219224
getCoreRowModel: getCoreRowModel(),
220225
onSortingChange: setSorting,
@@ -257,7 +262,7 @@ export function DataTable<TData extends Test, TValue>({
257262

258263
{/* Risk Filter Toggles */}
259264
<div className="flex items-center gap-1">
260-
<span className="text-xs font-medium text-muted-foreground mr-1">Risk:</span>
265+
<span className="text-xs font-medium text-muted-foreground mr-1">{riskLabel}:</span>
261266
{uniqueRisks.map((risk) => {
262267
const isSelected = selectedRisks.includes(risk);
263268
const riskCount = data.filter(item => item.TestRisk === risk).length;
@@ -348,6 +353,10 @@ export function DataTable<TData extends Test, TValue>({
348353
return true;
349354
})
350355
.map((column) => {
356+
const columnLabel = column.id === "TestRisk"
357+
? riskLabel
358+
: (column.columnDef.meta?.label ?? column.id);
359+
351360
return (
352361
<DropdownMenuCheckboxItem
353362
key={column.id}
@@ -357,7 +366,7 @@ export function DataTable<TData extends Test, TValue>({
357366
column.toggleVisibility(!!value)
358367
}
359368
>
360-
{column.columnDef.meta?.label ?? column.id}
369+
{columnLabel}
361370
</DropdownMenuCheckboxItem>
362371
)
363372
})}
@@ -509,7 +518,7 @@ export function DataTable<TData extends Test, TValue>({
509518
<div className={`mt-2 text-sm ${selectedRow?.TestPillar === "Infrastructure" ? "flex flex-col gap-y-2" : "grid grid-cols-3 gap-y-2"}`}>
510519
<div className="flex items-center gap-2">
511520
<AlertTriangle className="h-4 w-4 text-foreground" />
512-
<span className="font-semibold">Risk:</span>
521+
<span className="font-semibold">{selectedRow?.TestPillar === "Infrastructure" ? "Severity:" : "Risk:"}</span>
513522
<span>{selectedRow?.TestRisk ?? "N/A"}</span>
514523
</div>
515524
{selectedRow?.TestPillar !== "Infrastructure" && (

src/report/src/pages/Infrastructure.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function Infrastructure() {
1414
<CardHeader>
1515
<CardTitle className="mb-3">Assessment results</CardTitle>
1616
<CardDescription>
17-
The results presented below are based on Zero Trust security principles for infrastructure.
17+
The results below are based on Microsoft Defender for Cloud recommendations identified in the scanned environment.
1818
</CardDescription>
1919
</CardHeader>
2020
<CardContent className="gap-4 px-4 pb-4 pt-1">

0 commit comments

Comments
 (0)