fix(allocations): expand grouped rows by default
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
export type CollapsedAllocationGroups = Set<string> | "all";
|
||||
|
||||
export function createInitialCollapsedAllocationGroups(): CollapsedAllocationGroups {
|
||||
return new Set<string>();
|
||||
}
|
||||
|
||||
export function toggleCollapsedAllocationGroup(
|
||||
previous: CollapsedAllocationGroups,
|
||||
groupIds: string[],
|
||||
resourceId: string,
|
||||
): CollapsedAllocationGroups {
|
||||
if (previous === "all") {
|
||||
const next = new Set(groupIds);
|
||||
next.delete(resourceId);
|
||||
return next;
|
||||
}
|
||||
|
||||
const next = new Set(previous);
|
||||
if (next.has(resourceId)) {
|
||||
next.delete(resourceId);
|
||||
} else {
|
||||
next.add(resourceId);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
export function collapseAllAllocationGroups(): CollapsedAllocationGroups {
|
||||
return "all";
|
||||
}
|
||||
|
||||
export function expandAllAllocationGroups(): CollapsedAllocationGroups {
|
||||
return new Set<string>();
|
||||
}
|
||||
Reference in New Issue
Block a user