mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Add preview features enabled flag to issue reporter info (#20808)
* Add preview features enabled flag to issue reporter info * fix tests * fix key
This commit is contained in:
@@ -26,6 +26,8 @@ export const ToggleWholeWordCommandId = 'toggleSearchWholeWord';
|
||||
export const ToggleRegexCommandId = 'toggleSearchRegex';
|
||||
export const AddCursorsAtSearchResults = 'addCursorsAtSearchResults';
|
||||
|
||||
export const CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES = 'workbench.enablePreviewFeatures';
|
||||
|
||||
export const SearchViewFocusedKey = new RawContextKey<boolean>('notebookSearchViewletFocus', false);
|
||||
export const InputBoxFocusedKey = new RawContextKey<boolean>('inputBoxFocus', false);
|
||||
export const SearchInputBoxFocusedKey = new RawContextKey<boolean>('searchInputBoxFocus', false);
|
||||
|
||||
@@ -17,6 +17,7 @@ import { IBackupUiService } from 'sql/workbench/contrib/backup/common/backupUiSe
|
||||
import { Task } from 'sql/workbench/services/tasks/browser/tasksRegistry';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
export const BackupFeatureName = 'backup';
|
||||
export const backupIsPreviewFeature = localize('backup.isPreviewFeature', "You must enable preview features in order to use backup");
|
||||
@@ -44,7 +45,7 @@ export class BackupAction extends Task {
|
||||
|
||||
runTask(accessor: ServicesAccessor, profile?: IConnectionProfile): void | Promise<void> {
|
||||
const configurationService = accessor.get<IConfigurationService>(IConfigurationService);
|
||||
const previewFeaturesEnabled = configurationService.getValue<{ enablePreviewFeatures: boolean }>('workbench').enablePreviewFeatures;
|
||||
const previewFeaturesEnabled = configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
|
||||
if (!previewFeaturesEnabled) {
|
||||
return accessor.get<INotificationService>(INotificationService).info(backupIsPreviewFeature);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/tex
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionOptionSpecialType } from 'sql/platform/connection/common/interfaces';
|
||||
import { ICodeEditorViewState } from 'vs/editor/common/editorCommon';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
const QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'queryEditorViewState';
|
||||
|
||||
@@ -211,7 +212,7 @@ export class QueryEditor extends EditorPane {
|
||||
this._exportAsNotebookAction = this.instantiationService.createInstance(actions.ExportAsNotebookAction, this);
|
||||
this.setTaskbarContent();
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('workbench.enablePreviewFeatures')) {
|
||||
if (e.affectsConfiguration(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES)) {
|
||||
this.setTaskbarContent();
|
||||
}
|
||||
}));
|
||||
@@ -297,7 +298,7 @@ export class QueryEditor extends EditorPane {
|
||||
}
|
||||
|
||||
private setTaskbarContent(): void {
|
||||
const previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||
const previewFeaturesEnabled = this.configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
|
||||
const fileExtension = path.extname(this.input?.uri || '');
|
||||
const providerId = this.currentProvider;
|
||||
const content: ITaskbarContent[] = [
|
||||
|
||||
@@ -24,6 +24,7 @@ import { localize } from 'vs/nls';
|
||||
import { Extensions as ViewContainerExtensions, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'resourceViewer.openResourceViewer',
|
||||
@@ -56,7 +57,7 @@ class ResourceViewerContributor implements IWorkbenchContribution {
|
||||
@IProductService readonly productService: IProductService
|
||||
) {
|
||||
// Only show for insiders and dev
|
||||
if (['insider', ''].includes(productService.quality ?? '') && configurationService.getValue('workbench.enablePreviewFeatures')) {
|
||||
if (['insider', ''].includes(productService.quality ?? '') && configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES)) {
|
||||
registerResourceViewerContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Task } from 'sql/workbench/services/tasks/browser/tasksRegistry';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
export function showRestore(accessor: ServicesAccessor, connection: IConnectionProfile): Promise<void> {
|
||||
const restoreDialogService = accessor.get(IRestoreDialogController);
|
||||
@@ -46,7 +47,7 @@ export class RestoreAction extends Task {
|
||||
runTask(accessor: ServicesAccessor, withProfile?: IConnectionProfile): void | Promise<void> {
|
||||
let profile = withProfile;
|
||||
const configurationService = accessor.get<IConfigurationService>(IConfigurationService);
|
||||
const previewFeaturesEnabled: boolean = configurationService.getValue<{ enablePreviewFeatures: boolean }>('workbench').enablePreviewFeatures;
|
||||
const previewFeaturesEnabled: boolean = configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
|
||||
if (!previewFeaturesEnabled) {
|
||||
return accessor.get<INotificationService>(INotificationService).info(restoreIsPreviewFeature);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { localize } from 'vs/nls';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContribution {
|
||||
|
||||
@@ -23,7 +24,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
|
||||
) { }
|
||||
|
||||
protected handlePreviewFeatures(): void {
|
||||
let previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||
let previewFeaturesEnabled = this.configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
|
||||
if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) {
|
||||
return;
|
||||
}
|
||||
@@ -34,7 +35,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
|
||||
if (!focused && count > 1) {
|
||||
return null;
|
||||
}
|
||||
await this.configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
||||
await this.configurationService.updateValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, false);
|
||||
|
||||
const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Preview features enhance your experience in Azure Data Studio by giving you full access to new features and improvements. You can learn more about preview features [here]({0}). Would you like to enable preview features?", 'https://aka.ms/ads-preview-features');
|
||||
this.notificationService.prompt(
|
||||
@@ -43,18 +44,18 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
|
||||
[{
|
||||
label: localize('enablePreviewFeatures.yes', "Yes (recommended)"),
|
||||
run: () => {
|
||||
this.configurationService.updateValue('workbench.enablePreviewFeatures', true).catch(e => onUnexpectedError(e));
|
||||
this.configurationService.updateValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, true).catch(e => onUnexpectedError(e));
|
||||
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
}
|
||||
}, {
|
||||
label: localize('enablePreviewFeatures.no', "No"),
|
||||
run: () => {
|
||||
this.configurationService.updateValue('workbench.enablePreviewFeatures', false).catch(e => onUnexpectedError(e));
|
||||
this.configurationService.updateValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, false).catch(e => onUnexpectedError(e));
|
||||
}
|
||||
}, {
|
||||
label: localize('enablePreviewFeatures.never', "No, don't show again"),
|
||||
run: () => {
|
||||
this.configurationService.updateValue('workbench.enablePreviewFeatures', false).catch(e => onUnexpectedError(e));
|
||||
this.configurationService.updateValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES, false).catch(e => onUnexpectedError(e));
|
||||
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
},
|
||||
isSecondary: true
|
||||
|
||||
@@ -25,6 +25,7 @@ import { AsyncRecentConnectionTreeDataSource } from 'sql/workbench/services/obje
|
||||
import { AsyncServerTreeDataSource } from 'sql/workbench/services/objectExplorer/browser/asyncServerTreeDataSource';
|
||||
import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
export class TreeCreationUtils {
|
||||
/**
|
||||
@@ -141,5 +142,5 @@ export class TreeCreationUtils {
|
||||
}
|
||||
|
||||
function useAsyncServerTree(configurationService: IConfigurationService): boolean {
|
||||
return configurationService.getValue<boolean>('workbench.enablePreviewFeatures') && configurationService.getValue<boolean>('serverTree.useAsyncServerTree');
|
||||
return configurationService.getValue<boolean>(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES) && configurationService.getValue<boolean>('serverTree.useAsyncServerTree');
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { isUndefined } from 'vs/base/common/types';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
|
||||
|
||||
export const SERVICE_ID = 'queryManagementService';
|
||||
|
||||
@@ -336,7 +337,7 @@ export class QueryManagementService implements IQueryManagementService {
|
||||
public onResultSetUpdated(resultSetInfo: azdata.QueryExecuteResultSetNotificationParams): void {
|
||||
this._notify(resultSetInfo.ownerUri, (runner: QueryRunner) => {
|
||||
runner.handleResultSetUpdated(resultSetInfo.resultSetSummary);
|
||||
if (resultSetInfo.executionPlans && this._configurationService.getValue('workbench.enablePreviewFeatures')) {
|
||||
if (resultSetInfo.executionPlans && this._configurationService.getValue<boolean>(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES)) {
|
||||
runner.handleExecutionPlanAvailable(resultSetInfo.executionPlans);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user