@@ -7,7 +7,7 @@ import util from 'util';
77import { CLI } from '../cli/CLI' ;
88import { getCommandsConfig , getERDConfig } from '../config/config' ;
99import { TerminalAction } from './TerminalAction' ;
10- import { DEFAULT_EFCORE_PROVIDERS } from '../constants/constants' ;
10+ import { DEFAULT_EFCORE_PROVIDERS , TREE_VIEW_ID } from '../constants/constants' ;
1111import { InputWizard } from '../util/InputWizard' ;
1212import { ERDiagramWebViewProvider } from '../util/ERDiagramWebViewProvider' ;
1313import { ProjectFilesProvider } from '../solution/ProjectFilesProvider' ;
@@ -130,9 +130,13 @@ export class GenerateERDAction extends TerminalAction {
130130 return vscode . window . withProgress (
131131 {
132132 title : 'Generating diagram...' ,
133- location : vscode . ProgressLocation . Window ,
133+ location : { viewId : TREE_VIEW_ID } ,
134+ cancellable : true ,
134135 } ,
135- async ( ) => {
136+ async ( _progress , cancellationToken ) => {
137+ cancellationToken . onCancellationRequested ( ( ) => {
138+ this . cancel ( ) ;
139+ } ) ;
136140 try {
137141 // Backup any existing DbContext template
138142 const finalTemplatePathExists = fs . existsSync ( finalTemplatePath ) ;
@@ -145,23 +149,21 @@ export class GenerateERDAction extends TerminalAction {
145149 finalConfigPath ,
146150 JSON . stringify ( erDiagramConfig , null , 2 ) ,
147151 ) ;
148-
149- const output = CLI . getDataFromStdOut (
150- await super . run (
151- {
152- ...this . params ,
153- connectionString,
154- provider,
155- outputDir : this . outputDir ,
156- } ,
157- {
158- asJson : true ,
159- removeDataFromOutput : true ,
160- } ,
161- ) ,
152+ await this . start (
153+ {
154+ ...this . params ,
155+ connectionString,
156+ provider,
157+ outputDir : this . outputDir ,
158+ } ,
159+ {
160+ asJson : true ,
161+ removeDataFromOutput : true ,
162+ } ,
162163 ) ;
163-
164- const result = JSON . parse ( output ) as ScaffoldResult ;
164+ const output = await this . getOutput ( ) ;
165+ const data = CLI . getDataFromStdOut ( await this . getOutput ( ) ) ;
166+ const result = JSON . parse ( data ) as ScaffoldResult ;
165167
166168 const fileContents = fs . readFileSync ( result . contextFile , 'utf-8' ) ;
167169
0 commit comments