mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -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();
|
||||
|
||||
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;
|
||||
dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
|
||||
id: number;
|
||||
@@ -23,7 +28,7 @@ export class AlertData implements IAgentDialogData {
|
||||
eventSource: string;
|
||||
hasNotification: number;
|
||||
includeEventDescription: string;
|
||||
isEnabled: boolean;
|
||||
isEnabled: boolean = true;
|
||||
jobId: string;
|
||||
jobName: string;
|
||||
lastOccurrenceDate: string;
|
||||
@@ -36,7 +41,7 @@ export class AlertData implements IAgentDialogData {
|
||||
databaseName: string;
|
||||
countResetDate: string;
|
||||
categoryName: string;
|
||||
alertType: string;
|
||||
alertType: string = AlertData.DefaultAlertTypeString;
|
||||
wmiEventNamespace: string;
|
||||
wmiEventQuery: string;
|
||||
|
||||
@@ -109,9 +114,19 @@ export class AlertData implements IAgentDialogData {
|
||||
databaseName: this.databaseName,
|
||||
countResetDate: this.countResetDate,
|
||||
categoryName: this.categoryName,
|
||||
alertType: sqlops.AlertType.sqlServerEvent, //this.alertType,
|
||||
alertType: AlertData.getAlertTypeFromString(this.alertType),
|
||||
wmiEventNamespace: this.wmiEventNamespace,
|
||||
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 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;
|
||||
if (jobInfo) {
|
||||
this.dialogMode = AgentDialogMode.EDIT;
|
||||
this.name = jobInfo.name;
|
||||
this.enabled = jobInfo.enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public get jobCategories(): string[] {
|
||||
|
||||
@@ -29,8 +29,14 @@ export class OperatorData implements IAgentDialogData {
|
||||
weekdayPagerStartTime: string;
|
||||
weekdayPagerEndTime: string;
|
||||
|
||||
constructor(ownerUri:string) {
|
||||
constructor(ownerUri:string, operatorInfo: sqlops.AgentOperatorInfo) {
|
||||
this.ownerUri = ownerUri;
|
||||
|
||||
if (operatorInfo) {
|
||||
this.dialogMode = AgentDialogMode.EDIT;
|
||||
this.name = operatorInfo.name;
|
||||
this.enabled = operatorInfo.enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public async initialize() {
|
||||
|
||||
@@ -19,8 +19,14 @@ export class ProxyData implements IAgentDialogData {
|
||||
credentialId: number;
|
||||
isEnabled: boolean;
|
||||
|
||||
constructor(ownerUri:string) {
|
||||
constructor(ownerUri:string, proxyInfo: sqlops.AgentProxyInfo) {
|
||||
this.ownerUri = ownerUri;
|
||||
|
||||
if (proxyInfo) {
|
||||
this.accountName = proxyInfo.accountName;
|
||||
this.credentialName = proxyInfo.credentialName;
|
||||
this.description = proxyInfo.description;
|
||||
}
|
||||
}
|
||||
|
||||
public async initialize() {
|
||||
|
||||
Reference in New Issue
Block a user