aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2023-06-06 16:27:10 +0200
committersonartech <sonartech@sonarsource.com>2023-06-09 20:03:10 +0000
commite9712bd39c63373d2ee16be40cdd1d1db351c640 (patch)
tree43997a8b55955c588e3899d96e8896b92df5ec98 /server/sonar-web/src
parentf0347a3cf3e278c3d7ddb263a5dd0062b9421bff (diff)
downloadsonarqube-e9712bd39c63373d2ee16be40cdd1d1db351c640.tar.gz
sonarqube-e9712bd39c63373d2ee16be40cdd1d1db351c640.zip
SONAR-19398 Remove NewCode toggle for Applications
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Search.tsx30
1 files changed, 21 insertions, 9 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 69980d82774..3c1323fe81b 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
@@ -28,7 +28,7 @@ import { getBranchLikeQuery } from '../../../helpers/branch-like';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate } from '../../../helpers/l10n';
import { BranchLike } from '../../../types/branch-like';
-import { ComponentQualifier, isView } from '../../../types/component';
+import { ComponentQualifier, isPortfolioLike, isView } from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
interface Props {
@@ -141,11 +141,13 @@ class Search extends React.PureComponent<Props, State> {
render() {
const { className, component, newCodeSelected } = this.props;
const { loading, query } = this.state;
- const isViewLike = isView(component.qualifier);
+ const isPortfolio = isPortfolioLike(component.qualifier);
+
+ const searchPlaceholder = getSearchPlaceholderLabel(component.qualifier as ComponentQualifier);
return (
<div className={classNames('sw-flex sw-items-center', className)} id="code-search">
- {isViewLike && (
+ {isPortfolio && (
<div className="sw-mr-4">
<ToggleButton
disabled={!isEmpty(query)}
@@ -166,15 +168,11 @@ class Search extends React.PureComponent<Props, State> {
)}
<InputSearch
clearIconAriaLabel={translate('clear')}
- searchInputAriaLabel={translate(
- isViewLike ? 'code.search_placeholder.portfolio' : 'code.search_placeholder'
- )}
+ searchInputAriaLabel={searchPlaceholder}
minLength={3}
onChange={this.handleQueryChange}
onKeyDown={this.handleKeyDown}
- placeholder={translate(
- isViewLike ? 'code.search_placeholder.portfolio' : 'code.search_placeholder'
- )}
+ placeholder={searchPlaceholder}
size="large"
value={this.state.query}
/>
@@ -185,3 +183,17 @@ class Search extends React.PureComponent<Props, State> {
}
export default withRouter(Search);
+
+function getSearchPlaceholderLabel(qualifier: ComponentQualifier) {
+ switch (qualifier) {
+ case ComponentQualifier.Portfolio:
+ case ComponentQualifier.SubPortfolio:
+ return translate('code.search_placeholder.portfolio');
+
+ case ComponentQualifier.Application:
+ return translate('code.search_placeholder.application');
+
+ default:
+ return translate('code.search_placeholder.portfolio');
+ }
+}