Skip to content

Commit

Permalink
Merge branch 'thiago/ET-791' into thiago/ET-790
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodallacqua-hpe authored Oct 24, 2024
2 parents 7523bb0 + 8edf01b commit 32f655a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
34 changes: 12 additions & 22 deletions webui/react/src/components/ColumnPickerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Loadable } from 'hew/utils/loadable';
import React, { ChangeEvent, useCallback, useMemo, useState } from 'react';
import { FixedSizeList as List } from 'react-window';

import { runColumns } from 'pages/FlatRuns/columns';
import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk';
import { ProjectColumn } from 'types';
import { ensureArray } from 'utils/data';
Expand Down Expand Up @@ -65,8 +66,6 @@ interface ColumnTabProps {
onHeatmapSelectionRemove?: (id: string) => void;
}

const KNOWN_BOOLEAN_COLUMNS = ['archived', 'isExpMultitrial', 'parentArchived'];

const ColumnPickerTab: React.FC<ColumnTabProps> = ({
columnState,
compare,
Expand Down Expand Up @@ -103,24 +102,17 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({
}, [columnState, filteredColumns]);

const handleShowHideAll = useCallback(() => {
const filteredColumnMap: Record<string, boolean> = filteredColumns.reduce((acc, col) => {
if (col.location === V1LocationType.RUNMETADATA)
return { ...acc, [formatColumnKey(col)]: columnState.includes(formatColumnKey(col)) };

return { ...acc, [col.column]: columnState.includes(col.column) };
}, {});
const filteredColumnMap: Record<string, boolean> = filteredColumns.reduce(
(acc, col) => ({
...acc,
[formatColumnKey(col)]: columnState.includes(formatColumnKey(col)),
}),
{},
);

const newColumns = allFilteredColumnsChecked
? columnState.filter((col) => !filteredColumnMap[col])
: [
...new Set([
...columnState,
...filteredColumns.map((col) => {
if (col.location === V1LocationType.RUNMETADATA) return formatColumnKey(col);
return col.column;
}),
]),
]; // TODO: check if that needs to be mapped with the metadata
: [...new Set([...columnState, ...filteredColumns.map((col) => formatColumnKey(col))])];
const pinnedCount = allFilteredColumnsChecked
? // If uncheck something pinned, reduce the pinnedColumnsCount
newColumns.filter((col) => columnState.indexOf(col) < pinnedColumnsCount).length
Expand All @@ -137,11 +129,9 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({

const handleColumnChange = useCallback(
(event: CheckboxChangeEvent) => {
const { id, checked } = event.target;

if (id === undefined) return;
const { id: targetCol, checked } = event.target;

const targetCol = id;
if (targetCol === undefined) return;

if (compare) {
// pin or unpin column
Expand Down Expand Up @@ -184,7 +174,7 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({
({ index, style }: { index: number; style: React.CSSProperties }) => {
const col = filteredColumns[index];
const colType =
KNOWN_BOOLEAN_COLUMNS.includes(col.column) && col.type === V1ColumnType.UNSPECIFIED
(runColumns as readonly string[]).includes(col.column) && col.type === V1ColumnType.UNSPECIFIED
? 'BOOLEAN'
: removeColumnTypePrefix(col.type);
const getColDisplayName = (col: ProjectColumn) => {
Expand Down
1 change: 0 additions & 1 deletion webui/react/src/components/Searches/Searches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,6 @@ const Searches: React.FC<Props> = ({ project }) => {
currentColumn.displayName || currentColumn.column,
settings.columnWidths[currentColumn.column],
dataPath,
undefined,
);
break;
}
Expand Down

0 comments on commit 32f655a

Please sign in to comment.