Reset schema comapre when comparison result is not success (#17184)

This commit is contained in:
Kim Santiago
2021-10-01 10:21:07 -07:00
committed by GitHub
parent a0576456b6
commit e037118082

View File

@@ -291,6 +291,10 @@ export class SchemaCompareMainWindow {
operationId: this.comparisonResult.operationId operationId: this.comparisonResult.operationId
}).send(); }).send();
vscode.window.showErrorMessage(loc.compareErrorMessage(this.comparisonResult?.errorMessage)); vscode.window.showErrorMessage(loc.compareErrorMessage(this.comparisonResult?.errorMessage));
// reset state so a new comparison can be made
this.resetWindow();
return; return;
} }
TelemetryReporter.createActionEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaComparisonFinished') TelemetryReporter.createActionEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaComparisonFinished')
@@ -647,7 +651,18 @@ export class SchemaCompareMainWindow {
}); });
} }
public async cancelCompare() { /**
* Resets state of buttons and text to initial state before a comparison is started/completed
*/
public resetWindow(): void {
// clean the pane
this.flexModel.removeItem(this.loader);
this.flexModel.removeItem(this.waitText);
this.flexModel.addItem(this.startText, { CSSStyles: { 'margin': 'auto' } });
this.resetButtons(ResetButtonState.beforeCompareStart);
}
public async cancelCompare(): Promise<void> {
TelemetryReporter.createActionEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareCancelStarted') TelemetryReporter.createActionEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareCancelStarted')
.withAdditionalProperties({ .withAdditionalProperties({
@@ -655,11 +670,7 @@ export class SchemaCompareMainWindow {
'operationId': this.operationId 'operationId': this.operationId
}).send(); }).send();
// clean the pane this.resetWindow();
this.flexModel.removeItem(this.loader);
this.flexModel.removeItem(this.waitText);
this.flexModel.addItem(this.startText, { CSSStyles: { 'margin': 'auto' } });
this.resetButtons(ResetButtonState.beforeCompareStart);
// cancel compare // cancel compare
if (this.operationId) { if (this.operationId) {