Feature #13678
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>
export const PROJECT_PANEL_ID = "projectPanel";
export const PROJECT_PANEL_ID = "projectPanel";
-type ProjectPanelProps = { onItemOpen: (itemId: string) => void }
+type ProjectPanelProps = { onItemClick: (item: ProjectPanelItem) => void }
- & WithStyles<CssRules>
- & RouteComponentProps<{ id: string }>;
+ & WithStyles<CssRules>;
class ProjectPanel extends React.Component<ProjectPanelProps> {
render() {
return <div>
class ProjectPanel extends React.Component<ProjectPanelProps> {
render() {
return <div>
contextActions={contextMenuActions}
onColumnToggle={this.toggleColumn}
onFiltersChange={this.changeFilters}
contextActions={contextMenuActions}
onColumnToggle={this.toggleColumn}
onFiltersChange={this.changeFilters}
- onRowClick={this.openProject}
+ onRowClick={this.props.onItemClick}
onSortToggle={this.toggleSort}
onSearch={this.search}
onContextAction={this.executeAction}
onSortToggle={this.toggleSort}
onSearch={this.search}
onContextAction={this.executeAction}
this.props.dispatch(actions.SET_COLUMNS({ id: PROJECT_PANEL_ID, columns }));
}
this.props.dispatch(actions.SET_COLUMNS({ id: PROJECT_PANEL_ID, columns }));
}
- componentWillReceiveProps(nextProps: ProjectPanelProps) {
- if (this.props.match.params.id !== nextProps.match.params.id) {
- this.props.onItemOpen(nextProps.match.params.id);
- }
- }
-
toggleColumn = (toggledColumn: DataColumn<ProjectPanelItem>) => {
this.props.dispatch(actions.TOGGLE_COLUMN({ id: PROJECT_PANEL_ID, columnName: toggledColumn.name }));
}
toggleColumn = (toggledColumn: DataColumn<ProjectPanelItem>) => {
this.props.dispatch(actions.TOGGLE_COLUMN({ id: PROJECT_PANEL_ID, columnName: toggledColumn.name }));
}
changeRowsPerPage = (rowsPerPage: number) => {
this.props.dispatch(actions.SET_ROWS_PER_PAGE({ id: PROJECT_PANEL_ID, rowsPerPage }));
}
changeRowsPerPage = (rowsPerPage: number) => {
this.props.dispatch(actions.SET_ROWS_PER_PAGE({ id: PROJECT_PANEL_ID, rowsPerPage }));
}
-
- openProject = (item: ProjectPanelItem) => {
- this.props.onItemOpen(item.uuid);
- }
}
type CssRules = "toolbar" | "button";
}
type CssRules = "toolbar" | "button";
label: item.data.name,
itemId: item.data.uuid,
status: item.status
label: item.data.name,
itemId: item.data.uuid,
status: item.status
const { classes, user } = this.props;
return (
const { classes, user } = this.props;
return (
- renderProjectPanel = (props: RouteComponentProps<any>) =>
- <ProjectPanel
- onItemOpen={itemId => this.props.dispatch<any>(
- setProjectItem(itemId, ItemMode.ACTIVE)
- )}
- {...props} />
+ renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => {
+ if (props.match.params.id !== this.props.currentProjectId) {
+ this.props.dispatch<any>(
+ setProjectItem(props.match.params.id, ItemMode.ACTIVE)
+ );
+ }
+ return <ProjectPanel
+ onItemClick={item => this.props.dispatch<any>(
+ setProjectItem(item.uuid, ItemMode.ACTIVE)
+ )} />;
+ }
+
}
export default connect<WorkbenchDataProps>(
}
export default connect<WorkbenchDataProps>(