mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
@@ -4,8 +4,24 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { AbstractEnablePreviewFeatures } from 'sql/workbench/common/enablePreviewFeatures';
|
import { AbstractEnablePreviewFeatures } from 'sql/workbench/common/enablePreviewFeatures';
|
||||||
|
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||||
|
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||||
|
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||||
|
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||||
|
|
||||||
export class BrowserEnablePreviewFeatures extends AbstractEnablePreviewFeatures {
|
export class BrowserEnablePreviewFeatures extends AbstractEnablePreviewFeatures {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
@IStorageService storageService: IStorageService,
|
||||||
|
@INotificationService notificationService: INotificationService,
|
||||||
|
@IHostService hostService: IHostService,
|
||||||
|
@IConfigurationService configurationService: IConfigurationService
|
||||||
|
) {
|
||||||
|
super(storageService, notificationService, hostService, configurationService);
|
||||||
|
|
||||||
|
this.handlePreviewFeatures();
|
||||||
|
}
|
||||||
|
|
||||||
protected async getWindowCount(): Promise<number> {
|
protected async getWindowCount(): Promise<number> {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,44 +16,46 @@ export abstract class AbstractEnablePreviewFeatures implements IWorkbenchContrib
|
|||||||
private static ENABLE_PREVIEW_FEATURES_SHOWN = 'workbench.enablePreviewFeaturesShown';
|
private static ENABLE_PREVIEW_FEATURES_SHOWN = 'workbench.enablePreviewFeaturesShown';
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IStorageService storageService: IStorageService,
|
@IStorageService private readonly storageService: IStorageService,
|
||||||
@INotificationService notificationService: INotificationService,
|
@INotificationService private readonly notificationService: INotificationService,
|
||||||
@IHostService hostService: IHostService,
|
@IHostService private readonly hostService: IHostService,
|
||||||
@IConfigurationService configurationService: IConfigurationService
|
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||||
) {
|
) { }
|
||||||
let previewFeaturesEnabled = configurationService.getValue('workbench')['enablePreviewFeatures'];
|
|
||||||
if (previewFeaturesEnabled || storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) {
|
protected async handlePreviewFeatures(): Promise<void> {
|
||||||
|
let previewFeaturesEnabled = this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||||
|
if (previewFeaturesEnabled || this.storageService.get(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, StorageScope.GLOBAL)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Promise.all([
|
Promise.all([
|
||||||
hostService.hasFocus,
|
this.hostService.hasFocus,
|
||||||
this.getWindowCount()
|
this.getWindowCount()
|
||||||
]).then(([focused, count]) => {
|
]).then(([focused, count]) => {
|
||||||
if (!focused && count > 1) {
|
if (!focused && count > 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
this.configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
||||||
|
|
||||||
const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Preview features are required in order for extensions to be fully supported and for some actions to be available. Would you like to enable preview features?");
|
const enablePreviewFeaturesNotice = localize('enablePreviewFeatures.notice', "Preview features are required in order for extensions to be fully supported and for some actions to be available. Would you like to enable preview features?");
|
||||||
notificationService.prompt(
|
this.notificationService.prompt(
|
||||||
Severity.Info,
|
Severity.Info,
|
||||||
enablePreviewFeaturesNotice,
|
enablePreviewFeaturesNotice,
|
||||||
[{
|
[{
|
||||||
label: localize('enablePreviewFeatures.yes', "Yes"),
|
label: localize('enablePreviewFeatures.yes', "Yes"),
|
||||||
run: () => {
|
run: () => {
|
||||||
configurationService.updateValue('workbench.enablePreviewFeatures', true);
|
this.configurationService.updateValue('workbench.enablePreviewFeatures', true);
|
||||||
storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL);
|
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: localize('enablePreviewFeatures.no', "No"),
|
label: localize('enablePreviewFeatures.no', "No"),
|
||||||
run: () => {
|
run: () => {
|
||||||
configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
this.configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
label: localize('enablePreviewFeatures.never', "No, don't show again"),
|
label: localize('enablePreviewFeatures.never', "No, don't show again"),
|
||||||
run: () => {
|
run: () => {
|
||||||
configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
this.configurationService.updateValue('workbench.enablePreviewFeatures', false);
|
||||||
storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL);
|
this.storageService.store(AbstractEnablePreviewFeatures.ENABLE_PREVIEW_FEATURES_SHOWN, true, StorageScope.GLOBAL);
|
||||||
},
|
},
|
||||||
isSecondary: true
|
isSecondary: true
|
||||||
}]
|
}]
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ export class NativeEnablePreviewFeatures extends AbstractEnablePreviewFeatures {
|
|||||||
@IElectronService private readonly electronService: IElectronService
|
@IElectronService private readonly electronService: IElectronService
|
||||||
) {
|
) {
|
||||||
super(storageService, notificationService, hostService, configurationService);
|
super(storageService, notificationService, hostService, configurationService);
|
||||||
|
|
||||||
|
this.handlePreviewFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getWindowCount(): Promise<number> {
|
protected getWindowCount(): Promise<number> {
|
||||||
return this.electronService.getWindowCount();
|
return this.electronService.getWindowCount();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user