mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
rename context key databasename to databaseName (#903)
* rename context key databasename to databaseName * maintain correct context on database name
This commit is contained in:
@@ -12,7 +12,7 @@ export class ConnectionContextkey implements IContextKey<IConnectionProfile> {
|
|||||||
|
|
||||||
static Provider = new RawContextKey<string>('connectionProvider', undefined);
|
static Provider = new RawContextKey<string>('connectionProvider', undefined);
|
||||||
static Server = new RawContextKey<string>('serverName', 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);
|
static Connection = new RawContextKey<IConnectionProfile>('connection', undefined);
|
||||||
|
|
||||||
private _providerKey: IContextKey<string>;
|
private _providerKey: IContextKey<string>;
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import { DashboardComponentParams } from 'sql/services/bootstrap/bootstrapParams
|
|||||||
import { DASHBOARD_SELECTOR } from 'sql/parts/dashboard/dashboard.component';
|
import { DASHBOARD_SELECTOR } from 'sql/parts/dashboard/dashboard.component';
|
||||||
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
|
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
|
||||||
import { IDashboardService } from 'sql/services/dashboard/common/dashboardService';
|
import { IDashboardService } from 'sql/services/dashboard/common/dashboardService';
|
||||||
import { ConnectionProfile } from '../connection/common/connectionProfile';
|
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
|
||||||
import { IConnectionProfile } from 'sqlops';
|
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||||
|
|
||||||
export class DashboardEditor extends BaseEditor {
|
export class DashboardEditor extends BaseEditor {
|
||||||
@@ -117,7 +117,8 @@ export class DashboardEditor extends BaseEditor {
|
|||||||
let params: DashboardComponentParams = {
|
let params: DashboardComponentParams = {
|
||||||
connection: input.connectionProfile,
|
connection: input.connectionProfile,
|
||||||
ownerUri: input.uri,
|
ownerUri: input.uri,
|
||||||
scopedContextService: scopedContextService
|
scopedContextService,
|
||||||
|
connectionContextKey
|
||||||
};
|
};
|
||||||
|
|
||||||
input.hasBootstrapped = true;
|
input.hasBootstrapped = true;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
|
|||||||
import { TabSettingConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
import { TabSettingConfig } from 'sql/parts/dashboard/common/dashboardWidget';
|
||||||
import { IDashboardWebviewService } from 'sql/services/dashboardWebview/common/dashboardWebviewService';
|
import { IDashboardWebviewService } from 'sql/services/dashboardWebview/common/dashboardWebviewService';
|
||||||
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
||||||
|
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
|
||||||
|
|
||||||
import { ProviderMetadata, DatabaseInfo, SimpleExecuteResult } from 'sqlops';
|
import { ProviderMetadata, DatabaseInfo, SimpleExecuteResult } from 'sqlops';
|
||||||
|
|
||||||
@@ -70,11 +71,16 @@ export class SingleConnectionManagementService {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _connectionService: IConnectionManagementService,
|
private _connectionService: IConnectionManagementService,
|
||||||
private _uri: string
|
private _uri: string,
|
||||||
|
private _contextKey: ConnectionContextkey
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public changeDatabase(name: string): Thenable<boolean> {
|
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 {
|
public get connectionInfo(): ConnectionManagementInfo {
|
||||||
@@ -160,6 +166,8 @@ export class DashboardServiceInterface extends AngularDisposable {
|
|||||||
private _dashboardContextKey = new RawContextKey<string>('dashboardContext', undefined);
|
private _dashboardContextKey = new RawContextKey<string>('dashboardContext', undefined);
|
||||||
public dashboardContextKey: IContextKey<string>;
|
public dashboardContextKey: IContextKey<string>;
|
||||||
|
|
||||||
|
private _connectionContextKey: ConnectionContextkey;
|
||||||
|
|
||||||
private _numberOfPageNavigations = 0;
|
private _numberOfPageNavigations = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -251,9 +259,10 @@ export class DashboardServiceInterface extends AngularDisposable {
|
|||||||
|
|
||||||
private _getbootstrapParams(): void {
|
private _getbootstrapParams(): void {
|
||||||
this._bootstrapParams = this._bootstrapService.getBootstrapParams<DashboardComponentParams>(this._uniqueSelector);
|
this._bootstrapParams = this._bootstrapService.getBootstrapParams<DashboardComponentParams>(this._uniqueSelector);
|
||||||
this.uri = this._bootstrapParams.ownerUri;
|
|
||||||
this._contextKeyService = this._bootstrapParams.scopedContextService;
|
this._contextKeyService = this._bootstrapParams.scopedContextService;
|
||||||
|
this._connectionContextKey = this._bootstrapParams.connectionContextKey;
|
||||||
this.dashboardContextKey = this._dashboardContextKey.bindTo(this._contextKeyService);
|
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) {
|
private set uri(uri: string) {
|
||||||
this._uri = uri;
|
this._uri = uri;
|
||||||
this._metadataService = new SingleConnectionMetadataService(this._bootstrapService.metadataService, this._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._adminService = new SingleAdminService(this._bootstrapService.adminService, this._uri);
|
||||||
this._queryManagementService = new SingleQueryManagementService(this._bootstrapService.queryManagementService, this._uri);
|
this._queryManagementService = new SingleQueryManagementService(this._bootstrapService.queryManagementService, this._uri);
|
||||||
this._register(toDisposableSubscription(this._bootstrapService.angularEventingService.onAngularEvent(this._uri, (event) => this.handleDashboardEvent(event))));
|
this._register(toDisposableSubscription(this._bootstrapService.angularEventingService.onAngularEvent(this._uri, (event) => this.handleDashboardEvent(event))));
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
import { DataService } from 'sql/parts/grid/services/dataService';
|
import { DataService } from 'sql/parts/grid/services/dataService';
|
||||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
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 {
|
export interface BootstrapParams {
|
||||||
}
|
}
|
||||||
@@ -22,6 +23,7 @@ export interface DashboardComponentParams extends BootstrapParams {
|
|||||||
connection: IConnectionProfile;
|
connection: IConnectionProfile;
|
||||||
ownerUri: string;
|
ownerUri: string;
|
||||||
scopedContextService: IContextKeyService;
|
scopedContextService: IContextKeyService;
|
||||||
|
connectionContextKey: ConnectionContextkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TaskDialogComponentParams extends BootstrapParams {
|
export interface TaskDialogComponentParams extends BootstrapParams {
|
||||||
|
|||||||
Reference in New Issue
Block a user