aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViktor Vorona <viktor.vorona@sonarsource.com>2024-05-02 12:29:13 +0200
committersonartech <sonartech@sonarsource.com>2024-05-02 20:02:38 +0000
commit87ead0c47d63672052ff50b541b9d69e8c9757a2 (patch)
tree637fd7c8a9f2a2bfa9af0caca7927d9910c18374
parent6c34d0c9f32390986c0dc67191ae40e218650804 (diff)
downloadsonarqube-87ead0c47d63672052ff50b541b9d69e8c9757a2.tar.gz
sonarqube-87ead0c47d63672052ff50b541b9d69e8c9757a2.zip
SONAR-22168 Align BranchLike and isPullRequest
-rw-r--r--server/sonar-web/src/main/js/app/components/ComponentContainer.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx8
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/branch-like/PRLink.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Search.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/code/utils.ts3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/ComponentMeasuresApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.ts3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/QualityGateStatusHeader.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/AnalysisErrorMessage.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/App.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGate.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/pullRequests/SonarLintAd.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx3
-rw-r--r--server/sonar-web/src/main/js/components/measure/Measure.tsx2
-rw-r--r--server/sonar-web/src/main/js/helpers/branch-like.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/urls.ts10
-rw-r--r--server/sonar-web/src/main/js/queries/branch.tsx5
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts34
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/helpers/urls.ts4
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts23
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/types/common.ts20
-rw-r--r--server/sonar-web/src/main/js/types/branch-like.ts21
-rw-r--r--server/sonar-web/src/main/js/types/component.ts2
-rw-r--r--server/sonar-web/src/main/js/types/project-activity.ts2
-rw-r--r--server/sonar-web/src/main/js/types/quality-gates.ts3
-rw-r--r--server/sonar-web/src/main/js/types/types.ts2
51 files changed, 142 insertions, 107 deletions
diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
index 228a263d93b..0c19a7436ee 100644
--- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
+++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx
@@ -24,6 +24,7 @@ import { createPortal } from 'react-dom';
import { Helmet } from 'react-helmet-async';
import { Outlet } from 'react-router-dom';
import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { validateProjectAlmBinding } from '../../api/alm-settings';
import { getTasksForComponent } from '../../api/ce';
@@ -33,7 +34,6 @@ import { translateWithParameters } from '../../helpers/l10n';
import { HttpStatus } from '../../helpers/request';
import { getPortfolioUrl, getProjectUrl, getPullRequestUrl } from '../../helpers/urls';
import { useBranchesQuery } from '../../queries/branch';
-import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
import { ProjectAlmBindingConfigurationErrors } from '../../types/alm-settings';
import { Branch } from '../../types/branch-like';
import { isFile } from '../../types/component';
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
index 46d1e5da731..2d5863072fb 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
@@ -27,15 +27,14 @@ import {
} from 'design-system';
import * as React from 'react';
import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
-import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeQuery, isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { DEFAULT_ISSUES_QUERY } from '../../../../components/shared/utils';
-import { isPullRequest } from '../../../../helpers/branch-like';
import { hasMessage, translate, translateWithParameters } from '../../../../helpers/l10n';
import { getPortfolioUrl, getProjectQueryUrl } from '../../../../helpers/urls';
import { useBranchesQuery } from '../../../../queries/branch';
-import { isPortfolioLike } from '../../../../sonar-aligned/helpers/component';
import { isApplication, isProject } from '../../../../types/component';
import { Feature } from '../../../../types/features';
import { Component, Dict, Extension } from '../../../../types/types';
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx
index 79a59e0bf34..9dca663b31c 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/Menu.tsx
@@ -20,15 +20,11 @@
import { DropdownMenu, InputSearch, ItemDivider, Link } from 'design-system';
import * as React from 'react';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
-import { isBranch } from '~sonar-aligned/helpers/branch-like';
+import { isBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { queryToSearchString } from '~sonar-aligned/helpers/urls';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { Router } from '~sonar-aligned/types/router';
-import {
- getBrancheLikesAsTree,
- isPullRequest,
- isSameBranchLike,
-} from '../../../../../helpers/branch-like';
+import { getBrancheLikesAsTree, isSameBranchLike } from '../../../../../helpers/branch-like';
import { KeyboardKeys } from '../../../../../helpers/keycodes';
import { translate } from '../../../../../helpers/l10n';
import { getBranchLikeUrl } from '../../../../../helpers/urls';
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/PRLink.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/PRLink.tsx
index c94295f147b..c2bb7f92ba6 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/PRLink.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/PRLink.tsx
@@ -20,8 +20,8 @@
import { LinkStandalone } from '@sonarsource/echoes-react';
import React from 'react';
+import { isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { Image } from '../../../../../components/common/Image';
-import { isPullRequest } from '../../../../../helpers/branch-like';
import { translate, translateWithParameters } from '../../../../../helpers/l10n';
import { isDefined } from '../../../../../helpers/types';
import { AlmKeys } from '../../../../../types/alm-settings';
diff --git a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
index b655713b167..a2279d8b632 100644
--- a/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/account/projects/ProjectCard.tsx
@@ -28,6 +28,7 @@ import {
} from 'design-system';
import * as React from 'react';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { Status } from '~sonar-aligned/types/common';
import { MetricType } from '~sonar-aligned/types/metrics';
import MetaLink from '../../../components/common/MetaLink';
import Tooltip from '../../../components/controls/Tooltip';
@@ -35,7 +36,7 @@ import DateFromNow from '../../../components/intl/DateFromNow';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { orderLinks } from '../../../helpers/projectLinks';
import { getProjectUrl } from '../../../helpers/urls';
-import { MyProject, ProjectLink, Status } from '../../../types/types';
+import { MyProject, ProjectLink } from '../../../types/types';
interface Props {
project: MyProject;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
index 00a3ee090e8..80aa8bb1ace 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
@@ -27,6 +27,7 @@ import {
StandoutLink,
} from 'design-system';
import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { translate } from '../../../helpers/l10n';
import {
getBranchUrl,
@@ -34,7 +35,6 @@ import {
getProjectUrl,
getPullRequestUrl,
} from '../../../helpers/urls';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { Task } from '../../../types/tasks';
interface Props {
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 60a76bd2db9..a13db26792f 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
@@ -19,13 +19,13 @@
*/
import * as React from 'react';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { Location, Router } from '~sonar-aligned/types/router';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import withMetricsContext from '../../../app/components/metrics/withMetricsContext';
import { CodeScope, getCodeUrl, getProjectUrl } from '../../../helpers/urls';
import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types';
import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket';
import { loadMoreChildren, retrieveComponent, retrieveComponentChildren } from '../utils';
diff --git a/server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx b/server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx
index 71f21866ede..2724ae69aca 100644
--- a/server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx
@@ -31,6 +31,7 @@ import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { Location } from '~sonar-aligned/types/router';
import ListFooter from '../../../components/controls/ListFooter';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
@@ -39,7 +40,6 @@ import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../../hel
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate } from '../../../helpers/l10n';
import { areCCTMeasuresComputed } from '../../../helpers/measures';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { BranchLike } from '../../../types/branch-like';
import { isApplication } from '../../../types/component';
import { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
index 98f076fbee3..800af9d358f 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
@@ -27,6 +27,7 @@ import {
} from 'design-system';
import * as React from 'react';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { Status } from '~sonar-aligned/types/common';
import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
import Measure from '../../../components/measure/Measure';
import { getLeakValue } from '../../../components/measure/utils';
@@ -40,7 +41,7 @@ import {
isDiffMetric,
} from '../../../helpers/measures';
import { isApplication, isProject } from '../../../types/component';
-import { Metric, Status, ComponentMeasure as TypeComponentMeasure } from '../../../types/types';
+import { Metric, ComponentMeasure as TypeComponentMeasure } from '../../../types/types';
interface Props {
component: TypeComponentMeasure;
diff --git a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
index 5b9e92c2c8b..18ad9680db7 100644
--- a/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
+++ b/server/sonar-web/src/main/js/apps/code/components/ComponentName.tsx
@@ -21,12 +21,12 @@ import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react';
import { Badge, BranchIcon, LightLabel, Note, QualifierIcon } from 'design-system';
import * as React from 'react';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { queryToSearchString } from '~sonar-aligned/helpers/urls';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { translate } from '../../../helpers/l10n';
import { isDefined } from '../../../helpers/types';
import { CodeScope, getComponentOverviewUrl } from '../../../helpers/urls';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { BranchLike } from '../../../types/branch-like';
import { isApplication, isProject } from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
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 17db6ae5525..f1be0f903e6 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
@@ -23,12 +23,12 @@ import { isEmpty, omit } from 'lodash';
import * as React from 'react';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { Location, Router } from '~sonar-aligned/types/router';
import { getTree } from '../../../api/components';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { BranchLike } from '../../../types/branch-like';
import { isView } from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/code/utils.ts b/server/sonar-web/src/main/js/apps/code/utils.ts
index fc0d3d09c22..31c82837035 100644
--- a/server/sonar-web/src/main/js/apps/code/utils.ts
+++ b/server/sonar-web/src/main/js/apps/code/utils.ts
@@ -17,12 +17,11 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeQuery, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
import { getBreadcrumbs, getChildren, getComponent, getComponentData } from '../../api/components';
-import { isPullRequest } from '../../helpers/branch-like';
import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../helpers/constants';
import { BranchLike } from '../../types/branch-like';
import { Breadcrumb, ComponentMeasure } from '../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
index 035e0a6cac9..fce45c211b2 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx
@@ -30,6 +30,7 @@ import {
Modal,
} from 'design-system';
import * as React from 'react';
+import { Status } from '~sonar-aligned/types/common';
import FormattingTips from '../../../components/common/FormattingTips';
import MandatoryFieldsExplanation from '../../../components/ui/MandatoryFieldsExplanation';
import { RULE_STATUSES } from '../../../helpers/constants';
@@ -43,7 +44,7 @@ import {
CleanCodeAttributeCategory,
SoftwareImpact,
} from '../../../types/clean-code-taxonomy';
-import { Dict, RuleDetails, RuleParameter, Status } from '../../../types/types';
+import { Dict, RuleDetails, RuleParameter } from '../../../types/types';
import {
CleanCodeAttributeField,
CleanCodeCategoryField,
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/ComponentMeasuresApp.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/ComponentMeasuresApp.tsx
index b04b06bcb44..9eccd8c6154 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/ComponentMeasuresApp.tsx
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/ComponentMeasuresApp.tsx
@@ -33,7 +33,8 @@ import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
-import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeQuery, isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
import { Location, Router } from '~sonar-aligned/types/router';
@@ -44,11 +45,10 @@ import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { enhanceMeasure } from '../../../components/measure/utils';
import '../../../components/search-navigator.css';
import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissingInfoMessage';
-import { isPullRequest, isSameBranchLike } from '../../../helpers/branch-like';
+import { isSameBranchLike } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { areLeakAndOverallCCTMeasuresComputed } from '../../../helpers/measures';
import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { MeasurePageView } from '../../../types/measures';
import { ComponentMeasure, Dict, MeasureEnhanced, Metric, Period } from '../../../types/types';
import Sidebar from '../sidebar/Sidebar';
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
index 13c90589ca9..27369731902 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts
@@ -18,12 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { groupBy, memoize, sortBy, toPairs } from 'lodash';
-import { isBranch } from '~sonar-aligned/helpers/branch-like';
+import { isBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
import { RawQuery } from '~sonar-aligned/types/router';
import { enhanceMeasure } from '../../components/measure/utils';
-import { isPullRequest } from '../../helpers/branch-like';
import {
CCT_SOFTWARE_QUALITY_METRICS,
HIDDEN_METRICS,
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
index a6ef20e483b..f4925ec2e62 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx
@@ -36,7 +36,8 @@ import { Helmet } from 'react-helmet-async';
import { FormattedMessage } from 'react-intl';
import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
-import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeQuery, isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { Location, RawQuery, Router } from '~sonar-aligned/types/router';
import { listIssues, searchIssues } from '../../../api/issues';
@@ -54,7 +55,7 @@ import withIndexationGuard from '../../../components/hoc/withIndexationGuard';
import IssueTabViewer from '../../../components/rules/IssueTabViewer';
import '../../../components/search-navigator.css';
import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils';
-import { fillBranchLike, isPullRequest, isSameBranchLike } from '../../../helpers/branch-like';
+import { fillBranchLike, isSameBranchLike } from '../../../helpers/branch-like';
import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication';
import { parseIssueFromResponse } from '../../../helpers/issues';
import { isInput, isShortcut } from '../../../helpers/keyboardEventHelpers';
@@ -62,7 +63,6 @@ import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { serializeDate } from '../../../helpers/query';
import { withBranchLikes } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { BranchLike } from '../../../types/branch-like';
import { isProject } from '../../../types/component';
import {
diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
index 6d36e808194..4bc135d62bb 100644
--- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/IssueSourceViewerHeader.tsx
@@ -32,13 +32,12 @@ import {
themeColor,
} from 'design-system';
import * as React from 'react';
-import { getBranchLikeQuery, isBranch } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeQuery, isBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { getComponentIssuesUrl } from '~sonar-aligned/helpers/urls';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { ComponentContext } from '../../../app/components/componentContext/ComponentContext';
import { useCurrentUser } from '../../../app/components/current-user/CurrentUserContext';
import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils';
-import { isPullRequest } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path';
import { getBranchLikeUrl } from '../../../helpers/urls';
diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
index a54aeb4fb15..cafa99d1d90 100644
--- a/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/sidebar/Sidebar.tsx
@@ -20,12 +20,11 @@
import { BasicSeparator, FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { isBranch } from '~sonar-aligned/helpers/branch-like';
+import { isBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
-import { isPullRequest } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { AppState } from '../../../types/appstate';
import { BranchLike } from '../../../types/branch-like';
import { isApplication, isProject, isView } from '../../../types/component';
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx b/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx
index 8e296865e21..4c920a2e017 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/Analysis.tsx
@@ -21,6 +21,7 @@ import { QualityGateIndicator } from 'design-system';
import { sortBy } from 'lodash';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { Status } from '~sonar-aligned/types/common';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import DateTimeFormatter from '../../../components/intl/DateTimeFormatter';
import {
@@ -28,7 +29,6 @@ import {
ProjectAnalysisEventCategory,
Analysis as TypeAnalysis,
} from '../../../types/project-activity';
-import { Status } from '../../../types/types';
import { AnalysisVariations } from './AnalysisVariations';
import Event from './Event';
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
index 2cc345e1ba6..e1194406c2e 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx
@@ -27,12 +27,12 @@ import {
import * as React from 'react';
import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget';
import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissingInfoMessage';
import { parseDate } from '../../../helpers/dates';
import { areCCTMeasuresComputed, isDiffMetric } from '../../../helpers/measures';
import { CodeScope } from '../../../helpers/urls';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { ApplicationPeriod } from '../../../types/application';
import { Branch } from '../../../types/branch-like';
import { Analysis, GraphType, MeasureHistory } from '../../../types/project-activity';
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateStatusHeader.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateStatusHeader.tsx
index c4eee2fd3ae..2188c540a8e 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateStatusHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateStatusHeader.tsx
@@ -20,8 +20,8 @@
import { QualityGateIndicator, TextError } from 'design-system';
import React from 'react';
import { useIntl } from 'react-intl';
+import { Status } from '~sonar-aligned/types/common';
import { translate } from '../../../helpers/l10n';
-import { Status } from '../../../types/types';
interface Props {
status: Status;
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx
index 3bfb3a9d3de..7363d813328 100644
--- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/QualityGatePanelSection-test.tsx
@@ -19,13 +19,14 @@
*/
import { screen } from '@testing-library/react';
import * as React from 'react';
+import { Status } from '~sonar-aligned/types/common';
import { MetricKey } from '~sonar-aligned/types/metrics';
import CurrentUserContextProvider from '../../../../app/components/current-user/CurrentUserContextProvider';
import { mockQualityGate, mockQualityGateStatus } from '../../../../helpers/mocks/quality-gates';
import { mockLoggedInUser } from '../../../../helpers/testMocks';
import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { byRole } from '../../../../helpers/testSelector';
-import { CaycStatus, Status } from '../../../../types/types';
+import { CaycStatus } from '../../../../types/types';
import { CurrentUser, NoticeType } from '../../../../types/users';
import QualityGatePanelSection, { QualityGatePanelSectionProps } from '../QualityGatePanelSection';
diff --git a/server/sonar-web/src/main/js/apps/overview/components/AnalysisErrorMessage.tsx b/server/sonar-web/src/main/js/apps/overview/components/AnalysisErrorMessage.tsx
index a7e43540abe..212cb7725c1 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/AnalysisErrorMessage.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/AnalysisErrorMessage.tsx
@@ -21,8 +21,7 @@ import { Link } from 'design-system';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { useLocation } from 'react-router-dom';
-import { isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
-import { isPullRequest } from '../../../helpers/branch-like';
+import { isBranch, isMainBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { hasMessage, translate } from '../../../helpers/l10n';
import { getComponentBackgroundTaskUrl } from '../../../helpers/urls';
import { useBranchesQuery } from '../../../queries/branch';
diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.tsx b/server/sonar-web/src/main/js/apps/overview/components/App.tsx
index 4c7a33f930e..a4920fc60c8 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/App.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/components/App.tsx
@@ -19,15 +19,15 @@
*/
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import withAvailableFeatures, {
WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { isPullRequest } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { Feature } from '../../../types/features';
import { Component } from '../../../types/types';
import BranchOverview from '../branches/BranchOverview';
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGate.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGate.tsx
index f2de2bdbcc3..e5cfc9ffa0f 100644
--- a/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGate.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/BranchQualityGate.tsx
@@ -21,9 +21,10 @@ import { HelperHintIcon, LightPrimary, QualityGateIndicator, TextMuted } from 'd
import React from 'react';
import { useIntl } from 'react-intl';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
+import { Status } from '~sonar-aligned/types/common';
import { BranchLike } from '../../../types/branch-like';
import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates';
-import { Component, Status } from '../../../types/types';
+import { Component } from '../../../types/types';
import BranchQualityGateConditions from './BranchQualityGateConditions';
interface Props {
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/SonarLintAd.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/SonarLintAd.tsx
index 64997c92754..b787eac55b3 100644
--- a/server/sonar-web/src/main/js/apps/overview/pullRequests/SonarLintAd.tsx
+++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/SonarLintAd.tsx
@@ -31,9 +31,9 @@ import {
} from 'design-system';
import React from 'react';
import { useIntl } from 'react-intl';
+import { Status } from '~sonar-aligned/types/common';
import { useCurrentUser } from '../../../app/components/current-user/CurrentUserContext';
import useLocalStorage from '../../../hooks/useLocalStorage';
-import { Status } from '../../../types/types';
import { isLoggedIn } from '../../../types/users';
import { Status as QGStatus } from '../utils';
diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
index f72eae8e24b..693ad08b889 100644
--- a/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
+++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PageHeader.tsx
@@ -20,12 +20,12 @@
import { ButtonPrimary, FlagMessage, Title } from 'design-system';
import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import GitHubSynchronisationWarning from '../../../../app/components/GitHubSynchronisationWarning';
import { Image } from '../../../../components/common/Image';
import { translate } from '../../../../helpers/l10n';
import { isDefined } from '../../../../helpers/types';
import { useGithubProvisioningEnabledQuery } from '../../../../queries/identity-provider/github';
-import { isPortfolioLike } from '../../../../sonar-aligned/helpers/component';
import { isApplication, isProject } from '../../../../types/component';
import { Component } from '../../../../types/types';
import ApplyTemplate from './ApplyTemplate';
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
index b1251e4eddd..578135e7c6e 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx
@@ -19,9 +19,9 @@
*/
import { InputSelect, LabelValueSelectOption } from 'design-system';
import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import {
ApplicationAnalysisEventCategory,
ProjectAnalysisEventCategory,
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx
index 68c26e48d05..255e2c288fe 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx
@@ -27,11 +27,11 @@ import {
TableRowInteractive,
} from 'design-system';
import * as React from 'react';
-import { isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
+import { isBranch, isMainBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import QualityGateStatus from '../../../app/components/nav/component/branch-like/QualityGateStatus';
import BranchLikeIcon from '../../../components/icon-mappers/BranchLikeIcon';
import DateFromNow from '../../../components/intl/DateFromNow';
-import { getBranchLikeDisplayName, isPullRequest } from '../../../helpers/branch-like';
+import { getBranchLikeDisplayName } from '../../../helpers/branch-like';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { BranchLike } from '../../../types/branch-like';
import { Component } from '../../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx
index 603fb4ab9e2..d7d49d8fad1 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeTabs.tsx
@@ -22,8 +22,8 @@ import { IconGitBranch, IconPullrequest } from '@sonarsource/echoes-react';
import { ToggleButton, getTabId, getTabPanelId } from 'design-system';
import * as React from 'react';
import { useState } from 'react';
-import { isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
-import { isPullRequest, sortBranches, sortPullRequests } from '../../../helpers/branch-like';
+import { isBranch, isMainBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { sortBranches, sortPullRequests } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { useBranchesQuery } from '../../../queries/branch';
import { Branch, BranchLike, PullRequest } from '../../../types/branch-like';
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
index 9fe48ecf412..613af3a9334 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/DeleteBranchModal.tsx
@@ -20,7 +20,8 @@
import { DangerButtonPrimary, Modal } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { getBranchLikeDisplayName, isPullRequest } from '../../../helpers/branch-like';
+import { isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeDisplayName } from '../../../helpers/branch-like';
import { useDeletBranchMutation } from '../../../queries/branch';
import { BranchLike } from '../../../types/branch-like';
import { Component } from '../../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
index 4ca0bbcb80b..b4c09bf43c1 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
@@ -21,12 +21,12 @@
import { DangerButtonPrimary, addGlobalSuccessMessage } from 'design-system';
import * as React from 'react';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { Router } from '~sonar-aligned/types/router';
import { deleteApplication } from '../../api/application';
import { deletePortfolio, deleteProject } from '../../api/project-management';
import ConfirmButton from '../../components/controls/ConfirmButton';
import { translate, translateWithParameters } from '../../helpers/l10n';
-import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
import { isApplication } from '../../types/component';
import { Component } from '../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
index 44cef2bea20..6fad30895d7 100644
--- a/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
+++ b/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx
@@ -19,8 +19,8 @@
*/
import { Title } from 'design-system';
import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { translate } from '../../helpers/l10n';
-import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
import { isApplication } from '../../types/component';
import { Component } from '../../types/types';
diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
index 5039b6ad228..86f41cbe602 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
@@ -38,6 +38,7 @@ import { isEmpty } from 'lodash';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { Status } from '~sonar-aligned/types/common';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey, MetricType } from '~sonar-aligned/types/metrics';
import Favorite from '../../../../components/controls/Favorite';
@@ -48,7 +49,6 @@ import Measure from '../../../../components/measure/Measure';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
import { isDefined } from '../../../../helpers/types';
import { getProjectUrl } from '../../../../helpers/urls';
-import { Status } from '../../../../types/types';
import { CurrentUser, isLoggedIn } from '../../../../types/users';
import { Project } from '../../types';
import ProjectCardLanguages from './ProjectCardLanguages';
diff --git a/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx
index 0d7bf5234bd..548b70907ec 100644
--- a/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx
@@ -21,10 +21,10 @@ import { FacetBox, FacetItem, HelperHintIcon, QualityGateIndicator } from 'desig
import { without } from 'lodash';
import * as React from 'react';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
+import { Status } from '~sonar-aligned/types/common';
import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { isDefined } from '../../../helpers/types';
-import { Status } from '../../../types/types';
import { FacetItemsList } from '../../issues/sidebar/FacetItemsList';
import { formatFacetStat } from '../../issues/utils';
import { Facet } from '../types';
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
index 34c7fd9c736..fb4ba64d883 100644
--- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
+++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsApp.tsx
@@ -21,7 +21,7 @@
import { flatMap, range } from 'lodash';
import * as React from 'react';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
-import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { getBranchLikeQuery, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
import { Location, Router } from '~sonar-aligned/types/router';
@@ -31,7 +31,7 @@ import withComponentContext from '../../app/components/componentContext/withComp
import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext';
import withIndexationGuard from '../../components/hoc/withIndexationGuard';
import { getLeakValue } from '../../components/measure/utils';
-import { isPullRequest, isSameBranchLike } from '../../helpers/branch-like';
+import { isSameBranchLike } from '../../helpers/branch-like';
import { isInput } from '../../helpers/keyboardEventHelpers';
import { KeyboardKeys } from '../../helpers/keycodes';
import { getStandards } from '../../helpers/security-standard';
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
index 12bfd4b176c..0258c42c04a 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
+++ b/server/sonar-web/src/main/js/components/SourceViewer/components/DuplicationPopup.tsx
@@ -26,8 +26,8 @@ import {
} from 'design-system';
import { groupBy, sortBy } from 'lodash';
import React, { Fragment, PureComponent } from 'react';
+import { isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { ComponentQualifier } from '~sonar-aligned/types/component';
-import { isPullRequest } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path';
import { getProjectUrl } from '../../../helpers/urls';
diff --git a/server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx b/server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx
index c76172bc276..79c0684213d 100644
--- a/server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx
+++ b/server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx
@@ -21,8 +21,7 @@
import { IconBranch, IconGitBranch, IconProps, IconPullrequest } from '@sonarsource/echoes-react';
import { StyledMutedText } from 'design-system';
import * as React from 'react';
-import { isMainBranch } from '~sonar-aligned/helpers/branch-like';
-import { isPullRequest } from '../../helpers/branch-like';
+import { isMainBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { BranchLike } from '../../types/branch-like';
export interface BranchLikeIconProps extends IconProps {
diff --git a/server/sonar-web/src/main/js/components/measure/Measure.tsx b/server/sonar-web/src/main/js/components/measure/Measure.tsx
index 4c7c6c4388b..c76051540ff 100644
--- a/server/sonar-web/src/main/js/components/measure/Measure.tsx
+++ b/server/sonar-web/src/main/js/components/measure/Measure.tsx
@@ -20,10 +20,10 @@
import { MetricsRatingBadge, QualityGateIndicator, RatingLabel } from 'design-system';
import * as React from 'react';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { Status } from '~sonar-aligned/types/common';
import { MetricType } from '~sonar-aligned/types/metrics';
import Tooltip from '../../components/controls/Tooltip';
import { translate, translateWithParameters } from '../../helpers/l10n';
-import { Status } from '../../types/types';
import RatingTooltipContent from './RatingTooltipContent';
interface Props {
diff --git a/server/sonar-web/src/main/js/helpers/branch-like.ts b/server/sonar-web/src/main/js/helpers/branch-like.ts
index 4f9492068bd..e0676d7e353 100644
--- a/server/sonar-web/src/main/js/helpers/branch-like.ts
+++ b/server/sonar-web/src/main/js/helpers/branch-like.ts
@@ -18,17 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { orderBy } from 'lodash';
-import { isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
+import { isBranch, isMainBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
import { Branch, BranchLike, BranchLikeTree, PullRequest } from '../types/branch-like';
export function sortBranches(branches: Branch[]) {
return orderBy(branches, [(b) => b.isMain, (b) => b.name], ['desc', 'asc']);
}
-export function isPullRequest(branchLike?: BranchLike): branchLike is PullRequest {
- return branchLike !== undefined && (branchLike as PullRequest).key !== undefined;
-}
-
export function sortPullRequests(pullRequests: PullRequest[]) {
return orderBy(pullRequests, (pr) => getPullRequestDisplayName(pr));
}
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts
index 4b1bbd02d3b..07e8c76ff0d 100644
--- a/server/sonar-web/src/main/js/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/helpers/urls.ts
@@ -18,20 +18,24 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { Path, To } from 'react-router-dom';
-import { getBranchLikeQuery, isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
+import {
+ getBranchLikeQuery,
+ isBranch,
+ isMainBranch,
+ isPullRequest,
+} from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { queryToSearchString } from '~sonar-aligned/helpers/urls';
import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { getProfilePath } from '../apps/quality-profiles/utils';
import { DEFAULT_ISSUES_QUERY } from '../components/shared/utils';
-import { isPortfolioLike } from '../sonar-aligned/helpers/component';
import { BranchLike } from '../types/branch-like';
import { isApplication } from '../types/component';
import { MeasurePageView } from '../types/measures';
import { GraphType } from '../types/project-activity';
import { Dict } from '../types/types';
import { HomePage } from '../types/users';
-import { isPullRequest } from './branch-like';
import { serializeOptionalBoolean } from './query';
import { getBaseUrl } from './system';
diff --git a/server/sonar-web/src/main/js/queries/branch.tsx b/server/sonar-web/src/main/js/queries/branch.tsx
index 4e0644d48c5..d2c6195cb24 100644
--- a/server/sonar-web/src/main/js/queries/branch.tsx
+++ b/server/sonar-web/src/main/js/queries/branch.tsx
@@ -23,7 +23,8 @@ import * as React from 'react';
import { useCallback, useContext } from 'react';
import { useSearchParams } from 'react-router-dom';
import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
-import { isBranch } from '~sonar-aligned/helpers/branch-like';
+import { isBranch, isPullRequest } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { searchParamsToQuery } from '~sonar-aligned/helpers/router';
import {
deleteBranch,
@@ -37,9 +38,7 @@ import {
import { dismissAnalysisWarning, getAnalysisStatus } from '../api/ce';
import { getQualityGateProjectStatus } from '../api/quality-gates';
import { AvailableFeaturesContext } from '../app/components/available-features/AvailableFeaturesContext';
-import { isPullRequest } from '../helpers/branch-like';
import { extractStatusConditionsFromProjectStatus } from '../helpers/qualityGates';
-import { isPortfolioLike } from '../sonar-aligned/helpers/component';
import { Branch, BranchLike } from '../types/branch-like';
import { isApplication, isProject } from '../types/component';
import { Feature } from '../types/features';
diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts b/server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts
index f881115be97..71a8a535321 100644
--- a/server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts
+++ b/server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts
@@ -17,25 +17,37 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { isPullRequest } from '../../helpers/branch-like';
+import {
+ BranchBase,
+ BranchLikeBase,
+ BranchParameters,
+ PullRequestBase,
+} from '~sonar-aligned/types/branch-like';
-import { BranchParameters } from '~sonar-aligned/types/branch-like';
-import { Branch, BranchLike, MainBranch } from '../../types/branch-like';
-
-export function getBranchLikeQuery(
- branchLike?: BranchLike,
- includeMainBranch = false,
+export function getBranchLikeQuery<T extends BranchLikeBase>(
+ branchLike?: T,
+ withMainBranch = false,
): BranchParameters {
- if (isBranch(branchLike) && (includeMainBranch || !isMainBranch(branchLike))) {
+ if (isBranch(branchLike) && (withMainBranch || !isMainBranch(branchLike))) {
return { branch: branchLike.name };
} else if (isPullRequest(branchLike)) {
return { pullRequest: branchLike.key };
}
return {};
}
-export function isBranch(branchLike?: BranchLike): branchLike is Branch {
- return branchLike !== undefined && (branchLike as Branch).isMain !== undefined;
+
+export function isBranch<T extends BranchBase>(branchLike?: T | PullRequestBase): branchLike is T {
+ return branchLike !== undefined && (branchLike as T).isMain !== undefined;
}
-export function isMainBranch(branchLike?: BranchLike): branchLike is MainBranch {
+
+export function isMainBranch<T extends BranchBase>(
+ branchLike?: T | PullRequestBase,
+): branchLike is T & { isMain: true } {
return isBranch(branchLike) && branchLike.isMain;
}
+
+export function isPullRequest<T extends PullRequestBase>(
+ branchLike?: T | BranchBase,
+): branchLike is T {
+ return branchLike !== undefined && (branchLike as T).key !== undefined;
+}
diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/urls.ts b/server/sonar-web/src/main/js/sonar-aligned/helpers/urls.ts
index 406a6975c33..f7cf3ec13f8 100644
--- a/server/sonar-web/src/main/js/sonar-aligned/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/sonar-aligned/helpers/urls.ts
@@ -21,9 +21,9 @@ import { mapValues, omitBy, pick } from 'lodash';
import { Path, URLSearchParamsInit, createSearchParams } from 'react-router-dom';
import { cleanQuery } from '../../helpers/query';
import { Query } from '../../helpers/urls';
-import { BranchLike } from '../../types/branch-like';
import { SecurityStandard } from '../../types/security';
import { getBranchLikeQuery } from '../helpers/branch-like';
+import { BranchLikeBase } from '../types/branch-like';
import { RawQuery } from '../types/router';
export function queryToSearchString(query: RawQuery | URLSearchParamsInit = {}) {
@@ -56,7 +56,7 @@ export function getComponentIssuesUrl(componentKey: string, query?: Query): Part
*/
export function getComponentSecurityHotspotsUrl(
componentKey: string,
- branchLike?: BranchLike,
+ branchLike?: BranchLikeBase,
query: Query = {},
): Partial<Path> {
const { inNewCodePeriod, hotspots, assignedToMe, files } = query;
diff --git a/server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts b/server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts
index 319cf58bba7..3b9405f23f9 100644
--- a/server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts
+++ b/server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts
@@ -17,4 +17,27 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { Status } from './common';
+
export type BranchParameters = { branch?: string } | { pullRequest?: string };
+
+export type BranchLikeBase = BranchBase | PullRequestBase;
+
+export interface BranchBase {
+ analysisDate?: string;
+ isMain: boolean;
+ name: string;
+ status?: { qualityGateStatus: Status };
+}
+
+export interface PullRequestBase {
+ analysisDate?: string;
+ base: string;
+ branch: string;
+ key: string;
+ isOrphan?: true;
+ status?: { qualityGateStatus: Status };
+ target: string;
+ title: string;
+ url?: string;
+}
diff --git a/server/sonar-web/src/main/js/sonar-aligned/types/common.ts b/server/sonar-web/src/main/js/sonar-aligned/types/common.ts
new file mode 100644
index 00000000000..24d21cd8e79
--- /dev/null
+++ b/server/sonar-web/src/main/js/sonar-aligned/types/common.ts
@@ -0,0 +1,20 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2024 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+export type Status = 'ERROR' | 'OK' | 'NONE';
diff --git a/server/sonar-web/src/main/js/types/branch-like.ts b/server/sonar-web/src/main/js/types/branch-like.ts
index fa2c02c5e80..653490301d0 100644
--- a/server/sonar-web/src/main/js/types/branch-like.ts
+++ b/server/sonar-web/src/main/js/types/branch-like.ts
@@ -17,33 +17,20 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { BranchBase, PullRequestBase } from '~sonar-aligned/types/branch-like';
+import { Status } from '~sonar-aligned/types/common';
import { NewCodeDefinition } from './new-code-definition';
import { QualityGateStatusCondition } from './quality-gates';
-import { Status } from './types';
-export interface Branch {
- analysisDate?: string;
+export interface Branch extends BranchBase {
excludedFromPurge: boolean;
- isMain: boolean;
- name: string;
- status?: { qualityGateStatus: Status };
}
export interface MainBranch extends Branch {
isMain: true;
}
-export interface PullRequest {
- analysisDate?: string;
- base: string;
- branch: string;
- key: string;
- isOrphan?: true;
- status?: { qualityGateStatus: Status };
- target: string;
- title: string;
- url?: string;
-}
+export interface PullRequest extends PullRequestBase {}
export type BranchLike = Branch | PullRequest;
diff --git a/server/sonar-web/src/main/js/types/component.ts b/server/sonar-web/src/main/js/types/component.ts
index 11f63dd2f8c..48a85909af1 100644
--- a/server/sonar-web/src/main/js/types/component.ts
+++ b/server/sonar-web/src/main/js/types/component.ts
@@ -17,8 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { ComponentQualifier } from '~sonar-aligned/types/component';
-import { isPortfolioLike } from '../sonar-aligned/helpers/component';
import { Task } from './tasks';
import { Component, LightComponent } from './types';
diff --git a/server/sonar-web/src/main/js/types/project-activity.ts b/server/sonar-web/src/main/js/types/project-activity.ts
index 76e29b5be91..986484e5712 100644
--- a/server/sonar-web/src/main/js/types/project-activity.ts
+++ b/server/sonar-web/src/main/js/types/project-activity.ts
@@ -17,8 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { Status } from '~sonar-aligned/types/common';
import { MetricKey } from '~sonar-aligned/types/metrics';
-import { Status } from './types';
interface BaseAnalysis {
buildString?: string;
diff --git a/server/sonar-web/src/main/js/types/quality-gates.ts b/server/sonar-web/src/main/js/types/quality-gates.ts
index 34412f89c9f..308147bad96 100644
--- a/server/sonar-web/src/main/js/types/quality-gates.ts
+++ b/server/sonar-web/src/main/js/types/quality-gates.ts
@@ -17,9 +17,10 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { Status } from '~sonar-aligned/types/common';
import { MetricKey } from '~sonar-aligned/types/metrics';
import { BranchLike } from './branch-like';
-import { CaycStatus, MeasureEnhanced, Metric, Status } from './types';
+import { CaycStatus, MeasureEnhanced, Metric } from './types';
import { UserBase } from './users';
export interface QualityGateProjectStatus {
diff --git a/server/sonar-web/src/main/js/types/types.ts b/server/sonar-web/src/main/js/types/types.ts
index cfb310e230c..16daeeb7c75 100644
--- a/server/sonar-web/src/main/js/types/types.ts
+++ b/server/sonar-web/src/main/js/types/types.ts
@@ -712,8 +712,6 @@ export interface SourceViewerFile {
export type StandardSecurityCategories = Dict<{ title: string; description?: string }>;
-export type Status = 'ERROR' | 'OK';
-
export interface SubscriptionPlan {
maxNcloc: number;
price: number;