Skip to content

Commit

Permalink
feat: exclude Array type columns (#9808)
Browse files Browse the repository at this point in the history
  • Loading branch information
keita-determined authored Aug 12, 2024
1 parent 79ffa52 commit 9da5620
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
13 changes: 8 additions & 5 deletions webui/react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webui/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"fp-ts": "^2.16.5",
"fuse.js": "^7.0.0",
"hermes-parallel-coordinates": "^0.6.17",
"hew": "npm:@hpe.com/hew@^0.6.40",
"hew": "npm:@hpe.com/hew@^0.6.41",
"humanize-duration": "^3.28.0",
"immutable": "^4.3.0",
"io-ts": "^2.2.21",
Expand Down
37 changes: 33 additions & 4 deletions webui/react/src/pages/FlatRuns/FlatRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Column from 'hew/Column';
import {
ColumnDef,
DEFAULT_COLUMN_WIDTH,
defaultArrayColumn,
defaultDateColumn,
defaultNumberColumn,
defaultSelectionColumn,
Expand Down Expand Up @@ -226,6 +227,22 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
}
}, [projectId]);

const arrayTypeColumns = useMemo(() => {
const arrayTypeColumns = projectColumns
.getOrElse([])
.filter((col) => col.type === V1ColumnType.ARRAY)
.map((col) => col.column);
return arrayTypeColumns;
}, [projectColumns]);

const bannedFilterColumns: Set<string> = useMemo(() => {
return new Set([...BANNED_FILTER_COLUMNS, ...arrayTypeColumns]);
}, [arrayTypeColumns]);

const bannedSortColumns: Set<string> = useMemo(() => {
return new Set([...BANNED_SORT_COLUMNS, ...arrayTypeColumns]);
}, [arrayTypeColumns]);

const selectedRunIdSet = useMemo(() => {
return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []);
}, [settings.selection]);
Expand Down Expand Up @@ -408,6 +425,16 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
dataPath,
);
break;
case V1ColumnType.ARRAY:
columnDefs[currentColumn.column] = defaultArrayColumn(
currentColumn.column,
currentColumn.displayName || currentColumn.column,
settings.columnWidths[currentColumn.column] ??
defaultColumnWidths[currentColumn.column as RunColumn] ??
MIN_COLUMN_WIDTH,
dataPath,
);
break;
case V1ColumnType.TEXT:
case V1ColumnType.UNSPECIFIED:
default:
Expand Down Expand Up @@ -918,7 +945,7 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
return items;
}

if (!BANNED_SORT_COLUMNS.has(column.column)) {
if (!bannedSortColumns.has(column.column)) {
const sortCount = sortMenuItemsForColumn(column, sorts, handleSortChange).length;
const sortMenuItems =
sortCount === 0
Expand Down Expand Up @@ -949,7 +976,7 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
handleIsOpenFilterChange?.(true);
};

if (!BANNED_FILTER_COLUMNS.has(column.column)) {
if (!bannedFilterColumns.has(column.column)) {
items.push(
{ type: 'divider' as const },
{
Expand Down Expand Up @@ -1007,6 +1034,8 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
return items;
},
[
bannedFilterColumns,
bannedSortColumns,
projectColumns,
settings.pinnedColumnsCount,
settings.selection,
Expand Down Expand Up @@ -1038,15 +1067,15 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
<Column>
<Row>
<TableFilter
bannedFilterColumns={BANNED_FILTER_COLUMNS}
bannedFilterColumns={bannedFilterColumns}
formStore={formStore}
isMobile={isMobile}
isOpenFilter={isOpenFilter}
loadableColumns={projectColumns}
onIsOpenFilterChange={handleIsOpenFilterChange}
/>
<MultiSortMenu
bannedSortColumns={BANNED_SORT_COLUMNS}
bannedSortColumns={bannedSortColumns}
columns={projectColumns}
isMobile={isMobile}
sorts={sorts}
Expand Down

0 comments on commit 9da5620

Please sign in to comment.