Fill out controls for Alert, Operator and Proxy dialogs (#1827)

* Clean up alert dialog

* Fill in controls for operator and proxy dialogs
This commit is contained in:
Karl Burtram
2018-07-03 07:34:39 -07:00
committed by GitHub
parent a6837dcd40
commit 5b19d2b1fc
12 changed files with 388 additions and 217 deletions

View File

@@ -9,51 +9,57 @@ import * as sqlops from 'sqlops';
import * as vscode from 'vscode';
import { AgentUtils } from '../agentUtils';
import { CreateAlertData } from '../data/createAlertData';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export class CreateAlertDialog {
// Top level
private static readonly DialogTitle: string = 'Create Alert';
private static readonly OkButtonText: string = 'OK';
private static readonly CancelButtonText: string = 'Cancel';
private static readonly GeneralTabText: string = 'General';
private static readonly ResponseTabText: string = 'Response';
private static readonly OptionsTabText: string = 'Options';
private static readonly DialogTitle: string = localize('createAlert.createAlert', 'Create Alert');
private static readonly OkButtonText: string = localize('createAlert.OK', 'OK');
private static readonly CancelButtonText: string = localize('createAlert.Cancel', 'Cancel');
private static readonly GeneralTabText: string = localize('createAlert.General', 'General');
private static readonly ResponseTabText: string = localize('createAlert.Response', 'Response');
private static readonly OptionsTabText: string = localize('createAlert.Options', 'Options');
// General tab strings
private static readonly NameLabel: string = 'Name';
private static readonly TypeLabel: string = 'Type';
private static readonly DatabaseLabel: string = 'Database name';
private static readonly ErrorNumberLabel: string = 'Error number';
private static readonly SeverityrLabel: string = 'Severity';
private static readonly AlertTypeSqlServerEventString: string = 'SQL Server event alert';
private static readonly AlertTypePerformanceConditionString: string = 'SQL Server performance condition alert';
private static readonly AlertTypeWmiEventString: string = 'WMI event alert';
private static readonly AlertSeverity001Label: string = '001 - Miscellaneous System Information';
private static readonly AlertSeverity002Label: string = '002 - Reserved';
private static readonly AlertSeverity003Label: string = '003 - Reserved';
private static readonly AlertSeverity004Label: string = '004 - Reserved';
private static readonly AlertSeverity005Label: string = '005 - Reserved';
private static readonly AlertSeverity006Label: string = '006 - Reserved';
private static readonly AlertSeverity007Label: string = '007 - Notification: Status Information';
private static readonly AlertSeverity008Label: string = '008 - Notification: User Intervention Required';
private static readonly AlertSeverity009Label: string = '009 - User Defined';
private static readonly AlertSeverity010Label: string = '010 - Information';
private static readonly AlertSeverity011Label: string = '011 - Specified Database Object Not Found';
private static readonly AlertSeverity012Label: string = '012 - Unused';
private static readonly AlertSeverity013Label: string = '013 - User Transaction Syntax Error';
private static readonly AlertSeverity014Label: string = '014 - Insufficient Permission';
private static readonly AlertSeverity015Label: string = '015 - Syntax Error in SQL Statements';
private static readonly AlertSeverity016Label: string = '016 - Miscellaneous User Error';
private static readonly AlertSeverity017Label: string = '017 - Insufficient Resources';
private static readonly AlertSeverity018Label: string = '018 - Nonfatal Internal Error';
private static readonly AlertSeverity019Label: string = '019 - Fatal Error in Resource';
private static readonly AlertSeverity020Label: string = '020 - Fatal Error in Current Process';
private static readonly AlertSeverity021Label: string = '021 - Fatal Error in Database Processes';
private static readonly AlertSeverity022Label: string = '022 - Fatal Error: Table Integrity Suspect';
private static readonly AlertSeverity023Label: string = '023 - Fatal Error: Database Integrity Suspect';
private static readonly AlertSeverity024Label: string = '024 - Fatal Error: Hardware Error';
private static readonly AlertSeverity025Label: string = '025 - Fatal Error';
private static readonly NameLabel: string = localize('createAlert.Name', 'Name');
private static readonly TypeLabel: string = localize('createAlert.Type', 'Type');
private static readonly EnabledCheckboxLabel: string = localize('createAlert.Enabled', 'Enabled');
private static readonly DatabaseLabel: string = localize('createAlert.DatabaseName', 'Database name');
private static readonly ErrorNumberLabel: string = localize('createAlert.ErrorNumber', 'Error number');
private static readonly SeverityLabel: string = localize('createAlert.Severity', 'Severity');
private static readonly RaiseIfMessageContainsLabel: string = localize('createAlert.RaiseAlertContains', 'Raise alert when message contains');
private static readonly MessageTextLabel: string = localize('createAlert.MessageText', 'Message text');
private static readonly AlertTypeSqlServerEventString: string = localize('createAlert.SqlServerEventAlert', 'SQL Server event alert');
private static readonly AlertTypePerformanceConditionString: string = localize('createAlert.PerformanceCondition', 'SQL Server performance condition alert');
private static readonly AlertTypeWmiEventString: string = localize('createAlert.WmiEvent', 'WMI event alert');
private static readonly AlertSeverity001Label: string = localize('createAlert.Severity001', '001 - Miscellaneous System Information');
private static readonly AlertSeverity002Label: string = localize('createAlert.Severity002', '002 - Reserved');
private static readonly AlertSeverity003Label: string = localize('createAlert.Severity003', '003 - Reserved');
private static readonly AlertSeverity004Label: string = localize('createAlert.Severity004', '004 - Reserved');
private static readonly AlertSeverity005Label: string = localize('createAlert.Severity005', '005 - Reserved');
private static readonly AlertSeverity006Label: string = localize('createAlert.Severity006', '006 - Reserved');
private static readonly AlertSeverity007Label: string = localize('createAlert.Severity007', '007 - Notification: Status Information');
private static readonly AlertSeverity008Label: string = localize('createAlert.Severity008', '008 - Notification: User Intervention Required');
private static readonly AlertSeverity009Label: string = localize('createAlert.Severity009', '009 - User Defined');
private static readonly AlertSeverity010Label: string = localize('createAlert.Severity010', '010 - Information');
private static readonly AlertSeverity011Label: string = localize('createAlert.Severity011', '011 - Specified Database Object Not Found');
private static readonly AlertSeverity012Label: string = localize('createAlert.Severity012', '012 - Unused');
private static readonly AlertSeverity013Label: string = localize('createAlert.Severity013', '013 - User Transaction Syntax Error');
private static readonly AlertSeverity014Label: string = localize('createAlert.Severity014', '014 - Insufficient Permission');
private static readonly AlertSeverity015Label: string = localize('createAlert.Severity015', '015 - Syntax Error in SQL Statements');
private static readonly AlertSeverity016Label: string = localize('createAlert.Severity016', '016 - Miscellaneous User Error');
private static readonly AlertSeverity017Label: string = localize('createAlert.Severity017', '017 - Insufficient Resources');
private static readonly AlertSeverity018Label: string = localize('createAlert.Severity018', '018 - Nonfatal Internal Error');
private static readonly AlertSeverity019Label: string = localize('createAlert.Severity019', '019 - Fatal Error in Resource');
private static readonly AlertSeverity020Label: string = localize('createAlert.Severity020', '020 - Fatal Error in Current Process');
private static readonly AlertSeverity021Label: string = localize('createAlert.Severity021', '021 - Fatal Error in Database Processes');
private static readonly AlertSeverity022Label: string = localize('createAlert.Severity022', '022 - Fatal Error: Table Integrity Suspect');
private static readonly AlertSeverity023Label: string = localize('createAlert.Severity023', '023 - Fatal Error: Database Integrity Suspect');
private static readonly AlertSeverity024Label: string = localize('createAlert.Severity024', '024 - Fatal Error: Hardware Error');
private static readonly AlertSeverity025Label: string = localize('createAlert.Severity025', '025 - Fatal Error');
private static readonly AlertTypes: string[] = [
CreateAlertDialog.AlertTypeSqlServerEventString,
@@ -90,13 +96,23 @@ export class CreateAlertDialog {
];
// Response tab strings
private readonly ExecuteJobTextBoxLabel: string = 'Execute Job';
private static readonly ExecuteJobCheckBoxLabel: string = localize('createAlert.ExecuteJob', 'Execute Job');
private static readonly ExecuteJobTextBoxLabel: string = localize('createAlert.ExecuteJobName', 'Job Name');
private static readonly NotifyOperatorsTextBoxLabel: string = localize('createAlert.NotifyOperators', 'Notify Operators');
private static readonly NewJobButtonLabel: string = localize('createAlert.NewJob', 'New Job');
private static readonly OperatorListLabel: string = localize('createAlert.OperatorList', 'Operator List');
private static readonly OperatorNameColumnLabel: string = localize('createAlert.OperatorName', 'Operator');
private static readonly OperatorEmailColumnLabel: string = localize('createAlert.OperatorEmail', 'E-mail');
private static readonly OperatorPagerColumnLabel: string = localize('createAlert.OperatorPager', 'Pager');
private static readonly NewOperatorButtonLabel: string = localize('createAlert.NewOperator', 'New Operator');
// Options tab strings
private readonly AdditionalMessageTextBoxLabel: string = 'Additional notification message to send';
// History tab strings
private readonly ResetCountTextBoxLabel: string = 'Reset Count';
private static readonly IncludeErrorInEmailCheckBoxLabel: string = localize('createAlert.IncludeErrorInEmail', 'Include alert error text in e-mail');
private static readonly IncludeErrorInPagerCheckBoxLabel: string = localize('createAlert.IncludeErrorInPager', 'Include alert error text in pager');
private static readonly AdditionalMessageTextBoxLabel: string = localize('createAlert.AdditionalNotification', 'Additional notification message to send');
private static readonly DelayBetweenResponsesTextBoxLabel: string = localize('createAlert.DelayBetweenResponse', 'Delay between responses');
private static readonly DelayMinutesTextBoxLabel: string = localize('createAlert.DelayMinutes', 'Delay Minutes');
private static readonly DelaySecondsTextBoxLabel: string = localize('createAlert.DelaySeconds', 'Delay Seconds');
// UI Components
private dialog: sqlops.window.modelviewdialog.Dialog;
@@ -109,17 +125,25 @@ export class CreateAlertDialog {
private typeDropDown: sqlops.DropDownComponent;
private severityDropDown: sqlops.DropDownComponent;
private databaseDropDown: sqlops.DropDownComponent;
private enabledCheckBox: sqlops.CheckBoxComponent;
private raiseAlertMessageCheckBox: sqlops.CheckBoxComponent;
private raiseAlertMessageTextBox: sqlops.InputBoxComponent;
// Response tab controls
private executeJobTextBox: sqlops.InputBoxComponent;
private executeJobCheckBox: sqlops.CheckBoxComponent;
private newJobButton: sqlops.ButtonComponent;
private notifyOperatorsCheckBox: sqlops.CheckBoxComponent;
private operatorsTable: sqlops.TableComponent;
private newOperatorButton: sqlops.ButtonComponent;
// Options tab controls
private additionalMessageTextBox: sqlops.InputBoxComponent;
private includeErrorInEmailTextBox: sqlops.CheckBoxComponent;
private includeErrorInPagerTextBox: sqlops.CheckBoxComponent;
private delayMinutesTextBox: sqlops.InputBoxComponent;
private delaySecondsTextBox: sqlops.InputBoxComponent;
// History tab controls
private resetCountTextBox: sqlops.InputBoxComponent;
private model: CreateAlertData;
@@ -154,29 +178,59 @@ export class CreateAlertDialog {
private initializeGeneralTab(databases: string[]) {
this.generalTab.registerContent(async view => {
this.nameTextBox = view.modelBuilder.inputBox().component();
// this.enabledCheckBox = view.modelBuilder.checkBox()
// .withProperties({
// label: this.EnabledCheckboxLabel
// }).component();
this.enabledCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateAlertDialog.EnabledCheckboxLabel
}).component();
this.databaseDropDown = view.modelBuilder.dropDown()
.withProperties({
value: databases[0],
values: databases,
title: CreateAlertDialog.DatabaseLabel
values: databases
}).component();
this.typeDropDown = view.modelBuilder.dropDown()
.withProperties({
value: CreateAlertDialog.AlertTypes[0],
values: CreateAlertDialog.AlertTypes
}).component();
this.severityDropDown = view.modelBuilder.dropDown()
.withProperties({
value: CreateAlertDialog.AlertSeverities[0],
values: CreateAlertDialog.AlertSeverities
}).component();
this.raiseAlertMessageCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateAlertDialog.RaiseIfMessageContainsLabel
}).component();
this.raiseAlertMessageTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.nameTextBox,
title: CreateAlertDialog.NameLabel
}, {
component: this.enabledCheckBox,
title: ''
}, {
component: this.typeDropDown,
title: CreateAlertDialog.TypeLabel
}, {
component: this.databaseDropDown,
title: CreateAlertDialog.DatabaseLabel
}]).withLayout({ width: '100%' }).component();
}, {
component: this.raiseAlertMessageCheckBox,
title: CreateAlertDialog.RaiseIfMessageContainsLabel
}, {
component: this.raiseAlertMessageTextBox,
title: CreateAlertDialog.MessageTextLabel
}
]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
@@ -184,11 +238,56 @@ export class CreateAlertDialog {
private initializeResponseTab() {
this.responseTab.registerContent(async view => {
this.executeJobCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateAlertDialog.ExecuteJobCheckBoxLabel
}).component();
this.executeJobTextBox = view.modelBuilder.inputBox().component();
this.newJobButton = view.modelBuilder.button().withProperties({
label: CreateAlertDialog.NewJobButtonLabel,
width: 80
}).component();
this.notifyOperatorsCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateAlertDialog.NotifyOperatorsTextBoxLabel
}).component();
this.operatorsTable = view.modelBuilder.table()
.withProperties({
columns: [
CreateAlertDialog.OperatorNameColumnLabel,
CreateAlertDialog.OperatorEmailColumnLabel,
CreateAlertDialog.OperatorPagerColumnLabel
],
data: [],
height: 500
}).component();
this.newOperatorButton = view.modelBuilder.button().withProperties({
label: this.newOperatorButton,
width: 80
}).component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.executeJobCheckBox,
title: ''
}, {
component: this.executeJobTextBox,
title: this.ExecuteJobTextBoxLabel
title: CreateAlertDialog.ExecuteJobTextBoxLabel
}, {
component: this.newJobButton,
title: CreateAlertDialog.NewJobButtonLabel
}, {
component: this.notifyOperatorsCheckBox,
title: ''
}, {
component: this.operatorsTable,
title: CreateAlertDialog.OperatorListLabel,
actions: [this.newOperatorButton]
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
@@ -197,11 +296,39 @@ export class CreateAlertDialog {
private initializeOptionsTab() {
this.optionsTab.registerContent(async view => {
this.includeErrorInEmailTextBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateAlertDialog.IncludeErrorInEmailCheckBoxLabel
}).component();
this.includeErrorInPagerTextBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateAlertDialog.IncludeErrorInPagerCheckBoxLabel
}).component();
this.additionalMessageTextBox = view.modelBuilder.inputBox().component();
this.delayMinutesTextBox = view.modelBuilder.inputBox().component();
this.delaySecondsTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.includeErrorInEmailTextBox,
title: ''
}, {
component: this.includeErrorInPagerTextBox,
title: ''
}, {
component: this.additionalMessageTextBox,
title: this.AdditionalMessageTextBoxLabel
title: CreateAlertDialog.AdditionalMessageTextBoxLabel
}, {
component: this.delayMinutesTextBox,
title: CreateAlertDialog.DelayMinutesTextBoxLabel
}, {
component: this.delaySecondsTextBox,
title: CreateAlertDialog.DelaySecondsTextBoxLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);

