From 833514259b44443a29f0359298d7f6a7b808c174 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Thu, 2 Feb 2023 09:45:59 +0100 Subject: [PATCH] SONAR-18329 [1109516] Page does not identify purpose of page --- .../main/js/apps/code/components/CodeApp.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx b/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx index 53bc79a18e1..b7dbcdd5bc9 100644 --- a/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx @@ -35,7 +35,7 @@ import { isPullRequest } from '../../../helpers/branch-like'; import { translate } from '../../../helpers/l10n'; import { CodeScope, getCodeUrl, getProjectUrl } from '../../../helpers/urls'; import { BranchLike } from '../../../types/branch-like'; -import { ComponentQualifier, isPortfolioLike } from '../../../types/component'; +import { ComponentQualifier, isApplication, isPortfolioLike } from '../../../types/component'; import { Breadcrumb, Component, ComponentMeasure, Dict, Issue, Metric } from '../../../types/types'; import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket'; import '../code.css'; @@ -282,15 +282,12 @@ export class CodeApp extends React.Component<Props, State> { ); const metrics = metricKeys.map((metric) => this.props.metrics[metric]); - const defaultTitle = - baseComponent && - [ - ComponentQualifier.Application, - ComponentQualifier.Portfolio, - ComponentQualifier.SubPortfolio, - ].includes(baseComponent.qualifier as ComponentQualifier) - ? translate('projects.page') - : translate('code.page'); + let defaultTitle = translate('code.page'); + if (isApplication(baseComponent?.qualifier)) { + defaultTitle = translate('projects.page'); + } else if (isPortfolioLike(baseComponent?.qualifier)) { + defaultTitle = translate('portfolio_breakdown.page'); + } const isPortfolio = isPortfolioLike(qualifier); -- 2.39.5