Better grouping on Ports context menu

Fixes #117410
This commit is contained in:
Alex Ross 2021-02-23 16:48:32 +01:00
parent dda96b69bf
commit c1fb9152a1

View file

@ -1082,7 +1082,7 @@ namespace OpenPortInBrowserCommandPaletteAction {
namespace CopyAddressAction {
export const INLINE_ID = 'remote.tunnel.copyAddressInline';
export const COMMANDPALETTE_ID = 'remote.tunnel.copyAddressCommandPalette';
export const INLINE_LABEL = nls.localize('remote.tunnel.copyAddressInline', "Copy Address");
export const INLINE_LABEL = nls.localize('remote.tunnel.copyAddressInline', "Copy Local Address");
export const COMMANDPALETTE_LABEL = nls.localize('remote.tunnel.copyAddressCommandPalette', "Copy Forwarded Port Address");
async function copyAddress(remoteExplorerService: IRemoteExplorerService, clipboardService: IClipboardService, tunnelItem: ITunnelItem) {
@ -1280,7 +1280,34 @@ registerAction2(class extends Action2 {
});
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '0_manage',
group: '._open',
order: 0,
command: {
id: OpenPortInBrowserAction.ID,
title: OpenPortInBrowserAction.LABEL,
},
when: ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), TunnelTypeContextKey.isEqualTo(TunnelType.Detected))
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '._open',
order: 1,
command: {
id: OpenPortInPreviewAction.ID,
title: OpenPortInPreviewAction.LABEL,
},
when: ContextKeyExpr.and(WebContextKey.negate(), ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), TunnelTypeContextKey.isEqualTo(TunnelType.Detected)))
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '0_manage', // 0_manage is used by extensions, so try not to change it
order: 0,
command: {
id: LabelTunnelAction.ID,
title: LabelTunnelAction.LABEL,
},
when: TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '2_localaddress',
order: 0,
command: {
id: CopyAddressAction.INLINE_ID,
@ -1289,52 +1316,7 @@ MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
when: ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), TunnelTypeContextKey.isEqualTo(TunnelType.Detected))
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '0_manage',
order: 1,
command: {
id: OpenPortInBrowserAction.ID,
title: OpenPortInBrowserAction.LABEL,
},
when: ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), TunnelTypeContextKey.isEqualTo(TunnelType.Detected))
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '0_manage',
order: 2,
command: {
id: OpenPortInPreviewAction.ID,
title: OpenPortInPreviewAction.LABEL,
},
when: ContextKeyExpr.and(WebContextKey.negate(), ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), TunnelTypeContextKey.isEqualTo(TunnelType.Detected)))
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '0_manage',
order: 3,
command: {
id: LabelTunnelAction.ID,
title: LabelTunnelAction.LABEL,
},
when: TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '1_manage',
order: 0,
command: {
id: MakePortPublicAction.ID,
title: MakePortPublicAction.LABEL,
},
when: TunnelPrivacyContextKey.isEqualTo(TunnelPrivacy.Private)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '1_manage',
order: 0,
command: {
id: MakePortPrivateAction.ID,
title: MakePortPrivateAction.LABEL,
},
when: TunnelPrivacyContextKey.isEqualTo(TunnelPrivacy.Public)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '1_manage',
group: '2_localaddress',
order: 1,
command: {
id: ChangeLocalPortAction.ID,
@ -1343,17 +1325,26 @@ MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
when: ContextKeyExpr.and(TunnelTypeContextKey.isEqualTo(TunnelType.Forwarded), PortChangableContextKey)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '0_manage',
order: 1,
group: '2_localaddress',
order: 2,
command: {
id: ForwardPortAction.INLINE_ID,
title: ForwardPortAction.TREEITEM_LABEL,
id: MakePortPublicAction.ID,
title: MakePortPublicAction.LABEL,
},
when: ContextKeyExpr.or(TunnelTypeContextKey.isEqualTo(TunnelType.Candidate), TunnelTypeContextKey.isEqualTo(TunnelType.Add))
when: TunnelPrivacyContextKey.isEqualTo(TunnelPrivacy.Private)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '1_manage',
group: '2_localaddress',
order: 2,
command: {
id: MakePortPrivateAction.ID,
title: MakePortPrivateAction.LABEL,
},
when: TunnelPrivacyContextKey.isEqualTo(TunnelPrivacy.Public)
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '3_forward',
order: 0,
command: {
id: ClosePortAction.INLINE_ID,
title: ClosePortAction.LABEL,
@ -1361,8 +1352,8 @@ MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
when: TunnelCloseableContextKey
}));
MenuRegistry.appendMenuItem(MenuId.TunnelContext, ({
group: '2_view',
order: 0,
group: '3_forward',
order: 1,
command: {
id: ForwardPortAction.INLINE_ID,
title: ForwardPortAction.LABEL,