mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Deploy to Azure quick link experiment
This commit is contained in:
@@ -6,31 +6,46 @@
|
||||
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export interface ITelemetryExperiments {
|
||||
export interface IExperiments {
|
||||
deployToAzureQuickLink: boolean;
|
||||
}
|
||||
|
||||
const defaultExperiments: ITelemetryExperiments = {
|
||||
};
|
||||
export const IExperimentService = createDecorator<IExperimentService>('experimentService');
|
||||
|
||||
export function loadExperiments(accessor?: ServicesAccessor): ITelemetryExperiments {
|
||||
export interface IExperimentService {
|
||||
|
||||
// shortcut since there are currently no experiments (should introduce separate service to load only once)
|
||||
if (!accessor) {
|
||||
return {};
|
||||
_serviceBrand: any;
|
||||
|
||||
getExperiments(): IExperiments;
|
||||
}
|
||||
|
||||
export class ExperimentService implements IExperimentService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private experiments: IExperiments;
|
||||
|
||||
constructor(
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
) { }
|
||||
|
||||
getExperiments() {
|
||||
if (!this.experiments) {
|
||||
this.experiments = loadExperiments(this.storageService, this.configurationService);
|
||||
}
|
||||
return this.experiments;
|
||||
}
|
||||
|
||||
const storageService = accessor.get(IStorageService);
|
||||
const configurationService = accessor.get(IConfigurationService);
|
||||
|
||||
let {
|
||||
} = splitExperimentsRandomness(storageService);
|
||||
|
||||
return applyOverrides(defaultExperiments, configurationService);
|
||||
}
|
||||
|
||||
function applyOverrides(experiments: ITelemetryExperiments, configurationService: IConfigurationService): ITelemetryExperiments {
|
||||
function loadExperiments(storageService: IStorageService, configurationService: IConfigurationService): IExperiments {
|
||||
const experiments = splitExperimentsRandomness(storageService);
|
||||
return applyOverrides(experiments, configurationService);
|
||||
}
|
||||
|
||||
function applyOverrides(experiments: IExperiments, configurationService: IConfigurationService): IExperiments {
|
||||
const experimentsConfig = getExperimentsOverrides(configurationService);
|
||||
Object.keys(experiments).forEach(key => {
|
||||
if (key in experimentsConfig) {
|
||||
@@ -40,14 +55,14 @@ function applyOverrides(experiments: ITelemetryExperiments, configurationService
|
||||
return experiments;
|
||||
}
|
||||
|
||||
function splitExperimentsRandomness(storageService: IStorageService): ITelemetryExperiments {
|
||||
function splitExperimentsRandomness(storageService: IStorageService): IExperiments {
|
||||
const random1 = getExperimentsRandomness(storageService);
|
||||
const [random2, /* showTaskDocumentation */] = splitRandom(random1);
|
||||
const [random3, /* openUntitledFile */] = splitRandom(random2);
|
||||
const [random4, /* mergeQuickLinks */] = splitRandom(random3);
|
||||
// tslint:disable-next-line:no-unused-variable (https://github.com/Microsoft/TypeScript/issues/16628)
|
||||
const [random5, /* enableWelcomePage */] = splitRandom(random4);
|
||||
const [/* random3 */, deployToAzureQuickLink] = splitRandom(random2);
|
||||
// const [random4, /* mergeQuickLinks */] = splitRandom(random3);
|
||||
// const [random5, /* enableWelcomePage */] = splitRandom(random4);
|
||||
return {
|
||||
deployToAzureQuickLink
|
||||
};
|
||||
}
|
||||
|
||||
@@ -68,7 +83,7 @@ function splitRandom(random: number): [number, boolean] {
|
||||
return [scaled - i, i === 1];
|
||||
}
|
||||
|
||||
function getExperimentsOverrides(configurationService: IConfigurationService): ITelemetryExperiments {
|
||||
function getExperimentsOverrides(configurationService: IConfigurationService): IExperiments {
|
||||
const config: any = configurationService.getConfiguration('telemetry');
|
||||
return config && config.experiments || {};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ContextViewService } from 'vs/platform/contextview/browser/contextViewS
|
||||
import { Workbench, IWorkbenchStartedInfo } from 'vs/workbench/electron-browser/workbench';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService, configurationTelemetry, lifecycleTelemetry } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { loadExperiments } from 'vs/platform/telemetry/common/experiments';
|
||||
import { IExperimentService, ExperimentService } from 'vs/platform/telemetry/common/experiments';
|
||||
import { ITelemetryAppenderChannel, TelemetryAppenderClient } from 'vs/platform/telemetry/common/telemetryIpc';
|
||||
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { IdleMonitor, UserStatus } from 'vs/platform/telemetry/browser/idleMonitor';
|
||||
@@ -117,6 +117,7 @@ export class WorkbenchShell {
|
||||
private configurationService: IConfigurationService;
|
||||
private contextService: IWorkspaceContextService;
|
||||
private telemetryService: ITelemetryService;
|
||||
private experimentService: IExperimentService;
|
||||
private extensionService: ExtensionService;
|
||||
private broadcastService: IBroadcastService;
|
||||
private timerService: ITimerService;
|
||||
@@ -208,7 +209,7 @@ export class WorkbenchShell {
|
||||
customKeybindingsCount: info.customKeybindingsCount,
|
||||
theme: this.themeService.getColorTheme().id,
|
||||
language: platform.language,
|
||||
experiments: loadExperiments(),
|
||||
experiments: this.experimentService.getExperiments(),
|
||||
pinnedViewlets: info.pinnedViewlets,
|
||||
restoredViewlet: info.restoredViewlet,
|
||||
restoredEditors: info.restoredEditors.length,
|
||||
@@ -263,6 +264,10 @@ export class WorkbenchShell {
|
||||
restoreFontInfo(this.storageService);
|
||||
readFontInfo(BareFontInfo.createFromRawSettings(this.configurationService.getConfiguration('editor'), browser.getZoomLevel()));
|
||||
|
||||
// Experiments
|
||||
this.experimentService = instantiationService.createInstance(ExperimentService);
|
||||
serviceCollection.set(IExperimentService, this.experimentService);
|
||||
|
||||
// Telemetry
|
||||
this.sendMachineIdToMain(this.storageService);
|
||||
if (this.environmentService.isBuilt && !this.environmentService.isExtensionDevelopment && !!product.enableTelemetry) {
|
||||
|
||||
@@ -69,6 +69,7 @@ export default () => `
|
||||
<ul>
|
||||
<li class="showCommands"><button data-href="command:workbench.action.showCommands"><h3 class="caption">${escape(localize('welcomePage.showCommands', "Find and run all commands"))}</h3> <span class="detail">${escape(localize('welcomePage.showCommandsDescription', "Rapidly access and search commands from the Command Palette ({0})")).replace('{0}', '<span class="shortcut" data-command="workbench.action.showCommands"></span>')}</span></button></li>
|
||||
<li class="showInterfaceOverview"><button data-href="command:workbench.action.showInterfaceOverview"><h3 class="caption">${escape(localize('welcomePage.interfaceOverview', "Interface overview"))}</h3> <span class="detail">${escape(localize('welcomePage.interfaceOverviewDescription', "Get a visual overlay highlighting the major components of the UI"))}</span></button></li>
|
||||
<li class="deployToAzure"><button data-href="https://code.visualstudio.com/tutorials/nodejs-deployment/getting-started#vscode"><h3 class="caption">${escape(localize('welcomePage.deployToAzure', "Deploy applications to the cloud"))}</h3> <span class="detail">${escape(localize('welcomePage.deployToAzureDescription', "Learn how to deploy your Node apps to Azure App Service"))}</span></button></li>
|
||||
<li class="showInteractivePlayground"><button data-href="command:workbench.action.showInteractivePlayground"><h3 class="caption">${escape(localize('welcomePage.interactivePlayground', "Interactive playground"))}</h3> <span class="detail">${escape(localize('welcomePage.interactivePlaygroundDescription', "Try essential editor features out in a short walkthrough"))}</span></button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,7 @@ import { IConfigurationEditingService, ConfigurationTarget } from 'vs/workbench/
|
||||
import { localize } from 'vs/nls';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExperimentService } from 'vs/platform/telemetry/common/experiments';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
||||
@@ -194,6 +195,7 @@ class WelcomePage {
|
||||
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService,
|
||||
@ILifecycleService lifecycleService: ILifecycleService,
|
||||
@IThemeService private themeService: IThemeService,
|
||||
@IExperimentService private experimentService: IExperimentService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService
|
||||
) {
|
||||
this.disposables.push(lifecycleService.onShutdown(() => this.dispose()));
|
||||
@@ -313,6 +315,12 @@ class WelcomePage {
|
||||
}
|
||||
};
|
||||
}));
|
||||
|
||||
if (this.experimentService.getExperiments().deployToAzureQuickLink) {
|
||||
container.querySelector('.showInterfaceOverview').remove();
|
||||
} else {
|
||||
container.querySelector('.deployToAzure').remove();
|
||||
}
|
||||
}
|
||||
|
||||
private addExtensionList(container: HTMLElement, listSelector: string, suggestions: ExtensionSuggestion[], strings: Strings) {
|
||||
|
||||
Reference in New Issue
Block a user