Skip to content

Commit

Permalink
hard code CREATED_AT as initial sort key
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasser Elsayed committed Nov 8, 2018
1 parent 4aa0789 commit f278dff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 2 additions & 4 deletions frontend/src/pages/ExperimentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ interface ExperimentListState {
displayExperiments: DisplayExperiment[];
selectedRunIds: string[];
selectedTab: number;
sortBy: string;
}

class ExperimentList extends Page<{}, ExperimentListState> {
Expand All @@ -54,7 +53,6 @@ class ExperimentList extends Page<{}, ExperimentListState> {
displayExperiments: [],
selectedRunIds: [],
selectedTab: 0,
sortBy: ExperimentSortKeys.CREATED_AT,
};
}

Expand Down Expand Up @@ -122,7 +120,7 @@ class ExperimentList extends Page<{}, ExperimentListState> {
return (
<div className={classes(commonCss.page, padding(20, 'lr'))}>
<CustomTable columns={columns} rows={rows} ref={this._tableRef}
disableSelection={true} initialSortColumn={this.state.sortBy}
disableSelection={true} initialSortColumn={ExperimentSortKeys.CREATED_AT}
reload={this._reload.bind(this)} toggleExpansion={this._toggleRowExpand.bind(this)}
getExpandComponent={this._getExpandedExperimentComponent.bind(this)}
emptyMessage='No experiments found. Click "Create experiment" to start.' />
Expand Down Expand Up @@ -172,7 +170,7 @@ class ExperimentList extends Page<{}, ExperimentListState> {
}
}));

this.setState({ displayExperiments, sortBy: request.sortBy! });
this.setState({ displayExperiments });
return response.next_page_token || '';
}

Expand Down
8 changes: 3 additions & 5 deletions frontend/src/pages/PipelineSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ interface PipelineSelectorProps extends RouteComponentProps {
interface PipelineSelectorState {
pipelines: ApiPipeline[];
selectedIds: string[];
sortBy: string;
toolbarActions: ToolbarActionConfig[];
}

Expand All @@ -44,13 +43,12 @@ class PipelineSelector extends React.Component<PipelineSelectorProps, PipelineSe
this.state = {
pipelines: [],
selectedIds: [],
sortBy: PipelineSortKeys.CREATED_AT,
toolbarActions: [],
};
}

public render() {
const { pipelines, selectedIds, sortBy, toolbarActions } = this.state;
const { pipelines, selectedIds, toolbarActions } = this.state;

const columns: Column[] = [
{ label: 'Pipeline name', flex: 1, sortKey: PipelineSortKeys.NAME },
Expand All @@ -75,7 +73,7 @@ class PipelineSelector extends React.Component<PipelineSelectorProps, PipelineSe
<Toolbar actions={toolbarActions} breadcrumbs={[{ displayName: 'Choose a pipeline', href: '' }]} />
<CustomTable columns={columns} rows={rows} selectedIds={selectedIds} useRadioButtons={true}
updateSelection={ids => { this._pipelineSelectionChanged(ids); this.setState({ selectedIds: ids }); }}
initialSortColumn={sortBy} ref={this._tableRef}
initialSortColumn={PipelineSortKeys.CREATED_AT} ref={this._tableRef}
reload={this._loadPipelines.bind(this)} emptyMessage={'No pipelines found. Upload a pipeline and then try again.'} />
</React.Fragment>
);
Expand Down Expand Up @@ -113,7 +111,7 @@ class PipelineSelector extends React.Component<PipelineSelectorProps, PipelineSe
logger.error('Could not get list of pipelines', errorMessage);
}

this.setState({ pipelines, sortBy: request.sortBy! });
this.setState({ pipelines });
return nextPageToken;
}
}
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/pages/RecurringRunsManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ interface RecurringRunListState {
busyIds: Set<string>;
runs: ApiJob[];
selectedIds: string[];
sortBy: string;
toolbarActions: ToolbarActionConfig[];
}

Expand All @@ -51,13 +50,12 @@ class RecurringRunsManager extends React.Component<RecurringRunListProps, Recurr
busyIds: new Set(),
runs: [],
selectedIds: [],
sortBy: JobSortKeys.CREATED_AT,
toolbarActions: [],
};
}

public render() {
const { runs, selectedIds, sortBy, toolbarActions } = this.state;
const { runs, selectedIds, toolbarActions } = this.state;

const columns: Column[] = [
{
Expand Down Expand Up @@ -85,7 +83,7 @@ class RecurringRunsManager extends React.Component<RecurringRunListProps, Recurr
return (<React.Fragment>
<Toolbar actions={toolbarActions} breadcrumbs={[{ displayName: 'Recurring runs', href: '' }]} />
<CustomTable columns={columns} rows={rows} ref={this._tableRef} selectedIds={selectedIds}
updateSelection={ids => this.setState({ selectedIds: ids })} initialSortColumn={sortBy}
updateSelection={ids => this.setState({ selectedIds: ids })} initialSortColumn={JobSortKeys.CREATED_AT}
reload={this._loadRuns.bind(this)} emptyMessage={'No recurring runs found in this experiment.'}
disableSelection={true} />
</React.Fragment>);
Expand Down Expand Up @@ -120,7 +118,7 @@ class RecurringRunsManager extends React.Component<RecurringRunListProps, Recurr
logger.error('Could not get list of recurring runs', errorMessage);
}

this.setState({ runs, sortBy: request.sortBy! });
this.setState({ runs });
return nextPageToken;
}

Expand Down

0 comments on commit f278dff

Please sign in to comment.