Change feature flag for SQL kernel to be user preference (#3838)

* Change feature flag for SQL kernel to be user preference

* fix test that was broken

* Tweak package.nls.json to show "(Preview)"
This commit is contained in:
Chris LaFreniere
2019-01-30 17:29:08 -08:00
committed by GitHub
parent 0dab7f02ed
commit 83a6ee0a22
6 changed files with 18 additions and 8 deletions

View File

@@ -234,7 +234,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
private async loadModel(): Promise<void> {
await this.awaitNonDefaultProvider();
let providerId = notebookUtils.sqlNotebooksEnabled() ? 'sql' : this._notebookParams.providers.find(provider => provider !== DEFAULT_NOTEBOOK_PROVIDER); // this is tricky; really should also depend on the connection profile
let providerId = notebookUtils.sqlNotebooksEnabled(this.contextKeyService) ? 'sql' : this._notebookParams.providers.find(provider => provider !== DEFAULT_NOTEBOOK_PROVIDER); // this is tricky; really should also depend on the connection profile
this.setContextKeyServiceWithProviderId(providerId);
this.fillInActionsForCurrentContext();
for (let providerId of this._notebookParams.providers) {
@@ -248,7 +248,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
notificationService: this.notificationService,
notebookManagers: this.notebookManagers,
standardKernels: this._notebookParams.input.standardKernels,
providerId: notebookUtils.sqlNotebooksEnabled() ? 'sql' : 'jupyter', // this is tricky; really should also depend on the connection profile
providerId: notebookUtils.sqlNotebooksEnabled(this.contextKeyService) ? 'sql' : 'jupyter', // this is tricky; really should also depend on the connection profile
defaultKernel: this._notebookParams.input.defaultKernel,
capabilitiesService: this.capabilitiesService
}, false, this.profile);

View File

@@ -12,6 +12,7 @@ import * as pfs from 'vs/base/node/pfs';
import { localize } from 'vs/nls';
import { IOutputChannel } from 'vs/workbench/parts/output/common/output';
import { DEFAULT_NOTEBOOK_PROVIDER, DEFAULT_NOTEBOOK_FILETYPE, INotebookService } from 'sql/workbench/services/notebook/common/notebookService';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
/**
@@ -73,9 +74,9 @@ export function getStandardKernelsForProvider(providerId: string, notebookServic
return <IStandardKernelWithProvider[]>(standardKernels);
}
// Private feature flag to enable Sql Notebook experience
export function sqlNotebooksEnabled() {
return process.env['SQLOPS_SQL_NOTEBOOK'] !== undefined;
// Feature flag to enable Sql Notebook experience
export function sqlNotebooksEnabled(contextKeyService: IContextKeyService) {
return contextKeyService.contextMatchesRules(ContextKeyExpr.equals('config.notebook.sqlKernelEnabled', true));
}
export interface IStandardKernelWithProvider {

View File

@@ -30,6 +30,7 @@ import { Deferred } from 'sql/base/common/promise';
import { SqlSessionManager } from 'sql/workbench/services/notebook/common/sqlSessionManager';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { sqlNotebooksEnabled } from 'sql/parts/notebook/notebookUtils';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
export interface NotebookProviderProperties {
provider: string;
@@ -88,7 +89,8 @@ export class NotebookService extends Disposable implements INotebookService {
@IStorageService private _storageService: IStorageService,
@IExtensionService extensionService: IExtensionService,
@IExtensionManagementService extensionManagementService: IExtensionManagementService,
@IInstantiationService private _instantiationService: IInstantiationService
@IInstantiationService private _instantiationService: IInstantiationService,
@IContextKeyService private _contextKeyService: IContextKeyService
) {
super();
this._register(notebookRegistry.onNewRegistration(this.updateRegisteredProviders, this));
@@ -351,7 +353,7 @@ export class NotebookService extends Disposable implements INotebookService {
}
private registerBuiltInProvider() {
if (!sqlNotebooksEnabled()) {
if (!sqlNotebooksEnabled(this._contextKeyService)) {
let defaultProvider = new BuiltinProvider();
this.registerProvider(defaultProvider.providerId, defaultProvider);
notebookRegistry.registerNotebookProvider({