mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-07 03:00:29 +00:00
Visible by default to the right of Status; toggleable via the column picker. Extracts the principal avatar/label helper out of the run summary panel so both surfaces share one renderer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
export const TOGGLEABLE_COLUMNS = [
|
|
"created_by",
|
|
"repo",
|
|
"workflow",
|
|
"created",
|
|
"updated",
|
|
"elapsed",
|
|
"size",
|
|
"changes",
|
|
"pr",
|
|
] as const;
|
|
|
|
const TOGGLEABLE_COLUMN_SET = new Set<string>(TOGGLEABLE_COLUMNS);
|
|
|
|
export type ToggleableColumn = (typeof TOGGLEABLE_COLUMNS)[number];
|
|
|
|
export const toggleableColumnLabels: Record<ToggleableColumn, string> = {
|
|
repo: "Repo",
|
|
workflow: "Workflow",
|
|
created_by: "Created by",
|
|
created: "Created",
|
|
updated: "Updated",
|
|
elapsed: "Elapsed",
|
|
size: "Size",
|
|
changes: "Changes",
|
|
pr: "PR",
|
|
};
|
|
|
|
export function parseHiddenColumns(raw: string | null): Set<ToggleableColumn> {
|
|
const hidden = new Set<ToggleableColumn>();
|
|
if (!raw) return hidden;
|
|
for (const value of raw.split(",")) {
|
|
const trimmed = value.trim();
|
|
if (TOGGLEABLE_COLUMN_SET.has(trimmed)) {
|
|
hidden.add(trimmed as ToggleableColumn);
|
|
}
|
|
}
|
|
return hidden;
|
|
}
|
|
|
|
export function serializeHiddenColumns(hidden: Set<ToggleableColumn>): string | null {
|
|
if (hidden.size === 0) return null;
|
|
return TOGGLEABLE_COLUMNS.filter((col) => hidden.has(col)).join(",");
|
|
}
|