mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 09:35:38 -05:00
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:
@@ -18,6 +18,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||
import { AgentJobInfo, AgentJobHistoryInfo } from 'sqlops';
|
||||
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';
|
||||
@@ -56,8 +57,15 @@ export class AgentViewComponent {
|
||||
};
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef) {
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
|
||||
@Inject(IJobManagementService) jobManagementService: IJobManagementService) {
|
||||
this._expanded = new Map<string, string>();
|
||||
|
||||
let self = this;
|
||||
jobManagementService.onDidChange((args) => {
|
||||
self.refresh = true;
|
||||
self._cd.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
import * as sqlops from 'sqlops';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { JobCacheObject } from './jobManagementService';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
|
||||
export const SERVICE_ID = 'jobManagementService';
|
||||
|
||||
@@ -15,8 +16,10 @@ export const IJobManagementService = createDecorator<IJobManagementService>(SERV
|
||||
|
||||
export interface IJobManagementService {
|
||||
_serviceBrand: any;
|
||||
onDidChange: Event<void>;
|
||||
|
||||
registerProvider(providerId: string, provider: sqlops.AgentServicesProvider): void;
|
||||
fireOnDidChange(): void;
|
||||
|
||||
getJobs(connectionUri: string): Thenable<sqlops.AgentJobsResult>;
|
||||
getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult>;
|
||||
|
||||
@@ -244,11 +244,17 @@ export class EditAlertAction extends Action {
|
||||
public static ID = 'jobaction.editAlert';
|
||||
public static LABEL = nls.localize('jobaction.editAlert', "Edit Alert");
|
||||
|
||||
constructor() {
|
||||
constructor(
|
||||
@ICommandService private _commandService: ICommandService
|
||||
) {
|
||||
super(EditAlertAction.ID, EditAlertAction.LABEL);
|
||||
}
|
||||
|
||||
public run(actionInfo: IJobActionInfo): TPromise<boolean> {
|
||||
this._commandService.executeCommand(
|
||||
'agent.openAlertDialog',
|
||||
actionInfo.ownerUri,
|
||||
actionInfo.targetObject);
|
||||
return TPromise.as(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,14 @@ import * as sqlops from 'sqlops';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
|
||||
export class JobManagementService implements IJobManagementService {
|
||||
_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 _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> {
|
||||
return this._runAction(connectionUri, (runner) => {
|
||||
return runner.getJobs(connectionUri);
|
||||
|
||||
@@ -164,7 +164,7 @@ export class AlertsViewComponent extends JobManagementView implements OnInit {
|
||||
|
||||
public openCreateAlertDialog() {
|
||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||
this._commandService.executeCommand('agent.openCreateAlertDialog', ownerUri);
|
||||
this._commandService.executeCommand('agent.openAlertDialog', ownerUri);
|
||||
}
|
||||
|
||||
private refreshJobs() {
|
||||
|
||||
@@ -136,7 +136,7 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
|
||||
private onProxiesAvailable(proxies: sqlops.AgentProxyInfo[]) {
|
||||
let items: any = proxies.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
id: item.accountName,
|
||||
accountName: item.accountName,
|
||||
credentialName: item.credentialName
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user