mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Feature/agent2 adbist (#1113)
* added caching for jobs view and history page * added build fix * removed agent from cache service name * put cache in job mgmt service and fixed view destroy error * jobs view cache and refresh implemented * refresh and cache complete * added refresh to job history page * fixed steps style * explicitly tell user when no steps are available * show message when no prev runs available * code review refactor * cleaned code * added code that got left out
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import 'vs/css!./dashboardControlHostContainer';
|
import 'vs/css!./dashboardControlHostContainer';
|
||||||
|
|
||||||
import { Component, forwardRef, Input, AfterContentInit, ViewChild } from '@angular/core';
|
import { Component, forwardRef, Input, AfterContentInit, ViewChild, OnChanges } from '@angular/core';
|
||||||
import Event, { Emitter } from 'vs/base/common/event';
|
import Event, { Emitter } from 'vs/base/common/event';
|
||||||
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
|
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
|
||||||
import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||||
@@ -18,6 +18,7 @@ import { ControlHostContent } from 'sql/parts/dashboard/contents/controlHostCont
|
|||||||
</controlhost-content>
|
</controlhost-content>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
|
|
||||||
export class DashboardControlHostContainer extends DashboardTab implements AfterContentInit {
|
export class DashboardControlHostContainer extends DashboardTab implements AfterContentInit {
|
||||||
@Input() private tab: TabConfig;
|
@Input() private tab: TabConfig;
|
||||||
|
|
||||||
@@ -53,6 +54,6 @@ export class DashboardControlHostContainer extends DashboardTab implements After
|
|||||||
}
|
}
|
||||||
|
|
||||||
public refresh(): void {
|
public refresh(): void {
|
||||||
// no op
|
this._hostContent.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,4 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<agentview-component *ngIf="(controlType) === 'agent'">
|
<agentview-component #agent *ngIf="(controlType) === 'agent'"></agentview-component>
|
||||||
</agentview-component>
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import 'vs/css!./controlHostContent';
|
import 'vs/css!./controlHostContent';
|
||||||
|
|
||||||
import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef, ElementRef } from '@angular/core';
|
import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef, ElementRef, ViewChild } from '@angular/core';
|
||||||
|
|
||||||
import Event, { Emitter } from 'vs/base/common/event';
|
import Event, { Emitter } from 'vs/base/common/event';
|
||||||
import { Parts } from 'vs/workbench/services/part/common/partService';
|
import { Parts } from 'vs/workbench/services/part/common/partService';
|
||||||
@@ -16,12 +16,13 @@ import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboar
|
|||||||
|
|
||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
import { memoize } from 'vs/base/common/decorators';
|
import { memoize } from 'vs/base/common/decorators';
|
||||||
|
import { AgentViewComponent } from '../../jobManagement/agent/agentView.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: decodeURI(require.toUrl('sql/parts/dashboard/contents/controlHostContent.component.html')),
|
templateUrl: decodeURI(require.toUrl('sql/parts/dashboard/contents/controlHostContent.component.html')),
|
||||||
selector: 'controlhost-content'
|
selector: 'controlhost-content'
|
||||||
})
|
})
|
||||||
export class ControlHostContent implements OnInit {
|
export class ControlHostContent {
|
||||||
@Input() private webviewId: string;
|
@Input() private webviewId: string;
|
||||||
|
|
||||||
private _onResize = new Emitter<void>();
|
private _onResize = new Emitter<void>();
|
||||||
@@ -32,6 +33,9 @@ export class ControlHostContent implements OnInit {
|
|||||||
private _onMessageDisposable: IDisposable;
|
private _onMessageDisposable: IDisposable;
|
||||||
private _type: string;
|
private _type: string;
|
||||||
|
|
||||||
|
/* Children components */
|
||||||
|
@ViewChild('agent') private _agentViewComponent: AgentViewComponent;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface,
|
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface,
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||||
@@ -39,9 +43,6 @@ export class ControlHostContent implements OnInit {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public layout(): void {
|
public layout(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,4 +74,8 @@ export class ControlHostContent implements OnInit {
|
|||||||
public get controlType(): string {
|
public get controlType(): string {
|
||||||
return this._type;
|
return this._type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public refresh() {
|
||||||
|
this._agentViewComponent.refresh = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<jobsview-component></jobsview-component>
|
<jobsview-component></jobsview-component>
|
||||||
</div>
|
</div>
|
||||||
<div id="historyDiv" class="fullsize" *ngIf="showHistory === true">
|
<div id="historyDiv" class="fullsize" *ngIf="showHistory === true">
|
||||||
<jobhistory-component [jobId]="jobId" [agentJobInfo]="agentJobInfo" [agentJobHistories]="agentJobHistories"></jobhistory-component>
|
<jobhistory-component></jobhistory-component>
|
||||||
</div>
|
</div>
|
||||||
</tab>
|
</tab>
|
||||||
</panel>
|
</panel>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import 'vs/css!../common/media/jobs';
|
import 'vs/css!../common/media/jobs';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, Injectable } from '@angular/core';
|
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, Injectable} from '@angular/core';
|
||||||
import * as Utils from 'sql/parts/connection/common/utils';
|
import * as Utils from 'sql/parts/connection/common/utils';
|
||||||
import { RefreshWidgetAction, EditDashboardAction } from 'sql/parts/dashboard/common/actions';
|
import { RefreshWidgetAction, EditDashboardAction } from 'sql/parts/dashboard/common/actions';
|
||||||
import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||||
@@ -18,6 +18,7 @@ import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboar
|
|||||||
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';
|
||||||
|
|
||||||
|
|
||||||
export const DASHBOARD_SELECTOR: string = 'agentview-component';
|
export const DASHBOARD_SELECTOR: string = 'agentview-component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -31,14 +32,10 @@ export class AgentViewComponent {
|
|||||||
|
|
||||||
// tslint:disable:no-unused-variable
|
// tslint:disable:no-unused-variable
|
||||||
private readonly jobsComponentTitle: string = nls.localize('jobview.Jobs', "Jobs");
|
private readonly jobsComponentTitle: string = nls.localize('jobview.Jobs', "Jobs");
|
||||||
private readonly alertsComponentTitle: string = nls.localize('jobview.Alerts', "Alerts");
|
|
||||||
private readonly schedulesComponentTitle: string = nls.localize('jobview.Schedules', "Schedules");
|
|
||||||
private readonly operatorsComponentTitle: string = nls.localize('jobview.Operator', "Operators");
|
|
||||||
private readonly jobHistoryComponentTitle: string = nls.localize('jobview.History', "History");
|
|
||||||
private _showHistory: boolean = false;
|
private _showHistory: boolean = false;
|
||||||
private _jobId: string = null;
|
private _jobId: string = null;
|
||||||
private _agentJobInfo: AgentJobInfo = null;
|
private _agentJobInfo: AgentJobInfo = null;
|
||||||
private _agentJobHistories: AgentJobHistoryInfo[] = null;
|
private _refresh: boolean = undefined;
|
||||||
|
|
||||||
public jobsIconClass: string = 'jobsview-icon';
|
public jobsIconClass: string = 'jobsview-icon';
|
||||||
|
|
||||||
@@ -68,8 +65,8 @@ export class AgentViewComponent {
|
|||||||
return this._agentJobInfo;
|
return this._agentJobInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get agentJobHistories(): AgentJobHistoryInfo[] {
|
public get refresh(): boolean {
|
||||||
return this._agentJobHistories;
|
return this._refresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,8 +88,8 @@ export class AgentViewComponent {
|
|||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
public set agentJobHistories(value: AgentJobHistoryInfo[]) {
|
public set refresh(value: boolean) {
|
||||||
this._agentJobHistories = value;
|
this._refresh = value;
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import * as sqlops from 'sqlops';
|
|
||||||
import * as vscode from 'vscode';
|
|
||||||
import { IAgentJobCacheService } from './interfaces';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class AgentJobCacheService implements IAgentJobCacheService {
|
|
||||||
_serviceBrand: any;
|
|
||||||
private _jobs: sqlops.AgentJobInfo[];
|
|
||||||
private _jobHistories: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; } = {};
|
|
||||||
private _prevJobID: string;
|
|
||||||
|
|
||||||
/* Getters */
|
|
||||||
public get jobs(): sqlops.AgentJobInfo[] {
|
|
||||||
return this._jobs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get jobHistories(): { [jobId: string]: sqlops.AgentJobHistoryInfo[] } {
|
|
||||||
return this._jobHistories;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get prevJobID(): string {
|
|
||||||
return this._prevJobID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getJobHistory(jobID: string): sqlops.AgentJobHistoryInfo[] {
|
|
||||||
return this._jobHistories[jobID];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Setters */
|
|
||||||
public set jobs(value: sqlops.AgentJobInfo[]) {
|
|
||||||
this._jobs = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set jobHistories(value: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; }) {
|
|
||||||
this._jobHistories = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set prevJobID(value: string) {
|
|
||||||
this._prevJobID = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public setJobHistory(jobID:string, value: sqlops.AgentJobHistoryInfo[]) {
|
|
||||||
this._jobHistories[jobID] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -8,12 +8,11 @@
|
|||||||
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 { Table } from 'sql/base/browser/ui/table/table';
|
import { Table } from 'sql/base/browser/ui/table/table';
|
||||||
|
import { JobCacheObject } from './jobManagementService';
|
||||||
|
|
||||||
export const SERVICE_ID = 'jobManagementService';
|
export const SERVICE_ID = 'jobManagementService';
|
||||||
export const CACHE_ID = 'jobCacheService';
|
|
||||||
|
|
||||||
export const IJobManagementService = createDecorator<IJobManagementService>(SERVICE_ID);
|
export const IJobManagementService = createDecorator<IJobManagementService>(SERVICE_ID);
|
||||||
export const IAgentJobCacheService = createDecorator<IAgentJobCacheService>(CACHE_ID);
|
|
||||||
|
|
||||||
export interface IJobManagementService {
|
export interface IJobManagementService {
|
||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
@@ -25,18 +24,8 @@ export interface IJobManagementService {
|
|||||||
getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult>;
|
getJobHistory(connectionUri: string, jobID: string): Thenable<sqlops.AgentJobHistoryResult>;
|
||||||
|
|
||||||
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult>;
|
jobAction(connectionUri: string, jobName: string, action: string): Thenable<sqlops.AgentJobActionResult>;
|
||||||
}
|
|
||||||
|
|
||||||
export interface IAgentJobCacheService {
|
addToCache(server: string, cache: JobCacheObject);
|
||||||
_serviceBrand: any;
|
|
||||||
|
|
||||||
jobs: sqlops.AgentJobInfo[];
|
jobCacheObjectMap: { [server: string]: JobCacheObject; };
|
||||||
|
|
||||||
jobHistories: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; };
|
|
||||||
|
|
||||||
prevJobID: string;
|
|
||||||
|
|
||||||
getJobHistory(jobID: string): sqlops.AgentJobHistoryInfo[];
|
|
||||||
|
|
||||||
setJobHistory(jobID: string, value: sqlops.AgentJobHistoryInfo[]);
|
|
||||||
}
|
}
|
||||||
@@ -6,17 +6,20 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
|
import * as sqlops from 'sqlops';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
import { TPromise } from 'vs/base/common/winjs.base';
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||||
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
|
||||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||||
import { TPromise } from 'vs/base/common/winjs.base';
|
|
||||||
|
|
||||||
import * as sqlops from 'sqlops';
|
|
||||||
|
|
||||||
export class JobManagementService implements IJobManagementService {
|
export class JobManagementService implements IJobManagementService {
|
||||||
_serviceBrand: any;
|
_serviceBrand: any;
|
||||||
|
|
||||||
private _providers: { [handle: string]: sqlops.AgentServicesProvider; } = Object.create(null);
|
private _providers: { [handle: string]: sqlops.AgentServicesProvider; } = Object.create(null);
|
||||||
|
private _jobCacheObject : {[server: string]: JobCacheObject; } = {};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||||
@@ -60,4 +63,66 @@ export class JobManagementService implements IJobManagementService {
|
|||||||
public registerProvider(providerId: string, provider: sqlops.AgentServicesProvider): void {
|
public registerProvider(providerId: string, provider: sqlops.AgentServicesProvider): void {
|
||||||
this._providers[providerId] = provider;
|
this._providers[providerId] = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get jobCacheObjectMap(): {[server: string]: JobCacheObject;} {
|
||||||
|
return this._jobCacheObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addToCache(server: string, cacheObject: JobCacheObject) {
|
||||||
|
this._jobCacheObject[server] = cacheObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server level caching of jobs/job histories
|
||||||
|
*/
|
||||||
|
export class JobCacheObject {
|
||||||
|
_serviceBrand: any;
|
||||||
|
private _jobs: sqlops.AgentJobInfo[] = [];
|
||||||
|
private _jobHistories: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; } = {};
|
||||||
|
private _prevJobID: string;
|
||||||
|
private _serverName: string;
|
||||||
|
|
||||||
|
/* Getters */
|
||||||
|
public get jobs(): sqlops.AgentJobInfo[] {
|
||||||
|
return this._jobs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get jobHistories(): { [jobId: string]: sqlops.AgentJobHistoryInfo[] } {
|
||||||
|
return this._jobHistories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get prevJobID(): string {
|
||||||
|
return this._prevJobID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getJobHistory(jobID: string): sqlops.AgentJobHistoryInfo[] {
|
||||||
|
return this._jobHistories[jobID];
|
||||||
|
}
|
||||||
|
|
||||||
|
public get serverName(): string {
|
||||||
|
return this._serverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setters */
|
||||||
|
public set jobs(value: sqlops.AgentJobInfo[]) {
|
||||||
|
this._jobs = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set jobHistories(value: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; }) {
|
||||||
|
this._jobHistories = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set prevJobID(value: string) {
|
||||||
|
this._prevJobID = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public setJobHistory(jobID:string, value: sqlops.AgentJobHistoryInfo[]) {
|
||||||
|
this._jobHistories[jobID] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set serverName(value: string) {
|
||||||
|
this._serverName = value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<h1 class="job-heading">Jobs | {{agentJobInfo.name}} </h1>
|
<h1 class="job-heading">Jobs | {{this._agentJobInfo?.name}} </h1>
|
||||||
|
|
||||||
<!-- Back -->
|
<!-- Back -->
|
||||||
<div class="all-jobs">
|
<div class="all-jobs">
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
<!-- Actions -->
|
<!-- Actions -->
|
||||||
<ul class="action-buttons">
|
<ul class="action-buttons">
|
||||||
<li>
|
<li>
|
||||||
<div class="icon-start" (click)="jobAction('run', agentJobInfo.name)">Run</div>
|
<div class="icon-start" (click)="jobAction('run', this._agentJobInfo.name)">Run</div>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<div class="icon-stop" (click)="jobAction('stop', agentJobInfo.name)">Stop</div>
|
<div class="icon-stop" (click)="jobAction('stop', this._.agentJobInfo.name)">Stop</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -37,13 +37,13 @@
|
|||||||
Category:
|
Category:
|
||||||
</td>
|
</td>
|
||||||
<td id='col2'>
|
<td id='col2'>
|
||||||
{{agentJobInfo.category}}
|
{{this._agentJobInfo?.category}}
|
||||||
</td>
|
</td>
|
||||||
<td id='col3'>
|
<td id='col3'>
|
||||||
Enabled:
|
Enabled:
|
||||||
</td>
|
</td>
|
||||||
<td id='col4'>
|
<td id='col4'>
|
||||||
{{agentJobInfo.enabled}}
|
{{this._agentJobInfo?.enabled}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -51,13 +51,13 @@
|
|||||||
Has Alert:
|
Has Alert:
|
||||||
</td>
|
</td>
|
||||||
<td id='col2'>
|
<td id='col2'>
|
||||||
{{agentJobInfo.hasTarget}}
|
{{this._agentJobInfo?.hasTarget}}
|
||||||
</td>
|
</td>
|
||||||
<td id='col3'>
|
<td id='col3'>
|
||||||
Has Schedule:
|
Has Schedule:
|
||||||
</td>
|
</td>
|
||||||
<td id='col4'>
|
<td id='col4'>
|
||||||
{{agentJobInfo.hasSchedule}}
|
{{this._agentJobInfo?.hasSchedule}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -65,13 +65,13 @@
|
|||||||
Last Run:
|
Last Run:
|
||||||
</td>
|
</td>
|
||||||
<td id='col2'>
|
<td id='col2'>
|
||||||
{{agentJobInfo.lastRun}}
|
{{this._agentJobInfo?.lastRun}}
|
||||||
</td>
|
</td>
|
||||||
<td id='col3'>
|
<td id='col3'>
|
||||||
Next Run:
|
Next Run:
|
||||||
</td>
|
</td>
|
||||||
<td id='col4'>
|
<td id='col4'>
|
||||||
{{agentJobInfo.nextRun}}
|
{{this._agentJobInfo?.nextRun}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<div class='history-details'>
|
<div class='history-details'>
|
||||||
<!-- Previous run list -->
|
<!-- Previous run list -->
|
||||||
<div style="width: 20%">
|
<div style="width: 20%">
|
||||||
<table>
|
<table *ngIf="_showPreviousRuns === true">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="date-column">
|
<td class="date-column">
|
||||||
<b>Date</b>
|
<b>Date</b>
|
||||||
@@ -93,6 +93,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<h3 *ngIf="_showPreviousRuns === false">No Previous Runs Available</h3>
|
||||||
<div #table class="step-table prev-run-list" style="position: relative; height: 100%; width: 100%"></div>
|
<div #table class="step-table prev-run-list" style="position: relative; height: 100%; width: 100%"></div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Job Steps -->
|
<!-- Job Steps -->
|
||||||
@@ -158,7 +159,8 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<jobstepsview-component *ngIf="showSteps() === true" [stepRows]="_stepRows"></jobstepsview-component>
|
<jobstepsview-component *ngIf="showSteps === true" [stepRows]="_stepRows"></jobstepsview-component>
|
||||||
|
<h3 *ngIf="showSteps === false">No Steps Available</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -5,25 +5,26 @@
|
|||||||
|
|
||||||
import 'vs/css!./jobHistory';
|
import 'vs/css!./jobHistory';
|
||||||
|
|
||||||
import { OnInit, OnChanges, Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, OnDestroy, ViewChild, Input, Injectable, ChangeDetectionStrategy } from '@angular/core';
|
import { OnInit, OnChanges, Component, Inject, Input, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, ChangeDetectionStrategy } from '@angular/core';
|
||||||
import { AgentJobHistoryInfo, AgentJobInfo } from 'sqlops';
|
import { AgentJobHistoryInfo, AgentJobInfo } from 'sqlops';
|
||||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
|
||||||
|
import { localize } from 'vs/nls';
|
||||||
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
import Severity from 'vs/base/common/severity';
|
||||||
import { PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
|
import { PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
|
||||||
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
||||||
import { IJobManagementService, IAgentJobCacheService } from '../common/interfaces';
|
import { IJobManagementService } from '../common/interfaces';
|
||||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||||
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
||||||
import { JobHistoryController, JobHistoryDataSource,
|
import { JobHistoryController, JobHistoryDataSource,
|
||||||
JobHistoryRenderer, JobHistoryFilter, JobHistoryModel, JobHistoryRow } from 'sql/parts/jobManagement/views/jobHistoryTree';
|
JobHistoryRenderer, JobHistoryFilter, JobHistoryModel, JobHistoryRow } from 'sql/parts/jobManagement/views/jobHistoryTree';
|
||||||
import { JobStepsViewComponent } from 'sql/parts/jobManagement/views/jobStepsView.component';
|
import { JobStepsViewComponent } from 'sql/parts/jobManagement/views/jobStepsView.component';
|
||||||
import { JobStepsViewRow } from './jobStepsViewTree';
|
import { JobStepsViewRow } from './jobStepsViewTree';
|
||||||
import { localize } from 'vs/nls';
|
import { JobCacheObject } from 'sql/parts/jobManagement/common/jobManagementService';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
|
||||||
import Severity from 'vs/base/common/severity';
|
|
||||||
|
|
||||||
export const DASHBOARD_SELECTOR: string = 'jobhistory-component';
|
export const DASHBOARD_SELECTOR: string = 'jobhistory-component';
|
||||||
|
|
||||||
@@ -44,16 +45,17 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
|||||||
@ViewChild('table') private _tableContainer: ElementRef;
|
@ViewChild('table') private _tableContainer: ElementRef;
|
||||||
|
|
||||||
@Input() public agentJobInfo: AgentJobInfo = undefined;
|
@Input() public agentJobInfo: AgentJobInfo = undefined;
|
||||||
@Input() public jobId: string = undefined;
|
|
||||||
@Input() public agentJobHistories: AgentJobHistoryInfo[] = undefined;
|
@Input() public agentJobHistories: AgentJobHistoryInfo[] = undefined;
|
||||||
public agentJobHistoryInfo: AgentJobHistoryInfo = undefined;
|
public agentJobHistoryInfo: AgentJobHistoryInfo = undefined;
|
||||||
|
|
||||||
private _isVisible: boolean = false;
|
private _isVisible: boolean = false;
|
||||||
private _stepRows: JobStepsViewRow[] = [];
|
private _stepRows: JobStepsViewRow[] = [];
|
||||||
private _showSteps: boolean = false;
|
private _showSteps: boolean = undefined;
|
||||||
|
private _showPreviousRuns: boolean = undefined;
|
||||||
private _runStatus: string = undefined;
|
private _runStatus: string = undefined;
|
||||||
private _agentJobCacheService: IAgentJobCacheService;
|
private _jobCacheObject: JobCacheObject;
|
||||||
private _notificationService: INotificationService;
|
private _notificationService: INotificationService;
|
||||||
|
private _agentJobInfo: AgentJobInfo;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
|
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
|
||||||
@@ -68,8 +70,18 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
|||||||
this._treeRenderer = new JobHistoryRenderer();
|
this._treeRenderer = new JobHistoryRenderer();
|
||||||
this._treeFilter = new JobHistoryFilter();
|
this._treeFilter = new JobHistoryFilter();
|
||||||
this._jobManagementService = bootstrapService.jobManagementService;
|
this._jobManagementService = bootstrapService.jobManagementService;
|
||||||
this._agentJobCacheService = bootstrapService.agentJobCacheService;
|
|
||||||
this._notificationService = bootstrapService.notificationService;
|
this._notificationService = bootstrapService.notificationService;
|
||||||
|
let jobCacheObjectMap = this._jobManagementService.jobCacheObjectMap;
|
||||||
|
let serverName = _dashboardService.connectionManagementService.connectionInfo.connectionProfile.serverName;
|
||||||
|
let jobCache = jobCacheObjectMap[serverName];
|
||||||
|
if (jobCache) {
|
||||||
|
this._jobCacheObject = jobCache;
|
||||||
|
} else {
|
||||||
|
this._jobCacheObject = new JobCacheObject();
|
||||||
|
this._jobCacheObject.serverName = serverName;
|
||||||
|
this._jobManagementService.addToCache(serverName, this._jobCacheObject);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -103,8 +115,10 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
|||||||
stepViewRow.stepID = step.stepId.toString();
|
stepViewRow.stepID = step.stepId.toString();
|
||||||
return stepViewRow;
|
return stepViewRow;
|
||||||
});
|
});
|
||||||
|
this._showSteps = true;
|
||||||
|
} else {
|
||||||
|
this._showSteps = false;
|
||||||
}
|
}
|
||||||
this._showSteps = true;
|
|
||||||
self._cd.detectChanges();
|
self._cd.detectChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,23 +135,28 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentChecked() {
|
ngAfterContentChecked() {
|
||||||
|
this._agentJobInfo = this._agentViewComponent.agentJobInfo;
|
||||||
|
if (!this.agentJobInfo) {
|
||||||
|
this.agentJobInfo = this._agentJobInfo;
|
||||||
|
}
|
||||||
if (this._isVisible === false && this._tableContainer.nativeElement.offsetParent !== null) {
|
if (this._isVisible === false && this._tableContainer.nativeElement.offsetParent !== null) {
|
||||||
this._isVisible = true;
|
this._isVisible = true;
|
||||||
if (this.agentJobHistories && this.agentJobHistories.length > 0) {
|
let jobHistories = this._jobCacheObject.jobHistories[this._agentViewComponent.jobId];
|
||||||
if (this._agentJobCacheService.prevJobID === this.jobId || this.agentJobHistories[0].jobId === this.jobId) {
|
if (jobHistories && jobHistories.length > 0) {
|
||||||
this.agentJobHistoryInfo = this.agentJobHistories[0];
|
const self = this;
|
||||||
this.agentJobHistoryInfo.runDate = this.formatTime(this.agentJobHistories[0].runDate);
|
if (this._jobCacheObject.prevJobID === this._agentViewComponent.jobId || jobHistories[0].jobId === this._agentViewComponent.jobId) {
|
||||||
this._treeController.jobHistories = this.agentJobHistories;
|
this.buildHistoryTree(self, jobHistories);
|
||||||
this._agentJobCacheService.setJobHistory(this.jobId, this.agentJobHistories);
|
|
||||||
let jobHistoryRows = this._treeController.jobHistories.map(job => this.convertToJobHistoryRow(job));
|
|
||||||
this._treeDataSource.data = jobHistoryRows;
|
|
||||||
this._tree.setInput(new JobHistoryModel());
|
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
}
|
}
|
||||||
} else {
|
} else if (jobHistories && jobHistories.length === 0 ){
|
||||||
this.loadHistory();
|
this._showPreviousRuns = false;
|
||||||
|
this._showSteps = false;
|
||||||
|
this._cd.detectChanges();
|
||||||
}
|
}
|
||||||
this._agentJobCacheService.prevJobID = this.jobId;
|
this._jobCacheObject.prevJobID = this._agentViewComponent.jobId;
|
||||||
|
} else if (this._isVisible === true && this._agentViewComponent.refresh) {
|
||||||
|
this.loadHistory();
|
||||||
|
this._agentViewComponent.refresh = false;
|
||||||
} else if (this._isVisible === true && this._tableContainer.nativeElement.offsetParent === null) {
|
} else if (this._isVisible === true && this._tableContainer.nativeElement.offsetParent === null) {
|
||||||
this._isVisible = false;
|
this._isVisible = false;
|
||||||
}
|
}
|
||||||
@@ -146,22 +165,38 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
|||||||
loadHistory() {
|
loadHistory() {
|
||||||
const self = this;
|
const self = this;
|
||||||
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._jobManagementService.getJobHistory(ownerUri, this.jobId).then((result) => {
|
this._jobManagementService.getJobHistory(ownerUri, this._agentViewComponent.jobId).then((result) => {
|
||||||
if (result && result.jobs) {
|
if (result && result.jobs) {
|
||||||
self._treeController.jobHistories = result.jobs;
|
if (result.jobs.length > 0) {
|
||||||
self._agentJobCacheService.setJobHistory(self.jobId, result.jobs);
|
self._showPreviousRuns = true;
|
||||||
let jobHistoryRows = self._treeController.jobHistories.map(job => self.convertToJobHistoryRow(job));
|
self.buildHistoryTree(self, result.jobs);
|
||||||
self._treeDataSource.data = jobHistoryRows;
|
if (self._agentViewComponent.showHistory) {
|
||||||
self._tree.setInput(new JobHistoryModel());
|
self._cd.detectChanges();
|
||||||
self.agentJobHistoryInfo = self._treeController.jobHistories[0];
|
}
|
||||||
if (this.agentJobHistoryInfo) {
|
} else {
|
||||||
self.agentJobHistoryInfo.runDate = self.formatTime(self.agentJobHistoryInfo.runDate);
|
self._jobCacheObject.setJobHistory(self._agentViewComponent.jobId, result.jobs);
|
||||||
|
self._showPreviousRuns = false;
|
||||||
}
|
}
|
||||||
self._cd.detectChanges();
|
} else {
|
||||||
|
self._showPreviousRuns = false;
|
||||||
|
self._showSteps = false;
|
||||||
|
this._cd.detectChanges();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private buildHistoryTree(self: any, jobHistories: AgentJobHistoryInfo[]) {
|
||||||
|
self._treeController.jobHistories = jobHistories;
|
||||||
|
self._jobCacheObject.setJobHistory(self._agentViewComponent.jobId, jobHistories);
|
||||||
|
let jobHistoryRows = this._treeController.jobHistories.map(job => self.convertToJobHistoryRow(job));
|
||||||
|
self._treeDataSource.data = jobHistoryRows;
|
||||||
|
self._tree.setInput(new JobHistoryModel());
|
||||||
|
self.agentJobHistoryInfo = self._treeController.jobHistories[0];
|
||||||
|
if (self.agentJobHistoryInfo) {
|
||||||
|
self.agentJobHistoryInfo.runDate = self.formatTime(self.agentJobHistoryInfo.runDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private toggleCollapse(): void {
|
private toggleCollapse(): void {
|
||||||
let arrow: HTMLElement = $('.resultsViewCollapsible').get(0);
|
let arrow: HTMLElement = $('.resultsViewCollapsible').get(0);
|
||||||
let checkbox: any = document.getElementById('accordion');
|
let checkbox: any = document.getElementById('accordion');
|
||||||
@@ -221,8 +256,13 @@ export class JobHistoryComponent extends Disposable implements OnInit {
|
|||||||
return time.replace('T', ' ');
|
return time.replace('T', ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
public showSteps(): boolean {
|
public get showSteps(): boolean {
|
||||||
return this._showSteps;
|
return this._showSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public set showSteps(value: boolean) {
|
||||||
|
this._showSteps = value;
|
||||||
|
this._cd.detectChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,5 @@ export class JobStepsViewComponent extends Disposable implements OnInit, OnChang
|
|||||||
this._tree.setInput(new JobStepsViewModel());
|
this._tree.setInput(new JobStepsViewModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentChecked() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
padding-left: 50px;
|
padding-left: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-columns .step-id-col, .step-tree .tree-id-col {
|
.step-columns .step-id-col, .steps-tree .tree-id-col {
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -45,14 +45,14 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-columns .step-name-col, .step-tree .tree-name-col {
|
.step-columns .step-name-col, .steps-tree .tree-name-col {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 350px;
|
width: 350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-columns .step-message-col, .step-tree .tree-message-col {
|
.step-columns .step-message-col, .steps-tree .tree-message-col {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import 'vs/css!sql/parts/grid/media/slickGrid';
|
|||||||
import 'vs/css!../common/media/jobs';
|
import 'vs/css!../common/media/jobs';
|
||||||
import 'vs/css!../common/media/detailview';
|
import 'vs/css!../common/media/detailview';
|
||||||
|
|
||||||
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, Input } from '@angular/core';
|
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, AfterContentChecked } from '@angular/core';
|
||||||
import * as Utils from 'sql/parts/connection/common/utils';
|
import * as Utils from 'sql/parts/connection/common/utils';
|
||||||
import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||||
@@ -19,7 +19,7 @@ import * as themeColors from 'vs/workbench/common/theme';
|
|||||||
import { DashboardPage } from 'sql/parts/dashboard/common/dashboardPage.component';
|
import { DashboardPage } from 'sql/parts/dashboard/common/dashboardPage.component';
|
||||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||||
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
|
||||||
import { IJobManagementService, IAgentJobCacheService } from '../common/interfaces';
|
import { IJobManagementService } from '../common/interfaces';
|
||||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
@@ -31,7 +31,8 @@ import { attachTableStyler } from 'sql/common/theme/styler';
|
|||||||
import { JobHistoryComponent } from './jobHistory.component';
|
import { JobHistoryComponent } from './jobHistory.component';
|
||||||
import { AgentViewComponent } from '../agent/agentView.component';
|
import { AgentViewComponent } from '../agent/agentView.component';
|
||||||
import { RowDetailView } from 'sql/base/browser/ui/table/plugins/rowdetailview';
|
import { RowDetailView } from 'sql/base/browser/ui/table/plugins/rowdetailview';
|
||||||
import { AgentJobCacheService } from 'sql/parts/jobManagement/common/agentJobCacheService';
|
import { JobCacheObject } from 'sql/parts/jobManagement/common/jobManagementService';
|
||||||
|
|
||||||
|
|
||||||
export const JOBSVIEW_SELECTOR: string = 'jobsview-component';
|
export const JOBSVIEW_SELECTOR: string = 'jobsview-component';
|
||||||
|
|
||||||
@@ -39,10 +40,11 @@ export const JOBSVIEW_SELECTOR: string = 'jobsview-component';
|
|||||||
selector: JOBSVIEW_SELECTOR,
|
selector: JOBSVIEW_SELECTOR,
|
||||||
templateUrl: decodeURI(require.toUrl('./jobsView.component.html'))
|
templateUrl: decodeURI(require.toUrl('./jobsView.component.html'))
|
||||||
})
|
})
|
||||||
export class JobsViewComponent {
|
|
||||||
|
export class JobsViewComponent implements AfterContentChecked {
|
||||||
|
|
||||||
private _jobManagementService: IJobManagementService;
|
private _jobManagementService: IJobManagementService;
|
||||||
private _jobCacheService: IAgentJobCacheService;
|
private _jobCacheObject: JobCacheObject;
|
||||||
|
|
||||||
private _disposables = new Array<vscode.Disposable>();
|
private _disposables = new Array<vscode.Disposable>();
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ export class JobsViewComponent {
|
|||||||
private _table: Table<any>;
|
private _table: Table<any>;
|
||||||
public jobs: sqlops.AgentJobInfo[];
|
public jobs: sqlops.AgentJobInfo[];
|
||||||
public jobHistories: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; } = Object.create(null);
|
public jobHistories: { [jobId: string]: sqlops.AgentJobHistoryInfo[]; } = Object.create(null);
|
||||||
|
private _serverName: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
|
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
|
||||||
@@ -77,15 +80,24 @@ export class JobsViewComponent {
|
|||||||
@Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent
|
@Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent
|
||||||
) {
|
) {
|
||||||
this._jobManagementService = bootstrapService.jobManagementService;
|
this._jobManagementService = bootstrapService.jobManagementService;
|
||||||
this._jobCacheService = bootstrapService.agentJobCacheService;
|
let jobCacheObjectMap = this._jobManagementService.jobCacheObjectMap;
|
||||||
|
this._serverName = _dashboardService.connectionManagementService.connectionInfo.connectionProfile.serverName;
|
||||||
|
let jobCache = jobCacheObjectMap[this._serverName];
|
||||||
|
if (jobCache) {
|
||||||
|
this._jobCacheObject = jobCache;
|
||||||
|
} else {
|
||||||
|
this._jobCacheObject = new JobCacheObject();
|
||||||
|
this._jobCacheObject.serverName = this._serverName;
|
||||||
|
this._jobManagementService.addToCache(this._serverName, this._jobCacheObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentChecked() {
|
ngAfterContentChecked() {
|
||||||
if (this.isVisible === false && this._gridEl.nativeElement.offsetParent !== null) {
|
if (this.isVisible === false && this._gridEl.nativeElement.offsetParent !== null) {
|
||||||
this.isVisible = true;
|
this.isVisible = true;
|
||||||
if (!this.isInitialized) {
|
if (!this.isInitialized) {
|
||||||
if (this._jobCacheService.jobs !== undefined) {
|
if (this._jobCacheObject.serverName === this._serverName && this._jobCacheObject.jobs.length > 0) {
|
||||||
this.jobs = this._jobCacheService.jobs;
|
this.jobs = this._jobCacheObject.jobs;
|
||||||
this.onFirstVisible(true);
|
this.onFirstVisible(true);
|
||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -93,6 +105,11 @@ export class JobsViewComponent {
|
|||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (this.isVisible === true && this._agentViewComponent.refresh === true) {
|
||||||
|
this.onFirstVisible(false);
|
||||||
|
this._agentViewComponent.refresh = false;
|
||||||
|
} else if (this.isVisible === true && this._agentViewComponent.refresh === false) {
|
||||||
|
this.onFirstVisible(true);
|
||||||
} else if (this.isVisible === true && this._gridEl.nativeElement.offsetParent === null) {
|
} else if (this.isVisible === true && this._gridEl.nativeElement.offsetParent === null) {
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
}
|
}
|
||||||
@@ -117,10 +134,11 @@ export class JobsViewComponent {
|
|||||||
preTemplate: this.loadingTemplate,
|
preTemplate: this.loadingTemplate,
|
||||||
process: (job) => {
|
process: (job) => {
|
||||||
(<any>rowDetail).onAsyncResponse.notify({
|
(<any>rowDetail).onAsyncResponse.notify({
|
||||||
'itemDetail': job
|
'itemDetail': job,
|
||||||
}, undefined, this);
|
}, undefined, null);
|
||||||
},
|
},
|
||||||
panelRows: 2
|
panelRows: 2,
|
||||||
|
postTemplate: () => ''
|
||||||
});
|
});
|
||||||
|
|
||||||
this.rowDetail = rowDetail;
|
this.rowDetail = rowDetail;
|
||||||
@@ -132,24 +150,19 @@ export class JobsViewComponent {
|
|||||||
let job = self.getJob(args);
|
let job = self.getJob(args);
|
||||||
self._agentViewComponent.jobId = job.jobId;
|
self._agentViewComponent.jobId = job.jobId;
|
||||||
self._agentViewComponent.agentJobInfo = job;
|
self._agentViewComponent.agentJobInfo = job;
|
||||||
self.isVisible = false;
|
|
||||||
if (self._jobCacheService.getJobHistory(job.jobId)) {
|
|
||||||
self._agentViewComponent.agentJobHistories = self._jobCacheService.getJobHistory(job.jobId);
|
|
||||||
}
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
self._agentViewComponent.showHistory = true;
|
self._agentViewComponent.showHistory = true;
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
this._cd.detectChanges();
|
if (cached && this._agentViewComponent.refresh !== true) {
|
||||||
if (cached) {
|
this.onJobsAvailable(this._jobCacheObject.jobs);
|
||||||
this.onJobsAvailable(this._jobCacheService.jobs);
|
|
||||||
} else {
|
} else {
|
||||||
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
||||||
this._jobManagementService.getJobs(ownerUri).then((result) => {
|
this._jobManagementService.getJobs(ownerUri).then((result) => {
|
||||||
if (result && result.jobs) {
|
if (result && result.jobs) {
|
||||||
this.jobs = result.jobs;
|
self.jobs = result.jobs;
|
||||||
this._jobCacheService.jobs = this.jobs;
|
self._jobCacheObject.jobs = self.jobs;
|
||||||
this.onJobsAvailable(result.jobs);
|
self.onJobsAvailable(result.jobs);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -209,7 +222,7 @@ export class JobsViewComponent {
|
|||||||
this._jobManagementService.getJobHistory(ownerUri, job.jobId).then((result) => {
|
this._jobManagementService.getJobHistory(ownerUri, job.jobId).then((result) => {
|
||||||
if (result.jobs) {
|
if (result.jobs) {
|
||||||
this.jobHistories[job.jobId] = result.jobs;
|
this.jobHistories[job.jobId] = result.jobs;
|
||||||
this._jobCacheService.setJobHistory(job.jobId, result.jobs);
|
this._jobCacheObject.setJobHistory(job.jobId, result.jobs);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -222,4 +235,4 @@ export class JobsViewComponent {
|
|||||||
let job = this.jobs.filter(job => job.name === jobName)[0];
|
let job = this.jobs.filter(job => job.name === jobName)[0];
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
|||||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||||
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
|
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
import { IJobManagementService, IAgentJobCacheService } from 'sql/parts/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
|
||||||
@@ -95,7 +95,6 @@ export interface IBootstrapService {
|
|||||||
commandService: ICommandService;
|
commandService: ICommandService;
|
||||||
dashboardWebviewService: IDashboardWebviewService;
|
dashboardWebviewService: IDashboardWebviewService;
|
||||||
jobManagementService: IJobManagementService;
|
jobManagementService: IJobManagementService;
|
||||||
agentJobCacheService: IAgentJobCacheService;
|
|
||||||
environmentService: IEnvironmentService;
|
environmentService: IEnvironmentService;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
|||||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||||
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
|
import { ConfigurationEditingService } from 'vs/workbench/services/configuration/node/configurationEditingService';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
import { IJobManagementService, IAgentJobCacheService } from 'sql/parts/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
|
||||||
@@ -104,7 +104,6 @@ export class BootstrapService implements IBootstrapService {
|
|||||||
@ICommandService public commandService: ICommandService,
|
@ICommandService public commandService: ICommandService,
|
||||||
@IDashboardWebviewService public dashboardWebviewService: IDashboardWebviewService,
|
@IDashboardWebviewService public dashboardWebviewService: IDashboardWebviewService,
|
||||||
@IJobManagementService public jobManagementService: IJobManagementService,
|
@IJobManagementService public jobManagementService: IJobManagementService,
|
||||||
@IAgentJobCacheService public agentJobCacheService: IAgentJobCacheService,
|
|
||||||
@IEnvironmentService public environmentService: IEnvironmentService
|
@IEnvironmentService public environmentService: IEnvironmentService
|
||||||
) {
|
) {
|
||||||
this.configurationEditorService = this.instantiationService.createInstance(ConfigurationEditingService);
|
this.configurationEditorService = this.instantiationService.createInstance(ConfigurationEditingService);
|
||||||
|
|||||||
2
src/typings/modules/@angular/core/index.d.ts
vendored
2
src/typings/modules/@angular/core/index.d.ts
vendored
@@ -6633,7 +6633,7 @@ export class ResolvedReflectiveFactory {
|
|||||||
/**
|
/**
|
||||||
* Factory function which can return an instance of an object represented by a key.
|
* Factory function which can return an instance of an object represented by a key.
|
||||||
*/
|
*/
|
||||||
factory: Function,
|
factory: Function,
|
||||||
/**
|
/**
|
||||||
* Arguments (dependencies) to the `factory` function.
|
* Arguments (dependencies) to the `factory` function.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -130,9 +130,8 @@ import { IQueryManagementService, QueryManagementService } from 'sql/parts/query
|
|||||||
import { IEditorDescriptorService, EditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
import { IEditorDescriptorService, EditorDescriptorService } from 'sql/parts/query/editor/editorDescriptorService';
|
||||||
import { IScriptingService, ScriptingService } from 'sql/services/scripting/scriptingService';
|
import { IScriptingService, ScriptingService } from 'sql/services/scripting/scriptingService';
|
||||||
import { IAdminService, AdminService } from 'sql/parts/admin/common/adminService';
|
import { IAdminService, AdminService } from 'sql/parts/admin/common/adminService';
|
||||||
import { IJobManagementService, IAgentJobCacheService } from 'sql/parts/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||||
import { JobManagementService } from 'sql/parts/jobManagement/common/jobManagementService';
|
import { JobManagementService } from 'sql/parts/jobManagement/common/jobManagementService';
|
||||||
import { AgentJobCacheService } from 'sql/parts/jobManagement/common/agentJobCacheService';
|
|
||||||
import { IBackupService, IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
import { IBackupService, IBackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupService';
|
||||||
import { BackupService, BackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupServiceImp';
|
import { BackupService, BackupUiService } from 'sql/parts/disasterRecovery/backup/common/backupServiceImp';
|
||||||
import { IRestoreDialogController, IRestoreService } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
import { IRestoreDialogController, IRestoreService } from 'sql/parts/disasterRecovery/restore/common/restoreService';
|
||||||
@@ -703,7 +702,6 @@ export class Workbench implements IPartService {
|
|||||||
serviceCollection.set(IScriptingService, this.instantiationService.createInstance(ScriptingService));
|
serviceCollection.set(IScriptingService, this.instantiationService.createInstance(ScriptingService));
|
||||||
serviceCollection.set(IAdminService, this.instantiationService.createInstance(AdminService));
|
serviceCollection.set(IAdminService, this.instantiationService.createInstance(AdminService));
|
||||||
serviceCollection.set(IJobManagementService, this.instantiationService.createInstance(JobManagementService));
|
serviceCollection.set(IJobManagementService, this.instantiationService.createInstance(JobManagementService));
|
||||||
serviceCollection.set(IAgentJobCacheService, this.instantiationService.createInstance(AgentJobCacheService));
|
|
||||||
serviceCollection.set(IBackupService, this.instantiationService.createInstance(BackupService));
|
serviceCollection.set(IBackupService, this.instantiationService.createInstance(BackupService));
|
||||||
serviceCollection.set(IBackupUiService, this.instantiationService.createInstance(BackupUiService));
|
serviceCollection.set(IBackupUiService, this.instantiationService.createInstance(BackupUiService));
|
||||||
serviceCollection.set(IRestoreService, this.instantiationService.createInstance(RestoreService));
|
serviceCollection.set(IRestoreService, this.instantiationService.createInstance(RestoreService));
|
||||||
|
|||||||
Reference in New Issue
Block a user