Skip to content

Commit dd9ea97

Browse files
Remove on-close events from json-config-editor
This will force the user to use the button commands in the nav bar. Signed-off-by: Will Yang <william.yang@ericsson.com>
1 parent 70eed83 commit dd9ea97

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

vscode-trace-extension/src/json-editor/json-editor.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { FileService } from './file-service';
2020
export class JsonConfigEditor {
2121
private _tempFilePath: string = '';
2222
private isEditing: boolean = false;
23-
private isAwaitingUserSubmit: boolean = false;
2423
private availableConfigurations: CustomizationConfigObject[] = [];
2524
private userClickedSubmit: boolean = false;
2625
private trackedEditor?: vscode.TextEditor;
@@ -51,8 +50,6 @@ export class JsonConfigEditor {
5150
throw Error(
5251
'a config editing session is already active - Please close the active editor and try again.'
5352
);
54-
if (this.isAwaitingUserSubmit)
55-
throw Error('awaiting prompt response - Please chose to if you want to submit then try again.');
5653

5754
this.availableConfigurations = configs;
5855
const selectedConfig = await this.promptUserSchemaSelection(configs);
@@ -276,31 +273,26 @@ export class JsonConfigEditor {
276273

277274
try {
278275
this.isEditing = false;
279-
this.isAwaitingUserSubmit = true;
280276
// Write content to temp file for validation
281277
if (fs.existsSync(this.tempFilePath)) {
282278
fs.writeFileSync(this.tempFilePath, document.getText(), 'utf8');
283279
} else {
284280
throw new Error('Temporary file not found');
285281
}
286282

283+
if (!this.userClickedSubmit) {
284+
return;
285+
}
286+
287287
const validation = await this.schemaService.validateJsonFile(this.tempFileUri, schema);
288288

289289
if (validation.isValid && validation.content) {
290-
const submit = this.userClickedSubmit
291-
? 'Yes'
292-
: await vscode.window.showInformationMessage(
293-
'Do you want to submit this configuration?',
294-
'Yes',
295-
'No'
296-
);
297-
298-
if (submit === 'Yes') {
290+
if (this.userClickedSubmit) {
299291
vscode.window.showInformationMessage('Configuration submitted successfully');
300292
return validation.content;
301293
}
302294

303-
return undefined; // User chose not to submit
295+
return undefined; // User closed the window without submitting
304296
} else if (validation.errors) {
305297
this.displayValidationErrorDialogue(
306298
`Your configuration was not submitted because it had errors`,
@@ -321,7 +313,6 @@ export class JsonConfigEditor {
321313
private resetState = () => {
322314
this.fileService.cleanupTempFile(this.tempFilePath);
323315
this.userClickedSubmit = false;
324-
this.isAwaitingUserSubmit = false;
325316
this.isEditing = false;
326317
this.trackedEditor = undefined;
327318
this.tempFilePath = '';

0 commit comments

Comments
 (0)