View File

@@ -8,49 +8,58 @@
import * as sqlops from 'sqlops';
import * as vscode from 'vscode';
import { CreateOperatorData } from '../data/createOperatorData';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export class CreateOperatorDialog {
// Top level
private readonly DialogTitle: string = 'Create Operator';
private readonly OkButtonText: string = 'OK';
private readonly CancelButtonText: string = 'Cancel';
private readonly GeneralTabText: string = 'Response';
private readonly ResponseTabText: string = 'Steps';
private readonly OptionsTabText: string = 'Options';
private readonly HistoryTabText: string = 'History';
private static readonly DialogTitle: string = localize('createOperator.createOperator', 'Create Operator');
private static readonly OkButtonText: string = localize('createOperator.OK', 'OK');
private static readonly CancelButtonText: string = localize('createOperator.Cancel', 'Cancel');
private static readonly GeneralTabText: string = localize('createOperator.General', 'General');
private static readonly NotificationsTabText: string = localize('createOperator.Notifications', 'Notifications');
// General tab strings
private readonly NameTextBoxLabel: string = 'Name';
private static readonly NameLabel: string = localize('createOperator.Name', 'Name');
private static readonly EnabledCheckboxLabel: string = localize('createOperator.Enabled', 'Enabled');
private static readonly EmailNameTextLabel: string = localize('createOperator.EmailName', 'E-mail Name');
private static readonly PagerEmailNameTextLabel: string = localize('createOperator.PagerEmailName', 'Pager E-mail Name');
private static readonly PagerMondayCheckBoxLabel: string = localize('createOperator.PagerMondayCheckBox', 'Pager on duty Monday');
private static readonly PagerTuesdayCheckBoxLabel: string = localize('createOperator.PagerTuesdayCheckBox', 'Pager on duty Tuesday');
private static readonly PagerWednesdayCheckBoxLabel: string = localize('createOperator.PagerWednesdayCheckBox', 'Pager on duty Wednesday');
private static readonly PagerThursdayCheckBoxLabel: string = localize('createOperator.PagerThursdayCheckBox', 'Pager on duty Thursday');
private static readonly PagerFridayCheckBoxLabel: string = localize('createOperator.PagerFridayCheckBox', 'Pager on duty Friday');
private static readonly PagerSaturdayCheckBoxLabel: string = localize('createOperator.PagerSaturdayCheckBox', 'Pager on duty Saturday');
private static readonly PagerSundayCheckBoxLabel: string = localize('createOperator.PagerSundayCheckBox', 'Pager on duty Sunday');
// Response tab strings
private readonly ExecuteJobTextBoxLabel: string = 'Execute Job';
// Options tab strings
private readonly AdditionalMessageTextBoxLabel: string = 'Additional notification message to send';
// History tab strings
private readonly ResetCountTextBoxLabel: string = 'Reset Count';
// Notifications tab strings
private static readonly AlertsTableLabel: string = localize('createOperator.PagerSundayCheckBox', 'Pager on duty Sunday');
private static readonly AlertNameColumnLabel: string = localize('createOperator.AlertNameColumnLabel', 'Alert name');
private static readonly AlertEmailColumnLabel: string = localize('createOperator.AlertEmailColumnLabel', 'E-mail');
private static readonly AlertPagerColumnLabel: string = localize('createOperator.AlertPagerColumnLabel', 'Pager');
// UI Components
private dialog: sqlops.window.modelviewdialog.Dialog;
private generalTab: sqlops.window.modelviewdialog.DialogTab;
private responseTab: sqlops.window.modelviewdialog.DialogTab;
private optionsTab: sqlops.window.modelviewdialog.DialogTab;
private historyTab: sqlops.window.modelviewdialog.DialogTab;
private schedulesTable: sqlops.TableComponent;
private notificationsTab: sqlops.window.modelviewdialog.DialogTab;
// General tab controls
private nameTextBox: sqlops.InputBoxComponent;
private enabledCheckBox: sqlops.CheckBoxComponent;
private emailNameTextBox: sqlops.InputBoxComponent;
private pagerEmailNameTextBox: sqlops.InputBoxComponent;
private pagerMondayCheckBox: sqlops.CheckBoxComponent;
private pagerTuesdayCheckBox: sqlops.CheckBoxComponent;
private pagerWednesdayCheckBox: sqlops.CheckBoxComponent;
private pagerThursdayCheckBox: sqlops.CheckBoxComponent;
private pagerFridayCheckBox: sqlops.CheckBoxComponent;
private pagerSaturdayCheckBox: sqlops.CheckBoxComponent;
private pagerSundayCheckBox: sqlops.CheckBoxComponent;
// Response tab controls
private executeJobTextBox: sqlops.InputBoxComponent;
// Options tab controls
private additionalMessageTextBox: sqlops.InputBoxComponent;
// History tab controls
private resetCountTextBox: sqlops.InputBoxComponent;
// Notification tab controls
private alertsTable: sqlops.TableComponent;
private model: CreateOperatorData;
@@ -63,22 +72,18 @@ export class CreateOperatorDialog {
public async showDialog() {
await this.model.initialize();
this.dialog = sqlops.window.modelviewdialog.createDialog(this.DialogTitle);
this.generalTab = sqlops.window.modelviewdialog.createTab(this.GeneralTabText);
this.responseTab = sqlops.window.modelviewdialog.createTab(this.ResponseTabText);
this.optionsTab = sqlops.window.modelviewdialog.createTab(this.OptionsTabText);
this.historyTab = sqlops.window.modelviewdialog.createTab(this.HistoryTabText);
this.dialog = sqlops.window.modelviewdialog.createDialog(CreateOperatorDialog.DialogTitle);
this.generalTab = sqlops.window.modelviewdialog.createTab(CreateOperatorDialog.GeneralTabText);
this.notificationsTab = sqlops.window.modelviewdialog.createTab(CreateOperatorDialog.NotificationsTabText);
this.initializeGeneralTab();
this.initializeResponseTab();
this.initializeOptionsTab();
this.initializeHistoryTab();
this.initializeNotificationTab();
this.dialog.content = [this.generalTab, this.responseTab, this.optionsTab, this.historyTab];
this.dialog.content = [this.generalTab, this.notificationsTab];
this.dialog.okButton.onClick(async () => await this.execute());
this.dialog.cancelButton.onClick(async () => await this.cancel());
this.dialog.okButton.label = this.OkButtonText;
this.dialog.cancelButton.label = this.CancelButtonText;
this.dialog.okButton.label = CreateOperatorDialog.OkButtonText;
this.dialog.cancelButton.label = CreateOperatorDialog.CancelButtonText;
sqlops.window.modelviewdialog.openDialog(this.dialog);
}
@@ -86,49 +91,111 @@ export class CreateOperatorDialog {
private initializeGeneralTab() {
this.generalTab.registerContent(async view => {
this.nameTextBox = view.modelBuilder.inputBox().component();
this.enabledCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.EnabledCheckboxLabel
}).component();
this.emailNameTextBox = view.modelBuilder.inputBox().component();
this.pagerEmailNameTextBox = view.modelBuilder.inputBox().component();
this.enabledCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.EnabledCheckboxLabel
}).component();
this.pagerMondayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerMondayCheckBoxLabel
}).component();
this.pagerTuesdayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerTuesdayCheckBoxLabel
}).component();
this.pagerWednesdayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerWednesdayCheckBoxLabel
}).component();
this.pagerThursdayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerThursdayCheckBoxLabel
}).component();
this.pagerFridayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerFridayCheckBoxLabel
}).component();
this.pagerSaturdayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerSaturdayCheckBoxLabel
}).component();
this.pagerSundayCheckBox = view.modelBuilder.checkBox()
.withProperties({
label: CreateOperatorDialog.PagerSundayCheckBoxLabel
}).component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.nameTextBox,
title: this.NameTextBoxLabel
title: CreateOperatorDialog.NameLabel
}, {
component: this.enabledCheckBox,
title: ''
}, {
component: this.emailNameTextBox,
title: CreateOperatorDialog.EmailNameTextLabel
}, {
component: this.pagerEmailNameTextBox,
title: CreateOperatorDialog.PagerEmailNameTextLabel
}, {
component: this.pagerTuesdayCheckBox,
title: ''
}, {
component: this.pagerWednesdayCheckBox,
title: ''
}, {
component: this.pagerThursdayCheckBox,
title: ''
}, {
component: this.pagerFridayCheckBox,
title: ''
}, {
component: this.pagerSaturdayCheckBox,
title: ''
}, {
component: this.pagerSundayCheckBox,
title: ''
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
}
private initializeResponseTab() {
this.responseTab.registerContent(async view => {
this.executeJobTextBox = view.modelBuilder.inputBox().component();
private initializeNotificationTab() {
this.notificationsTab.registerContent(async view => {
this.alertsTable = view.modelBuilder.table()
.withProperties({
columns: [
CreateOperatorDialog.AlertNameColumnLabel,
CreateOperatorDialog.AlertEmailColumnLabel,
CreateOperatorDialog.AlertPagerColumnLabel
],
data: [],
height: 500
}).component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.executeJobTextBox,
title: this.ExecuteJobTextBoxLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
}
private initializeOptionsTab() {
this.optionsTab.registerContent(async view => {
this.additionalMessageTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.additionalMessageTextBox,
title: this.AdditionalMessageTextBoxLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
}
private initializeHistoryTab() {
this.historyTab.registerContent(async view => {
this.resetCountTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.resetCountTextBox,
title: this.ResetCountTextBoxLabel
component: this.alertsTable,
title: CreateOperatorDialog.AlertsTableLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);

View File

@@ -8,49 +8,34 @@
import * as sqlops from 'sqlops';
import * as vscode from 'vscode';
import { CreateProxyData } from '../data/createProxyData';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
export class CreateProxyDialog {
// Top level
private readonly DialogTitle: string = 'Create Proxy';
private readonly OkButtonText: string = 'OK';
private readonly CancelButtonText: string = 'Cancel';
private readonly GeneralTabText: string = 'Response';
private readonly ResponseTabText: string = 'Steps';
private readonly OptionsTabText: string = 'Options';
private readonly HistoryTabText: string = 'History';
private static readonly DialogTitle: string = localize('createProxy.createAlert', 'Create Alert');
private static readonly OkButtonText: string = localize('createProxy.OK', 'OK');
private static readonly CancelButtonText: string = localize('createProxy.Cancel', 'Cancel');
private static readonly GeneralTabText: string = localize('createProxy.General', 'General');
// General tab strings
private readonly NameTextBoxLabel: string = 'Name';
// Response tab strings
private readonly ExecuteJobTextBoxLabel: string = 'Execute Job';
// Options tab strings
private readonly AdditionalMessageTextBoxLabel: string = 'Additional notification message to send';
// History tab strings
private readonly ResetCountTextBoxLabel: string = 'Reset Count';
private static readonly ProxyNameTextBoxLabel: string = localize('createProxy.ProxyName', 'Proxy name');
private static readonly CredentialNameTextBoxLabel: string = localize('createProxy.CredentialName', 'Credential name');
private static readonly DescriptionTextBoxLabel: string = localize('createProxy.Description', 'Description');
private static readonly SubsystemsTableLabel: string = localize('createProxy.Subsystems', 'Subsystems');
private static readonly SubsystemNameColumnLabel: string = localize('createProxy.SubsystemName', 'Subsystem');
// UI Components
private dialog: sqlops.window.modelviewdialog.Dialog;
private generalTab: sqlops.window.modelviewdialog.DialogTab;
private responseTab: sqlops.window.modelviewdialog.DialogTab;
private optionsTab: sqlops.window.modelviewdialog.DialogTab;
private historyTab: sqlops.window.modelviewdialog.DialogTab;
private schedulesTable: sqlops.TableComponent;
// General tab controls
private nameTextBox: sqlops.InputBoxComponent;
// Response tab controls
private executeJobTextBox: sqlops.InputBoxComponent;
// Options tab controls
private additionalMessageTextBox: sqlops.InputBoxComponent;
// History tab controls
private resetCountTextBox: sqlops.InputBoxComponent;
private proxyNameTextBox: sqlops.InputBoxComponent;
private credentialNameTextBox: sqlops.InputBoxComponent;
private descriptionTextBox: sqlops.InputBoxComponent;
private subsystemsTable: sqlops.TableComponent;
private model: CreateProxyData;
@@ -63,72 +48,51 @@ export class CreateProxyDialog {
public async showDialog() {
await this.model.initialize();
this.dialog = sqlops.window.modelviewdialog.createDialog(this.DialogTitle);
this.generalTab = sqlops.window.modelviewdialog.createTab(this.GeneralTabText);
this.responseTab = sqlops.window.modelviewdialog.createTab(this.ResponseTabText);
this.optionsTab = sqlops.window.modelviewdialog.createTab(this.OptionsTabText);
this.historyTab = sqlops.window.modelviewdialog.createTab(this.HistoryTabText);
this.dialog = sqlops.window.modelviewdialog.createDialog(CreateProxyDialog.DialogTitle);
this.generalTab = sqlops.window.modelviewdialog.createTab(CreateProxyDialog.GeneralTabText);
this.initializeGeneralTab();
this.initializeResponseTab();
this.initializeOptionsTab();
this.initializeHistoryTab();
this.dialog.content = [this.generalTab, this.responseTab, this.optionsTab, this.historyTab];
this.dialog.content = [this.generalTab];
this.dialog.okButton.onClick(async () => await this.execute());
this.dialog.cancelButton.onClick(async () => await this.cancel());
this.dialog.okButton.label = this.OkButtonText;
this.dialog.cancelButton.label = this.CancelButtonText;
this.dialog.okButton.label = CreateProxyDialog.OkButtonText;
this.dialog.cancelButton.label = CreateProxyDialog.CancelButtonText;
sqlops.window.modelviewdialog.openDialog(this.dialog);
}
private initializeGeneralTab() {
this.generalTab.registerContent(async view => {
this.nameTextBox = view.modelBuilder.inputBox().component();
this.proxyNameTextBox = view.modelBuilder.inputBox().component();
this.credentialNameTextBox = view.modelBuilder.inputBox().component();
this.descriptionTextBox = view.modelBuilder.inputBox().component();
this.subsystemsTable = view.modelBuilder.table()
.withProperties({
columns: [
CreateProxyDialog.SubsystemNameColumnLabel
],
data: [],
height: 500
}).component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.nameTextBox,
title: this.NameTextBoxLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
}
private initializeResponseTab() {
this.responseTab.registerContent(async view => {
this.executeJobTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.executeJobTextBox,
title: this.ExecuteJobTextBoxLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
}
private initializeOptionsTab() {
this.optionsTab.registerContent(async view => {
this.additionalMessageTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.additionalMessageTextBox,
title: this.AdditionalMessageTextBoxLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);
});
}
private initializeHistoryTab() {
this.historyTab.registerContent(async view => {
this.resetCountTextBox = view.modelBuilder.inputBox().component();
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: this.resetCountTextBox,
title: this.ResetCountTextBoxLabel
component: this.proxyNameTextBox,
title: CreateProxyDialog.ProxyNameTextBoxLabel
}, {
component: this.credentialNameTextBox,
title: CreateProxyDialog.CredentialNameTextBoxLabel
}, {
component: this.descriptionTextBox,
title: CreateProxyDialog.DescriptionTextBoxLabel
}, {
component: this.subsystemsTable,
title: CreateProxyDialog.SubsystemsTableLabel
}]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel);