diff --git a/extensions/agent/package.json b/extensions/agent/package.json index d8004de626..de1f987705 100644 --- a/extensions/agent/package.json +++ b/extensions/agent/package.json @@ -47,6 +47,9 @@ } ] }, + "dependencies": { + "vscode-nls": "^3.2.1" + }, "devDependencies": { "mocha-junit-reporter": "^1.17.0", "mocha-multi-reporters": "^1.1.7" diff --git a/extensions/agent/src/dialogs/createAlertDialog.ts b/extensions/agent/src/dialogs/createAlertDialog.ts index 6ddb39b435..3540ada189 100644 --- a/extensions/agent/src/dialogs/createAlertDialog.ts +++ b/extensions/agent/src/dialogs/createAlertDialog.ts @@ -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); diff --git a/extensions/agent/src/dialogs/createOperatorDialog.ts b/extensions/agent/src/dialogs/createOperatorDialog.ts index cc6fc5be3b..cd3d7d96d6 100644 --- a/extensions/agent/src/dialogs/createOperatorDialog.ts +++ b/extensions/agent/src/dialogs/createOperatorDialog.ts @@ -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); diff --git a/extensions/agent/src/dialogs/createProxyDialog.ts b/extensions/agent/src/dialogs/createProxyDialog.ts index 1afecb71b6..8d5bf5445c 100644 --- a/extensions/agent/src/dialogs/createProxyDialog.ts +++ b/extensions/agent/src/dialogs/createProxyDialog.ts @@ -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); diff --git a/extensions/agent/src/mainController.ts b/extensions/agent/src/mainController.ts index 12288ad75c..be32105491 100644 --- a/extensions/agent/src/mainController.ts +++ b/extensions/agent/src/mainController.ts @@ -6,6 +6,8 @@ import * as vscode from 'vscode'; import { CreateAlertDialog } from './dialogs/createAlertDialog'; import { CreateJobDialog } from './dialogs/createJobDialog'; +import { CreateOperatorDialog } from './dialogs/createOperatorDialog'; +import { CreateProxyDialog } from './dialogs/createProxyDialog'; import { CreateStepDialog } from './dialogs/createStepDialog'; import { PickScheduleDialog } from './dialogs/pickScheduleDialog'; @@ -41,8 +43,12 @@ export class MainController { dialog.showDialog(); }); vscode.commands.registerCommand('agent.openCreateOperatorDialog', (ownerUri: string) => { + let dialog = new CreateOperatorDialog(ownerUri); + dialog.showDialog(); }); vscode.commands.registerCommand('agent.openCreateProxyDialog', (ownerUri: string) => { + let dialog = new CreateProxyDialog(ownerUri); + dialog.showDialog(); }); } diff --git a/extensions/agent/yarn.lock b/extensions/agent/yarn.lock index 7d5bd5fc4d..132dcefa7d 100644 --- a/extensions/agent/yarn.lock +++ b/extensions/agent/yarn.lock @@ -79,6 +79,10 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" +vscode-nls@^3.2.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.2.tgz#3817eca5b985c2393de325197cf4e15eb2aa5350" + xml@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" diff --git a/src/sql/parts/jobManagement/common/media/alert.svg b/src/sql/parts/jobManagement/common/media/alert.svg index d0e8ce7861..a3d1b81fee 100644 --- a/src/sql/parts/jobManagement/common/media/alert.svg +++ b/src/sql/parts/jobManagement/common/media/alert.svg @@ -1 +1 @@ -blocker \ No newline at end of file +jobalert \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/alert_inverse.svg b/src/sql/parts/jobManagement/common/media/alert_inverse.svg index 060f8ab73b..baf0544460 100644 --- a/src/sql/parts/jobManagement/common/media/alert_inverse.svg +++ b/src/sql/parts/jobManagement/common/media/alert_inverse.svg @@ -1 +1 @@ -blocker_inverse \ No newline at end of file +jobalert_inverse \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/operator.svg b/src/sql/parts/jobManagement/common/media/operator.svg index 0666e82d3a..a019525d9c 100644 --- a/src/sql/parts/jobManagement/common/media/operator.svg +++ b/src/sql/parts/jobManagement/common/media/operator.svg @@ -1 +1 @@ -security \ No newline at end of file +operator \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/operator_inverse.svg b/src/sql/parts/jobManagement/common/media/operator_inverse.svg index 6380ef9d8f..9d8626c598 100644 --- a/src/sql/parts/jobManagement/common/media/operator_inverse.svg +++ b/src/sql/parts/jobManagement/common/media/operator_inverse.svg @@ -1 +1 @@ -security_inverse \ No newline at end of file +operator_inverse \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/proxy.svg b/src/sql/parts/jobManagement/common/media/proxy.svg index 8978eceb79..a5e36a66b1 100644 --- a/src/sql/parts/jobManagement/common/media/proxy.svg +++ b/src/sql/parts/jobManagement/common/media/proxy.svg @@ -1 +1 @@ -health \ No newline at end of file +proxy_account \ No newline at end of file diff --git a/src/sql/parts/jobManagement/common/media/proxy_inverse.svg b/src/sql/parts/jobManagement/common/media/proxy_inverse.svg index d47d10bab2..d71131a099 100644 --- a/src/sql/parts/jobManagement/common/media/proxy_inverse.svg +++ b/src/sql/parts/jobManagement/common/media/proxy_inverse.svg @@ -1 +1 @@ -health_inverse \ No newline at end of file +proxy_account_inverse \ No newline at end of file