-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add group by type class for config summary
Fixes #2048 chore: update config class label
- Loading branch information
1 parent
d68661c
commit def72c6
Showing
9 changed files
with
187 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/components/Configs/ConfigSummary/Cells/ConfigSummaryTableVirtualAggregateColumn.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { ConfigSummary } from "@flanksource-ui/api/types/configs"; | ||
import { Badge } from "@flanksource-ui/ui/Badge/Badge"; | ||
import { CellContext } from "@tanstack/react-table"; | ||
import { IoChevronDown, IoChevronForward } from "react-icons/io5"; | ||
import ConfigsTypeIcon from "../../ConfigsTypeIcon"; | ||
|
||
export function ConfigSummaryTableVirtualAggregateColumn({ | ||
row | ||
}: CellContext<ConfigSummary, any>) { | ||
if (row.getCanExpand()) { | ||
const groupingValue = row.getGroupingValue(row.groupingColumnId!) as string; | ||
const count = row.subRows.reduce((acc, row) => acc + row.original.count, 0); | ||
return ( | ||
<div | ||
className="flex flex-row items-center gap-1" | ||
style={{ | ||
marginLeft: row.depth * 20 | ||
}} | ||
> | ||
{row.getIsExpanded() ? <IoChevronDown /> : <IoChevronForward />} | ||
{row.groupingColumnId === "type" || | ||
row.groupingColumnId === "config_class" ? ( | ||
<ConfigsTypeIcon | ||
config={row.original} | ||
showLabel={row.groupingColumnId === "type"} | ||
showSecondaryIcon={row.groupingColumnId === "type"} | ||
> | ||
<div className="flex flex-row items-center gap-1"> | ||
{row.groupingColumnId === "config_class" && ( | ||
<span>{groupingValue}</span> | ||
)} | ||
<Badge text={count} /> | ||
</div> | ||
</ConfigsTypeIcon> | ||
) : ( | ||
<div className="flex flex-row gap-1 items-center"> | ||
{groupingValue ? ( | ||
<span>{groupingValue}</span> | ||
) : ( | ||
<span className="text-gray-400">(None)</span> | ||
)} | ||
<Badge text={count} /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/components/Configs/ConfigSummary/Cells/ConfigSummaryVirtualColumnCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ConfigSummary } from "@flanksource-ui/api/types/configs"; | ||
import { Badge } from "@flanksource-ui/ui/Badge/Badge"; | ||
import { CellContext } from "@tanstack/react-table"; | ||
import { BiLabel } from "react-icons/bi"; | ||
|
||
export function ConfigSummaryVirtualColumnCell({ | ||
getValue, | ||
row, | ||
groupByTags, | ||
columnId | ||
}: CellContext<ConfigSummary, any> & { | ||
groupByTags: string[]; | ||
columnId: string; | ||
}) { | ||
const isTag = groupByTags.includes(columnId); | ||
const value = getValue(); | ||
|
||
return ( | ||
<div | ||
className="flex flex-1 flex-row gap-1 items-center" | ||
style={{ | ||
marginLeft: row.depth * 20 | ||
}} | ||
> | ||
{isTag && <BiLabel />} | ||
{value ? ( | ||
<span>{value}</span> | ||
) : ( | ||
<span className="text-gray-400">(None)</span> | ||
)} | ||
<Badge text={row.original.count} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.