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:
Charles Gagnon
2022-10-11 15:46:32 -07:00
committed by GitHub
parent 22a2bce55e
commit 3005d5435f
13 changed files with 37 additions and 13 deletions

View File

@@ -26,6 +26,8 @@ export const ToggleWholeWordCommandId = 'toggleSearchWholeWord';
export const ToggleRegexCommandId = 'toggleSearchRegex'; export const ToggleRegexCommandId = 'toggleSearchRegex';
export const AddCursorsAtSearchResults = 'addCursorsAtSearchResults'; export const AddCursorsAtSearchResults = 'addCursorsAtSearchResults';
export const CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES = 'workbench.enablePreviewFeatures';
export const SearchViewFocusedKey = new RawContextKey<boolean>('notebookSearchViewletFocus', false); export const SearchViewFocusedKey = new RawContextKey<boolean>('notebookSearchViewletFocus', false);
export const InputBoxFocusedKey = new RawContextKey<boolean>('inputBoxFocus', false); export const InputBoxFocusedKey = new RawContextKey<boolean>('inputBoxFocus', false);
export const SearchInputBoxFocusedKey = new RawContextKey<boolean>('searchInputBoxFocus', false); export const SearchInputBoxFocusedKey = new RawContextKey<boolean>('searchInputBoxFocus', false);

View File

@@ -17,6 +17,7 @@ import { IBackupUiService } from 'sql/workbench/contrib/backup/common/backupUiSe
import { Task } from 'sql/workbench/services/tasks/browser/tasksRegistry'; import { Task } from 'sql/workbench/services/tasks/browser/tasksRegistry';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService'; import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile'; import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
export const BackupFeatureName = 'backup'; export const BackupFeatureName = 'backup';
export const backupIsPreviewFeature = localize('backup.isPreviewFeature', "You must enable preview features in order to use 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> { runTask(accessor: ServicesAccessor, profile?: IConnectionProfile): void | Promise<void> {
const configurationService = accessor.get<IConfigurationService>(IConfigurationService); const configurationService = accessor.get<IConfigurationService>(IConfigurationService);
const previewFeaturesEnabled = configurationService.getValue<{ enablePreviewFeatures: boolean }>('workbench').enablePreviewFeatures; const previewFeaturesEnabled = configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES);
if (!previewFeaturesEnabled) { if (!previewFeaturesEnabled) {
return accessor.get<INotificationService>(INotificationService).info(backupIsPreviewFeature); return accessor.get<INotificationService>(INotificationService).info(backupIsPreviewFeature);
} }

View File

