rename context key databasename to databaseName (#903)

* rename context key databasename to databaseName

* maintain correct context on database name
This commit is contained in:
Anthony Dresser
2018-03-16 19:52:33 -07:00
committed by GitHub
parent 38bedea0bd
commit 40550d0840
4 changed files with 21 additions and 9 deletions

View File

@@ -12,7 +12,7 @@ export class ConnectionContextkey implements IContextKey<IConnectionProfile> {
static Provider = new RawContextKey<string>('connectionProvider', undefined);
static Server = new RawContextKey<string>('serverName', undefined);
static Database = new RawContextKey<string>('databasename', undefined);
static Database = new RawContextKey<string>('databaseName', undefined);
static Connection = new RawContextKey<IConnectionProfile>('connection', undefined);
private _providerKey: IContextKey<string>;

View File

@@ -20,8 +20,8 @@ import { DashboardComponentParams } from 'sql/services/bootstrap/bootstrapParams
import { DASHBOARD_SELECTOR } from 'sql/parts/dashboard/dashboard.component';
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
import { IDashboardService } from 'sql/services/dashboard/common/dashboardService';
import { ConnectionProfile } from '../connection/common/connectionProfile';
import { IConnectionProfile } from 'sqlops';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
export class DashboardEditor extends BaseEditor {
@@ -117,7 +117,8 @@ export class DashboardEditor extends BaseEditor {
let params: DashboardComponentParams = {
connection: input.connectionProfile,
ownerUri: input.uri,
scopedContextService: scopedContextService
scopedContextService,
connectionContextKey
};
input.hasBootstrapped = true;

View File

@@ -25,6 +25,7 @@ import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
import { TabSettingConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { IDashboardWebviewService } from 'sql/services/dashboardWebview/common/dashboardWebviewService';
import { AngularDisposable } from 'sql/base/common/lifecycle';
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
import { ProviderMetadata, DatabaseInfo, SimpleExecuteResult } from 'sqlops';
@@ -70,11 +71,16 @@ export class SingleConnectionManagementService {
constructor(
private _connectionService: IConnectionManagementService,
private _uri: string
private _uri: string,
private _contextKey: ConnectionContextkey
) { }
public changeDatabase(name: string): Thenable<boolean> {
return this._connectionService.changeDatabase(this._uri, name);
return this._connectionService.changeDatabase(this._uri, name).then(e => {
// we need to update our context
this._contextKey.set(this.connectionInfo.connectionProfile);
return e;
});
}
public get connectionInfo(): ConnectionManagementInfo {
@@ -160,6 +166,8 @@ export class DashboardServiceInterface extends AngularDisposable {
private _dashboardContextKey = new RawContextKey<string>('dashboardContext', undefined);
public dashboardContextKey: IContextKey<string>;
private _connectionContextKey: ConnectionContextkey;
private _numberOfPageNavigations = 0;
constructor(
@@ -251,9 +259,10 @@ export class DashboardServiceInterface extends AngularDisposable {
private _getbootstrapParams(): void {
this._bootstrapParams = this._bootstrapService.getBootstrapParams<DashboardComponentParams>(this._uniqueSelector);
this.uri = this._bootstrapParams.ownerUri;
this._contextKeyService = this._bootstrapParams.scopedContextService;
this._connectionContextKey = this._bootstrapParams.connectionContextKey;
this.dashboardContextKey = this._dashboardContextKey.bindTo(this._contextKeyService);
this.uri = this._bootstrapParams.ownerUri;
}
/**
@@ -263,7 +272,7 @@ export class DashboardServiceInterface extends AngularDisposable {
private set uri(uri: string) {
this._uri = uri;
this._metadataService = new SingleConnectionMetadataService(this._bootstrapService.metadataService, this._uri);
this._connectionManagementService = new SingleConnectionManagementService(this._bootstrapService.connectionManagementService, this._uri);
this._connectionManagementService = new SingleConnectionManagementService(this._bootstrapService.connectionManagementService, this._uri, this._connectionContextKey);
this._adminService = new SingleAdminService(this._bootstrapService.adminService, this._uri);
this._queryManagementService = new SingleQueryManagementService(this._bootstrapService.queryManagementService, this._uri);
this._register(toDisposableSubscription(this._bootstrapService.angularEventingService.onAngularEvent(this._uri, (event) => this.handleDashboardEvent(event))));

View File

@@ -5,7 +5,8 @@
import { DataService } from 'sql/parts/grid/services/dataService';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
export interface BootstrapParams {
}
@@ -22,6 +23,7 @@ export interface DashboardComponentParams extends BootstrapParams {
connection: IConnectionProfile;
ownerUri: string;
scopedContextService: IContextKeyService;
connectionContextKey: ConnectionContextkey;
}
export interface TaskDialogComponentParams extends BootstrapParams {