Quellcode durchsuchen

Update Cluster Deletion (#3596)

sdess09 vor 2 Jahren
Ursprung
Commit
1d1a39272b

+ 1 - 1
dashboard/src/components/ProvisionerSettings.tsx

@@ -984,7 +984,7 @@ const ProvisionerSettings: React.FC<Props> = (props) => {
               </Text><Spacer height="10px" /><SelectRow
                 options={regionOptions}
                 width="350px"
-                disabled={isReadOnly}
+                disabled={isReadOnly || isLoading}
                 value={awsRegion}
                 scrollBuffer={true}
                 dropdownMaxHeight="240px"

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/dashboard/ClusterSettings.tsx

@@ -151,7 +151,7 @@ const ClusterSettings: React.FC<Props> = (props) => {
     </Helper>
   );
 
-  if (!currentCluster?.infra_id || !currentCluster?.service) {
+  if (!currentCluster?.infra_id && !currentProject?.capi_provisioner_enabled || !currentCluster?.service) {
     helperText = (
       <Helper>
         Remove this cluster from Porter. Since this cluster was not provisioned

+ 26 - 16
dashboard/src/main/home/modals/UpdateClusterModal.tsx

@@ -52,7 +52,7 @@ class UpdateClusterModal extends Component<PropsType, StateType> {
           cluster_id: currentCluster.id,
         }
       )
-      .then((_) => {
+      .then(async (_) => {
         if (!currentCluster?.infra_id) {
           // TODO: make this more declarative from the Home component
           this.props.setRefreshClusters(true);
@@ -61,24 +61,34 @@ class UpdateClusterModal extends Component<PropsType, StateType> {
           pushFiltered(this.props, "/dashboard", ["project_id"], {
             tab: "overview",
           });
+
+
+          // Handle destroying infra we've provisioned
+          api
+            .destroyInfra(
+              "<token>",
+              {},
+              {
+                project_id: currentProject.id,
+                infra_id: currentCluster.infra_id,
+              }
+            )
+            .then(() =>
+              console.log("destroyed provisioned infra:", currentCluster.infra_id)
+            )
+            .catch(console.log);
+
+          if (currentProject.simplified_view_enabled) {
+            await api.saveOnboardingState(
+              "<token>",
+              { current_step: "connect_source" },
+              { project_id: currentProject.id }
+            );
+            window.location.reload();
+          }
           return;
         }
 
-        // Handle destroying infra we've provisioned
-        api
-          .destroyInfra(
-            "<token>",
-            {},
-            {
-              project_id: currentProject.id,
-              infra_id: currentCluster.infra_id,
-            }
-          )
-          .then(() =>
-            console.log("destroyed provisioned infra:", currentCluster.infra_id)
-          )
-          .catch(console.log);
-
         this.props.setRefreshClusters(true);
         this.setState({ status: "successful", showDeleteOverlay: false });
         this.context.setCurrentModal(null, null);