add severity support for issues (#18761)

* add severity support for issues

* vbump STS

* pr comments
This commit is contained in:
Alan Ren
2022-03-17 14:09:02 -07:00
committed by GitHub
parent aeb4e87c1f
commit 9f2940e8f8
8 changed files with 195 additions and 160 deletions

View File

@@ -36,7 +36,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { DesignerMessagesTabPanelView } from 'sql/workbench/browser/designer/designerMessagesTabPanelView';
import { DesignerIssuesTabPanelView } from 'sql/workbench/browser/designer/designerIssuesTabPanelView';
import { DesignerScriptEditorTabPanelView } from 'sql/workbench/browser/designer/designerScriptEditorTabPanelView';
import { DesignerPropertyPathValidator } from 'sql/workbench/browser/designer/designerPropertyPathValidator';
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -70,7 +70,7 @@ interface DesignerTableCellContext {
}
const ScriptTabId = 'scripts';
const MessagesTabId = 'messages';
const IssuesTabId = 'issues';
export class Designer extends Disposable implements IThemable {
private _loadingSpinner: LoadingSpinner;
@@ -95,7 +95,7 @@ export class Designer extends Disposable implements IThemable {
private _inputDisposable: DisposableStore;
private _loadingTimeoutHandle: any;
private _groupHeaders: HTMLElement[] = [];
private _messagesView: DesignerMessagesTabPanelView;
private _issuesView: DesignerIssuesTabPanelView;
private _scriptEditorView: DesignerScriptEditorTabPanelView;
private _onStyleChangeEventEmitter = new Emitter<void>();
@@ -152,8 +152,8 @@ export class Designer extends Disposable implements IThemable {
onDidChange: Event.None
}, Sizing.Distribute);
this._scriptTabbedPannel = new TabbedPanel(this._editorContainer);
this._messagesView = this._instantiationService.createInstance(DesignerMessagesTabPanelView);
this._register(this._messagesView.onMessageSelected((path) => {
this._issuesView = this._instantiationService.createInstance(DesignerIssuesTabPanelView);
this._register(this._issuesView.onIssueSelected((path) => {
if (path && path.length > 0) {
this.selectProperty(path);
}
@@ -332,14 +332,14 @@ export class Designer extends Disposable implements IThemable {
private handleEditProcessedEvent(args: DesignerEditProcessedEventArgs): void {
const edit = args.edit;
this._supressEditProcessing = true;
if (!args.result.isValid) {
alert(localize('designer.errorCountAlert', "{0} validation errors found.", args.result.errors.length));
if (args.result.issues?.length > 0) {
alert(localize('designer.issueCountAlert', "{0} validation issues found.", args.result.issues.length));
}
try {
if (args.result.refreshView) {
this.refresh();
if (!args.result.isValid) {
this._scriptTabbedPannel.showTab(MessagesTabId);
this._scriptTabbedPannel.showTab(IssuesTabId);
}
} else {
this.updateComponentValues();
@@ -466,7 +466,7 @@ export class Designer extends Disposable implements IThemable {
}
private updateComponentValues(): void {
this.updateMessagesTab();
this.updateIssuesTab();
const viewModel = this._input.viewModel;
const scriptProperty = viewModel[ScriptProperty] as InputBoxProperties;
if (scriptProperty) {
@@ -477,23 +477,24 @@ export class Designer extends Disposable implements IThemable {
});
}
private updateMessagesTab(): void {
private updateIssuesTab(): void {
if (!this._input) {
return;
}
if (this._scriptTabbedPannel.contains(MessagesTabId)) {
this._scriptTabbedPannel.removeTab(MessagesTabId);
if (this._scriptTabbedPannel.contains(IssuesTabId)) {
this._scriptTabbedPannel.removeTab(IssuesTabId);
}
if (this._input.validationErrors === undefined || this._input.validationErrors.length === 0) {
if (this._input.issues === undefined || this._input.issues.length === 0) {
return;
}
this._scriptTabbedPannel.pushTab({
title: localize('designer.messagesTabTitle', "Errors ({0})", this._input.validationErrors.length),
identifier: MessagesTabId,
view: this._messagesView
title: localize('designer.issuesTabTitle', "Issues ({0})", this._input.issues.length),
identifier: IssuesTabId,
view: this._issuesView
});
this._scriptTabbedPannel.showTab(MessagesTabId);
this._messagesView.updateMessages(this._input.validationErrors);
this._scriptTabbedPannel.showTab(IssuesTabId);
this._issuesView.updateIssues(this._input.issues);
}
private selectProperty(path: DesignerPropertyPath, view?: DesignerUIArea, highlight: boolean = true): void {