diff options
author | Philippe Perrin <philippe.perrin@sonarsource.com> | 2022-07-12 11:09:07 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-07-18 20:03:26 +0000 |
commit | abcb9a091d999569ed6f5bbe86a8ba24c11994cc (patch) | |
tree | 6aba91f777e6e7ca44f628dce08ebf3859a7e280 /server/sonar-web/src/main/js/apps/code/components/Search.tsx | |
parent | 5d008ce289fc169c9e6cdd9f34cbac13dc79b426 (diff) | |
download | sonarqube-abcb9a091d999569ed6f5bbe86a8ba24c11994cc.tar.gz sonarqube-abcb9a091d999569ed6f5bbe86a8ba24c11994cc.zip |
[NO-JIRA] Consistently use ButtonToggle component
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code/components/Search.tsx')
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/components/Search.tsx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx index d4b5c14b8e5..8fee9b154cc 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx @@ -20,6 +20,7 @@ import { isEmpty, omit } from 'lodash'; import * as React from 'react'; import { getTree } from '../../../api/components'; +import ButtonToggle from '../../../components/controls/ButtonToggle'; import SearchBox from '../../../components/controls/SearchBox'; import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; @@ -28,7 +29,6 @@ import { KeyboardKeys } from '../../../helpers/keycodes'; import { translate } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { ComponentMeasure } from '../../../types/types'; -import PortfolioNewCodeToggle from './PortfolioNewCodeToggle'; interface Props { branchLike?: BranchLike; @@ -140,10 +140,23 @@ export class Search extends React.PureComponent<Props, State> { return ( <div className="code-search" id="code-search"> {isPortfolio && ( - <PortfolioNewCodeToggle - enabled={isEmpty(query)} - onNewCodeToggle={this.props.onNewCodeToggle} - showNewCode={newCodeSelected} + <ButtonToggle + name="portfolio-scope" + className="big-spacer-right" + options={[ + { + value: true, + label: translate('projects.view.new_code'), + disabled: !isEmpty(query) + }, + { + value: false, + label: translate('projects.view.overall_code'), + disabled: !isEmpty(query) + } + ]} + value={newCodeSelected} + onCheck={this.props.onNewCodeToggle} /> )} <SearchBox |