Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to preview profile in web #171765

Merged
merged 1 commit into from Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/vs/workbench/browser/web.api.ts
Expand Up @@ -263,6 +263,12 @@ export interface IWorkbenchConstructionOptions {

//#endregion

//#region Profile options

readonly profile?: string;

//#endregion


//#region Update/Quality related

Expand Down
Expand Up @@ -8,6 +8,8 @@ import { IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common
import { UserDataProfilesWorkbenchContribution } from 'vs/workbench/contrib/userDataProfile/browser/userDataProfile';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import './userDataProfileActions';
import { UserDataProfilePreviewContribution } from 'vs/workbench/contrib/userDataProfile/browser/userDataProfilePreview';

const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench);
workbenchRegistry.registerWorkbenchContribution(UserDataProfilesWorkbenchContribution, LifecyclePhase.Ready);
workbenchRegistry.registerWorkbenchContribution(UserDataProfilePreviewContribution, LifecyclePhase.Restored);
Expand Up @@ -124,10 +124,16 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
}

private registerProfileSubMenu(): void {
const that = this;
const getProfilesTitle = () => {
if (this.userDataProfileService.currentProfile.isTransient) {
return localize('profiles temporary', "Profiles ({0}) - Temporary", this.userDataProfileService.currentProfile.name);
} else {
return localize('profiles', "Profiles ({0})", this.userDataProfileService.currentProfile.name);
}
};
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, <ISubmenuItem>{
get title() {
return localize('profiles', "Profiles ({0})", that.userDataProfileService.currentProfile.name);
return getProfilesTitle();
},
submenu: ProfilesMenu,
group: '1_profiles',
Expand All @@ -136,7 +142,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
});
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, <ISubmenuItem>{
get title() {
return localize('profiles', "Profiles ({0})", that.userDataProfileService.currentProfile.name);
return getProfilesTitle();
},
submenu: ProfilesMenu,
group: '1_profiles',
Expand All @@ -159,7 +165,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
constructor() {
super({
id: `workbench.profiles.actions.profileEntry.${profile.id}`,
title: profile.name,
title: profile.isTransient ? localize('profile temporary', "{0} - Temporary", profile.name) : profile.name,
toggled: ContextKeyExpr.equals(CURRENT_PROFILE_CONTEXT.key, profile.id),
menu: [
{
Expand Down
@@ -0,0 +1,25 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Disposable } from 'vs/base/common/lifecycle';
import { IProductService } from 'vs/platform/product/common/productService';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
import { IUserDataProfileImportExportService, toUserDataProfileUri } from 'vs/workbench/services/userDataProfile/common/userDataProfile';

export class UserDataProfilePreviewContribution extends Disposable implements IWorkbenchContribution {

constructor(
@IBrowserWorkbenchEnvironmentService environmentService: IBrowserWorkbenchEnvironmentService,
@IProductService productService: IProductService,
@IUserDataProfileImportExportService userDataProfileImportExportService: IUserDataProfileImportExportService
) {
super();
if (environmentService.options?.profile) {
userDataProfileImportExportService.importProfile(toUserDataProfileUri(environmentService.options?.profile, productService), { donotPrompt: true, previewAsTempProfile: true });
}
}

}
Expand Up @@ -10,11 +10,22 @@
box-sizing: border-box;
}

.monaco-workbench .pane > .pane-body > .profile-view-buttons-container .monaco-button {
.monaco-workbench .pane > .pane-body > .profile-view-buttons-container > .monaco-button,
.monaco-workbench .pane > .pane-body > .profile-view-buttons-container > .monaco-button-dropdown {
margin-block-start: 13px;
margin-inline-start: 0px;
margin-inline-end: 0px;
max-width: 260px;
margin-left: auto;
margin-right: auto;
}

.monaco-workbench .pane > .pane-body > .profile-view-buttons-container > .monaco-button-dropdown {
width: 100%;
}

.monaco-workbench .pane > .pane-body > .profile-view-buttons-container > .monaco-button-dropdown > .monaco-dropdown-button {
display: flex;
align-items: center;
padding: 0 4px;
}