|
|
@@ -3,7 +3,7 @@ import styled from "styled-components";
|
|
|
|
|
|
import { Context } from "shared/Context";
|
|
|
import api from "shared/api";
|
|
|
-import { ChartTypeWithExtendedConfig, PorterTemplate } from "shared/types";
|
|
|
+import { ChartTypeWithExtendedConfig, PorterTemplate, ClusterType } from "shared/types";
|
|
|
|
|
|
import TabSelector from "components/TabSelector";
|
|
|
import ExpandedTemplate from "./expanded-template/ExpandedTemplate";
|
|
|
@@ -11,6 +11,7 @@ import Loading from "components/Loading";
|
|
|
import LaunchFlow from "./launch-flow/LaunchFlow";
|
|
|
import NoClusterPlaceholder from "../NoClusterPlaceholder";
|
|
|
import TitleSection from "components/TitleSection";
|
|
|
+import ClusterProvisioningPlaceholder from "components/ClusterProvisioningPlaceholder";
|
|
|
|
|
|
import semver from "semver";
|
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
|
@@ -43,6 +44,7 @@ type StateType = {
|
|
|
isOnLaunchFlow: boolean;
|
|
|
clonedChart: ChartTypeWithExtendedConfig;
|
|
|
tabOptions: TabOption[];
|
|
|
+ readyClusterStatus: string;
|
|
|
};
|
|
|
class Templates extends Component<PropsType, StateType> {
|
|
|
private previousContext: any;
|
|
|
@@ -58,6 +60,7 @@ class Templates extends Component<PropsType, StateType> {
|
|
|
isOnLaunchFlow: false,
|
|
|
clonedChart: null as ChartTypeWithExtendedConfig,
|
|
|
tabOptions: initialTabOptions,
|
|
|
+ readyClusterStatus: "checking",
|
|
|
};
|
|
|
|
|
|
componentDidMount() {
|
|
|
@@ -82,6 +85,30 @@ class Templates extends Component<PropsType, StateType> {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // Block launch tab on initial provisioning
|
|
|
+ api.getClusters(
|
|
|
+ "<token>",
|
|
|
+ {},
|
|
|
+ { id: this.context.currentProject.id },
|
|
|
+ )
|
|
|
+ .then(({ data }) => {
|
|
|
+ let numUnavailable = 0;
|
|
|
+ data.forEach((cluster: ClusterType) => {
|
|
|
+ if (cluster.status === "UPDATING_UNAVAILABLE") {
|
|
|
+ numUnavailable += 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (numUnavailable === data.length) {
|
|
|
+ this.setState({ readyClusterStatus: "none-ready" });
|
|
|
+ } else {
|
|
|
+ this.setState({ readyClusterStatus: "has-ready" });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+
|
|
|
let default_addon_helm_repo_url = this.context?.capabilities
|
|
|
?.default_addon_helm_repo_url;
|
|
|
let default_app_helm_repo_url = this.context?.capabilities
|
|
|
@@ -336,7 +363,16 @@ class Templates extends Component<PropsType, StateType> {
|
|
|
};
|
|
|
|
|
|
renderContents = () => {
|
|
|
- if (this.context.currentCluster) {
|
|
|
+ if (this.state.readyClusterStatus === "checking") {
|
|
|
+ return <Loading height="300px" />;
|
|
|
+ } else if (this.state.readyClusterStatus === "none-ready") {
|
|
|
+ return (
|
|
|
+ <>
|
|
|
+ <Br />
|
|
|
+ <ClusterProvisioningPlaceholder />
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ } else if (this.context.currentCluster) {
|
|
|
return (
|
|
|
<>
|
|
|
<TabSelector
|
|
|
@@ -353,7 +389,7 @@ class Templates extends Component<PropsType, StateType> {
|
|
|
</>
|
|
|
);
|
|
|
} else if (this.context.currentCluster?.id === -1) {
|
|
|
- return <Loading />;
|
|
|
+ return <Loading height="300px" />;
|
|
|
} else if (!this.context.currentCluster) {
|
|
|
return (
|
|
|
<>
|
|
|
@@ -405,6 +441,11 @@ Templates.contextType = Context;
|
|
|
|
|
|
export default withRouter(Templates);
|
|
|
|
|
|
+const Br = styled.div`
|
|
|
+ width: 100%;
|
|
|
+ height: 10px;
|
|
|
+`;
|
|
|
+
|
|
|
const Placeholder = styled.div`
|
|
|
padding-top: 200px;
|
|
|
width: 100%;
|