|
|
@@ -14,11 +14,13 @@ import Provisioner from "../provisioner/Provisioner";
|
|
|
import FormDebugger from "components/values-form/FormDebugger";
|
|
|
|
|
|
import { pushQueryParams, pushFiltered } from "shared/routing";
|
|
|
+import { withAuth, WithAuthProps } from "shared/auth/AuthorizationHoc";
|
|
|
|
|
|
-type PropsType = RouteComponentProps & {
|
|
|
- projectId: number | null;
|
|
|
- setRefreshClusters: (x: boolean) => void;
|
|
|
-};
|
|
|
+type PropsType = RouteComponentProps &
|
|
|
+ WithAuthProps & {
|
|
|
+ projectId: number | null;
|
|
|
+ setRefreshClusters: (x: boolean) => void;
|
|
|
+ };
|
|
|
|
|
|
// TODO: rethink this list, should be coupled with tabOptions
|
|
|
const tabOptionStrings = ["overview", "create-cluster", "provisioner"];
|
|
|
@@ -126,11 +128,13 @@ class Dashboard extends Component<PropsType, StateType> {
|
|
|
let { currentProject, capabilities } = this.context;
|
|
|
let { onShowProjectSettings } = this;
|
|
|
|
|
|
- let tabOptions = [
|
|
|
- { label: "Project Overview", value: "overview" },
|
|
|
- { label: "Create a Cluster", value: "create-cluster" },
|
|
|
- { label: "Provisioner Status", value: "provisioner" },
|
|
|
- ];
|
|
|
+ let tabOptions = [{ label: "Project Overview", value: "overview" }];
|
|
|
+
|
|
|
+ if (this.props.isAuthorized("cluster", "", ["get", "create"])) {
|
|
|
+ tabOptions.push({ label: "Create a Cluster", value: "create-cluster" });
|
|
|
+ }
|
|
|
+
|
|
|
+ tabOptions.push({ label: "Provisioner Status", value: "provisioner" });
|
|
|
|
|
|
if (!capabilities?.provisioner) {
|
|
|
tabOptions = [{ label: "Project Overview", value: "overview" }];
|
|
|
@@ -195,7 +199,7 @@ class Dashboard extends Component<PropsType, StateType> {
|
|
|
|
|
|
Dashboard.contextType = Context;
|
|
|
|
|
|
-export default withRouter(Dashboard);
|
|
|
+export default withRouter(withAuth(Dashboard));
|
|
|
|
|
|
const DashboardWrapper = styled.div`
|
|
|
padding-bottom: 100px;
|
|
|
@@ -318,8 +322,8 @@ const TitleSection = styled.div`
|
|
|
> i {
|
|
|
margin-left: 10px;
|
|
|
cursor: pointer;
|
|
|
- font-size 18px;
|
|
|
- color: #858FAAaa;
|
|
|
+ font-size: 18px;
|
|
|
+ color: #858faaaa;
|
|
|
padding: 5px;
|
|
|
border-radius: 100px;
|
|
|
:hover {
|