diff options
author | guillaume-peoch-sonarsource <guillaume.peoch@sonarsource.com> | 2023-11-08 14:45:44 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-08 20:02:52 +0000 |
commit | d05dc82a384ab40fe72212d6864dd111b1c023fa (patch) | |
tree | 7e78959c627c24dd490346f8fb858b86fd4f6606 | |
parent | 5999d37644bb847ea5d54819f60e4efebfe968ae (diff) | |
download | sonarqube-d05dc82a384ab40fe72212d6864dd111b1c023fa.tar.gz sonarqube-d05dc82a384ab40fe72212d6864dd111b1c023fa.zip |
SONAR-20984 Application's Projects list metrics are not retrieved for "New code"
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/components/Search.tsx | 25 | ||||
-rw-r--r-- | sonar-core/src/main/resources/org/sonar/l10n/core.properties | 1 |
2 files changed, 21 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 0a95d1baece..9fe54cf31fa 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 } from '../../../types/component'; +import { ComponentQualifier, isPortfolioLike } from '../../../types/component'; import { ComponentMeasure } from '../../../types/types'; interface Props { @@ -144,7 +144,9 @@ export class Search extends React.PureComponent<Props, State> { render() { const { component, newCodeSelected } = this.props; const { loading, query } = this.state; - const isPortfolio = ['VW', 'SVW', 'APP'].includes(component.qualifier); + + const isPortfolio = isPortfolioLike(component.qualifier); + const searchPlaceholder = getSearchPlaceholderLabel(component.qualifier as ComponentQualifier); return ( <div className="code-search" id="code-search"> @@ -171,9 +173,8 @@ export class Search extends React.PureComponent<Props, State> { minLength={3} onChange={this.handleQueryChange} onKeyDown={this.handleKeyDown} - placeholder={translate( - isPortfolio ? 'code.search_placeholder.portfolio' : 'code.search_placeholder' - )} + placeholder={searchPlaceholder} + aria-label={searchPlaceholder} value={this.state.query} /> <DeferredSpinner className="spacer-left" loading={loading} /> @@ -183,3 +184,17 @@ export 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'); + } +} diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 8f399e90dfe..c43b1e3a9fb 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3435,6 +3435,7 @@ api_documentation.search=Search by name... #------------------------------------------------------------------------------ code.open_component_page=Open Component's Page code.search_placeholder=Search for files... +code.search_placeholder.application=Search for projects... code.search_placeholder.portfolio=Search for projects and sub-portfolios... code.parent_folder=Parent folder code.last_analysis_date=Last analysis |