Isolate more features (#6854)

* working; new query and scripting

* working; removing manage from menus and combining data explorer contributions

* consolidate dashboard contributions; move manage action to dashboard contributions; make groupings the same

* fix notebook actions not firing

* fix notebook actions

* notebooks working

* move backup and restore entry points into their own file; move explorerwidget contribution into their respective files

* fix tests

* move extension actions to their own file

* fix tests

* change tests
This commit is contained in:
Anthony Dresser
2019-08-22 16:54:30 -07:00
committed by GitHub
parent 36244ed517
commit 82a8f09709
19 changed files with 616 additions and 589 deletions

View File

@@ -3,13 +3,11 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
import { ConnectionProviderProperties } from 'sql/workbench/parts/connection/common/connectionProviderExtension';
import * as azdata from 'sqlops';
import { Event } from 'vs/base/common/event';
import { IAction } from 'vs/base/common/actions';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export const SERVICE_ID = 'capabilitiesService';
@@ -49,11 +47,6 @@ export interface ICapabilitiesService {
*/
registerProvider(provider: azdata.CapabilitiesProvider): void;
/**
* Returns true if the feature is available for given connection
*/
isFeatureAvailable(action: IAction, connectionManagementInfo: ConnectionManagementInfo): boolean;
/**
* When new capabilities are registered, it emits the @see ProviderFeatures, which can be used to get the new capabilities
*/

View File

@@ -10,17 +10,13 @@ import { Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { Registry } from 'vs/platform/registry/common/platform';
import { IAction } from 'vs/base/common/actions';
import * as azdata from 'azdata';
import { entries } from 'sql/base/common/objects';
import { RestoreFeatureName, BackupFeatureName } from 'sql/workbench/common/actions';
import { toObject } from 'sql/base/common/map';
import { ConnectionProviderProperties, IConnectionProviderRegistry, Extensions as ConnectionExtensions } from 'sql/workbench/parts/connection/common/connectionProviderExtension';
import { ICapabilitiesService, ProviderFeatures, clientCapabilities } from 'sql/platform/capabilities/common/capabilitiesService';
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
const connectionRegistry = Registry.as<IConnectionProviderRegistry>(ConnectionExtensions.ConnectionProviderContributions);
@@ -152,38 +148,6 @@ export class CapabilitiesService extends Disposable implements ICapabilitiesServ
});
}
/**
* Returns true if the feature is available for given connection
* @param featureComponent a component which should have the feature name
* @param connectionManagementInfo connectionManagementInfo
*/
public isFeatureAvailable(action: IAction, connectionManagementInfo: ConnectionManagementInfo): boolean {
let isCloud = connectionManagementInfo && connectionManagementInfo.serverInfo && connectionManagementInfo.serverInfo.isCloud;
let isMssql = connectionManagementInfo.connectionProfile.providerName === mssqlProviderName;
// TODO: The logic should from capabilities service.
if (action) {
let featureName: string = action.id;
switch (featureName) {
case BackupFeatureName:
if (isMssql) {
return connectionManagementInfo.connectionProfile.databaseName && !isCloud;
} else {
return !!connectionManagementInfo.connectionProfile.databaseName;
}
case RestoreFeatureName:
if (isMssql) {
return !isCloud;
} else {
return !!connectionManagementInfo.connectionProfile.databaseName;
}
default:
return true;
}
} else {
return true;
}
}
private shutdown(): void {
this._momento.saveMemento();
}