diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2023-12-21 14:56:45 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-12-22 20:03:03 +0000 |
commit | 7796b0b6b9f2b16043915ec5b125c594d40006c8 (patch) | |
tree | ead7201f0313a68f0a855679d94d766e444f51c3 | |
parent | fce9db4d8dff4cce21eb3e9fbe72e7c1ad9f4540 (diff) | |
download | sonarqube-7796b0b6b9f2b16043915ec5b125c594d40006c8.tar.gz sonarqube-7796b0b6b9f2b16043915ec5b125c594d40006c8.zip |
SONAR-21312 Migrate portfolio definition mode form to the new UI
-rw-r--r-- | server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx b/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx index abc668de03e..56794b4fe01 100644 --- a/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx +++ b/server/sonar-web/design-system/src/components/input/MultiSelectMenu.tsx @@ -19,7 +19,7 @@ */ import classNames from 'classnames'; import { difference } from 'lodash'; -import { PureComponent } from 'react'; +import React, { PureComponent } from 'react'; import { Key } from '../../helpers/keyboard'; import { ItemDivider, ItemHeader } from '../DropdownMenu'; import { InputSearch } from './InputSearch'; @@ -32,6 +32,7 @@ interface Props { createElementLabel: string; disableMessage?: string; elements: string[]; + elementsDisabled?: string[]; footerNode?: React.ReactNode; headerNode?: React.ReactNode; inputId?: string; @@ -271,6 +272,7 @@ export class MultiSelectMenu extends PureComponent<Props, State> { inputId, noResultsLabel, searchInputAriaLabel, + elementsDisabled, } = this.props; const { renderLabel } = this.props as PropsWithDefault; @@ -334,6 +336,18 @@ export class MultiSelectMenu extends PureComponent<Props, State> { renderLabel={renderLabel} /> ))} + {elementsDisabled?.map((element) => ( + <MultiSelectMenuOption + active={activeElement === element} + createElementLabel={createElementLabel} + disabled + element={element} + key={element} + onHover={this.handleElementHover} + onSelectChange={this.handleSelectChange} + renderLabel={renderLabel} + /> + ))} {showNewElement && ( <MultiSelectMenuOption active={activeElement === query} @@ -345,9 +359,10 @@ export class MultiSelectMenu extends PureComponent<Props, State> { onSelectChange={this.handleSelectChange} /> )} - {!showNewElement && selectedElements.length < 1 && unselectedElements.length < 1 && ( - <li className="sw-ml-2">{noResultsLabel}</li> - )} + {!showNewElement && + selectedElements.length < 1 && + unselectedElements.length < 1 && + (elementsDisabled ?? []).length < 1 && <li className="sw-ml-2">{noResultsLabel}</li>} </ul> {hasFooter && <ItemDivider className="sw-mt-2" />} <div className="sw-px-3">{footerNode}</div> |