Add dashboard context (database vs server) to scoped context (#893)

* explicitly add dashboard context to scoped context

* formatting
This commit is contained in:
Anthony Dresser
2018-03-13 13:54:37 -07:00
committed by GitHub
parent f3c7b2416b
commit 722f5e56cd
3 changed files with 6 additions and 2 deletions

View File

@@ -95,6 +95,7 @@ export abstract class DashboardPage extends AngularDisposable {
}
protected init() {
this.dashboardService.dashboardContextKey.set(this.context);
if (!this.dashboardService.connectionManagementService.connectionInfo) {
this.dashboardService.messageService.show(Severity.Warning, nls.localize('missingConnectionInfo', 'No connection information could be found for this dashboard'));
} else {

View File

@@ -44,7 +44,6 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
this.refresh(true);
this._cd.detectChanges();
}));
}
ngOnInit() {

View File

@@ -44,7 +44,7 @@ import * as nls from 'vs/nls';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { deepClone } from 'vs/base/common/objects';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
const DASHBOARD_SETTINGS = 'dashboard';
@@ -157,6 +157,9 @@ export class DashboardServiceInterface extends AngularDisposable {
private _onCloseTab = new Emitter<string>();
public readonly onCloseTab: Event<string> = this._onCloseTab.event;
private _dashboardContextKey = new RawContextKey<string>('dashboardContext', undefined);
public dashboardContextKey: IContextKey<string>;
private _numberOfPageNavigations = 0;
constructor(
@@ -250,6 +253,7 @@ export class DashboardServiceInterface extends AngularDisposable {
this._bootstrapParams = this._bootstrapService.getBootstrapParams<DashboardComponentParams>(this._uniqueSelector);
this.uri = this._bootstrapParams.ownerUri;
this._contextKeyService = this._bootstrapParams.scopedContextService;
this.dashboardContextKey = this._dashboardContextKey.bindTo(this._contextKeyService);
}
/**