import { StyleRulesCallback, Theme, WithStyles, withStyles } from '@material-ui/core/styles';
import Drawer from '@material-ui/core/Drawer';
import { connect, DispatchProp } from "react-redux";
-import { Route, Switch, RouteComponentProps } from "react-router";
+import { Route, Switch, RouteComponentProps, withRouter } from "react-router";
import authActions from "../../store/auth/auth-action";
import dataExplorerActions from "../../store/data-explorer/data-explorer-action";
import { User } from "../../models/user";
import { ItemMode, setProjectItem } from "../../store/navigation/navigation-action";
import projectActions from "../../store/project/project-action";
import ProjectPanel from "../project-panel/project-panel";
+import { sidePanelData } from '../../store/side-panel/side-panel-reducer';
const drawerWidth = 240;
const appBarHeight = 102;
}
interface WorkbenchState {
+ isCreationDialogOpen: boolean;
anchorEl: any;
searchText: string;
menuItems: {
class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
state = {
+ isCreationDialogOpen: false,
anchorEl: null,
searchText: "",
breadcrumbs: [],
this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
}
+ handleCreationDialogOpen = () => {
+ this.setState({ isCreationDialogOpen: true });
+ }
+
+ handleCreationDialogClose = () => {
+ this.setState({ isCreationDialogOpen: false });
+ }
+
render() {
const path = getTreePath(this.props.projects, this.props.currentProjectId);
const breadcrumbs = path.map(item => ({
<SidePanel
toggleOpen={this.toggleSidePanelOpen}
toggleActive={this.toggleSidePanelActive}
- sidePanelItems={this.props.sidePanelItems}>
+ sidePanelItems={this.props.sidePanelItems}
+ handleCreationDialogOpen={this.handleCreationDialogOpen}
+ handleCreationDialogClose={this.handleCreationDialogClose}>
<ProjectTree
projects={this.props.projects}
- toggleOpen={itemId =>
- this.props.dispatch<any>(
- setProjectItem(itemId, ItemMode.OPEN)
- )}
- toggleActive={itemId =>
- this.props.dispatch<any>(
- setProjectItem(itemId, ItemMode.ACTIVE)
- )}
+ toggleOpen={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.OPEN))}
+ toggleActive={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE))}
+ handleCreationDialogOpen={this.handleCreationDialogOpen}
+ handleCreationDialogClose={this.handleCreationDialogClose}
/>
</SidePanel>
</Drawer>}
);
}
- 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)
- )} />;
- }
-
+ renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => <ProjectPanel
+ onItemRouteChange={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE))}
+ onItemClick={item => this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE))}
+ handleCreationDialogOpen={this.handleCreationDialogOpen}
+ handleCreationDialogClose={this.handleCreationDialogClose}
+ isCreationDialogOpen={this.state.isCreationDialogOpen}
+ {...props} />
+
}
export default connect<WorkbenchDataProps>(