Skip to content

Commit

Permalink
minor improvements to ux when graphs require no changes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidthor committed Dec 22, 2023
1 parent c2faa75 commit bd7a172
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/commands/common/infra-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,20 @@ export class InfraRenderer {
const tableStr = this.graphToTableOutput(graph);
console.log(tableStr);
}

// No need for confirmation when autoApprove is set
if (autoApprove) {
return;
}

// No need for confirmation if there are no changes to apply
if (graph.nodes.every((n) => n.status.state === 'complete')) {
return;
}

const tableStr = this.graphToTableOutput(graph);
console.log(tableStr);
Inputs.assertInteractiveShell('Use the flag \'--auto-approve\' to skip interactive approval');
Inputs.assertInteractiveShell("Use the flag '--auto-approve' to skip interactive approval");
const shouldContinue = await Inputs.promptForContinuation('Do you want to apply the above changes?');
if (!shouldContinue) {
Deno.exit(0);
Expand Down
2 changes: 0 additions & 2 deletions src/commands/destroy/datacenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ async function destroy_datacenter_action(options: DestroyDatacenterOptions, name
const allEnvs = await command_helper.environmentStore.find();
const datacenterEnvs = allEnvs.filter((env) => env.datacenter === datacenterRecord.name);

command_helper.infraRenderer.renderGraph(graph);

if (datacenterEnvs.length > 0) {
console.log('This will also destroy all the following environments:');
for (const env of datacenterEnvs) {
Expand Down

0 comments on commit bd7a172

Please sign in to comment.