|
@@ -22,6 +22,9 @@ import { getQueryParam, pushFiltered } from "shared/routing";
|
|
|
import { withAuth, WithAuthProps } from "shared/auth/AuthorizationHoc";
|
|
import { withAuth, WithAuthProps } from "shared/auth/AuthorizationHoc";
|
|
|
import SidebarLink from "./SidebarLink";
|
|
import SidebarLink from "./SidebarLink";
|
|
|
import { overrideInfraTabEnabled } from "utils/infrastructure";
|
|
import { overrideInfraTabEnabled } from "utils/infrastructure";
|
|
|
|
|
+import ClusterListContainer from "./ClusterListContainer";
|
|
|
|
|
+import ProjectButtonContainer from "./ProjectButtonContainer";
|
|
|
|
|
+import ProjectButtonContianer from "./ProjectButtonContainer";
|
|
|
|
|
|
|
|
type PropsType = RouteComponentProps &
|
|
type PropsType = RouteComponentProps &
|
|
|
WithAuthProps & {
|
|
WithAuthProps & {
|
|
@@ -173,85 +176,195 @@ class Sidebar extends Component<PropsType, StateType> {
|
|
|
</ScrollWrapper>
|
|
</ScrollWrapper>
|
|
|
);
|
|
);
|
|
|
} else if (currentProject.simplified_view_enabled) {
|
|
} else if (currentProject.simplified_view_enabled) {
|
|
|
- return (
|
|
|
|
|
- <ScrollWrapper>
|
|
|
|
|
- <NavButton
|
|
|
|
|
- path="/apps"
|
|
|
|
|
- active={window.location.pathname.startsWith("/apps")}
|
|
|
|
|
- >
|
|
|
|
|
- <Img src={web} />
|
|
|
|
|
- Applications
|
|
|
|
|
- </NavButton>
|
|
|
|
|
- <NavButton
|
|
|
|
|
- path="/addons"
|
|
|
|
|
- active={window.location.pathname.startsWith("/addons")}
|
|
|
|
|
- >
|
|
|
|
|
- <Img src={addOns} />
|
|
|
|
|
- Add-ons
|
|
|
|
|
- </NavButton>
|
|
|
|
|
- {currentProject.env_group_enabled && <NavButton
|
|
|
|
|
- path="/env-groups"
|
|
|
|
|
-
|
|
|
|
|
- active={
|
|
|
|
|
|
|
|
|
|
- window.location.pathname.startsWith("/env-groups")
|
|
|
|
|
|
|
+ if (currentProject.multi_cluster) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <ScrollWrapper>
|
|
|
|
|
+ {this.props.isAuthorized("settings", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+ <NavButton path={"/project-settings"}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={settings} />
|
|
|
|
|
+ Project settings
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+
|
|
|
|
|
+ )}
|
|
|
|
|
+ {this.props.isAuthorized("integrations", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "create",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+ <NavButton path={"/integrations"}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={integrations} />
|
|
|
|
|
+ Integrations
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {currentCluster &&
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Spacer y={.5} />
|
|
|
|
|
+ <ClusterListContainer />
|
|
|
|
|
+ </>
|
|
|
}
|
|
}
|
|
|
- >
|
|
|
|
|
- <Img src={sliders} />
|
|
|
|
|
- Env groups
|
|
|
|
|
- </NavButton>}
|
|
|
|
|
- {this.props.isAuthorized("integrations", "", [
|
|
|
|
|
- "get",
|
|
|
|
|
- "create",
|
|
|
|
|
- "update",
|
|
|
|
|
- "delete",
|
|
|
|
|
- ]) && (
|
|
|
|
|
- <NavButton path={"/integrations"}>
|
|
|
|
|
- <Img src={integrations} />
|
|
|
|
|
- Integrations
|
|
|
|
|
- </NavButton>
|
|
|
|
|
- )}
|
|
|
|
|
- {this.props.isAuthorized("settings", "", [
|
|
|
|
|
- "get",
|
|
|
|
|
- "update",
|
|
|
|
|
- "delete",
|
|
|
|
|
- ]) && (
|
|
|
|
|
- <NavButton
|
|
|
|
|
- path={"/cluster-dashboard"}
|
|
|
|
|
- targetClusterName={currentCluster?.name}
|
|
|
|
|
- active={
|
|
|
|
|
- window.location.pathname.startsWith("/cluster-dashboard")
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- <Img src={infra} />
|
|
|
|
|
- Infrastructure
|
|
|
|
|
- </NavButton>
|
|
|
|
|
- )}
|
|
|
|
|
- {this.props.isAuthorized("settings", "", [
|
|
|
|
|
- "get",
|
|
|
|
|
- "update",
|
|
|
|
|
- "delete",
|
|
|
|
|
- ]) && (
|
|
|
|
|
- <NavButton path={"/project-settings"}>
|
|
|
|
|
- <Img src={settings} />
|
|
|
|
|
- Project settings
|
|
|
|
|
- </NavButton>
|
|
|
|
|
- )}
|
|
|
|
|
-
|
|
|
|
|
- {/* Hacky workaround for setting currentCluster with legacy method */}
|
|
|
|
|
- <Clusters
|
|
|
|
|
- setWelcome={this.props.setWelcome}
|
|
|
|
|
- currentView={currentView}
|
|
|
|
|
- isSelected={false}
|
|
|
|
|
- forceRefreshClusters={this.props.forceRefreshClusters}
|
|
|
|
|
- setRefreshClusters={this.props.setRefreshClusters}
|
|
|
|
|
- />
|
|
|
|
|
- </ScrollWrapper>
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ path="/apps"
|
|
|
|
|
+ active={window.location.pathname.startsWith("/apps")}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={web} />
|
|
|
|
|
+ Applications
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ path="/addons"
|
|
|
|
|
+ active={window.location.pathname.startsWith("/addons")}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={addOns} />
|
|
|
|
|
+ Add-ons
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ {currentProject.env_group_enabled && <NavButton
|
|
|
|
|
+ path="/env-groups"
|
|
|
|
|
+ active={
|
|
|
|
|
+ window.location.pathname.startsWith("/env-groups")
|
|
|
|
|
+ }
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={sliders} />
|
|
|
|
|
+
|
|
|
|
|
+ Env groups
|
|
|
|
|
+ </NavButton>}
|
|
|
|
|
+ {this.props.isAuthorized("settings", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ path={"/cluster-dashboard"}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ active={
|
|
|
|
|
+ window.location.pathname.startsWith("/cluster-dashboard")
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={infra} />
|
|
|
|
|
+ Infrastructure
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
|
|
+ {/* Hacky workaround for setting currentCluster with legacy method */}
|
|
|
|
|
+ <Clusters
|
|
|
|
|
+ setWelcome={this.props.setWelcome}
|
|
|
|
|
+ currentView={currentView}
|
|
|
|
|
+ isSelected={false}
|
|
|
|
|
+ forceRefreshClusters={this.props.forceRefreshClusters}
|
|
|
|
|
+ setRefreshClusters={this.props.setRefreshClusters}
|
|
|
|
|
+ />
|
|
|
|
|
+ </ScrollWrapper>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <ScrollWrapper>
|
|
|
|
|
+ <Spacer y={.5} />
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ path="/apps"
|
|
|
|
|
+ active={window.location.pathname.startsWith("/apps")}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={web} />
|
|
|
|
|
+ Applications
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ path="/addons"
|
|
|
|
|
+ active={window.location.pathname.startsWith("/addons")}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={addOns} />
|
|
|
|
|
+ Add-ons
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ {currentProject.env_group_enabled && <NavButton
|
|
|
|
|
+ path="/env-groups"
|
|
|
|
|
+ active={
|
|
|
|
|
+ window.location.pathname.startsWith("/env-groups")
|
|
|
|
|
+ }
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={sliders} />
|
|
|
|
|
+
|
|
|
|
|
+ Env groups
|
|
|
|
|
+ </NavButton>}
|
|
|
|
|
+ {this.props.isAuthorized("settings", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ path={"/cluster-dashboard"}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ active={
|
|
|
|
|
+ window.location.pathname.startsWith("/cluster-dashboard")
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={infra} />
|
|
|
|
|
+ Infrastructure
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
|
|
+ {this.props.isAuthorized("integrations", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "create",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+ <NavButton path={"/integrations"}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={integrations} />
|
|
|
|
|
+ Integrations
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
|
|
+ {this.props.isAuthorized("settings", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+ <NavButton path={"/project-settings"}
|
|
|
|
|
+ style={{ marginLeft: '25px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img src={settings} />
|
|
|
|
|
+ Project settings
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
|
|
+ {/* Hacky workaround for setting currentCluster with legacy method */}
|
|
|
|
|
+ <Clusters
|
|
|
|
|
+ setWelcome={this.props.setWelcome}
|
|
|
|
|
+ currentView={currentView}
|
|
|
|
|
+ isSelected={false}
|
|
|
|
|
+ forceRefreshClusters={this.props.forceRefreshClusters}
|
|
|
|
|
+ setRefreshClusters={this.props.setRefreshClusters}
|
|
|
|
|
+ />
|
|
|
|
|
+ </ScrollWrapper>
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Render placeholder if no project exists
|
|
// Render placeholder if no project exists
|
|
|
return <ProjectPlaceholder>No projects found.</ProjectPlaceholder>;
|
|
return <ProjectPlaceholder>No projects found.</ProjectPlaceholder>;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// SidebarBg is separate to cover retracted drawer
|
|
// SidebarBg is separate to cover retracted drawer
|
|
@@ -275,9 +388,6 @@ class Sidebar extends Component<PropsType, StateType> {
|
|
|
</CollapseButton>
|
|
</CollapseButton>
|
|
|
|
|
|
|
|
<ProjectSectionContainer />
|
|
<ProjectSectionContainer />
|
|
|
-
|
|
|
|
|
- <br />
|
|
|
|
|
-
|
|
|
|
|
{this.renderProjectContents()}
|
|
{this.renderProjectContents()}
|
|
|
{this.context.featurePreview && (
|
|
{this.context.featurePreview && (
|
|
|
<Container row>
|
|
<Container row>
|