Skip to content

Commit

Permalink
refactor: Remove unnecessary toLowerCase method from column type ca…
Browse files Browse the repository at this point in the history
…pture.
  • Loading branch information
thiagodallacqua-hpe committed Oct 21, 2024
1 parent 8185b5a commit b063426
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions webui/react/package-lock.json

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

7 changes: 3 additions & 4 deletions webui/react/src/components/ColumnPickerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({

const allFilteredColumnsChecked = useMemo(() => {
return filteredColumns.every((col) => {
const colType = col.type.replace('COLUMN_TYPE_', '').toLowerCase();
const colType = col.type.replace('COLUMN_TYPE_', '');

if (col.column.includes('metadata'))
return columnState.includes(col.column.concat(`_${colType}`));
Expand All @@ -108,7 +108,7 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({

const handleShowHideAll = useCallback(() => {
const filteredColumnMap: Record<string, boolean> = filteredColumns.reduce((acc, col) => {
const colType = col.type.replace('COLUMN_TYPE_', '').toLowerCase();
const colType = col.type.replace('COLUMN_TYPE_', '');

if (col.column.includes('metadata'))
return {
Expand All @@ -127,7 +127,7 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({
...new Set([
...columnState,
...filteredColumns.map((col) => {
const colType = col.type.replace('COLUMN_TYPE_', '').toLowerCase();
const colType = col.type.replace('COLUMN_TYPE_', '');

if (col.column.includes('metadata')) return col.column.concat(`_${colType}`);
return col.column;
Expand Down Expand Up @@ -179,7 +179,6 @@ const ColumnPickerTab: React.FC<ColumnTabProps> = ({
if (!checked) {
onHeatmapSelectionRemove?.(targetCol);
}
// TODO: work on a logic to map the metadata columns
const newColumnSet = new Set(columnState);
checked ? newColumnSet.add(targetCol) : newColumnSet.delete(targetCol);
onVisibleColumnChange?.([...newColumnSet], pinnedCount);
Expand Down
2 changes: 1 addition & 1 deletion webui/react/src/pages/FlatRuns/FlatRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ const FlatRuns: React.FC<Props> = ({ projectId, workspaceId, searchId }) => {
projectColumns,
(columns) => {
return columns.reduce((acc, col) => {
const colType = col.type.replace('COLUMN_TYPE_', '').toLowerCase();
const colType = col.type.replace('COLUMN_TYPE_', '');

if (col.column.includes('metadata'))
return { ...acc, [col.column.concat(`_${colType}`)]: col };
Expand Down

0 comments on commit b063426

Please sign in to comment.