diff --git a/ui/src/timeMachine/components/view_options/TableOptions.tsx b/ui/src/timeMachine/components/view_options/TableOptions.tsx index f11fefdbf14..fbc69d8a1d9 100644 --- a/ui/src/timeMachine/components/view_options/TableOptions.tsx +++ b/ui/src/timeMachine/components/view_options/TableOptions.tsx @@ -72,13 +72,7 @@ export class TableOptions extends Component { onSetDecimalPlaces, } = this.props - const filteredColumns = fieldOptions.filter( - col => - col.internalName !== 'time' && - col.internalName !== '' && - col.internalName !== 'result' && - col.internalName !== 'table' - ) + const filteredColumns = this.filterFieldOptions(fieldOptions) const {fixFirstColumn, sortBy} = tableOptions @@ -139,13 +133,27 @@ export class TableOptions extends Component { ) } + private filterFieldOptions = (fieldOptions: FieldOption[]) => { + return fieldOptions.filter( + col => + col.internalName !== 'time' && + col.internalName !== '' && + col.internalName !== 'result' && + col.internalName !== 'table' + ) + } + private handleChangeSortBy = (sortBy: FieldOption) => { const {tableOptions, onSetTableOptions} = this.props onSetTableOptions({...tableOptions, sortBy}) } private handleMoveColumn = (dragIndex: number, hoverIndex: number) => { - const fieldOptions = move(this.props.fieldOptions, dragIndex, hoverIndex) + const fieldOptions = move( + this.filterFieldOptions(this.props.fieldOptions), + dragIndex, + hoverIndex + ) this.props.onSetFieldOptions(fieldOptions) }