testing: avoid profiles dropdown when there's a single profile (#236509)
Fixes #232767pull/236513/head
parent
91581cab6f
commit
7f9c7a4187
|
@ -346,6 +346,7 @@ export class TestingExplorerView extends ViewPane {
|
|||
const profileActions: IAction[] = [];
|
||||
|
||||
let participatingGroups = 0;
|
||||
let participatingProfiles = 0;
|
||||
let hasConfigurable = false;
|
||||
const defaults = this.testProfileService.getGroupDefaultProfiles(group);
|
||||
for (const { profiles, controller } of this.testProfileService.all()) {
|
||||
|
@ -363,6 +364,7 @@ export class TestingExplorerView extends ViewPane {
|
|||
}
|
||||
|
||||
hasConfigurable = hasConfigurable || profile.hasConfigurationHandler;
|
||||
participatingProfiles++;
|
||||
profileActions.push(new Action(
|
||||
`${controller.id}.${profile.profileId}`,
|
||||
defaults.includes(profile) ? localize('defaultTestProfile', '{0} (Default)', profile.label) : profile.label,
|
||||
|
@ -402,7 +404,7 @@ export class TestingExplorerView extends ViewPane {
|
|||
const menuActions = getFlatContextMenuActions(menu);
|
||||
|
||||
const postActions: IAction[] = [];
|
||||
if (profileActions.length > 1) {
|
||||
if (participatingProfiles > 1) {
|
||||
postActions.push(new Action(
|
||||
'selectDefaultTestConfigurations',
|
||||
localize('selectDefaultConfigs', 'Select Default Profile'),
|
||||
|
@ -423,9 +425,12 @@ export class TestingExplorerView extends ViewPane {
|
|||
}
|
||||
|
||||
// show menu actions if there are any otherwise don't
|
||||
return menuActions.length > 0
|
||||
? Separator.join(profileActions, menuActions, postActions)
|
||||
: Separator.join(profileActions, postActions);
|
||||
return {
|
||||
numberOfProfiles: participatingProfiles,
|
||||
actions: menuActions.length > 0
|
||||
? Separator.join(profileActions, menuActions, postActions)
|
||||
: Separator.join(profileActions, postActions),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -438,7 +443,7 @@ export class TestingExplorerView extends ViewPane {
|
|||
|
||||
private getRunGroupDropdown(group: TestRunProfileBitset, defaultAction: IAction, options: IActionViewItemOptions) {
|
||||
const dropdownActions = this.getTestConfigGroupActions(group);
|
||||
if (dropdownActions.length < 2) {
|
||||
if (dropdownActions.numberOfProfiles < 2) {
|
||||
return super.getActionViewItem(defaultAction, options);
|
||||
}
|
||||
|
||||
|
@ -452,7 +457,7 @@ export class TestingExplorerView extends ViewPane {
|
|||
|
||||
return this.instantiationService.createInstance(
|
||||
DropdownWithPrimaryActionViewItem,
|
||||
primaryAction, this.getDropdownAction(), dropdownActions,
|
||||
primaryAction, this.getDropdownAction(), dropdownActions.actions,
|
||||
'',
|
||||
options
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue