|
@@ -16,14 +16,16 @@ import ProjectSectionContainer from "./ProjectSectionContainer";
|
|
|
import loading from "assets/loading.gif";
|
|
import loading from "assets/loading.gif";
|
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
|
import { pushFiltered, pushQueryParams } from "shared/routing";
|
|
import { pushFiltered, pushQueryParams } from "shared/routing";
|
|
|
-
|
|
|
|
|
-type PropsType = RouteComponentProps & {
|
|
|
|
|
- forceSidebar: boolean;
|
|
|
|
|
- setWelcome: (x: boolean) => void;
|
|
|
|
|
- currentView: string;
|
|
|
|
|
- forceRefreshClusters: boolean;
|
|
|
|
|
- setRefreshClusters: (x: boolean) => void;
|
|
|
|
|
-};
|
|
|
|
|
|
|
+import { withAuth, WithAuthProps } from "shared/auth/AuthorizationHoc";
|
|
|
|
|
+
|
|
|
|
|
+type PropsType = RouteComponentProps &
|
|
|
|
|
+ WithAuthProps & {
|
|
|
|
|
+ forceSidebar: boolean;
|
|
|
|
|
+ setWelcome: (x: boolean) => void;
|
|
|
|
|
+ currentView: string;
|
|
|
|
|
+ forceRefreshClusters: boolean;
|
|
|
|
|
+ setRefreshClusters: (x: boolean) => void;
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
type StateType = {
|
|
type StateType = {
|
|
|
showSidebar: boolean;
|
|
showSidebar: boolean;
|
|
@@ -231,28 +233,35 @@ class Sidebar extends Component<PropsType, StateType> {
|
|
|
<Img src={rocket} />
|
|
<Img src={rocket} />
|
|
|
Launch
|
|
Launch
|
|
|
</NavButton>
|
|
</NavButton>
|
|
|
- <NavButton
|
|
|
|
|
- selected={currentView === "integrations"}
|
|
|
|
|
- onClick={() =>
|
|
|
|
|
- pushFiltered(this.props, "/integrations", ["project_id"])
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- <Img src={integrations} />
|
|
|
|
|
- Integrations
|
|
|
|
|
- </NavButton>
|
|
|
|
|
- {this.context.currentProject.roles.filter((obj: any) => {
|
|
|
|
|
- return obj.user_id === this.context.user.userId;
|
|
|
|
|
- })[0].kind === "admin" && (
|
|
|
|
|
|
|
+ {this.props.isAuthorized("integrations", "", ["get"]) && (
|
|
|
<NavButton
|
|
<NavButton
|
|
|
|
|
+ selected={currentView === "integrations"}
|
|
|
onClick={() =>
|
|
onClick={() =>
|
|
|
- pushFiltered(this.props, "/project-settings", ["project_id"])
|
|
|
|
|
|
|
+ pushFiltered(this.props, "/integrations", ["project_id"])
|
|
|
}
|
|
}
|
|
|
- selected={this.props.currentView === "project-settings"}
|
|
|
|
|
>
|
|
>
|
|
|
- <Img enlarge={true} src={settings} />
|
|
|
|
|
- Settings
|
|
|
|
|
|
|
+ <Img src={integrations} />
|
|
|
|
|
+ Integrations
|
|
|
</NavButton>
|
|
</NavButton>
|
|
|
)}
|
|
)}
|
|
|
|
|
+ {this.context.currentProject.roles.filter((obj: any) => {
|
|
|
|
|
+ return obj.user_id === this.context.user.userId;
|
|
|
|
|
+ })[0].kind === "admin" &&
|
|
|
|
|
+ this.props.isAuthorized("settings", "", [
|
|
|
|
|
+ "get",
|
|
|
|
|
+ "update",
|
|
|
|
|
+ "delete",
|
|
|
|
|
+ ]) && (
|
|
|
|
|
+ <NavButton
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ pushFiltered(this.props, "/project-settings", ["project_id"])
|
|
|
|
|
+ }
|
|
|
|
|
+ selected={this.props.currentView === "project-settings"}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Img enlarge={true} src={settings} />
|
|
|
|
|
+ Settings
|
|
|
|
|
+ </NavButton>
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
<br />
|
|
<br />
|
|
|
|
|
|
|
@@ -313,7 +322,7 @@ class Sidebar extends Component<PropsType, StateType> {
|
|
|
|
|
|
|
|
Sidebar.contextType = Context;
|
|
Sidebar.contextType = Context;
|
|
|
|
|
|
|
|
-export default withRouter(Sidebar);
|
|
|
|
|
|
|
+export default withRouter(withAuth(Sidebar));
|
|
|
|
|
|
|
|
const BranchPad = styled.div`
|
|
const BranchPad = styled.div`
|
|
|
width: 20px;
|
|
width: 20px;
|