Skip to content

Commit 8543ef3

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 8543ef3

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export class FileService {
3030
'* • Submit the current config',
3131
'* • Save this config for future use',
3232
'* • Load an existing config file',
33-
'*',
34-
'* You can also submit by simply closing the file',
3533
'*/',
3634
JSON.stringify(json, undefined, 2)
3735
].join('\n');

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

Lines changed: 6 additions & 19 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,22 @@ 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') {
299-
vscode.window.showInformationMessage('Configuration submitted successfully');
300-
return validation.content;
301-
}
302-
303-
return undefined; // User chose not to submit
290+
vscode.window.showInformationMessage('Configuration submitted successfully');
291+
return validation.content;
304292
} else if (validation.errors) {
305293
this.displayValidationErrorDialogue(
306294
`Your configuration was not submitted because it had errors`,
@@ -321,7 +309,6 @@ export class JsonConfigEditor {
321309
private resetState = () => {
322310
this.fileService.cleanupTempFile(this.tempFilePath);
323311
this.userClickedSubmit = false;
324-
this.isAwaitingUserSubmit = false;
325312
this.isEditing = false;
326313
this.trackedEditor = undefined;
327314
this.tempFilePath = '';

0 commit comments

Comments
 (0)