Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pinot-controller/src/main/resources/app/app_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class app_state {
queryConsoleOnlyView: boolean;
authWorkflow: AuthWorkflow;
authToken: string | null;
columnNameSeparator: string = '#$%';
}

export default new app_state();
7 changes: 4 additions & 3 deletions pinot-controller/src/main/resources/app/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp';
import { Link } from 'react-router-dom';
import Chip from '@material-ui/core/Chip';
import _ from 'lodash';
import app_state from '../app_state';
import Utils from '../utils/Utils';
import TableToolbar from './TableToolbar';
import SimpleAccordion from './SimpleAccordion';
Expand Down Expand Up @@ -450,14 +451,14 @@ export default function CustomizedTables({
onClick={() => {
if(column === 'Number of Segments'){
const data = finalData.sort((a,b)=>{
const aSegmentInt = parseInt(a[column]);
const bSegmentInt = parseInt(b[column]);
const aSegmentInt = parseInt(a[column+app_state.columnNameSeparator+index]);
const bSegmentInt = parseInt(b[column+app_state.columnNameSeparator+index]);
const result = order ? (aSegmentInt > bSegmentInt) : (aSegmentInt < bSegmentInt);
return result ? 1 : -1;
});
setFinalData(data);
} else {
setFinalData(_.orderBy(finalData, column, order ? 'asc' : 'desc'));
setFinalData(_.orderBy(finalData, column+app_state.columnNameSeparator+index, order ? 'asc' : 'desc'));
}
setOrder(!order);
setColumnClicked(column);
Expand Down
3 changes: 2 additions & 1 deletion pinot-controller/src/main/resources/app/utils/Utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import React from 'react';
import ReactDiffViewer, {DiffMethod} from 'react-diff-viewer';
import _ from 'lodash';
import app_state from '../app_state';

const sortArray = function (sortingArr, keyName, ascendingFlag) {
if (ascendingFlag) {
Expand Down Expand Up @@ -53,7 +54,7 @@ const tableFormat = (data) => {
rows.forEach((singleRow) => {
const obj = {};
singleRow.forEach((val: any, index: number) => {
obj[header[index]] = val;
obj[header[index]+app_state.columnNameSeparator+index] = val;
});
results.push(obj);
});
Expand Down