Skip to content

Commit

Permalink
Merge main into sweep/convert-main-to-functional-component
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Sep 19, 2023
2 parents 8288a90 + 1d1a392 commit c83735d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion dashboard/src/components/ProvisionerSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
42 changes: 26 additions & 16 deletions dashboard/src/main/home/modals/UpdateClusterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit c83735d

Please sign in to comment.