handle validation error (#18766)

This commit is contained in:
Alan Ren
2022-03-17 19:43:02 -07:00
committed by GitHub
parent 3071a7b710
commit d6abcb892d
2 changed files with 15 additions and 0 deletions

View File

@@ -1089,6 +1089,10 @@ declare module 'azdata' {
* Issues of current state. * Issues of current state.
*/ */
issues?: { severity: DesignerIssueSeverity, description: string, propertyPath?: DesignerEditPath }[]; issues?: { severity: DesignerIssueSeverity, description: string, propertyPath?: DesignerEditPath }[];
/**
* The input validation error.
*/
inputValidationError?: string;
} }
/** /**
@@ -1118,6 +1122,10 @@ declare module 'azdata' {
* Format (mimeType) of the report * Format (mimeType) of the report
*/ */
mimeType: string; mimeType: string;
/**
* The table schema validation error.
*/
schemaValidationError?: string;
} }
} }

View File

@@ -89,6 +89,9 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
this.updateState(this.valid, this.dirty, 'processEdit'); this.updateState(this.valid, this.dirty, 'processEdit');
this._provider.processTableEdit(this.tableInfo, edit).then( this._provider.processTableEdit(this.tableInfo, edit).then(
result => { result => {
if (result.inputValidationError) {
this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.inputValidationError', "The input validation failed with error: {0}", result.inputValidationError));
}
this._viewModel = result.viewModel; this._viewModel = result.viewModel;
if (result.view) { if (result.view) {
this.setDesignerView(result.view); this.setDesignerView(result.view);
@@ -189,6 +192,10 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
this.updateState(this.valid, this.dirty); this.updateState(this.valid, this.dirty);
return; return;
} }
if (previewReportResult.schemaValidationError) {
this._errorMessageService.showDialog(Severity.Error, ErrorDialogTitle, localize('tableDesigner.TableSchemaValidationError', "Table schema validation failed with error: {0}", previewReportResult.schemaValidationError));
return;
}
const dialog = this._instantiationService.createInstance(TableDesignerPublishDialog); const dialog = this._instantiationService.createInstance(TableDesignerPublishDialog);
const result = await dialog.open(previewReportResult.report, previewReportResult.mimeType); const result = await dialog.open(previewReportResult.report, previewReportResult.mimeType);
if (result === TableDesignerPublishDialogResult.GenerateScript) { if (result === TableDesignerPublishDialogResult.GenerateScript) {