Refresh agent dashboard panel after create\update\delete operations (#1861)

* Edit alert WIP

* A couple alert edit bugs

* Hook up dashboard refresh notification

* Hook onchange event to other agent service calls

* Switch update handler to scalar value

* Add null check on handler callback
This commit is contained in:
Karl Burtram
2018-07-06 08:57:30 -07:00
committed by GitHub
parent 6f9a27ecc7
commit 21bad7a01f
25 changed files with 280 additions and 103 deletions

View File

@@ -4,14 +4,20 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
import * as nls from 'vscode-nls';
import * as vscode from 'vscode';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
const localize = nls.loadMessageBundle();
export class AlertData implements IAgentDialogData { export class AlertData implements IAgentDialogData {
ownerUri: string; ownerUri: string;
dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
id: number; id: number;
name: string; name: string;
originalName: string;
delayBetweenResponses: number; delayBetweenResponses: number;
eventDescriptionKeyword: string; eventDescriptionKeyword: string;
eventSource: string; eventSource: string;
@@ -34,8 +40,36 @@ export class AlertData implements IAgentDialogData {
wmiEventNamespace: string; wmiEventNamespace: string;
wmiEventQuery: string; wmiEventQuery: string;
constructor(ownerUri:string) { constructor(ownerUri:string, alertInfo: sqlops.AgentAlertInfo) {
this.ownerUri = ownerUri; this.ownerUri = ownerUri;
if (alertInfo) {
this.dialogMode = AgentDialogMode.EDIT;
this.id = alertInfo.id;
this.name = alertInfo.name;
this.originalName = alertInfo.name;
this.delayBetweenResponses = alertInfo.delayBetweenResponses;
this.eventDescriptionKeyword = alertInfo.eventDescriptionKeyword;
this.eventSource = alertInfo.eventSource;
this.hasNotification = alertInfo.hasNotification;
this.includeEventDescription = alertInfo.includeEventDescription.toString();
this.isEnabled = alertInfo.isEnabled;
this.jobId = alertInfo.jobId;
this.jobName = alertInfo.jobName;
this.lastOccurrenceDate = alertInfo.lastOccurrenceDate;
this.lastResponseDate = alertInfo.lastResponseDate;
this.messageId = alertInfo.messageId;
this.notificationMessage = alertInfo.notificationMessage;
this.occurrenceCount = alertInfo.occurrenceCount;
this.performanceCondition = alertInfo.performanceCondition;
this.severity = alertInfo.severity;
this.databaseName = alertInfo.databaseName;
this.countResetDate = alertInfo.countResetDate;
this.categoryName = alertInfo.categoryName;
this.alertType = alertInfo.alertType.toString();
this.wmiEventNamespace = alertInfo.wmiEventNamespace;
this.wmiEventQuery = alertInfo.wmiEventQuery;
}
} }
public async initialize() { public async initialize() {
@@ -43,9 +77,13 @@ export class AlertData implements IAgentDialogData {
public async save() { public async save() {
let agentService = await AgentUtils.getAgentService(); let agentService = await AgentUtils.getAgentService();
let result = await agentService.createAlert(this.ownerUri, this.toAgentAlertInfo()); let result = this.dialogMode === AgentDialogMode.CREATE
? await agentService.createAlert(this.ownerUri, this.toAgentAlertInfo())
: await agentService.updateAlert(this.ownerUri, this.originalName, this.toAgentAlertInfo());
if (!result || !result.success) { if (!result || !result.success) {
// TODO handle error here vscode.window.showErrorMessage(
localize('alertData.saveErrorMessage', "Alert update failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));
} }
} }
@@ -76,4 +114,4 @@ export class AlertData implements IAgentDialogData {
wmiEventQuery: this.wmiEventQuery wmiEventQuery: this.wmiEventQuery
}; };
} }
} }

View File

@@ -6,7 +6,7 @@
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
export class JobData implements IAgentDialogData { export class JobData implements IAgentDialogData {
@@ -23,6 +23,7 @@ export class JobData implements IAgentDialogData {
private _defaultOwner: string; private _defaultOwner: string;
private _jobCompletionActionConditions: sqlops.CategoryValue[]; private _jobCompletionActionConditions: sqlops.CategoryValue[];
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
public name: string; public name: string;
public enabled: boolean = true; public enabled: boolean = true;
public description: string; public description: string;

View File

@@ -5,9 +5,10 @@
'use strict'; 'use strict';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
export class JobStepData implements IAgentDialogData { export class JobStepData implements IAgentDialogData {
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
public ownerUri: string; public ownerUri: string;
public jobId: string; // public jobId: string; //
public jobName: string; public jobName: string;

View File

@@ -6,9 +6,10 @@
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
export class OperatorData implements IAgentDialogData { export class OperatorData implements IAgentDialogData {
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
ownerUri: string; ownerUri: string;
name: string; name: string;
id: number; id: number;

View File

@@ -6,9 +6,10 @@
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
export class PickScheduleData implements IAgentDialogData { export class PickScheduleData implements IAgentDialogData {
public dialogMode: AgentDialogMode = AgentDialogMode.VIEW;
public ownerUri: string; public ownerUri: string;
public schedules: sqlops.AgentJobScheduleInfo[]; public schedules: sqlops.AgentJobScheduleInfo[];
public selectedSchedule: sqlops.AgentJobScheduleInfo; public selectedSchedule: sqlops.AgentJobScheduleInfo;

View File

@@ -6,9 +6,10 @@
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
export class ProxyData implements IAgentDialogData { export class ProxyData implements IAgentDialogData {
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
ownerUri: string; ownerUri: string;
id: number; id: number;
accountName: string; accountName: string;

View File

@@ -6,9 +6,10 @@
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils'; import { AgentUtils } from '../agentUtils';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
export class ScheduleData implements IAgentDialogData { export class ScheduleData implements IAgentDialogData {
public dialogMode: AgentDialogMode = AgentDialogMode.CREATE;
public ownerUri: string; public ownerUri: string;
public schedules: sqlops.AgentJobScheduleInfo[]; public schedules: sqlops.AgentJobScheduleInfo[];
public selectedSchedule: sqlops.AgentJobScheduleInfo; public selectedSchedule: sqlops.AgentJobScheduleInfo;

View File

@@ -7,14 +7,14 @@
import * as nls from 'vscode-nls'; import * as nls from 'vscode-nls';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { IAgentDialogData } from '../interfaces'; import { IAgentDialogData, AgentDialogMode } from '../interfaces';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
export abstract class AgentDialog<T extends IAgentDialogData> { export abstract class AgentDialog<T extends IAgentDialogData> {
private static readonly OkButtonText: string = localize('createAlert.OK', 'OK'); private static readonly OkButtonText: string = localize('agentDialog.OK', 'OK');
private static readonly CancelButtonText: string = localize('createAlert.Cancel', 'Cancel'); private static readonly CancelButtonText: string = localize('agentDialog.Cancel', 'Cancel');
protected _onSuccess: vscode.EventEmitter<T> = new vscode.EventEmitter<T>(); protected _onSuccess: vscode.EventEmitter<T> = new vscode.EventEmitter<T>();
public readonly onSuccess: vscode.Event<T> = this._onSuccess.event; public readonly onSuccess: vscode.Event<T> = this._onSuccess.event;
@@ -23,6 +23,10 @@ export abstract class AgentDialog<T extends IAgentDialogData> {
constructor(public ownerUri: string, public model: T, public title: string) { constructor(public ownerUri: string, public model: T, public title: string) {
} }
public get dialogMode(): AgentDialogMode {
return this.model.dialogMode;
}
protected abstract async updateModel(); protected abstract async updateModel();
protected abstract async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog); protected abstract async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog);

View File

@@ -16,48 +16,49 @@ const localize = nls.loadMessageBundle();
export class AlertDialog extends AgentDialog<AlertData> { export class AlertDialog extends AgentDialog<AlertData> {
// Top level // Top level
private static readonly DialogTitle: string = localize('createAlert.createAlert', 'Create Alert'); private static readonly CreateDialogTitle: string = localize('alertDialog.createAlert', 'Create Alert');
private static readonly GeneralTabText: string = localize('createAlert.General', 'General'); private static readonly EditDialogTitle: string = localize('alertDialog.editAlert', 'Edit Alert');
private static readonly ResponseTabText: string = localize('createAlert.Response', 'Response'); private static readonly GeneralTabText: string = localize('alertDialog.General', 'General');
private static readonly OptionsTabText: string = localize('createAlert.Options', 'Options'); private static readonly ResponseTabText: string = localize('alertDialog.Response', 'Response');
private static readonly OptionsTabText: string = localize('alertDialog.Options', 'Options');
// General tab strings // General tab strings
private static readonly NameLabel: string = localize('createAlert.Name', 'Name'); private static readonly NameLabel: string = localize('alertDialog.Name', 'Name');
private static readonly TypeLabel: string = localize('createAlert.Type', 'Type'); private static readonly TypeLabel: string = localize('alertDialog.Type', 'Type');
private static readonly EnabledCheckboxLabel: string = localize('createAlert.Enabled', 'Enabled'); private static readonly EnabledCheckboxLabel: string = localize('alertDialog.Enabled', 'Enabled');
private static readonly DatabaseLabel: string = localize('createAlert.DatabaseName', 'Database name'); private static readonly DatabaseLabel: string = localize('alertDialog.DatabaseName', 'Database name');
private static readonly ErrorNumberLabel: string = localize('createAlert.ErrorNumber', 'Error number'); private static readonly ErrorNumberLabel: string = localize('alertDialog.ErrorNumber', 'Error number');
private static readonly SeverityLabel: string = localize('createAlert.Severity', 'Severity'); private static readonly SeverityLabel: string = localize('alertDialog.Severity', 'Severity');
private static readonly RaiseIfMessageContainsLabel: string = localize('createAlert.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('createAlert.MessageText', 'Message text'); private static readonly MessageTextLabel: string = localize('alertDialog.MessageText', 'Message text');
private static readonly AlertTypeSqlServerEventString: string = localize('createAlert.SqlServerEventAlert', 'SQL Server event alert'); private static readonly AlertTypeSqlServerEventString: string = localize('alertDialog.SqlServerEventAlert', 'SQL Server event alert');
private static readonly AlertTypePerformanceConditionString: string = localize('createAlert.PerformanceCondition', 'SQL Server performance condition alert'); private static readonly AlertTypePerformanceConditionString: string = localize('alertDialog.PerformanceCondition', 'SQL Server performance condition alert');
private static readonly AlertTypeWmiEventString: string = localize('createAlert.WmiEvent', 'WMI event alert'); private static readonly AlertTypeWmiEventString: string = localize('alertDialog.WmiEvent', 'WMI event alert');
private static readonly AlertSeverity001Label: string = localize('createAlert.Severity001', '001 - Miscellaneous System Information'); private static readonly AlertSeverity001Label: string = localize('alertDialog.Severity001', '001 - Miscellaneous System Information');
private static readonly AlertSeverity002Label: string = localize('createAlert.Severity002', '002 - Reserved'); private static readonly AlertSeverity002Label: string = localize('alertDialog.Severity002', '002 - Reserved');
private static readonly AlertSeverity003Label: string = localize('createAlert.Severity003', '003 - Reserved'); private static readonly AlertSeverity003Label: string = localize('alertDialog.Severity003', '003 - Reserved');
private static readonly AlertSeverity004Label: string = localize('createAlert.Severity004', '004 - Reserved'); private static readonly AlertSeverity004Label: string = localize('alertDialog.Severity004', '004 - Reserved');
private static readonly AlertSeverity005Label: string = localize('createAlert.Severity005', '005 - Reserved'); private static readonly AlertSeverity005Label: string = localize('alertDialog.Severity005', '005 - Reserved');
private static readonly AlertSeverity006Label: string = localize('createAlert.Severity006', '006 - Reserved'); private static readonly AlertSeverity006Label: string = localize('alertDialog.Severity006', '006 - Reserved');
private static readonly AlertSeverity007Label: string = localize('createAlert.Severity007', '007 - Notification: Status Information'); private static readonly AlertSeverity007Label: string = localize('alertDialog.Severity007', '007 - Notification: Status Information');
private static readonly AlertSeverity008Label: string = localize('createAlert.Severity008', '008 - Notification: User Intervention Required'); private static readonly AlertSeverity008Label: string = localize('alertDialog.Severity008', '008 - Notification: User Intervention Required');
private static readonly AlertSeverity009Label: string = localize('createAlert.Severity009', '009 - User Defined'); private static readonly AlertSeverity009Label: string = localize('alertDialog.Severity009', '009 - User Defined');
private static readonly AlertSeverity010Label: string = localize('createAlert.Severity010', '010 - Information'); private static readonly AlertSeverity010Label: string = localize('alertDialog.Severity010', '010 - Information');
private static readonly AlertSeverity011Label: string = localize('createAlert.Severity011', '011 - Specified Database Object Not Found'); private static readonly AlertSeverity011Label: string = localize('alertDialog.Severity011', '011 - Specified Database Object Not Found');
private static readonly AlertSeverity012Label: string = localize('createAlert.Severity012', '012 - Unused'); private static readonly AlertSeverity012Label: string = localize('alertDialog.Severity012', '012 - Unused');
private static readonly AlertSeverity013Label: string = localize('createAlert.Severity013', '013 - User Transaction Syntax Error'); private static readonly AlertSeverity013Label: string = localize('alertDialog.Severity013', '013 - User Transaction Syntax Error');
private static readonly AlertSeverity014Label: string = localize('createAlert.Severity014', '014 - Insufficient Permission'); private static readonly AlertSeverity014Label: string = localize('alertDialog.Severity014', '014 - Insufficient Permission');
private static readonly AlertSeverity015Label: string = localize('createAlert.Severity015', '015 - Syntax Error in SQL Statements'); private static readonly AlertSeverity015Label: string = localize('alertDialog.Severity015', '015 - Syntax Error in SQL Statements');
private static readonly AlertSeverity016Label: string = localize('createAlert.Severity016', '016 - Miscellaneous User Error'); private static readonly AlertSeverity016Label: string = localize('alertDialog.Severity016', '016 - Miscellaneous User Error');
private static readonly AlertSeverity017Label: string = localize('createAlert.Severity017', '017 - Insufficient Resources'); private static readonly AlertSeverity017Label: string = localize('alertDialog.Severity017', '017 - Insufficient Resources');
private static readonly AlertSeverity018Label: string = localize('createAlert.Severity018', '018 - Nonfatal Internal Error'); private static readonly AlertSeverity018Label: string = localize('alertDialog.Severity018', '018 - Nonfatal Internal Error');
private static readonly AlertSeverity019Label: string = localize('createAlert.Severity019', '019 - Fatal Error in Resource'); private static readonly AlertSeverity019Label: string = localize('alertDialog.Severity019', '019 - Fatal Error in Resource');
private static readonly AlertSeverity020Label: string = localize('createAlert.Severity020', '020 - Fatal Error in Current Process'); private static readonly AlertSeverity020Label: string = localize('alertDialog.Severity020', '020 - Fatal Error in Current Process');
private static readonly AlertSeverity021Label: string = localize('createAlert.Severity021', '021 - Fatal Error in Database Processes'); private static readonly AlertSeverity021Label: string = localize('alertDialog.Severity021', '021 - Fatal Error in Database Processes');
private static readonly AlertSeverity022Label: string = localize('createAlert.Severity022', '022 - Fatal Error: Table Integrity Suspect'); private static readonly AlertSeverity022Label: string = localize('alertDialog.Severity022', '022 - Fatal Error: Table Integrity Suspect');
private static readonly AlertSeverity023Label: string = localize('createAlert.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('createAlert.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('createAlert.Severity025', '025 - Fatal Error'); private static readonly AlertSeverity025Label: string = localize('alertDialog.Severity025', '025 - Fatal Error');
private static readonly AlertTypes: string[] = [ private static readonly AlertTypes: string[] = [
AlertDialog.AlertTypeSqlServerEventString, AlertDialog.AlertTypeSqlServerEventString,
@@ -94,23 +95,23 @@ export class AlertDialog extends AgentDialog<AlertData> {
]; ];
// Response tab strings // Response tab strings
private static readonly ExecuteJobCheckBoxLabel: string = localize('createAlert.ExecuteJob', 'Execute Job'); private static readonly ExecuteJobCheckBoxLabel: string = localize('alertDialog.ExecuteJob', 'Execute Job');
private static readonly ExecuteJobTextBoxLabel: string = localize('createAlert.ExecuteJobName', 'Job Name'); private static readonly ExecuteJobTextBoxLabel: string = localize('alertDialog.ExecuteJobName', 'Job Name');
private static readonly NotifyOperatorsTextBoxLabel: string = localize('createAlert.NotifyOperators', 'Notify Operators'); private static readonly NotifyOperatorsTextBoxLabel: string = localize('alertDialog.NotifyOperators', 'Notify Operators');
private static readonly NewJobButtonLabel: string = localize('createAlert.NewJob', 'New Job'); private static readonly NewJobButtonLabel: string = localize('alertDialog.NewJob', 'New Job');
private static readonly OperatorListLabel: string = localize('createAlert.OperatorList', 'Operator List'); private static readonly OperatorListLabel: string = localize('alertDialog.OperatorList', 'Operator List');
private static readonly OperatorNameColumnLabel: string = localize('createAlert.OperatorName', 'Operator'); private static readonly OperatorNameColumnLabel: string = localize('alertDialog.OperatorName', 'Operator');
private static readonly OperatorEmailColumnLabel: string = localize('createAlert.OperatorEmail', 'E-mail'); private static readonly OperatorEmailColumnLabel: string = localize('alertDialog.OperatorEmail', 'E-mail');
private static readonly OperatorPagerColumnLabel: string = localize('createAlert.OperatorPager', 'Pager'); private static readonly OperatorPagerColumnLabel: string = localize('alertDialog.OperatorPager', 'Pager');
private static readonly NewOperatorButtonLabel: string = localize('createAlert.NewOperator', 'New Operator'); private static readonly NewOperatorButtonLabel: string = localize('alertDialog.NewOperator', 'New Operator');
// Options tab strings // Options tab strings
private static readonly IncludeErrorInEmailCheckBoxLabel: string = localize('createAlert.IncludeErrorInEmail', 'Include alert error text in e-mail'); private static readonly IncludeErrorInEmailCheckBoxLabel: string = localize('alertDialog.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 IncludeErrorInPagerCheckBoxLabel: string = localize('alertDialog.IncludeErrorInPager', 'Include alert error text in pager');
private static readonly AdditionalMessageTextBoxLabel: string = localize('createAlert.AdditionalNotification', 'Additional notification message to send'); private static readonly AdditionalMessageTextBoxLabel: string = localize('alertDialog.AdditionalNotification', 'Additional notification message to send');
private static readonly DelayBetweenResponsesTextBoxLabel: string = localize('createAlert.DelayBetweenResponse', 'Delay between responses'); private static readonly DelayBetweenResponsesTextBoxLabel: string = localize('alertDialog.DelayBetweenResponse', 'Delay between responses');
private static readonly DelayMinutesTextBoxLabel: string = localize('createAlert.DelayMinutes', 'Delay Minutes'); private static readonly DelayMinutesTextBoxLabel: string = localize('alertDialog.DelayMinutes', 'Delay Minutes');
private static readonly DelaySecondsTextBoxLabel: string = localize('createAlert.DelaySeconds', 'Delay Seconds'); private static readonly DelaySecondsTextBoxLabel: string = localize('alertDialog.DelaySeconds', 'Delay Seconds');
// UI Components // UI Components
private generalTab: sqlops.window.modelviewdialog.DialogTab; private generalTab: sqlops.window.modelviewdialog.DialogTab;
@@ -141,8 +142,10 @@ 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) { constructor(ownerUri: string, alertInfo: sqlops.AgentAlertInfo = null) {
super(ownerUri, new AlertData(ownerUri), AlertDialog.DialogTitle); super(ownerUri,
new AlertData(ownerUri, alertInfo),
alertInfo ? AlertDialog.EditDialogTitle : AlertDialog.CreateDialogTitle);
} }
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) { protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
@@ -210,7 +213,7 @@ export class AlertDialog extends AgentDialog<AlertData> {
title: AlertDialog.SeverityLabel title: AlertDialog.SeverityLabel
}, { }, {
component: this.raiseAlertMessageCheckBox, component: this.raiseAlertMessageCheckBox,
title: AlertDialog.RaiseIfMessageContainsLabel title: ''
}, { }, {
component: this.raiseAlertMessageTextBox, component: this.raiseAlertMessageTextBox,
title: AlertDialog.MessageTextLabel title: AlertDialog.MessageTextLabel
@@ -218,6 +221,9 @@ export class AlertDialog extends AgentDialog<AlertData> {
]).withLayout({ width: '100%' }).component(); ]).withLayout({ width: '100%' }).component();
await view.initializeModel(formModel); await view.initializeModel(formModel);
this.nameTextBox.value = this.model.name;
this.enabledCheckBox.checked = this.model.isEnabled;
}); });
} }
@@ -326,7 +332,7 @@ export class AlertDialog extends AgentDialog<AlertData> {
if (selected) { if (selected) {
let index = AlertDialog.AlertSeverities.indexOf(selected); let index = AlertDialog.AlertSeverities.indexOf(selected);
if (index >= 0) { if (index >= 0) {
severityNumber = index; severityNumber = index + 1;
} }
} }
return severityNumber; return severityNumber;
@@ -339,6 +345,7 @@ export class AlertDialog extends AgentDialog<AlertData> {
this.model.alertType = this.getDropdownValue(this.typeDropDown); this.model.alertType = this.getDropdownValue(this.typeDropDown);
this.model.databaseName = this.getDropdownValue(this.databaseDropDown); this.model.databaseName = this.getDropdownValue(this.databaseDropDown);
this.model.severity = this.getSeverityNumber(); this.model.severity = this.getSeverityNumber();
this.model.messageId = undefined;
let raiseIfError = this.raiseAlertMessageCheckBox.checked; let raiseIfError = this.raiseAlertMessageCheckBox.checked;
if (raiseIfError) { if (raiseIfError) {

View File

@@ -81,9 +81,9 @@ export class OperatorDialog extends AgentDialog<OperatorData> {
private initializeGeneralTab() { private initializeGeneralTab() {
this.generalTab.registerContent(async view => { this.generalTab.registerContent(async view => {
this.nameTextBox = view.modelBuilder.inputBox()
.withProperties({ width: '100%' }) this.nameTextBox = view.modelBuilder.inputBox().component();
.component();
this.enabledCheckBox = view.modelBuilder.checkBox() this.enabledCheckBox = view.modelBuilder.checkBox()
.withProperties({ .withProperties({
label: OperatorDialog.EnabledCheckboxLabel label: OperatorDialog.EnabledCheckboxLabel

View File

@@ -4,7 +4,14 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
export enum AgentDialogMode {
CREATE = 1,
EDIT = 2,
VIEW = 3
}
export interface IAgentDialogData { export interface IAgentDialogData {
dialogMode: AgentDialogMode;
initialize(): void; initialize(): void;
save(): void; save(): void;
} }

View File

@@ -3,6 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
'use strict'; 'use strict';
import * as sqlops from 'sqlops';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { AlertDialog } from './dialogs/alertDialog'; import { AlertDialog } from './dialogs/alertDialog';
import { JobDialog } from './dialogs/jobDialog'; import { JobDialog } from './dialogs/jobDialog';
@@ -38,8 +39,8 @@ export class MainController {
let dialog = new PickScheduleDialog(ownerUri); let dialog = new PickScheduleDialog(ownerUri);
dialog.showDialog(); dialog.showDialog();
}); });
vscode.commands.registerCommand('agent.openCreateAlertDialog', (ownerUri: string) => { vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, alertInfo: sqlops.AgentAlertInfo) => {
let dialog = new AlertDialog(ownerUri); let dialog = new AlertDialog(ownerUri, alertInfo);
dialog.openDialog(); dialog.openDialog();
}); });
vscode.commands.registerCommand('agent.openCreateOperatorDialog', (ownerUri: string) => { vscode.commands.registerCommand('agent.openCreateOperatorDialog', (ownerUri: string) => {

View File

@@ -99,4 +99,7 @@ export class TestAgentService implements sqlops.AgentServicesProvider {
deleteJobSchedule(ownerUri: string, scheduleInfo: sqlops.AgentJobScheduleInfo): Thenable<sqlops.ResultStatus> { deleteJobSchedule(ownerUri: string, scheduleInfo: sqlops.AgentJobScheduleInfo): Thenable<sqlops.ResultStatus> {
return undefined; return undefined;
} }
registerOnUpdated(handler: () => any): void {
}
} }

View File

@@ -35,6 +35,8 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
contracts.AgentJobActionRequest.type contracts.AgentJobActionRequest.type
]; ];
private onUpdatedHandler: () => any;
constructor(client: SqlOpsDataClient) { constructor(client: SqlOpsDataClient) {
super(client, AgentServicesFeature.messagesTypes); super(client, AgentServicesFeature.messagesTypes);
} }
@@ -53,6 +55,18 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
protected registerProvider(options: undefined): Disposable { protected registerProvider(options: undefined): Disposable {
const client = this._client; const client = this._client;
let self = this;
// On updated registration
let registerOnUpdated = (handler: () => any): void => {
self.onUpdatedHandler = handler;
};
let fireOnUpdated = (): void => {
if (self.onUpdatedHandler) {
self.onUpdatedHandler();
}
};
// Job management methods // Job management methods
let getJobs = (ownerUri: string): Thenable<sqlops.AgentJobsResult> => { let getJobs = (ownerUri: string): Thenable<sqlops.AgentJobsResult> => {
@@ -96,7 +110,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.CreateAgentJobRequest.type; let requestType = contracts.CreateAgentJobRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -112,7 +129,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.UpdateAgentJobRequest.type; let requestType = contracts.UpdateAgentJobRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -127,7 +147,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.DeleteAgentJobRequest.type; let requestType = contracts.DeleteAgentJobRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -157,7 +180,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.CreateAgentJobStepRequest.type; let requestType = contracts.CreateAgentJobStepRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -173,7 +199,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.UpdateAgentJobStepRequest.type; let requestType = contracts.UpdateAgentJobStepRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -188,7 +217,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.DeleteAgentJobStepRequest.type; let requestType = contracts.DeleteAgentJobStepRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -218,7 +250,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.CreateAgentAlertRequest.type; let requestType = contracts.CreateAgentAlertRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -234,7 +269,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.UpdateAgentAlertRequest.type; let requestType = contracts.UpdateAgentAlertRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -249,7 +287,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.DeleteAgentAlertRequest.type; let requestType = contracts.DeleteAgentAlertRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -279,7 +320,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.CreateAgentOperatorRequest.type; let requestType = contracts.CreateAgentOperatorRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -295,7 +339,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.UpdateAgentOperatorRequest.type; let requestType = contracts.UpdateAgentOperatorRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -310,7 +357,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.DeleteAgentOperatorRequest.type; let requestType = contracts.DeleteAgentOperatorRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -340,7 +390,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.CreateAgentProxyRequest.type; let requestType = contracts.CreateAgentProxyRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -356,7 +409,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.UpdateAgentProxyRequest.type; let requestType = contracts.UpdateAgentProxyRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -371,7 +427,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.DeleteAgentProxyRequest.type; let requestType = contracts.DeleteAgentProxyRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -401,7 +460,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.CreateAgentJobScheduleRequest.type; let requestType = contracts.CreateAgentJobScheduleRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -417,7 +479,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.UpdateAgentJobScheduleRequest.type; let requestType = contracts.UpdateAgentJobScheduleRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -432,7 +497,10 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
}; };
let requestType = contracts.DeleteAgentJobScheduleRequest.type; let requestType = contracts.DeleteAgentJobScheduleRequest.type;
return client.sendRequest(requestType, params).then( return client.sendRequest(requestType, params).then(
r => r, r => {
fireOnUpdated();
return r;
},
e => { e => {
client.logFailedRequest(requestType, e); client.logFailedRequest(requestType, e);
return Promise.resolve(undefined); return Promise.resolve(undefined);
@@ -467,7 +535,8 @@ export class AgentServicesFeature extends SqlOpsFeature<undefined> {
getJobSchedules, getJobSchedules,
createJobSchedule, createJobSchedule,
updateJobSchedule, updateJobSchedule,
deleteJobSchedule deleteJobSchedule,
registerOnUpdated
}); });
} }
} }

View File

@@ -18,6 +18,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { AgentJobInfo, AgentJobHistoryInfo } from 'sqlops'; import { AgentJobInfo, AgentJobHistoryInfo } from 'sqlops';
import { PanelComponent, IPanelOptions, NavigationBarLayout } from 'sql/base/browser/ui/panel/panel.component'; import { PanelComponent, IPanelOptions, NavigationBarLayout } from 'sql/base/browser/ui/panel/panel.component';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
export const DASHBOARD_SELECTOR: string = 'agentview-component'; export const DASHBOARD_SELECTOR: string = 'agentview-component';
@@ -56,8 +57,15 @@ export class AgentViewComponent {
}; };
constructor( constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef) { @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
@Inject(IJobManagementService) jobManagementService: IJobManagementService) {
this._expanded = new Map<string, string>(); this._expanded = new Map<string, string>();
let self = this;
jobManagementService.onDidChange((args) => {
self.refresh = true;
self._cd.detectChanges();
});
} }
/** /**

View File

@@ -8,6 +8,7 @@
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { JobCacheObject } from './jobManagementService'; import { JobCacheObject } from './jobManagementService';
import { Event } from 'vs/base/common/event';
export const SERVICE_ID = 'jobManagementService'; export const SERVICE_ID = 'jobManagementService';
@@ -15,8 +16,10 @@ export const IJobManagementService = createDecorator<IJobManagementService>(SERV
export interface IJobManagementService { export interface IJobManagementService {
_serviceBrand: any; _serviceBrand: any;
onDidChange: Event<void>;
registerProvider(providerId: string, provider: sqlops.AgentServicesProvider): void; registerProvider(providerId: string, provider: sqlops.AgentServicesProvider): void;
fireOnDidChange(): void;
getJobs(connectionUri: string): Thenable<sqlops.AgentJobsResult>; getJobs(connectionUri: string): Thenable<sqlops.AgentJobsResult>;
getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult>; getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult>;

View File

@@ -244,11 +244,17 @@ export class EditAlertAction extends Action {
public static ID = 'jobaction.editAlert'; public static ID = 'jobaction.editAlert';
public static LABEL = nls.localize('jobaction.editAlert', "Edit Alert"); public static LABEL = nls.localize('jobaction.editAlert', "Edit Alert");
constructor() { constructor(
@ICommandService private _commandService: ICommandService
) {
super(EditAlertAction.ID, EditAlertAction.LABEL); super(EditAlertAction.ID, EditAlertAction.LABEL);
} }
public run(actionInfo: IJobActionInfo): TPromise<boolean> { public run(actionInfo: IJobActionInfo): TPromise<boolean> {
this._commandService.executeCommand(
'agent.openAlertDialog',
actionInfo.ownerUri,
actionInfo.targetObject);
return TPromise.as(true); return TPromise.as(true);
} }
} }

View File

@@ -10,11 +10,14 @@ import * as sqlops from 'sqlops';
import { TPromise } from 'vs/base/common/winjs.base'; import { TPromise } from 'vs/base/common/winjs.base';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces'; import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement'; import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { Event, Emitter } from 'vs/base/common/event';
export class JobManagementService implements IJobManagementService { export class JobManagementService implements IJobManagementService {
_serviceBrand: any; _serviceBrand: any;
private _onDidChange = new Emitter<void>();
public readonly onDidChange: Event<void> = this._onDidChange.event;
private _providers: { [handle: string]: sqlops.AgentServicesProvider; } = Object.create(null); private _providers: { [handle: string]: sqlops.AgentServicesProvider; } = Object.create(null);
private _jobCacheObject : {[server: string]: JobCacheObject; } = {}; private _jobCacheObject : {[server: string]: JobCacheObject; } = {};
@@ -23,6 +26,10 @@ export class JobManagementService implements IJobManagementService {
) { ) {
} }
public fireOnDidChange(): void {
this._onDidChange.fire(void 0);
}
public getJobs(connectionUri: string): Thenable<sqlops.AgentJobsResult> { public getJobs(connectionUri: string): Thenable<sqlops.AgentJobsResult> {
return this._runAction(connectionUri, (runner) => { return this._runAction(connectionUri, (runner) => {
return runner.getJobs(connectionUri); return runner.getJobs(connectionUri);

View File

@@ -164,7 +164,7 @@ export class AlertsViewComponent extends JobManagementView implements OnInit {
public openCreateAlertDialog() { public openCreateAlertDialog() {
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri; let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
this._commandService.executeCommand('agent.openCreateAlertDialog', ownerUri); this._commandService.executeCommand('agent.openAlertDialog', ownerUri);
} }
private refreshJobs() { private refreshJobs() {

View File

@@ -136,7 +136,7 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
private onProxiesAvailable(proxies: sqlops.AgentProxyInfo[]) { private onProxiesAvailable(proxies: sqlops.AgentProxyInfo[]) {
let items: any = proxies.map((item) => { let items: any = proxies.map((item) => {
return { return {
id: item.id, id: item.accountName,
accountName: item.accountName, accountName: item.accountName,
credentialName: item.credentialName credentialName: item.credentialName
}; };

3
src/sql/sqlops.d.ts vendored
View File

@@ -1384,12 +1384,13 @@ declare module 'sqlops' {
updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: AgentProxyInfo): Thenable<UpdateAgentOperatorResult>; updateProxy(ownerUri: string, originalProxyName: string, proxyInfo: AgentProxyInfo): Thenable<UpdateAgentOperatorResult>;
deleteProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<ResultStatus>; deleteProxy(ownerUri: string, proxyInfo: AgentProxyInfo): Thenable<ResultStatus>;
// Job Schedule management methods // Job Schedule management methods
getJobSchedules(ownerUri: string): Thenable<AgentJobSchedulesResult>; getJobSchedules(ownerUri: string): Thenable<AgentJobSchedulesResult>;
createJobSchedule(ownerUri: string, scheduleInfo: AgentJobScheduleInfo): Thenable<CreateAgentJobScheduleResult>; createJobSchedule(ownerUri: string, scheduleInfo: AgentJobScheduleInfo): Thenable<CreateAgentJobScheduleResult>;
updateJobSchedule(ownerUri: string, originalScheduleName: string, scheduleInfo: AgentJobScheduleInfo): Thenable<UpdateAgentJobScheduleResult>; updateJobSchedule(ownerUri: string, originalScheduleName: string, scheduleInfo: AgentJobScheduleInfo): Thenable<UpdateAgentJobScheduleResult>;
deleteJobSchedule(ownerUri: string, scheduleInfo: AgentJobScheduleInfo): Thenable<ResultStatus>; deleteJobSchedule(ownerUri: string, scheduleInfo: AgentJobScheduleInfo): Thenable<ResultStatus>;
registerOnUpdated(handler: () => any): void;
} }
// Task service interfaces ---------------------------------------------------------------------------- // Task service interfaces ----------------------------------------------------------------------------

View File

@@ -603,4 +603,11 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
$deleteProxy(handle: number, ownerUri: string, proxy: sqlops.AgentProxyInfo): Thenable<sqlops.ResultStatus> { $deleteProxy(handle: number, ownerUri: string, proxy: sqlops.AgentProxyInfo): Thenable<sqlops.ResultStatus> {
return this._resolveProvider<sqlops.AgentServicesProvider>(handle).deleteProxy(ownerUri, proxy); return this._resolveProvider<sqlops.AgentServicesProvider>(handle).deleteProxy(ownerUri, proxy);
} }
/**
* SQL Agent job data update notification
*/
public $onJobDataUpdated(handle: Number): void {
this._proxy.$onJobDataUpdated(handle);
}
} }

View File

@@ -460,6 +460,11 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape {
this._profilerService.onSessionStopped(response); this._profilerService.onSessionStopped(response);
} }
// SQL Server Agent handlers
public $onJobDataUpdated(handle: Number): void {
this._jobManagementService.fireOnDidChange();
}
public $unregisterProvider(handle: number): TPromise<any> { public $unregisterProvider(handle: number): TPromise<any> {
let capabilitiesRegistration = this._capabilitiesRegistrations[handle]; let capabilitiesRegistration = this._capabilitiesRegistrations[handle];
if (capabilitiesRegistration) { if (capabilitiesRegistration) {

View File

@@ -265,6 +265,10 @@ export function createApiFactory(
}; };
let registerAgentServicesProvider = (provider: sqlops.AgentServicesProvider): vscode.Disposable => { let registerAgentServicesProvider = (provider: sqlops.AgentServicesProvider): vscode.Disposable => {
provider.registerOnUpdated(() => {
extHostDataProvider.$onJobDataUpdated(provider.handle);
});
return extHostDataProvider.$registerAgentServiceProvider(provider); return extHostDataProvider.$registerAgentServiceProvider(provider);
}; };

View File

@@ -456,6 +456,7 @@ export interface MainThreadDataProtocolShape extends IDisposable {
$onScriptingComplete(handle: number, message: sqlops.ScriptingCompleteResult): void; $onScriptingComplete(handle: number, message: sqlops.ScriptingCompleteResult): void;
$onSessionEventsAvailable(handle: number, response: sqlops.ProfilerSessionEvents): void; $onSessionEventsAvailable(handle: number, response: sqlops.ProfilerSessionEvents): void;
$onSessionStopped(handle: number, response: sqlops.ProfilerSessionStoppedParams): void; $onSessionStopped(handle: number, response: sqlops.ProfilerSessionStoppedParams): void;
$onJobDataUpdated(handle: Number): void;
/** /**
* Callback when a session has completed initialization * Callback when a session has completed initialization