|
|
@@ -21,47 +21,47 @@ const ProvisionerStatus: React.FC<Props> = ({ provisionFailureReason }) => {
|
|
|
const [progress, setProgress] = useState(1);
|
|
|
|
|
|
// Continuously poll provisioning status and cluster status
|
|
|
- const pollProvisioningAndClusterStatus = async () => {
|
|
|
+ const pollProvisioningAndClusterStatus = async (currentProgress) => {
|
|
|
try {
|
|
|
- const [resState, resStatus] = await Promise.all([
|
|
|
- api.getClusterState(
|
|
|
+ if (currentProgress < 4) {
|
|
|
+ const resState = await api.getClusterState(
|
|
|
"<token>",
|
|
|
{},
|
|
|
{
|
|
|
project_id: currentProject.id,
|
|
|
cluster_id: currentCluster.id,
|
|
|
}
|
|
|
- ),
|
|
|
- api.getCluster(
|
|
|
+ );
|
|
|
+ const {
|
|
|
+ is_control_plane_ready,
|
|
|
+ is_infrastructure_ready,
|
|
|
+ phase,
|
|
|
+ } = resState.data;
|
|
|
+ let newProgress = 1;
|
|
|
+ if (is_control_plane_ready) {
|
|
|
+ newProgress += 1;
|
|
|
+ }
|
|
|
+ if (is_infrastructure_ready) {
|
|
|
+ newProgress += 1;
|
|
|
+ }
|
|
|
+ if (phase === "Provisioned") {
|
|
|
+ newProgress += 1;
|
|
|
+ }
|
|
|
+ setProgress(newProgress);
|
|
|
+ } else {
|
|
|
+ const resStatus = await api.getCluster(
|
|
|
"<token>",
|
|
|
{},
|
|
|
{
|
|
|
project_id: currentProject.id,
|
|
|
cluster_id: currentCluster.id,
|
|
|
}
|
|
|
- ),
|
|
|
- ]);
|
|
|
-
|
|
|
- const {
|
|
|
- is_control_plane_ready,
|
|
|
- is_infrastructure_ready,
|
|
|
- phase,
|
|
|
- } = resState.data;
|
|
|
- const status = resStatus.data.status;
|
|
|
- let progress = 1;
|
|
|
- if (is_control_plane_ready) {
|
|
|
- progress += 1;
|
|
|
- }
|
|
|
- if (is_infrastructure_ready) {
|
|
|
- progress += 1;
|
|
|
- }
|
|
|
- if (phase === "Provisioned") {
|
|
|
- progress += 1;
|
|
|
- }
|
|
|
- if (status === "READY") {
|
|
|
- window.location.reload();
|
|
|
+ );
|
|
|
+ const status = resStatus.data.status;
|
|
|
+ if (status === "READY") {
|
|
|
+ window.location.reload();
|
|
|
+ }
|
|
|
}
|
|
|
- setProgress(progress);
|
|
|
} catch (err) {
|
|
|
console.log(err);
|
|
|
}
|
|
|
@@ -72,7 +72,7 @@ const ProvisionerStatus: React.FC<Props> = ({ provisionFailureReason }) => {
|
|
|
pollProvisioningAndClusterStatus,
|
|
|
PROVISIONING_STATUS_POLL_INTERVAL
|
|
|
);
|
|
|
- pollProvisioningAndClusterStatus();
|
|
|
+ pollProvisioningAndClusterStatus(progress);
|
|
|
return () => clearInterval(intervalId);
|
|
|
}, []);
|
|
|
|
|
|
@@ -87,7 +87,7 @@ const ProvisionerStatus: React.FC<Props> = ({ provisionFailureReason }) => {
|
|
|
<LoadingBar
|
|
|
color={provisionFailureReason ? "failed" : undefined}
|
|
|
completed={progress}
|
|
|
- total={4}
|
|
|
+ total={5}
|
|
|
/>
|
|
|
<Spacer height="18px" />
|
|
|
<Text color="#aaaabb">
|