Skip to content

Commit

Permalink
Remove Parent Workflow ID column (#1606)
Browse files Browse the repository at this point in the history
* Remove Parent Workflow ID column

* Filter out column from saved columns

* Filter out Parent ID column in workflowTableColumns as well
  • Loading branch information
laurakwhit authored Sep 6, 2023
1 parent 7f10977 commit bbd6771
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { formatBytes } from '$lib/utilities/format-bytes';
import { formatDate } from '$lib/utilities/format-date';
import { formatDistance } from '$lib/utilities/format-time';
import FilterableTableCell from './filterable-table-cell.svelte';
export let column: WorkflowHeader;
Expand Down Expand Up @@ -73,8 +73,6 @@
{workflow.taskQueue}
{:else if label === 'Parent Namespace'}
{workflow.parentNamespaceId}
{:else if label === 'Parent Workflow ID'}
{workflow.parent ? workflow.parent.workflowId : ''}
{:else if label === 'History Size'}
{formatBytes(parseInt(workflow.historySizeBytes, 10))}
{:else if label === 'State Transitions'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ exports[`Table_body_cell$ > History Size renders 1`] = `"<td class=\\"workflows-
exports[`Table_body_cell$ > Parent Namespace renders 1`] = `"<td class=\\"workflows-summary-table-body-cell svelte-qupenl\\" data-testid=\\"workflows-summary-table-body-cell\\">parent-namespace-id</td>"`;
exports[`Table_body_cell$ > Parent Workflow ID renders 1`] = `"<td class=\\"workflows-summary-table-body-cell svelte-qupenl\\" data-testid=\\"workflows-summary-table-body-cell\\">parent-workflow-id</td>"`;
exports[`Table_body_cell$ > Run ID renders 1`] = `"<td class=\\"workflows-summary-table-body-cell filterable svelte-qupenl\\" data-testid=\\"workflows-summary-table-body-cell\\"><a href=\\"/namespaces/default/workflows/abc-123/def-456/history\\" class=\\"link svelte-1v8baj6\\"> def-456</a> </td>"`;
exports[`Table_body_cell$ > Start renders 1`] = `"<td class=\\"workflows-summary-table-body-cell svelte-qupenl\\" data-testid=\\"workflows-summary-table-body-cell\\">2023-04-27 UTC 00:00:00.00</td>"`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ exports[`Table_header_cell$ > History Size renders 1`] = `"<th class=\\"workflow
exports[`Table_header_cell$ > Parent Namespace renders 1`] = `"<th class=\\"workflows-summary-table-header-cell svelte-x2wk3\\" data-testid=\\"workflows-summary-table-header-cell-Parent Namespace\\">Parent Namespace</th>"`;
exports[`Table_header_cell$ > Parent Workflow ID renders 1`] = `"<th class=\\"workflows-summary-table-header-cell svelte-x2wk3\\" data-testid=\\"workflows-summary-table-header-cell-Parent Workflow ID\\">Parent Workflow ID</th>"`;
exports[`Table_header_cell$ > Run ID renders 1`] = `"<th class=\\"workflows-summary-table-header-cell svelte-x2wk3\\" data-testid=\\"workflows-summary-table-header-cell-Run ID\\"><div class=\\"relative \\"><button type=\\"button\\" aria-haspopup=\\"true\\" aria-controls=\\"run-id-filter-menu\\" aria-expanded=\\"false\\" class=\\"menu-button table-header svelte-4tb2vr\\" data-testid=\\"run-id-filter-button\\"> <div class=\\"flex items-center grow\\">Run ID</div> <svg width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" xmlns=\\"http://www.w3.org/2000/svg\\" role=\\"img\\"><title>filter</title><path d=\\"M5.5 7.5H18.5C18.75 7.5 19 7.28125 19 7.03125C19 6.78125 18.75 6.5 18.5 6.5H5.5C5.21875 6.5 5 6.75 5 7C5 7.25 5.21875 7.5 5.5 7.5ZM16.5 11.5H7.5C7.21875 11.5 7 11.75 7 12C7 12.2812 7.21875 12.5 7.5 12.5H16.5C16.75 12.5 17 12.2812 17 12.0312C17 11.75 16.75 11.5 16.5 11.5ZM13.5 16.5H10.5C10.2188 16.5 10 16.75 10 17C10 17.25 10.2188 17.5 10.5 17.5H13.5C13.75 17.5 14 17.2812 14 17.0312C14 16.7812 13.75 16.5 13.5 16.5Z\\" fill=\\"currentcolor\\"></path></svg> </button> <ul role=\\"menu\\" class=\\"menu left w-[500px] hidden svelte-63nj9m\\" aria-labelledby=\\"run-id-filter-menu\\" tabindex=\\"-1\\" id=\\"run-id-filter-menu\\"><div class=\\"flex items-center p-2 transition-all hover:cursor-pointer svelte-17wusc4\\"><label for=\\"run-id\\" class=\\"svelte-17wusc4 sr-only\\">Search</label> <div class=\\"input-container light svelte-17wusc4\\"><span class=\\"icon-container svelte-17wusc4\\"><svg width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" xmlns=\\"http://www.w3.org/2000/svg\\" role=\\"img\\"><title>search</title><path d=\\"M19.8438 19.1562L15.4062 14.75C16.4062 13.5938 16.9688 12.125 16.9688 10.5C16.9688 6.9375 14.0312 4 10.4688 4C6.875 4 4 6.9375 4 10.5C4 14.0938 6.90625 17 10.4688 17C12.0625 17 13.5312 16.4375 14.6875 15.4375L19.0938 19.875C19.2188 19.9688 19.3438 20 19.5 20C19.625 20 19.75 19.9688 19.8438 19.875C20.0312 19.6875 20.0312 19.3438 19.8438 19.1562ZM10.5 16C7.4375 16 5 13.5312 5 10.5C5 7.46875 7.4375 5 10.5 5C13.5312 5 16 7.46875 16 10.5C16 13.5625 13.5312 16 10.5 16Z\\" fill=\\"currentcolor\\"></path></svg></span> <input class=\\"m-2 block w-full bg-white focus:outline-none svelte-17wusc4\\" data-lpignore=\\"true\\" placeholder=\\"Run ID\\" id=\\"run-id\\" name=\\"run-id\\" autocomplete=\\"off\\" type=\\"search\\"> </div> <span class=\\"inline-block hint-text svelte-17wusc4 hidden\\"></span></div></ul></div></th>"`;
exports[`Table_header_cell$ > Start renders 1`] = `"<th class=\\"workflows-summary-table-header-cell svelte-x2wk3\\" data-testid=\\"workflows-summary-table-header-cell-Start\\">Start</th>"`;
Expand Down
19 changes: 16 additions & 3 deletions src/lib/stores/workflow-table-columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const WorkflowHeaderLabels = [
'Execution Duration',
'State Transitions',
'Parent Namespace',
'Parent Workflow ID',
'Task Queue',
] as const;

Expand Down Expand Up @@ -74,10 +73,12 @@ const DEFAULT_AVAILABLE_COLUMNS: WorkflowHeader[] = [
{ label: 'Execution Duration', pinned: false },
{ label: 'State Transitions', pinned: false },
{ label: 'Parent Namespace', pinned: false },
{ label: 'Parent Workflow ID', pinned: false },
{ label: 'Task Queue', pinned: false },
];

const isNotParentWorkflowIdColumn = (column: WorkflowHeader) =>
column.label !== 'Parent Workflow ID';

export const getDefaultColumns = (): WorkflowHeader[] => {
let columns: WorkflowHeader[];
try {
Expand All @@ -89,7 +90,10 @@ export const getDefaultColumns = (): WorkflowHeader[] => {
const parsedOldColumns = JSON.parse(stringifiedOldColumns);

if (stringifiedOldColumns && parsedOldColumns?.length) {
columns = parsedOldColumns;
const filteredOldColumns = parsedOldColumns.filter(
isNotParentWorkflowIdColumn,
);
columns = filteredOldColumns;
} else {
columns = DEFAULT_COLUMNS;
}
Expand Down Expand Up @@ -118,6 +122,15 @@ export const workflowTableColumns: Readable<State> = derived(
columns[namespace] = [...getDefaultColumns()];
return columns[namespace];
}
const filteredColumns = columns[namespace].filter(
isNotParentWorkflowIdColumn,
);

if (filteredColumns.length !== columns[namespace].length) {
columns[namespace] = filteredColumns;
persistedWorkflowTableColumns.set(columns);
}

return columns[namespace];
};

Expand Down

0 comments on commit bbd6771

Please sign in to comment.