|
@@ -6,18 +6,13 @@ import { Context } from "shared/Context";
|
|
|
import { InfraType } from "shared/types";
|
|
import { InfraType } from "shared/types";
|
|
|
import api from "shared/api";
|
|
import api from "shared/api";
|
|
|
|
|
|
|
|
-import ProvisionerSettings from "../provisioner/ProvisionerSettings";
|
|
|
|
|
-import ClusterPlaceholderContainer from "./ClusterPlaceholderContainer";
|
|
|
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
|
-import TabRegion from "components/TabRegion";
|
|
|
|
|
-import Provisioner from "../provisioner/Provisioner";
|
|
|
|
|
import FormDebugger from "components/porter-form/FormDebugger";
|
|
import FormDebugger from "components/porter-form/FormDebugger";
|
|
|
import TitleSection from "components/TitleSection";
|
|
import TitleSection from "components/TitleSection";
|
|
|
|
|
+import ClusterSection from "./ClusterSection";
|
|
|
|
|
|
|
|
-import { pushFiltered, pushQueryParams } from "shared/routing";
|
|
|
|
|
|
|
+import { pushFiltered } from "shared/routing";
|
|
|
import { withAuth, WithAuthProps } from "shared/auth/AuthorizationHoc";
|
|
import { withAuth, WithAuthProps } from "shared/auth/AuthorizationHoc";
|
|
|
-import { StatusPage } from "../onboarding/steps/ProvisionResources/forms/StatusPage";
|
|
|
|
|
-import Banner from "components/Banner";
|
|
|
|
|
|
|
|
|
|
type PropsType = RouteComponentProps &
|
|
type PropsType = RouteComponentProps &
|
|
|
WithAuthProps & {
|
|
WithAuthProps & {
|
|
@@ -25,9 +20,6 @@ type PropsType = RouteComponentProps &
|
|
|
setRefreshClusters: (x: boolean) => void;
|
|
setRefreshClusters: (x: boolean) => void;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// TODO: rethink this list, should be coupled with tabOptions
|
|
|
|
|
-const tabOptionStrings = ["overview", "create-cluster", "provisioner"];
|
|
|
|
|
-
|
|
|
|
|
type StateType = {
|
|
type StateType = {
|
|
|
infras: InfraType[];
|
|
infras: InfraType[];
|
|
|
pressingCtrl: boolean;
|
|
pressingCtrl: boolean;
|
|
@@ -93,71 +85,16 @@ class Dashboard extends Component<PropsType, StateType> {
|
|
|
if (this.props.projectId && prevProps.projectId !== this.props.projectId) {
|
|
if (this.props.projectId && prevProps.projectId !== this.props.projectId) {
|
|
|
this.refreshInfras();
|
|
this.refreshInfras();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- if (!tabOptionStrings.includes(this.currentTab())) {
|
|
|
|
|
- this.setCurrentTab("overview");
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onShowProjectSettings = () => {
|
|
onShowProjectSettings = () => {
|
|
|
pushFiltered(this.props, "/project-settings", ["project_id"]);
|
|
pushFiltered(this.props, "/project-settings", ["project_id"]);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- currentTab = () => new URLSearchParams(this.props.location.search).get("tab");
|
|
|
|
|
-
|
|
|
|
|
- renderTabContents = () => {
|
|
|
|
|
- if (this.currentTab() === "provisioner") {
|
|
|
|
|
- return (
|
|
|
|
|
- <StatusPage
|
|
|
|
|
- filter={[]}
|
|
|
|
|
- project_id={this.props.projectId}
|
|
|
|
|
- setInfraStatus={() => null}
|
|
|
|
|
- />
|
|
|
|
|
- );
|
|
|
|
|
- } else if (this.currentTab() === "create-cluster") {
|
|
|
|
|
- let helperText = "Create a cluster to link to this project";
|
|
|
|
|
- let helperType = "info";
|
|
|
|
|
- if (
|
|
|
|
|
- true
|
|
|
|
|
- ) {
|
|
|
|
|
- helperText =
|
|
|
|
|
- "You need to update your billing to provision or connect a new cluster";
|
|
|
|
|
- helperType = "warning";
|
|
|
|
|
- }
|
|
|
|
|
- return (
|
|
|
|
|
- <>
|
|
|
|
|
- <Banner type={helperType} noMargin>
|
|
|
|
|
- {helperText}
|
|
|
|
|
- </Banner>
|
|
|
|
|
- <Br />
|
|
|
|
|
- <ProvisionerSettings infras={this.state.infras} provisioner={true} />
|
|
|
|
|
- </>
|
|
|
|
|
- );
|
|
|
|
|
- } else {
|
|
|
|
|
- return <ClusterPlaceholderContainer />;
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- setCurrentTab = (x: string) => {
|
|
|
|
|
- pushQueryParams(this.props, { tab: x });
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
render() {
|
|
render() {
|
|
|
let { currentProject, capabilities } = this.context;
|
|
let { currentProject, capabilities } = this.context;
|
|
|
let { onShowProjectSettings } = this;
|
|
let { onShowProjectSettings } = this;
|
|
|
|
|
|
|
|
- let tabOptions = [{ label: "Connected clusters", 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" }];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
{currentProject && (
|
|
{currentProject && (
|
|
@@ -200,13 +137,7 @@ class Dashboard extends Component<PropsType, StateType> {
|
|
|
.
|
|
.
|
|
|
</Description>
|
|
</Description>
|
|
|
</InfoSection>
|
|
</InfoSection>
|
|
|
- <TabRegion
|
|
|
|
|
- currentTab={this.currentTab()}
|
|
|
|
|
- setCurrentTab={this.setCurrentTab}
|
|
|
|
|
- options={tabOptions}
|
|
|
|
|
- >
|
|
|
|
|
- {this.renderTabContents()}
|
|
|
|
|
- </TabRegion>
|
|
|
|
|
|
|
+ <ClusterSection />
|
|
|
</>
|
|
</>
|
|
|
)}
|
|
)}
|
|
|
</DashboardWrapper>
|
|
</DashboardWrapper>
|
|
@@ -220,6 +151,49 @@ Dashboard.contextType = Context;
|
|
|
|
|
|
|
|
export default withRouter(withAuth(Dashboard));
|
|
export default withRouter(withAuth(Dashboard));
|
|
|
|
|
|
|
|
|
|
+const Button = styled.div`
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: row;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ font-family: "Work Sans", sans-serif;
|
|
|
|
|
+ border-radius: 5px;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ width: 147px;
|
|
|
|
|
+ margin-bottom: 30px;
|
|
|
|
|
+ color: white;
|
|
|
|
|
+ height: 30px;
|
|
|
|
|
+ padding: 0 8px;
|
|
|
|
|
+ padding-right: 13px;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ cursor: ${(props: { disabled?: boolean }) =>
|
|
|
|
|
+ props.disabled ? "not-allowed" : "pointer"};
|
|
|
|
|
+
|
|
|
|
|
+ background: ${(props: { disabled?: boolean }) =>
|
|
|
|
|
+ props.disabled ? "#aaaabbee" : "#616FEEcc"};
|
|
|
|
|
+ :hover {
|
|
|
|
|
+ background: ${(props: { disabled?: boolean }) =>
|
|
|
|
|
+ props.disabled ? "" : "#505edddd"};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ > i {
|
|
|
|
|
+ color: white;
|
|
|
|
|
+ width: 18px;
|
|
|
|
|
+ height: 18px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ border-radius: 20px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ margin-right: 5px;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ }
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
const Br = styled.div`
|
|
const Br = styled.div`
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 1px;
|
|
height: 1px;
|
|
@@ -252,7 +226,7 @@ const TopRow = styled.div`
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
|
const Description = styled.div`
|
|
const Description = styled.div`
|
|
|
- color: #8b949f;
|
|
|
|
|
|
|
+ color: #aaaabb;
|
|
|
margin-top: 13px;
|
|
margin-top: 13px;
|
|
|
margin-left: 2px;
|
|
margin-left: 2px;
|
|
|
font-size: 13px;
|
|
font-size: 13px;
|
|
@@ -263,10 +237,10 @@ const InfoLabel = styled.div`
|
|
|
height: 20px;
|
|
height: 20px;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- color: #8b949f;
|
|
|
|
|
|
|
+ color: #aaaabb;
|
|
|
font-size: 13px;
|
|
font-size: 13px;
|
|
|
> i {
|
|
> i {
|
|
|
- color: #8b949f;
|
|
|
|
|
|
|
+ color: #aaaabb;
|
|
|
font-size: 18px;
|
|
font-size: 18px;
|
|
|
margin-right: 5px;
|
|
margin-right: 5px;
|
|
|
}
|
|
}
|