Fix agent steps refresh when changing history (#9446)

* layering

* switch to events and emitters

* changed to self
This commit is contained in:
Aditya Bist
2020-03-05 12:33:47 -08:00
committed by GitHub
parent a93cc68e24
commit 997e91f19c
5 changed files with 33 additions and 18 deletions

View File

@@ -12,12 +12,22 @@ export const SERVICE_ID = 'jobManagementService';
export const IJobManagementService = createDecorator<IJobManagementService>(SERVICE_ID);
export interface IJobStepsViewRow {
stepId: string;
stepName: string;
message: string;
rowID: string;
runStatus: string;
}
export interface IJobManagementService {
_serviceBrand: undefined;
onDidChange: Event<void>;
stepsChanged: Event<IJobStepsViewRow[]>;
registerProvider(providerId: string, provider: azdata.AgentServicesProvider): void;
fireOnDidChange(): void;
onStepsChange(data: IJobStepsViewRow[]): void;
getJobs(connectionUri: string): Thenable<azdata.AgentJobsResult>;
getJobHistory(connectionUri: string, jobID: string, jobName: string): Thenable<azdata.AgentJobHistoryResult>;

View File

@@ -5,7 +5,7 @@
import { localize } from 'vs/nls';
import * as azdata from 'azdata';
import { IJobManagementService } from 'sql/workbench/services/jobManagement/common/interfaces';
import { IJobManagementService, IJobStepsViewRow } from 'sql/workbench/services/jobManagement/common/interfaces';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { Event, Emitter } from 'vs/base/common/event';
@@ -15,6 +15,10 @@ export class JobManagementService implements IJobManagementService {
private _onDidChange = new Emitter<void>();
public readonly onDidChange: Event<void> = this._onDidChange.event;
// data oservables for steps tree
private _stepsChanged: Emitter<IJobStepsViewRow[]> = new Emitter<IJobStepsViewRow[]>();
public stepsChanged: Event<IJobStepsViewRow[]> = this._stepsChanged.event;
private _providers: { [handle: string]: azdata.AgentServicesProvider; } = Object.create(null);
private _jobCacheObjectMap: { [server: string]: JobCacheObject; } = {};
private _operatorsCacheObjectMap: { [server: string]: OperatorsCacheObject; } = {};
@@ -23,8 +27,7 @@ export class JobManagementService implements IJobManagementService {
private _notebookCacheObjectMap: { [server: string]: NotebookCacheObject; } = {};
constructor(
@IConnectionManagementService private _connectionService: IConnectionManagementService
) {
}
) { }
public fireOnDidChange(): void {
this._onDidChange.fire(void 0);
@@ -62,6 +65,11 @@ export class JobManagementService implements IJobManagementService {
});
}
// Notify Steps changed to steps tree
public onStepsChange(data: IJobStepsViewRow[]): void {
this._stepsChanged.fire(data);
}
// Notebooks
public getNotebooks(connectionUri: string): Thenable<azdata.AgentNotebooksResult> {
return this._runAction(connectionUri, (runner) => {