@@ -7,7 +7,7 @@ import util from 'util';
7
7
import { CLI } from '../cli/CLI' ;
8
8
import { getCommandsConfig , getERDConfig } from '../config/config' ;
9
9
import { TerminalAction } from './TerminalAction' ;
10
- import { DEFAULT_EFCORE_PROVIDERS } from '../constants/constants' ;
10
+ import { DEFAULT_EFCORE_PROVIDERS , TREE_VIEW_ID } from '../constants/constants' ;
11
11
import { InputWizard } from '../util/InputWizard' ;
12
12
import { ERDiagramWebViewProvider } from '../util/ERDiagramWebViewProvider' ;
13
13
import { ProjectFilesProvider } from '../solution/ProjectFilesProvider' ;
@@ -130,9 +130,13 @@ export class GenerateERDAction extends TerminalAction {
130
130
return vscode . window . withProgress (
131
131
{
132
132
title : 'Generating diagram...' ,
133
- location : vscode . ProgressLocation . Window ,
133
+ location : { viewId : TREE_VIEW_ID } ,
134
+ cancellable : true ,
134
135
} ,
135
- async ( ) => {
136
+ async ( _progress , cancellationToken ) => {
137
+ cancellationToken . onCancellationRequested ( ( ) => {
138
+ this . cancel ( ) ;
139
+ } ) ;
136
140
try {
137
141
// Backup any existing DbContext template
138
142
const finalTemplatePathExists = fs . existsSync ( finalTemplatePath ) ;
@@ -145,23 +149,21 @@ export class GenerateERDAction extends TerminalAction {
145
149
finalConfigPath ,
146
150
JSON . stringify ( erDiagramConfig , null , 2 ) ,
147
151
) ;
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
+ } ,
162
163
) ;
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 ;
165
167
166
168
const fileContents = fs . readFileSync ( result . contextFile , 'utf-8' ) ;
167
169
0 commit comments