mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
fix loading perf when switching tabs (#3169)
This commit is contained in:
@@ -15,7 +15,7 @@ import 'vs/css!sql/base/browser/ui/table/media/table';
|
|||||||
import * as dom from 'vs/base/browser/dom';
|
import * as dom from 'vs/base/browser/dom';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit } from '@angular/core';
|
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||||
import { Table } from 'sql/base/browser/ui/table/table';
|
import { Table } from 'sql/base/browser/ui/table/table';
|
||||||
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
||||||
@@ -41,7 +41,7 @@ export const ROW_HEIGHT: number = 45;
|
|||||||
templateUrl: decodeURI(require.toUrl('./alertsView.component.html')),
|
templateUrl: decodeURI(require.toUrl('./alertsView.component.html')),
|
||||||
providers: [{ provide: TabChild, useExisting: forwardRef(() => AlertsViewComponent) }],
|
providers: [{ provide: TabChild, useExisting: forwardRef(() => AlertsViewComponent) }],
|
||||||
})
|
})
|
||||||
export class AlertsViewComponent extends JobManagementView implements OnInit {
|
export class AlertsViewComponent extends JobManagementView implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private columns: Array<Slick.Column<any>> = [
|
private columns: Array<Slick.Column<any>> = [
|
||||||
{
|
{
|
||||||
@@ -69,6 +69,7 @@ export class AlertsViewComponent extends JobManagementView implements OnInit {
|
|||||||
private _isCloud: boolean;
|
private _isCloud: boolean;
|
||||||
private _alertsCacheObject: AlertsCacheObject;
|
private _alertsCacheObject: AlertsCacheObject;
|
||||||
|
|
||||||
|
private _didTabChange: boolean;
|
||||||
@ViewChild('jobalertsgrid') _gridEl: ElementRef;
|
@ViewChild('jobalertsgrid') _gridEl: ElementRef;
|
||||||
|
|
||||||
public alerts: sqlops.AgentAlertInfo[];
|
public alerts: sqlops.AgentAlertInfo[];
|
||||||
@@ -86,6 +87,7 @@ export class AlertsViewComponent extends JobManagementView implements OnInit {
|
|||||||
@Inject(IKeybindingService) keybindingService: IKeybindingService,
|
@Inject(IKeybindingService) keybindingService: IKeybindingService,
|
||||||
@Inject(IDashboardService) _dashboardService: IDashboardService) {
|
@Inject(IDashboardService) _dashboardService: IDashboardService) {
|
||||||
super(commonService, _dashboardService, contextMenuService, keybindingService, instantiationService);
|
super(commonService, _dashboardService, contextMenuService, keybindingService, instantiationService);
|
||||||
|
this._didTabChange = false;
|
||||||
this._isCloud = commonService.connectionManagementService.connectionInfo.serverInfo.isCloud;
|
this._isCloud = commonService.connectionManagementService.connectionInfo.serverInfo.isCloud;
|
||||||
let alertsCacheObjectMap = this._jobManagementService.alertsCacheObjectMap;
|
let alertsCacheObjectMap = this._jobManagementService.alertsCacheObjectMap;
|
||||||
let alertsCache = alertsCacheObjectMap[this._serverName];
|
let alertsCache = alertsCacheObjectMap[this._serverName];
|
||||||
@@ -104,6 +106,10 @@ export class AlertsViewComponent extends JobManagementView implements OnInit {
|
|||||||
this._parentComponent = this._agentViewComponent;
|
this._parentComponent = this._agentViewComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this._didTabChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
let height = dom.getContentHeight(this._gridEl.nativeElement) - 10;
|
let height = dom.getContentHeight(this._gridEl.nativeElement) - 10;
|
||||||
if (height < 0) {
|
if (height < 0) {
|
||||||
@@ -166,8 +172,10 @@ export class AlertsViewComponent extends JobManagementView implements OnInit {
|
|||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
}
|
}
|
||||||
this._showProgressWheel = false;
|
this._showProgressWheel = false;
|
||||||
if (this.isVisible) {
|
if (this.isVisible && !this._didTabChange) {
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
|
} else if (this._didTabChange) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import 'vs/css!sql/base/browser/ui/table/media/table';
|
|||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import * as dom from 'vs/base/browser/dom';
|
import * as dom from 'vs/base/browser/dom';
|
||||||
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit } from '@angular/core';
|
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||||
import { Table } from 'sql/base/browser/ui/table/table';
|
import { Table } from 'sql/base/browser/ui/table/table';
|
||||||
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
||||||
@@ -47,7 +47,7 @@ export const ROW_HEIGHT: number = 45;
|
|||||||
providers: [{ provide: TabChild, useExisting: forwardRef(() => JobsViewComponent) }],
|
providers: [{ provide: TabChild, useExisting: forwardRef(() => JobsViewComponent) }],
|
||||||
})
|
})
|
||||||
|
|
||||||
export class JobsViewComponent extends JobManagementView implements OnInit {
|
export class JobsViewComponent extends JobManagementView implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private columns: Array<Slick.Column<any>> = [
|
private columns: Array<Slick.Column<any>> = [
|
||||||
{
|
{
|
||||||
@@ -91,6 +91,8 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
private jobSchedules: { [jobId: string]: sqlops.AgentJobScheduleInfo[]; } = Object.create(null);
|
private jobSchedules: { [jobId: string]: sqlops.AgentJobScheduleInfo[]; } = Object.create(null);
|
||||||
public contextAction = NewJobAction;
|
public contextAction = NewJobAction;
|
||||||
|
|
||||||
|
private _didTabChange: boolean;
|
||||||
|
|
||||||
@ViewChild('jobsgrid') _gridEl: ElementRef;
|
@ViewChild('jobsgrid') _gridEl: ElementRef;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -107,6 +109,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
@Inject(IDashboardService) _dashboardService: IDashboardService
|
@Inject(IDashboardService) _dashboardService: IDashboardService
|
||||||
) {
|
) {
|
||||||
super(commonService, _dashboardService, contextMenuService, keybindingService, instantiationService);
|
super(commonService, _dashboardService, contextMenuService, keybindingService, instantiationService);
|
||||||
|
this._didTabChange = false;
|
||||||
let jobCacheObjectMap = this._jobManagementService.jobCacheObjectMap;
|
let jobCacheObjectMap = this._jobManagementService.jobCacheObjectMap;
|
||||||
let jobCache = jobCacheObjectMap[this._serverName];
|
let jobCache = jobCacheObjectMap[this._serverName];
|
||||||
if (jobCache) {
|
if (jobCache) {
|
||||||
@@ -126,6 +129,10 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e)));
|
this._register(this._themeService.onDidColorThemeChange(e => this.updateTheme(e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this._didTabChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
let jobsViewToolbar = $('jobsview-component .actionbar-container').get(0);
|
let jobsViewToolbar = $('jobsview-component .actionbar-container').get(0);
|
||||||
let statusBar = $('.part.statusbar').get(0);
|
let statusBar = $('.part.statusbar').get(0);
|
||||||
@@ -208,8 +215,10 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._showProgressWheel = false;
|
this._showProgressWheel = false;
|
||||||
if (this.isVisible) {
|
if (this.isVisible && !this._didTabChange) {
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
|
} else if (this._didTabChange) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -579,7 +588,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
private async curateJobHistory(jobs: sqlops.AgentJobInfo[], ownerUri: string) {
|
private async curateJobHistory(jobs: sqlops.AgentJobInfo[], ownerUri: string) {
|
||||||
const self = this;
|
const self = this;
|
||||||
jobs.forEach(async (job) => {
|
jobs.forEach(async (job) => {
|
||||||
await this._jobManagementService.getJobHistory(ownerUri, job.jobId, job.name).then((result) => {
|
await this._jobManagementService.getJobHistory(ownerUri, job.jobId, job.name).then(async(result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
self.jobSteps[job.jobId] = result.steps ? result.steps : [];
|
self.jobSteps[job.jobId] = result.steps ? result.steps : [];
|
||||||
self.jobAlerts[job.jobId] = result.alerts ? result.alerts : [];
|
self.jobAlerts[job.jobId] = result.alerts ? result.alerts : [];
|
||||||
@@ -594,7 +603,10 @@ export class JobsViewComponent extends JobManagementView implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
previousRuns = jobHistories;
|
previousRuns = jobHistories;
|
||||||
}
|
}
|
||||||
|
// dont create the charts if the tab changed
|
||||||
|
if (!self._didTabChange) {
|
||||||
self.createJobChart(job.jobId, previousRuns);
|
self.createJobChart(job.jobId, previousRuns);
|
||||||
|
}
|
||||||
if (self._agentViewComponent.expanded.has(job.jobId)) {
|
if (self._agentViewComponent.expanded.has(job.jobId)) {
|
||||||
let lastJobHistory = jobHistories[jobHistories.length - 1];
|
let lastJobHistory = jobHistories[jobHistories.length - 1];
|
||||||
let item = self.dataView.getItemById(job.jobId + '.error');
|
let item = self.dataView.getItemById(job.jobId + '.error');
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import 'vs/css!sql/base/browser/ui/table/media/table';
|
|||||||
import * as dom from 'vs/base/browser/dom';
|
import * as dom from 'vs/base/browser/dom';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit } from '@angular/core';
|
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { Table } from 'sql/base/browser/ui/table/table';
|
import { Table } from 'sql/base/browser/ui/table/table';
|
||||||
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
||||||
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||||
@@ -42,7 +42,7 @@ export const ROW_HEIGHT: number = 45;
|
|||||||
providers: [{ provide: TabChild, useExisting: forwardRef(() => OperatorsViewComponent) }],
|
providers: [{ provide: TabChild, useExisting: forwardRef(() => OperatorsViewComponent) }],
|
||||||
})
|
})
|
||||||
|
|
||||||
export class OperatorsViewComponent extends JobManagementView implements OnInit {
|
export class OperatorsViewComponent extends JobManagementView implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private columns: Array<Slick.Column<any>> = [
|
private columns: Array<Slick.Column<any>> = [
|
||||||
{
|
{
|
||||||
@@ -68,6 +68,7 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
|||||||
private _isCloud: boolean;
|
private _isCloud: boolean;
|
||||||
private _operatorsCacheObject: OperatorsCacheObject;
|
private _operatorsCacheObject: OperatorsCacheObject;
|
||||||
|
|
||||||
|
private _didTabChange: boolean;
|
||||||
@ViewChild('operatorsgrid') _gridEl: ElementRef;
|
@ViewChild('operatorsgrid') _gridEl: ElementRef;
|
||||||
|
|
||||||
public operators: sqlops.AgentOperatorInfo[];
|
public operators: sqlops.AgentOperatorInfo[];
|
||||||
@@ -104,6 +105,10 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
|||||||
this._parentComponent = this._agentViewComponent;
|
this._parentComponent = this._agentViewComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this._didTabChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
let height = dom.getContentHeight(this._gridEl.nativeElement) - 10;
|
let height = dom.getContentHeight(this._gridEl.nativeElement) - 10;
|
||||||
if (height < 0) {
|
if (height < 0) {
|
||||||
@@ -169,8 +174,10 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
|||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
}
|
}
|
||||||
this._showProgressWheel = false;
|
this._showProgressWheel = false;
|
||||||
if (this.isVisible) {
|
if (this.isVisible && !this._didTabChange) {
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
|
} else if (this._didTabChange) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import 'vs/css!sql/base/browser/ui/table/media/table';
|
|||||||
import * as dom from 'vs/base/browser/dom';
|
import * as dom from 'vs/base/browser/dom';
|
||||||
import * as sqlops from 'sqlops';
|
import * as sqlops from 'sqlops';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit } from '@angular/core';
|
import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnInit, OnDestroy } from '@angular/core';
|
||||||
import { Table } from 'sql/base/browser/ui/table/table';
|
import { Table } from 'sql/base/browser/ui/table/table';
|
||||||
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
||||||
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||||
@@ -42,7 +42,7 @@ export const ROW_HEIGHT: number = 45;
|
|||||||
providers: [{ provide: TabChild, useExisting: forwardRef(() => ProxiesViewComponent) }],
|
providers: [{ provide: TabChild, useExisting: forwardRef(() => ProxiesViewComponent) }],
|
||||||
})
|
})
|
||||||
|
|
||||||
export class ProxiesViewComponent extends JobManagementView implements OnInit {
|
export class ProxiesViewComponent extends JobManagementView implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private NewProxyText: string = nls.localize('jobProxyToolbar-NewItem', "New Proxy");
|
private NewProxyText: string = nls.localize('jobProxyToolbar-NewItem', "New Proxy");
|
||||||
private RefreshText: string = nls.localize('jobProxyToolbar-Refresh', "Refresh");
|
private RefreshText: string = nls.localize('jobProxyToolbar-Refresh', "Refresh");
|
||||||
@@ -75,6 +75,7 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
|
|||||||
public proxies: sqlops.AgentProxyInfo[];
|
public proxies: sqlops.AgentProxyInfo[];
|
||||||
public readonly contextAction = NewProxyAction;
|
public readonly contextAction = NewProxyAction;
|
||||||
|
|
||||||
|
private _didTabChange: boolean;
|
||||||
@ViewChild('proxiesgrid') _gridEl: ElementRef;
|
@ViewChild('proxiesgrid') _gridEl: ElementRef;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -108,6 +109,10 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
|
|||||||
this._parentComponent = this._agentViewComponent;
|
this._parentComponent = this._agentViewComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this._didTabChange = true;
|
||||||
|
}
|
||||||
|
|
||||||
public layout() {
|
public layout() {
|
||||||
let height = dom.getContentHeight(this._gridEl.nativeElement) - 10;
|
let height = dom.getContentHeight(this._gridEl.nativeElement) - 10;
|
||||||
if (height < 0) {
|
if (height < 0) {
|
||||||
@@ -172,8 +177,10 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit {
|
|||||||
// TODO: handle error
|
// TODO: handle error
|
||||||
}
|
}
|
||||||
this._showProgressWheel = false;
|
this._showProgressWheel = false;
|
||||||
if (this.isVisible) {
|
if (this.isVisible && !this._didTabChange) {
|
||||||
this._cd.detectChanges();
|
this._cd.detectChanges();
|
||||||
|
} else if (this._didTabChange) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user