@@ -46,6 +46,7 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/tex
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService'; import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { ConnectionOptionSpecialType } from 'sql/platform/connection/common/interfaces'; import { ConnectionOptionSpecialType } from 'sql/platform/connection/common/interfaces';
import { ICodeEditorViewState } from 'vs/editor/common/editorCommon'; import { ICodeEditorViewState } from 'vs/editor/common/editorCommon';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
const QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'queryEditorViewState'; 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._exportAsNotebookAction = this.instantiationService.createInstance(actions.ExportAsNotebookAction, this);
this.setTaskbarContent(); this.setTaskbarContent();
this._register(this.configurationService.onDidChangeConfiguration(e => { this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration('workbench.enablePreviewFeatures')) { if (e.affectsConfiguration(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES)) {
this.setTaskbarContent(); this.setTaskbarContent();
} }
})); }));
@@ -297,7 +298,7 @@ export class QueryEditor extends EditorPane {
} }
private setTaskbarContent(): void { 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 fileExtension = path.extname(this.input?.uri || '');
const providerId = this.currentProvider; const providerId = this.currentProvider;
const content: ITaskbarContent[] = [ const content: ITaskbarContent[] = [

View File

@@ -24,6 +24,7 @@ import { localize } from 'vs/nls';
import { Extensions as ViewContainerExtensions, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation } from 'vs/workbench/common/views'; import { Extensions as ViewContainerExtensions, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation } from 'vs/workbench/common/views';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IProductService } from 'vs/platform/product/common/productService'; import { IProductService } from 'vs/platform/product/common/productService';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
CommandsRegistry.registerCommand({ CommandsRegistry.registerCommand({
id: 'resourceViewer.openResourceViewer', id: 'resourceViewer.openResourceViewer',
@@ -56,7 +57,7 @@ class ResourceViewerContributor implements IWorkbenchContribution {
@IProductService readonly productService: IProductService @IProductService readonly productService: IProductService
) { ) {
// Only show for insiders and dev // 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(); registerResourceViewerContainer();
} }
} }

View File

@@ -17,6 +17,7 @@ import { Task } from 'sql/workbench/services/tasks/browser/tasksRegistry';
import { mssqlProviderName } from 'sql/platform/connection/common/constants'; import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService'; import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile'; 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> { export function showRestore(accessor: ServicesAccessor, connection: IConnectionProfile): Promise<void> {
const restoreDialogService = accessor.get(IRestoreDialogController); const restoreDialogService = accessor.get(IRestoreDialogController);
@@ -46,7 +47,7 @@ export class RestoreAction extends Task {
runTask(accessor: ServicesAccessor, withProfile?: IConnectionProfile): void | Promise<void> { runTask(accessor: ServicesAccessor, withProfile?: IConnectionProfile): void | Promise<void> {
let profile = withProfile; let profile = withProfile;
const configurationService = accessor.get<IConfigurationService>(IConfigurationService); 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) { if (!previewFeaturesEnabled) {
return accessor.get<INotificationService>(INotificationService).info(restoreIsPreviewFeature); return accessor.get<INotificationService>(INotificationService).info(restoreIsPreviewFeature);
} }

View File

@@ -10,6 +10,7 @@ import { localize } from 'vs/nls';
import { onUnexpectedError } from 'vs/base/common/errors'; import { onUnexpectedError } from 'vs/base/common/errors';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IHostService } from 'vs/workbench/services/host/browser/host'; import { IHostService } from 'vs/workbench/services/host/browser/host';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContribution { export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContribution {
@@ -23,7 +24,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
) { } ) { }
protected handlePreviewFeatures(): void { 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)) { if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) {
return; return;
} }
@@ -34,7 +35,7 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
if (!focused && count > 1) { if (!focused && count > 1) {
return null; 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'); 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( this.notificationService.prompt(
@@ -43,18 +44,18 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
[{ [{
label: localize('enablePreviewFeatures.yes', "Yes (recommended)"), label: localize('enablePreviewFeatures.yes', "Yes (recommended)"),
run: () => { 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); this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
} }
}, { }, {
label: localize('enablePreviewFeatures.no', "No"), label: localize('enablePreviewFeatures.no', "No"),
run: () => { 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"), label: localize('enablePreviewFeatures.never', "No, don't show again"),
run: () => { 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); this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
}, },
isSecondary: true isSecondary: true

View File

@@ -25,6 +25,7 @@ import { AsyncRecentConnectionTreeDataSource } from 'sql/workbench/services/obje
import { AsyncServerTreeDataSource } from 'sql/workbench/services/objectExplorer/browser/asyncServerTreeDataSource'; import { AsyncServerTreeDataSource } from 'sql/workbench/services/objectExplorer/browser/asyncServerTreeDataSource';
import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree'; import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
export class TreeCreationUtils { export class TreeCreationUtils {
/** /**
@@ -141,5 +142,5 @@ export class TreeCreationUtils {
} }
function useAsyncServerTree(configurationService: IConfigurationService): boolean { 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');
} }

View File

@@ -18,6 +18,7 @@ import { isUndefined } from 'vs/base/common/types';
import { ILogService } from 'vs/platform/log/common/log'; import { ILogService } from 'vs/platform/log/common/log';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants';
export const SERVICE_ID = 'queryManagementService'; export const SERVICE_ID = 'queryManagementService';
@@ -336,7 +337,7 @@ export class QueryManagementService implements IQueryManagementService {
public onResultSetUpdated(resultSetInfo: azdata.QueryExecuteResultSetNotificationParams): void { public onResultSetUpdated(resultSetInfo: azdata.QueryExecuteResultSetNotificationParams): void {
this._notify(resultSetInfo.ownerUri, (runner: QueryRunner) => { this._notify(resultSetInfo.ownerUri, (runner: QueryRunner) => {
runner.handleResultSetUpdated(resultSetInfo.resultSetSummary); 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); runner.handleExecutionPlanAvailable(resultSetInfo.executionPlans);
} }
}); });

View File

@@ -142,6 +142,7 @@ export class IssueReporter extends Disposable {
this.handleExtensionData(configuration.data.enabledExtensions); this.handleExtensionData(configuration.data.enabledExtensions);
this.updateExperimentsInfo(configuration.data.experiments); this.updateExperimentsInfo(configuration.data.experiments);
this.updateRestrictedMode(configuration.data.restrictedMode); this.updateRestrictedMode(configuration.data.restrictedMode);
this.updatePreviewFeaturesEnabled(configuration.data.previewFeaturesEnabled); // {{SQL CARBON EDIT}} Add preview features flag
} }
render(): void { render(): void {
@@ -1165,6 +1166,11 @@ export class IssueReporter extends Disposable {
this.issueReporterModel.update({ restrictedMode }); this.issueReporterModel.update({ restrictedMode });
} }
// {{SQL CARBON EDIT}} Add preview features flag
private updatePreviewFeaturesEnabled(previewFeaturesEnabled: boolean) {
this.issueReporterModel.update({ previewFeaturesEnabled });
}
private updateExperimentsInfo(experimentInfo: string | undefined) { private updateExperimentsInfo(experimentInfo: string | undefined) {
this.issueReporterModel.update({ experimentInfo }); this.issueReporterModel.update({ experimentInfo });
const target = document.querySelector<HTMLElement>('.block-experiments .block-info'); const target = document.querySelector<HTMLElement>('.block-experiments .block-info');

View File

@@ -33,6 +33,7 @@ export interface IssueReporterData {
filterResultCount?: number; filterResultCount?: number;
experimentInfo?: string; experimentInfo?: string;
restrictedMode?: boolean; restrictedMode?: boolean;
previewFeaturesEnabled?: boolean; // {{SQL CARBON EDIT}} Add preview features flag
} }
export class IssueReporterModel { export class IssueReporterModel {
@@ -70,6 +71,7 @@ ${this.getExtensionVersion()}
Azure Data Studio version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion} Azure Data Studio version: ${this._data.versionInfo && this._data.versionInfo.vscodeVersion}
OS version: ${this._data.versionInfo && this._data.versionInfo.os} OS version: ${this._data.versionInfo && this._data.versionInfo.os}
Restricted Mode: ${this._data.restrictedMode ? 'Yes' : 'No'} Restricted Mode: ${this._data.restrictedMode ? 'Yes' : 'No'}
Preview Features: ${this._data.previewFeaturesEnabled ? 'Enabled' : 'Disabled'}
${this.getRemoteOSes()} ${this.getRemoteOSes()}
${this.getInfos()} ${this.getInfos()}
<!-- generated by issue reporter -->`; <!-- generated by issue reporter -->`;

View File

@@ -34,6 +34,7 @@ undefined
Azure Data Studio version: undefined Azure Data Studio version: undefined
OS version: undefined OS version: undefined
Restricted Mode: No Restricted Mode: No
Preview Features: Disabled
Extensions: none Extensions: none
<!-- generated by issue reporter -->`); <!-- generated by issue reporter -->`);
@@ -65,6 +66,7 @@ undefined
Azure Data Studio version: undefined Azure Data Studio version: undefined
OS version: undefined OS version: undefined
Restricted Mode: No Restricted Mode: No
Preview Features: Disabled
<details> <details>
<summary>System Info</summary> <summary>System Info</summary>

View File

@@ -59,6 +59,7 @@ export interface IssueReporterData extends WindowData {
extensionId?: string; extensionId?: string;
experiments?: string; experiments?: string;
restrictedMode: boolean; restrictedMode: boolean;
previewFeaturesEnabled: boolean; // {{SQL CARBON EDIT}} Add preview features flag
githubAccessToken: string; githubAccessToken: string;
readonly issueTitle?: string; readonly issueTitle?: string;
readonly issueBody?: string; readonly issueBody?: string;

View File

@@ -20,6 +20,8 @@ import { ITASExperimentService } from 'vs/workbench/services/experiment/common/e
import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService'; import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
import { registerMainProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services'; import { registerMainProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services';
import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust'; import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; // {{SQL CARBON EDIT}} Add preview features flag
import { CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES } from 'sql/workbench/common/constants'; // {{SQL CARBON EDIT}} Add preview features flag
export class WorkbenchIssueService implements IWorkbenchIssueService { export class WorkbenchIssueService implements IWorkbenchIssueService {
declare readonly _serviceBrand: undefined; declare readonly _serviceBrand: undefined;
@@ -33,7 +35,8 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
@IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService, @IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService,
@IProductService private readonly productService: IProductService, @IProductService private readonly productService: IProductService,
@ITASExperimentService private readonly experimentService: ITASExperimentService, @ITASExperimentService private readonly experimentService: ITASExperimentService,
@IAuthenticationService private readonly authenticationService: IAuthenticationService @IAuthenticationService private readonly authenticationService: IAuthenticationService,
@IConfigurationService private readonly configurationService: IConfigurationService // {{SQL CARBON EDIT}} Add preview features flag
) { } ) { }
async openReporter(dataOverrides: Partial<IssueReporterData> = {}): Promise<void> { async openReporter(dataOverrides: Partial<IssueReporterData> = {}): Promise<void> {
@@ -89,6 +92,7 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
enabledExtensions: extensionData, enabledExtensions: extensionData,
experiments: experiments?.join('\n'), experiments: experiments?.join('\n'),
restrictedMode: !this.workspaceTrustManagementService.isWorkspaceTrusted(), restrictedMode: !this.workspaceTrustManagementService.isWorkspaceTrusted(),
previewFeaturesEnabled: this.configurationService.getValue(CONFIG_WORKBENCH_ENABLEPREVIEWFEATURES), // {{SQL CARBON EDIT}} Add preview features flag
githubAccessToken, githubAccessToken,
}, dataOverrides); }, dataOverrides);
return this.issueService.openReporter(issueReporterData); return this.issueService.openReporter(issueReporterData);