aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorViktor Vorona <viktor.vorona@sonarsource.com>2024-04-25 14:27:33 +0200
committerMatteo Mara <matteo.mara@sonarsource.com>2024-04-30 10:59:04 +0200
commit0a731b7621e835a8aef15055a717b95b8203a3e2 (patch)
tree7d49958efbbef56f0063226c42ebe6e9e06d2df3 /server
parentda21bb7e20058ad4c2dfabbb9ed84230e0998cd7 (diff)
downloadsonarqube-0a731b7621e835a8aef15055a717b95b8203a3e2.tar.gz
sonarqube-0a731b7621e835a8aef15055a717b95b8203a3e2.zip
SONAR-22049 Align BranchParameters
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/api/components.ts2
-rw-r--r--server/sonar-web/src/main/js/api/measures.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/ComponentsServiceMock.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/MeasuresServiceMock.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/ProjectActivityServiceMock.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts2
-rw-r--r--server/sonar-web/src/main/js/api/mocks/TimeMachineServiceMock.ts2
-rw-r--r--server/sonar-web/src/main/js/api/navigation.ts2
-rw-r--r--server/sonar-web/src/main/js/api/projectActivity.ts2
-rw-r--r--server/sonar-web/src/main/js/api/quality-gates.ts2
-rw-r--r--server/sonar-web/src/main/js/api/security-hotspots.ts2
-rw-r--r--server/sonar-web/src/main/js/api/settings.ts2
-rw-r--r--server/sonar-web/src/main/js/api/time-machine.ts2
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx2
-rw-r--r--server/sonar-web/src/main/js/helpers/urls.ts3
-rw-r--r--server/sonar-web/src/main/js/queries/component.ts2
-rw-r--r--server/sonar-web/src/main/js/queries/measures.ts2
-rw-r--r--server/sonar-web/src/main/js/queries/project-analyses.ts2
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts3
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts20
-rw-r--r--server/sonar-web/src/main/js/types/branch-like.ts2
21 files changed, 41 insertions, 21 deletions
diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts
index 375e6a8ea19..02035fcdb7f 100644
--- a/server/sonar-web/src/main/js/api/components.ts
+++ b/server/sonar-web/src/main/js/api/components.ts
@@ -19,8 +19,8 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { post, RequestData } from '../helpers/request';
-import { BranchParameters } from '../types/branch-like';
import {
ComponentQualifier,
TreeComponent,
diff --git a/server/sonar-web/src/main/js/api/measures.ts b/server/sonar-web/src/main/js/api/measures.ts
index 093b0df065d..b7e1a89cf84 100644
--- a/server/sonar-web/src/main/js/api/measures.ts
+++ b/server/sonar-web/src/main/js/api/measures.ts
@@ -19,7 +19,7 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
-import { BranchParameters } from '../types/branch-like';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import {
MeasuresAndMetaWithMetrics,
MeasuresAndMetaWithPeriod,
diff --git a/server/sonar-web/src/main/js/api/mocks/ComponentsServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/ComponentsServiceMock.ts
index 9c3e7948066..2ca70ceb996 100644
--- a/server/sonar-web/src/main/js/api/mocks/ComponentsServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/ComponentsServiceMock.ts
@@ -18,11 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { cloneDeep, pick } from 'lodash';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { DEFAULT_METRICS } from '../../helpers/mocks/metrics';
import { HttpStatus, RequestData } from '../../helpers/request';
import { mockMetric } from '../../helpers/testMocks';
import { isDefined } from '../../helpers/types';
-import { BranchParameters } from '../../types/branch-like';
import { TreeComponent, Visibility } from '../../types/component';
import {
Component,
diff --git a/server/sonar-web/src/main/js/api/mocks/MeasuresServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/MeasuresServiceMock.ts
index 72c89587e92..fbe372e58d3 100644
--- a/server/sonar-web/src/main/js/api/mocks/MeasuresServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/MeasuresServiceMock.ts
@@ -18,8 +18,8 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { cloneDeep } from 'lodash';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { mockMetric, mockPeriod } from '../../helpers/testMocks';
-import { BranchParameters } from '../../types/branch-like';
import { MetricKey } from '../../types/metrics';
import { Metric, Period } from '../../types/types';
import { getMeasures, getMeasuresWithPeriod, getMeasuresWithPeriodAndMetrics } from '../measures';
diff --git a/server/sonar-web/src/main/js/api/mocks/ProjectActivityServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/ProjectActivityServiceMock.ts
index aaea03df35d..1bf40fabd37 100644
--- a/server/sonar-web/src/main/js/api/mocks/ProjectActivityServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/ProjectActivityServiceMock.ts
@@ -18,9 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { chunk, cloneDeep, uniqueId } from 'lodash';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { parseDate } from '../../helpers/dates';
import { mockAnalysis, mockAnalysisEvent } from '../../helpers/mocks/project-activity';
-import { BranchParameters } from '../../types/branch-like';
import { Analysis, ProjectAnalysisEventCategory } from '../../types/project-activity';
import {
changeEvent,
diff --git a/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
index f6d83f8b986..b67a20c4524 100644
--- a/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
@@ -18,10 +18,10 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { cloneDeep, isArray, isObject, isString } from 'lodash';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { HousekeepingPolicy } from '../../apps/audit-logs/utils';
import { mockDefinition, mockSettingFieldDefinition } from '../../helpers/mocks/settings';
import { isDefined } from '../../helpers/types';
-import { BranchParameters } from '../../types/branch-like';
import {
ExtendedSettingDefinition,
SettingDefinition,
diff --git a/server/sonar-web/src/main/js/api/mocks/TimeMachineServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/TimeMachineServiceMock.ts
index 593eac07bee..9c1249a1516 100644
--- a/server/sonar-web/src/main/js/api/mocks/TimeMachineServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/TimeMachineServiceMock.ts
@@ -18,9 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { chunk, cloneDeep, times } from 'lodash';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { parseDate } from '../../helpers/dates';
import { mockHistoryItem, mockMeasureHistory } from '../../helpers/mocks/project-activity';
-import { BranchParameters } from '../../types/branch-like';
import { MetricKey } from '../../types/metrics';
import { MeasureHistory } from '../../types/project-activity';
import { TimeMachineResponse, getAllTimeMachineData, getTimeMachineData } from '../time-machine';
diff --git a/server/sonar-web/src/main/js/api/navigation.ts b/server/sonar-web/src/main/js/api/navigation.ts
index da908049ae6..8c370062964 100644
--- a/server/sonar-web/src/main/js/api/navigation.ts
+++ b/server/sonar-web/src/main/js/api/navigation.ts
@@ -19,8 +19,8 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { AppState } from '../types/appstate';
-import { BranchParameters } from '../types/branch-like';
import { Extension, NavigationComponent } from '../types/types';
export function getComponentNavigation(
diff --git a/server/sonar-web/src/main/js/api/projectActivity.ts b/server/sonar-web/src/main/js/api/projectActivity.ts
index f6aa6224ad2..2feb8ca042b 100644
--- a/server/sonar-web/src/main/js/api/projectActivity.ts
+++ b/server/sonar-web/src/main/js/api/projectActivity.ts
@@ -19,8 +19,8 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { post, postJSON } from '../helpers/request';
-import { BranchParameters } from '../types/branch-like';
import {
Analysis,
ApplicationAnalysisEventCategory,
diff --git a/server/sonar-web/src/main/js/api/quality-gates.ts b/server/sonar-web/src/main/js/api/quality-gates.ts
index 2c8f490222b..e961ecb3639 100644
--- a/server/sonar-web/src/main/js/api/quality-gates.ts
+++ b/server/sonar-web/src/main/js/api/quality-gates.ts
@@ -19,8 +19,8 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { post, postJSON } from '../helpers/request';
-import { BranchParameters } from '../types/branch-like';
import {
AddDeleteGroupPermissionsParameters,
AddDeleteUserPermissionsParameters,
diff --git a/server/sonar-web/src/main/js/api/security-hotspots.ts b/server/sonar-web/src/main/js/api/security-hotspots.ts
index 866a0dcbd44..eeb40e168bf 100644
--- a/server/sonar-web/src/main/js/api/security-hotspots.ts
+++ b/server/sonar-web/src/main/js/api/security-hotspots.ts
@@ -19,8 +19,8 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { post } from '../helpers/request';
-import { BranchParameters } from '../types/branch-like';
import {
Hotspot,
HotspotAssignRequest,
diff --git a/server/sonar-web/src/main/js/api/settings.ts b/server/sonar-web/src/main/js/api/settings.ts
index 52b3a0b03ca..53aecff13e8 100644
--- a/server/sonar-web/src/main/js/api/settings.ts
+++ b/server/sonar-web/src/main/js/api/settings.ts
@@ -20,9 +20,9 @@
import { omitBy } from 'lodash';
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { isCategoryDefinition } from '../apps/settings/utils';
import { post, postJSON, RequestData } from '../helpers/request';
-import { BranchParameters } from '../types/branch-like';
import {
ExtendedSettingDefinition,
SettingDefinition,
diff --git a/server/sonar-web/src/main/js/api/time-machine.ts b/server/sonar-web/src/main/js/api/time-machine.ts
index 0dd1b2b6b1e..1941bcdca8c 100644
--- a/server/sonar-web/src/main/js/api/time-machine.ts
+++ b/server/sonar-web/src/main/js/api/time-machine.ts
@@ -19,7 +19,7 @@
*/
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getJSON } from '~sonar-aligned/helpers/request';
-import { BranchParameters } from '../types/branch-like';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { MetricKey } from '../types/metrics';
import { Paging } from '../types/types';
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 f5db2e2a13d..705a4e0515a 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
@@ -28,12 +28,12 @@ import {
import * as React from 'react';
import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
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 { BranchParameters } from '../../../../types/branch-like';
import {
ComponentQualifier,
isApplication,
diff --git a/server/sonar-web/src/main/js/helpers/urls.ts b/server/sonar-web/src/main/js/helpers/urls.ts
index ce1ce5d5710..dd95ec6b079 100644
--- a/server/sonar-web/src/main/js/helpers/urls.ts
+++ b/server/sonar-web/src/main/js/helpers/urls.ts
@@ -20,9 +20,10 @@
import { Path, To } from 'react-router-dom';
import { getBranchLikeQuery, isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
import { queryToSearch } from '~sonar-aligned/helpers/urls';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { getProfilePath } from '../apps/quality-profiles/utils';
import { DEFAULT_ISSUES_QUERY } from '../components/shared/utils';
-import { BranchLike, BranchParameters } from '../types/branch-like';
+import { BranchLike } from '../types/branch-like';
import { ComponentQualifier, isApplication, isPortfolioLike } from '../types/component';
import { MeasurePageView } from '../types/measures';
import { GraphType } from '../types/project-activity';
diff --git a/server/sonar-web/src/main/js/queries/component.ts b/server/sonar-web/src/main/js/queries/component.ts
index 96a861413d1..3a45dbda571 100644
--- a/server/sonar-web/src/main/js/queries/component.ts
+++ b/server/sonar-web/src/main/js/queries/component.ts
@@ -18,9 +18,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { UseQueryResult, useQuery } from '@tanstack/react-query';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { getTasksForComponent } from '../api/ce';
import { getMeasuresWithMetrics } from '../api/measures';
-import { BranchParameters } from '../types/branch-like';
import { MeasuresAndMetaWithMetrics } from '../types/measures';
import { Component } from '../types/types';
diff --git a/server/sonar-web/src/main/js/queries/measures.ts b/server/sonar-web/src/main/js/queries/measures.ts
index 60aa82a40c4..e34ff3be2a5 100644
--- a/server/sonar-web/src/main/js/queries/measures.ts
+++ b/server/sonar-web/src/main/js/queries/measures.ts
@@ -19,8 +19,8 @@
*/
import { useQuery } from '@tanstack/react-query';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import { getAllTimeMachineData } from '../api/time-machine';
-import { BranchParameters } from '../types/branch-like';
export function useAllMeasuresHistoryQuery(
component: string | undefined,
diff --git a/server/sonar-web/src/main/js/queries/project-analyses.ts b/server/sonar-web/src/main/js/queries/project-analyses.ts
index 75615849dfc..02186c97420 100644
--- a/server/sonar-web/src/main/js/queries/project-analyses.ts
+++ b/server/sonar-web/src/main/js/queries/project-analyses.ts
@@ -20,6 +20,7 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
import {
CreateEventResponse,
ProjectActivityStatuses,
@@ -35,7 +36,6 @@ import {
} from '../app/components/componentContext/withComponentContext';
import { parseDate } from '../helpers/dates';
import { serializeStringArray } from '../helpers/query';
-import { BranchParameters } from '../types/branch-like';
import { ParsedAnalysis } from '../types/project-activity';
import { useBranchesQuery } from './branch';
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 c8fed5f3f57..f881115be97 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
@@ -19,7 +19,8 @@
*/
import { isPullRequest } from '../../helpers/branch-like';
-import { Branch, BranchLike, BranchParameters, MainBranch } from '../../types/branch-like';
+import { BranchParameters } from '~sonar-aligned/types/branch-like';
+import { Branch, BranchLike, MainBranch } from '../../types/branch-like';
export function getBranchLikeQuery(
branchLike?: BranchLike,
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
new file mode 100644
index 00000000000..319cf58bba7
--- /dev/null
+++ b/server/sonar-web/src/main/js/sonar-aligned/types/branch-like.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 BranchParameters = { branch?: string } | { pullRequest?: string };
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 70e10b1d60c..fa2c02c5e80 100644
--- a/server/sonar-web/src/main/js/types/branch-like.ts
+++ b/server/sonar-web/src/main/js/types/branch-like.ts
@@ -59,8 +59,6 @@ export interface BranchLikeTree {
orphanPullRequests: PullRequest[];
}
-export type BranchParameters = { branch?: string } | { pullRequest?: string };
-
export interface BranchWithNewCodePeriod extends Branch {
newCodePeriod?: NewCodeDefinition;
}