mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Edit Agent Alert updates (#1872)
* Set database name and severity when editing alert * Add Operator and Proxy edit * Add edit job hookup * Edit WIP * Additional edit alert updates * Remove unused method
This commit is contained in:
@@ -13,6 +13,11 @@ import { IAgentDialogData, AgentDialogMode } from '../interfaces';
|
|||||||
const localize = nls.loadMessageBundle();
|
const localize = nls.loadMessageBundle();
|
||||||
|
|
||||||
export class AlertData implements IAgentDialogData {
|
export class AlertData implements IAgentDialogData {
|
||||||
|
public static readonly AlertTypeSqlServerEventString: string = localize('alertData.DefaultAlertTypString', 'SQL Server event alert');
|
||||||
|
public static readonly AlertTypePerformanceConditionString: string = localize('alertDialog.PerformanceCondition', 'SQL Server performance condition alert');
|
||||||
|
public static readonly AlertTypeWmiEventString: string = localize('alertDialog.WmiEvent', 'WMI event alert');
|
||||||
|
public static readonly DefaultAlertTypeString: string = AlertData.AlertTypeSqlServerEventString;
|
||||||
|
|
||||||
ownerUri: string;
|
ownerUri: string;
|
||||||
dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
|
dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
|
||||||
id: number;
|
id: number;
|
||||||
@@ -23,7 +28,7 @@ export class AlertData implements IAgentDialogData {
|
|||||||
eventSource: string;
|
eventSource: string;
|
||||||
hasNotification: number;
|
hasNotification: number;
|
||||||
includeEventDescription: string;
|
includeEventDescription: string;
|
||||||
isEnabled: boolean;
|
isEnabled: boolean = true;
|
||||||
jobId: string;
|
jobId: string;
|
||||||
jobName: string;
|
jobName: string;
|
||||||
lastOccurrenceDate: string;
|
lastOccurrenceDate: string;
|
||||||
@@ -36,7 +41,7 @@ export class AlertData implements IAgentDialogData {
|
|||||||
databaseName: string;
|
databaseName: string;
|
||||||
countResetDate: string;
|
countResetDate: string;
|
||||||
categoryName: string;
|
categoryName: string;
|
||||||
alertType: string;
|
alertType: string = AlertData.DefaultAlertTypeString;
|
||||||
wmiEventNamespace: string;
|
wmiEventNamespace: string;
|
||||||
wmiEventQuery: string;
|
wmiEventQuery: string;
|
||||||
|
|
||||||
@@ -109,9 +114,19 @@ export class AlertData implements IAgentDialogData {
|
|||||||
databaseName: this.databaseName,
|
databaseName: this.databaseName,
|
||||||
countResetDate: this.countResetDate,
|
countResetDate: this.countResetDate,
|
||||||
categoryName: this.categoryName,
|
categoryName: this.categoryName,
|
||||||
alertType: sqlops.AlertType.sqlServerEvent, //this.alertType,
|
alertType: AlertData.getAlertTypeFromString(this.alertType),
|
||||||
wmiEventNamespace: this.wmiEventNamespace,
|
wmiEventNamespace: this.wmiEventNamespace,
|
||||||
wmiEventQuery: this.wmiEventQuery
|
wmiEventQuery: this.wmiEventQuery
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static getAlertTypeFromString(alertTypeString: string): sqlops.AlertType {
|
||||||
|
if (alertTypeString === AlertData.AlertTypePerformanceConditionString) {
|
||||||
|
return sqlops.AlertType.sqlServerPerformanceCondition;
|
||||||
|
} else if (alertTypeString === AlertData.AlertTypeWmiEventString) {
|
||||||
|
return sqlops.AlertType.wmiEvent;
|
||||||
|
} else {
|
||||||
|
return sqlops.AlertType.sqlServerEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -40,8 +40,17 @@ export class JobData implements IAgentDialogData {
|
|||||||
public jobSchedules: sqlops.AgentJobScheduleInfo[];
|
public jobSchedules: sqlops.AgentJobScheduleInfo[];
|
||||||
public alerts: sqlops.AgentAlertInfo[];
|
public alerts: sqlops.AgentAlertInfo[];
|
||||||
|
|
||||||
constructor(ownerUri: string, private _agentService: sqlops.AgentServicesProvider = null) {
|
constructor(
|
||||||
|
ownerUri: string,
|
||||||
|
jobInfo: sqlops.AgentJobInfo = undefined,
|
||||||
|
private _agentService: sqlops.AgentServicesProvider = undefined) {
|
||||||
|
|
||||||
this._ownerUri = ownerUri;
|
this._ownerUri = ownerUri;
|
||||||
|
if (jobInfo) {
|
||||||
|
this.dialogMode = AgentDialogMode.EDIT;
|
||||||
|
this.name = jobInfo.name;
|
||||||
|
this.enabled = jobInfo.enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get jobCategories(): string[] {
|
public get jobCategories(): string[] {
|
||||||
|
|||||||
@@ -29,8 +29,14 @@ export class OperatorData implements IAgentDialogData {
|
|||||||
weekdayPagerStartTime: string;
|
weekdayPagerStartTime: string;
|
||||||
weekdayPagerEndTime: string;
|
weekdayPagerEndTime: string;
|
||||||
|
|
||||||
constructor(ownerUri:string) {
|
constructor(ownerUri:string, operatorInfo: sqlops.AgentOperatorInfo) {
|
||||||
this.ownerUri = ownerUri;
|
this.ownerUri = ownerUri;
|
||||||
|
|
||||||
|
if (operatorInfo) {
|
||||||
|
this.dialogMode = AgentDialogMode.EDIT;
|
||||||
|
this.name = operatorInfo.name;
|
||||||
|
this.enabled = operatorInfo.enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initialize() {
|
public async initialize() {
|
||||||
|
|||||||
@@ -19,8 +19,14 @@ export class ProxyData implements IAgentDialogData {
|
|||||||
credentialId: number;
|
credentialId: number;
|
||||||
isEnabled: boolean;
|
isEnabled: boolean;
|
||||||
|
|
||||||
constructor(ownerUri:string) {
|
constructor(ownerUri:string, proxyInfo: sqlops.AgentProxyInfo) {
|
||||||
this.ownerUri = ownerUri;
|
this.ownerUri = ownerUri;
|
||||||
|
|
||||||
|
if (proxyInfo) {
|
||||||
|
this.accountName = proxyInfo.accountName;
|
||||||
|
this.credentialName = proxyInfo.credentialName;
|
||||||
|
this.description = proxyInfo.description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async initialize() {
|
public async initialize() {
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
private static readonly SeverityLabel: string = localize('alertDialog.Severity', 'Severity');
|
private static readonly SeverityLabel: string = localize('alertDialog.Severity', 'Severity');
|
||||||
private static readonly RaiseIfMessageContainsLabel: string = localize('alertDialog.RaiseAlertContains', 'Raise alert when message contains');
|
private static readonly RaiseIfMessageContainsLabel: string = localize('alertDialog.RaiseAlertContains', 'Raise alert when message contains');
|
||||||
private static readonly MessageTextLabel: string = localize('alertDialog.MessageText', 'Message text');
|
private static readonly MessageTextLabel: string = localize('alertDialog.MessageText', 'Message text');
|
||||||
private static readonly AlertTypeSqlServerEventString: string = localize('alertDialog.SqlServerEventAlert', 'SQL Server event alert');
|
|
||||||
private static readonly AlertTypePerformanceConditionString: string = localize('alertDialog.PerformanceCondition', 'SQL Server performance condition alert');
|
|
||||||
private static readonly AlertTypeWmiEventString: string = localize('alertDialog.WmiEvent', 'WMI event alert');
|
|
||||||
private static readonly AlertSeverity001Label: string = localize('alertDialog.Severity001', '001 - Miscellaneous System Information');
|
private static readonly AlertSeverity001Label: string = localize('alertDialog.Severity001', '001 - Miscellaneous System Information');
|
||||||
private static readonly AlertSeverity002Label: string = localize('alertDialog.Severity002', '002 - Reserved');
|
private static readonly AlertSeverity002Label: string = localize('alertDialog.Severity002', '002 - Reserved');
|
||||||
private static readonly AlertSeverity003Label: string = localize('alertDialog.Severity003', '003 - Reserved');
|
private static readonly AlertSeverity003Label: string = localize('alertDialog.Severity003', '003 - Reserved');
|
||||||
@@ -59,11 +56,12 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
private static readonly AlertSeverity023Label: string = localize('alertDialog.Severity023', '023 - Fatal Error: Database Integrity Suspect');
|
private static readonly AlertSeverity023Label: string = localize('alertDialog.Severity023', '023 - Fatal Error: Database Integrity Suspect');
|
||||||
private static readonly AlertSeverity024Label: string = localize('alertDialog.Severity024', '024 - Fatal Error: Hardware Error');
|
private static readonly AlertSeverity024Label: string = localize('alertDialog.Severity024', '024 - Fatal Error: Hardware Error');
|
||||||
private static readonly AlertSeverity025Label: string = localize('alertDialog.Severity025', '025 - Fatal Error');
|
private static readonly AlertSeverity025Label: string = localize('alertDialog.Severity025', '025 - Fatal Error');
|
||||||
|
private static readonly AllDatabases: string = localize('alertDialog.AllDatabases', '<all databases>');
|
||||||
|
|
||||||
private static readonly AlertTypes: string[] = [
|
private static readonly AlertTypes: string[] = [
|
||||||
AlertDialog.AlertTypeSqlServerEventString,
|
AlertData.AlertTypeSqlServerEventString,
|
||||||
AlertDialog.AlertTypePerformanceConditionString,
|
AlertData.AlertTypePerformanceConditionString,
|
||||||
AlertDialog.AlertTypeWmiEventString
|
AlertData.AlertTypeWmiEventString
|
||||||
];
|
];
|
||||||
|
|
||||||
private static readonly AlertSeverities: string[] = [
|
private static readonly AlertSeverities: string[] = [
|
||||||
@@ -124,6 +122,10 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
private severityDropDown: sqlops.DropDownComponent;
|
private severityDropDown: sqlops.DropDownComponent;
|
||||||
private databaseDropDown: sqlops.DropDownComponent;
|
private databaseDropDown: sqlops.DropDownComponent;
|
||||||
private enabledCheckBox: sqlops.CheckBoxComponent;
|
private enabledCheckBox: sqlops.CheckBoxComponent;
|
||||||
|
private errorNumberRadioButton: sqlops.RadioButtonComponent;
|
||||||
|
private severityRadioButton: sqlops.RadioButtonComponent;
|
||||||
|
private errorNumberTextBox: sqlops.InputBoxComponent;
|
||||||
|
|
||||||
private raiseAlertMessageCheckBox: sqlops.CheckBoxComponent;
|
private raiseAlertMessageCheckBox: sqlops.CheckBoxComponent;
|
||||||
private raiseAlertMessageTextBox: sqlops.InputBoxComponent;
|
private raiseAlertMessageTextBox: sqlops.InputBoxComponent;
|
||||||
|
|
||||||
@@ -142,19 +144,23 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
private delayMinutesTextBox: sqlops.InputBoxComponent;
|
private delayMinutesTextBox: sqlops.InputBoxComponent;
|
||||||
private delaySecondsTextBox: sqlops.InputBoxComponent;
|
private delaySecondsTextBox: sqlops.InputBoxComponent;
|
||||||
|
|
||||||
constructor(ownerUri: string, alertInfo: sqlops.AgentAlertInfo = null) {
|
private databases: string[];
|
||||||
|
|
||||||
|
constructor(ownerUri: string, alertInfo: sqlops.AgentAlertInfo = undefined) {
|
||||||
super(ownerUri,
|
super(ownerUri,
|
||||||
new AlertData(ownerUri, alertInfo),
|
new AlertData(ownerUri, alertInfo),
|
||||||
alertInfo ? AlertDialog.EditDialogTitle : AlertDialog.CreateDialogTitle);
|
alertInfo ? AlertDialog.EditDialogTitle : AlertDialog.CreateDialogTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
||||||
let databases = await AgentUtils.getDatabases(this.ownerUri);
|
this.databases = await AgentUtils.getDatabases(this.ownerUri);
|
||||||
|
this.databases.unshift(AlertDialog.AllDatabases);
|
||||||
|
|
||||||
this.generalTab = sqlops.window.modelviewdialog.createTab(AlertDialog.GeneralTabText);
|
this.generalTab = sqlops.window.modelviewdialog.createTab(AlertDialog.GeneralTabText);
|
||||||
this.responseTab = sqlops.window.modelviewdialog.createTab(AlertDialog.ResponseTabText);
|
this.responseTab = sqlops.window.modelviewdialog.createTab(AlertDialog.ResponseTabText);
|
||||||
this.optionsTab = sqlops.window.modelviewdialog.createTab(AlertDialog.OptionsTabText);
|
this.optionsTab = sqlops.window.modelviewdialog.createTab(AlertDialog.OptionsTabText);
|
||||||
|
|
||||||
this.initializeGeneralTab(databases);
|
this.initializeGeneralTab(this.databases);
|
||||||
this.initializeResponseTab();
|
this.initializeResponseTab();
|
||||||
this.initializeOptionsTab();
|
this.initializeOptionsTab();
|
||||||
|
|
||||||
@@ -163,6 +169,7 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
|
|
||||||
private initializeGeneralTab(databases: string[]) {
|
private initializeGeneralTab(databases: string[]) {
|
||||||
this.generalTab.registerContent(async view => {
|
this.generalTab.registerContent(async view => {
|
||||||
|
// create controls
|
||||||
this.nameTextBox = view.modelBuilder.inputBox().component();
|
this.nameTextBox = view.modelBuilder.inputBox().component();
|
||||||
|
|
||||||
this.enabledCheckBox = view.modelBuilder.checkBox()
|
this.enabledCheckBox = view.modelBuilder.checkBox()
|
||||||
@@ -182,18 +189,51 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
values: AlertDialog.AlertTypes
|
values: AlertDialog.AlertTypes
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
|
|
||||||
|
this.severityRadioButton = view.modelBuilder.radioButton()
|
||||||
|
.withProperties({
|
||||||
|
value: 'serverity',
|
||||||
|
name: 'alertTypeOptions',
|
||||||
|
label: AlertDialog.SeverityLabel,
|
||||||
|
checked: true
|
||||||
|
}).component();
|
||||||
|
|
||||||
this.severityDropDown = view.modelBuilder.dropDown()
|
this.severityDropDown = view.modelBuilder.dropDown()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
value: AlertDialog.AlertSeverities[0],
|
value: AlertDialog.AlertSeverities[0],
|
||||||
values: AlertDialog.AlertSeverities
|
values: AlertDialog.AlertSeverities
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
|
this.errorNumberRadioButton = view.modelBuilder.radioButton()
|
||||||
|
.withProperties({
|
||||||
|
value: 'errorNumber',
|
||||||
|
name: 'alertTypeOptions',
|
||||||
|
label: AlertDialog.ErrorNumberLabel
|
||||||
|
}).component();
|
||||||
|
|
||||||
|
this.errorNumberTextBox = view.modelBuilder.inputBox().component();
|
||||||
|
|
||||||
|
this.errorNumberRadioButton.onDidClick(() => {
|
||||||
|
this.errorNumberTextBox.enabled = true;
|
||||||
|
this.severityDropDown.enabled = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.severityRadioButton.onDidClick(() => {
|
||||||
|
this.errorNumberTextBox.enabled = false;
|
||||||
|
this.severityDropDown.enabled = true;
|
||||||
|
});
|
||||||
|
|
||||||
this.raiseAlertMessageCheckBox = view.modelBuilder.checkBox()
|
this.raiseAlertMessageCheckBox = view.modelBuilder.checkBox()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
label: AlertDialog.RaiseIfMessageContainsLabel
|
label: AlertDialog.RaiseIfMessageContainsLabel
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
this.raiseAlertMessageTextBox = view.modelBuilder.inputBox().component();
|
this.raiseAlertMessageTextBox = view.modelBuilder.inputBox().component();
|
||||||
|
this.raiseAlertMessageTextBox.enabled = false;
|
||||||
|
|
||||||
|
this.raiseAlertMessageCheckBox.onChanged(() => {
|
||||||
|
this.raiseAlertMessageTextBox.enabled = this.raiseAlertMessageCheckBox.checked;
|
||||||
|
});
|
||||||
|
|
||||||
let formModel = view.modelBuilder.formContainer()
|
let formModel = view.modelBuilder.formContainer()
|
||||||
.withFormItems([{
|
.withFormItems([{
|
||||||
@@ -208,10 +248,24 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
}, {
|
}, {
|
||||||
component: this.databaseDropDown,
|
component: this.databaseDropDown,
|
||||||
title: AlertDialog.DatabaseLabel
|
title: AlertDialog.DatabaseLabel
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
component: this.severityRadioButton,
|
||||||
|
title: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
component: this.severityDropDown,
|
component: this.severityDropDown,
|
||||||
title: AlertDialog.SeverityLabel
|
title: ''
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
|
component: this.errorNumberRadioButton,
|
||||||
|
title: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: this.errorNumberTextBox,
|
||||||
|
title: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
component: this.raiseAlertMessageCheckBox,
|
component: this.raiseAlertMessageCheckBox,
|
||||||
title: ''
|
title: ''
|
||||||
}, {
|
}, {
|
||||||
@@ -222,8 +276,28 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
|
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
|
||||||
|
// initialize control values
|
||||||
this.nameTextBox.value = this.model.name;
|
this.nameTextBox.value = this.model.name;
|
||||||
|
this.raiseAlertMessageTextBox.value = this.model.eventDescriptionKeyword;
|
||||||
|
this.typeDropDown.value = this.model.alertType;
|
||||||
this.enabledCheckBox.checked = this.model.isEnabled;
|
this.enabledCheckBox.checked = this.model.isEnabled;
|
||||||
|
|
||||||
|
if (this.model.messageId > 0) {
|
||||||
|
this.errorNumberRadioButton.checked = true;
|
||||||
|
this.errorNumberTextBox.value = this.model.messageId.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.model.severity > 0) {
|
||||||
|
this.severityRadioButton.checked = true;
|
||||||
|
this.severityDropDown.value = this.severityDropDown.values[this.model.severity-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.model.databaseName) {
|
||||||
|
let idx = this.databases.indexOf(this.model.databaseName);
|
||||||
|
if (idx >= 0) {
|
||||||
|
this.databaseDropDown.value = this.databases[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,13 +417,21 @@ export class AlertDialog extends AgentDialog<AlertData> {
|
|||||||
this.model.isEnabled = this.enabledCheckBox.checked;
|
this.model.isEnabled = this.enabledCheckBox.checked;
|
||||||
|
|
||||||
this.model.alertType = this.getDropdownValue(this.typeDropDown);
|
this.model.alertType = this.getDropdownValue(this.typeDropDown);
|
||||||
this.model.databaseName = this.getDropdownValue(this.databaseDropDown);
|
let databaseName = this.getDropdownValue(this.databaseDropDown);
|
||||||
this.model.severity = this.getSeverityNumber();
|
this.model.databaseName = (databaseName !== AlertDialog.AllDatabases) ? databaseName : undefined;
|
||||||
this.model.messageId = undefined;
|
|
||||||
|
|
||||||
let raiseIfError = this.raiseAlertMessageCheckBox.checked;
|
if (this.severityRadioButton.checked) {
|
||||||
if (raiseIfError) {
|
this.model.severity = this.getSeverityNumber();
|
||||||
let messageText = this.raiseAlertMessageTextBox.value;
|
this.model.messageId = 0;
|
||||||
|
} else {
|
||||||
|
this.model.severity = 0;
|
||||||
|
this.model.messageId = +this.errorNumberTextBox.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.raiseAlertMessageCheckBox.checked) {
|
||||||
|
this.model.eventDescriptionKeyword = this.raiseAlertMessageTextBox.value;
|
||||||
|
} else {
|
||||||
|
this.model.eventDescriptionKeyword = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
|
|
||||||
// TODO: localize
|
// TODO: localize
|
||||||
// Top level
|
// Top level
|
||||||
private static readonly DialogTitle: string = 'New Job';
|
private static readonly CreateDialogTitle: string = 'New Job';
|
||||||
|
private static readonly EditDialogTitle: string = 'Edit Job';
|
||||||
private readonly GeneralTabText: string = 'General';
|
private readonly GeneralTabText: string = 'General';
|
||||||
private readonly StepsTabText: string = 'Steps';
|
private readonly StepsTabText: string = 'Steps';
|
||||||
private readonly SchedulesTabText: string = 'Schedules';
|
private readonly SchedulesTabText: string = 'Schedules';
|
||||||
@@ -97,8 +98,11 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
private alertsTable: sqlops.TableComponent;
|
private alertsTable: sqlops.TableComponent;
|
||||||
private newAlertButton: sqlops.ButtonComponent;
|
private newAlertButton: sqlops.ButtonComponent;
|
||||||
|
|
||||||
constructor(ownerUri: string) {
|
constructor(ownerUri: string, jobInfo: sqlops.AgentJobInfo = undefined) {
|
||||||
super(ownerUri, new JobData(ownerUri), JobDialog.DialogTitle);
|
super(
|
||||||
|
ownerUri,
|
||||||
|
new JobData(ownerUri),
|
||||||
|
jobInfo ? JobDialog.EditDialogTitle : JobDialog.CreateDialogTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async initializeDialog() {
|
protected async initializeDialog() {
|
||||||
@@ -159,6 +163,7 @@ export class JobDialog extends AgentDialog<JobData> {
|
|||||||
|
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
|
||||||
|
this.nameTextBox.value = this.model.name;
|
||||||
this.ownerTextBox.value = this.model.defaultOwner;
|
this.ownerTextBox.value = this.model.defaultOwner;
|
||||||
this.categoryDropdown.values = this.model.jobCategories;
|
this.categoryDropdown.values = this.model.jobCategories;
|
||||||
this.categoryDropdown.value = this.model.jobCategories[0];
|
this.categoryDropdown.value = this.model.jobCategories[0];
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ const localize = nls.loadMessageBundle();
|
|||||||
export class OperatorDialog extends AgentDialog<OperatorData> {
|
export class OperatorDialog extends AgentDialog<OperatorData> {
|
||||||
|
|
||||||
// Top level
|
// Top level
|
||||||
private static readonly DialogTitle: string = localize('createOperator.createOperator', 'Create Operator');
|
private static readonly CreateDialogTitle: string = localize('createOperator.createOperator', 'Create Operator');
|
||||||
|
private static readonly EditDialogTitle: string = localize('createOperator.editOperator', 'Edit Operator');
|
||||||
private static readonly GeneralTabText: string = localize('createOperator.General', 'General');
|
private static readonly GeneralTabText: string = localize('createOperator.General', 'General');
|
||||||
private static readonly NotificationsTabText: string = localize('createOperator.Notifications', 'Notifications');
|
private static readonly NotificationsTabText: string = localize('createOperator.Notifications', 'Notifications');
|
||||||
|
|
||||||
@@ -65,8 +66,11 @@ export class OperatorDialog extends AgentDialog<OperatorData> {
|
|||||||
// Notification tab controls
|
// Notification tab controls
|
||||||
private alertsTable: sqlops.TableComponent;
|
private alertsTable: sqlops.TableComponent;
|
||||||
|
|
||||||
constructor(ownerUri: string) {
|
constructor(ownerUri: string, operatorInfo: sqlops.AgentOperatorInfo = undefined) {
|
||||||
super(ownerUri, new OperatorData(ownerUri), OperatorDialog.DialogTitle);
|
super(
|
||||||
|
ownerUri,
|
||||||
|
new OperatorData(ownerUri, operatorInfo),
|
||||||
|
operatorInfo ? OperatorDialog.EditDialogTitle : OperatorDialog.CreateDialogTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ const localize = nls.loadMessageBundle();
|
|||||||
export class ProxyDialog extends AgentDialog<ProxyData> {
|
export class ProxyDialog extends AgentDialog<ProxyData> {
|
||||||
|
|
||||||
// Top level
|
// Top level
|
||||||
private static readonly DialogTitle: string = localize('createProxy.createAlert', 'Create Alert');
|
private static readonly CreateDialogTitle: string = localize('createProxy.createAlert', 'Create Alert');
|
||||||
|
private static readonly EditDialogTitle: string = localize('createProxy.createAlert', 'Create Alert');
|
||||||
private static readonly GeneralTabText: string = localize('createProxy.General', 'General');
|
private static readonly GeneralTabText: string = localize('createProxy.General', 'General');
|
||||||
|
|
||||||
// General tab strings
|
// General tab strings
|
||||||
@@ -34,8 +35,11 @@ export class ProxyDialog extends AgentDialog<ProxyData> {
|
|||||||
private descriptionTextBox: sqlops.InputBoxComponent;
|
private descriptionTextBox: sqlops.InputBoxComponent;
|
||||||
private subsystemsTable: sqlops.TableComponent;
|
private subsystemsTable: sqlops.TableComponent;
|
||||||
|
|
||||||
constructor(ownerUri: string) {
|
constructor(ownerUri: string, proxyInfo: sqlops.AgentProxyInfo = undefined) {
|
||||||
super(ownerUri, new ProxyData(ownerUri), ProxyDialog.DialogTitle);
|
super(
|
||||||
|
ownerUri,
|
||||||
|
new ProxyData(ownerUri, proxyInfo),
|
||||||
|
proxyInfo ? ProxyDialog.EditDialogTitle : ProxyDialog.CreateDialogTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
|
||||||
@@ -80,6 +84,10 @@ export class ProxyDialog extends AgentDialog<ProxyData> {
|
|||||||
}]).withLayout({ width: '100%' }).component();
|
}]).withLayout({ width: '100%' }).component();
|
||||||
|
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
|
||||||
|
this.proxyNameTextBox.value = this.model.accountName;
|
||||||
|
this.credentialNameTextBox.value = this.model.credentialName;
|
||||||
|
this.descriptionTextBox.value = this.model.description;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ export class MainController {
|
|||||||
* Activates the extension
|
* Activates the extension
|
||||||
*/
|
*/
|
||||||
public activate(): void {
|
public activate(): void {
|
||||||
vscode.commands.registerCommand('agent.openCreateJobDialog', (ownerUri: string) => {
|
vscode.commands.registerCommand('agent.openJobDialog', (ownerUri: string, jobInfo: sqlops.AgentJobInfo) => {
|
||||||
let dialog = new JobDialog(ownerUri);
|
let dialog = new JobDialog(ownerUri, jobInfo);
|
||||||
dialog.openDialog();
|
dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, jobId: string, server: string, stepId: number) => {
|
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, jobId: string, server: string, stepId: number) => {
|
||||||
@@ -43,12 +43,12 @@ export class MainController {
|
|||||||
let dialog = new AlertDialog(ownerUri, alertInfo);
|
let dialog = new AlertDialog(ownerUri, alertInfo);
|
||||||
dialog.openDialog();
|
dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openCreateOperatorDialog', (ownerUri: string) => {
|
vscode.commands.registerCommand('agent.openOperatorDialog', (ownerUri: string, operatorInfo: sqlops.AgentOperatorInfo) => {
|
||||||
let dialog = new OperatorDialog(ownerUri);
|
let dialog = new OperatorDialog(ownerUri, operatorInfo);
|
||||||
dialog.openDialog();
|
dialog.openDialog();
|
||||||
});
|
});
|
||||||
vscode.commands.registerCommand('agent.openCreateProxyDialog', (ownerUri: string) => {
|
vscode.commands.registerCommand('agent.openProxyDialog', (ownerUri: string, proxyInfo: sqlops.AgentProxyInfo) => {
|
||||||
let dialog = new ProxyDialog(ownerUri);
|
let dialog = new ProxyDialog(ownerUri, proxyInfo);
|
||||||
dialog.openDialog();
|
dialog.openDialog();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const testOwnerUri = 'agent://testuri';
|
|||||||
suite('Agent extension', () => {
|
suite('Agent extension', () => {
|
||||||
test('Create Job Data', async () => {
|
test('Create Job Data', async () => {
|
||||||
let testAgentService = new TestAgentService();
|
let testAgentService = new TestAgentService();
|
||||||
let data = new JobData(testOwnerUri, testAgentService);
|
let data = new JobData(testOwnerUri, undefined, testAgentService);
|
||||||
data.save();
|
data.save();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -145,11 +145,17 @@ export class EditJobAction extends Action {
|
|||||||
public static ID = 'jobaction.editJob';
|
public static ID = 'jobaction.editJob';
|
||||||
public static LABEL = nls.localize('jobaction.editJob', "Edit Job");
|
public static LABEL = nls.localize('jobaction.editJob', "Edit Job");
|
||||||
|
|
||||||
constructor() {
|
constructor(
|
||||||
|
@ICommandService private _commandService: ICommandService
|
||||||
|
) {
|
||||||
super(EditJobAction.ID, EditJobAction.LABEL);
|
super(EditJobAction.ID, EditJobAction.LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||||
|
this._commandService.executeCommand(
|
||||||
|
'agent.openJobDialog',
|
||||||
|
actionInfo.ownerUri,
|
||||||
|
actionInfo.targetObject);
|
||||||
return TPromise.as(true);
|
return TPromise.as(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,11 +330,17 @@ export class EditOperatorAction extends Action {
|
|||||||
public static ID = 'jobaction.editAlert';
|
public static ID = 'jobaction.editAlert';
|
||||||
public static LABEL = nls.localize('jobaction.editOperator', "Edit Operator");
|
public static LABEL = nls.localize('jobaction.editOperator', "Edit Operator");
|
||||||
|
|
||||||
constructor() {
|
constructor(
|
||||||
|
@ICommandService private _commandService: ICommandService
|
||||||
|
) {
|
||||||
super(EditOperatorAction.ID, EditOperatorAction.LABEL);
|
super(EditOperatorAction.ID, EditOperatorAction.LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(info: any): TPromise<boolean> {
|
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||||
|
this._commandService.executeCommand(
|
||||||
|
'agent.openOperatorDialog',
|
||||||
|
actionInfo.ownerUri,
|
||||||
|
actionInfo.targetObject);
|
||||||
return TPromise.as(true);
|
return TPromise.as(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -398,11 +410,17 @@ export class EditProxyAction extends Action {
|
|||||||
public static ID = 'jobaction.editProxy';
|
public static ID = 'jobaction.editProxy';
|
||||||
public static LABEL = nls.localize('jobaction.editProxy', "Edit Proxy");
|
public static LABEL = nls.localize('jobaction.editProxy', "Edit Proxy");
|
||||||
|
|
||||||
constructor() {
|
constructor(
|
||||||
|
@ICommandService private _commandService: ICommandService
|
||||||
|
) {
|
||||||
super(EditProxyAction.ID, EditProxyAction.LABEL);
|
super(EditProxyAction.ID, EditProxyAction.LABEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public run(info: any): TPromise<boolean> {
|
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||||
|
this._commandService.executeCommand(
|
||||||
|
'agent.openProxyDialog',
|
||||||
|
actionInfo.ownerUri,
|
||||||
|
actionInfo.targetObject);
|
||||||
return TPromise.as(true);
|
return TPromise.as(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
|
|
||||||
public openCreateJobDialog() {
|
public openCreateJobDialog() {
|
||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._commandService.executeCommand('agent.openCreateJobDialog', ownerUri);
|
this._commandService.executeCommand('agent.openJobDialog', ownerUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public refreshJobs() {
|
public refreshJobs() {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
|||||||
|
|
||||||
public openCreateOperatorDialog() {
|
public openCreateOperatorDialog() {
|
||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._commandService.executeCommand('agent.openCreateOperatorDialog', ownerUri);
|
this._commandService.executeCommand('agent.openOperatorDialog', ownerUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private refreshJobs() {
|
private refreshJobs() {
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
|
|||||||
|
|
||||||
public openCreateProxyDialog() {
|
public openCreateProxyDialog() {
|
||||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._commandService.executeCommand('agent.openCreateProxyDialog', ownerUri);
|
this._commandService.executeCommand('agent.openProxyDialog', ownerUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private refreshJobs() {
|
private refreshJobs() {
|
||||||
|
|||||||
Reference in New Issue
Block a user