]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-22049 Align BranchParameters
authorViktor Vorona <viktor.vorona@sonarsource.com>
Thu, 25 Apr 2024 12:27:33 +0000 (14:27 +0200)
committerMatteo Mara <matteo.mara@sonarsource.com>
Tue, 30 Apr 2024 08:59:04 +0000 (10:59 +0200)
21 files changed:
server/sonar-web/src/main/js/api/components.ts
server/sonar-web/src/main/js/api/measures.ts
server/sonar-web/src/main/js/api/mocks/ComponentsServiceMock.ts
server/sonar-web/src/main/js/api/mocks/MeasuresServiceMock.ts
server/sonar-web/src/main/js/api/mocks/ProjectActivityServiceMock.ts
server/sonar-web/src/main/js/api/mocks/SettingsServiceMock.ts
server/sonar-web/src/main/js/api/mocks/TimeMachineServiceMock.ts
server/sonar-web/src/main/js/api/navigation.ts
server/sonar-web/src/main/js/api/projectActivity.ts
server/sonar-web/src/main/js/api/quality-gates.ts
server/sonar-web/src/main/js/api/security-hotspots.ts
server/sonar-web/src/main/js/api/settings.ts
server/sonar-web/src/main/js/api/time-machine.ts
server/sonar-web/src/main/js/app/components/nav/component/Menu.tsx
server/sonar-web/src/main/js/helpers/urls.ts
server/sonar-web/src/main/js/queries/component.ts
server/sonar-web/src/main/js/queries/measures.ts
server/sonar-web/src/main/js/queries/project-analyses.ts
server/sonar-web/src/main/js/sonar-aligned/helpers/branch-like.ts
server/sonar-web/src/main/js/sonar-aligned/types/branch-like.ts [new file with mode: 0644]
server/sonar-web/src/main/js/types/branch-like.ts

index 375e6a8ea192103f69564198afba960ab0147df7..02035fcdb7fb7d1ac98c2be53bdf7e993ebedc4f 100644 (file)
@@ -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,
index 093b0df065dbf88bfcb078029ff4b10f135638f6..b7e1a89cf84216160b934b7a1e578e3cd79094d2 100644 (file)
@@ -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,
index 9c3e794806608d09e9a4c4dbb94787c648543f40..2ca70ceb9965f41b42cc113032ee695eb2dee2b7 100644 (file)
  * 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,
index 72c89587e92e0bb3bd62143cfcf12a5db1b82423..fbe372e58d3c022790ccba57500324ff797158d7 100644 (file)
@@ -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';
index aaea03df35dc23c9b7f08500bdcfbb234590b9df..1bf40fabd37f1b2459f6f27960bf9db76841dca8 100644 (file)
@@ -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,
index f6d83f8b986f3087fdb6500d78cf901480dc6140..b67a20c4524729b932732e86881fad6b1482a457 100644 (file)
  * 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,
index 593eac07bee225b6777fbb1a43a0409431f0bad5..9c1249a1516f3afec8a74a6c67986232d6cf737c 100644 (file)
@@ -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';
index da908049ae6551004513fb7683ba77408a89e34f..8c3700629645caf107baa155ea9ffead2b3a7211 100644 (file)
@@ -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(
index f6aa6224ad2a948a420e55e0277b1ff7dea99ae9..2feb8ca042ba7c412701435f03983e3c1d1a572c 100644 (file)
@@ -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,
index 2c8f490222b6eb87791614c8c8b9129618da7280..e961ecb36399b2eba12a91811c5f2611e7d6ec26 100644 (file)
@@ -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,
index 866a0dcbd4424ab7196b17da57022e8381c1463e..eeb40e168bf41706dfdc67585560e9c840824bc8 100644 (file)
@@ -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,
index 52b3a0b03ca0d8477df2efbf08779b45db1d9616..53aecff13e8d5f8e823a66fc6f873b69654c717d 100644 (file)
@@ -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,
index 0dd1b2b6b1e23684be5ba96612d7cdbf7f00ff7e..1941bcdca8c6feaf12821c0acdb36390b4c8c597 100644 (file)
@@ -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';
 
index f5db2e2a13d5bad06a9d00327aae850b0db01487..705a4e0515a7bf7bd259114b908e9ed74c34b146 100644 (file)
@@ -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,
index ce1ce5d5710b3683ae44ba5b6851a304a9f540ec..dd95ec6b0793793f2920097175eac2870d109097 100644 (file)
 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';
index 96a861413d150cf5eb71c85e078c10541d3f8248..3a45dbda5719c5e09dd6bc9ac8f8792ef91df7d2 100644 (file)
@@ -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';
 
index 60aa82a40c46b13c1a6ccc149e4c9da3a3d82122..e34ff3be2a52121aacdd22b3181d0b0417d372a8 100644 (file)
@@ -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,
index 75615849dfc7c9cf5cad0332653a9048ccdbab6f..02186c97420487b4df4bd33b841971b360ab8f93 100644 (file)
@@ -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';
 
index c8fed5f3f572d97cab04e422f712eae9dfb3ff13..f881115be97cc00b66497d3c6fe28990cf85af40 100644 (file)
@@ -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 (file)
index 0000000..319cf58
--- /dev/null
@@ -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 };
index 70e10b1d60c3912c0a108e7eb5e6188ee92d567c..fa2c02c5e80e6b7ad6806171cfe1798e625897d1 100644 (file)
@@ -59,8 +59,6 @@ export interface BranchLikeTree {
   orphanPullRequests: PullRequest[];
 }
 
-export type BranchParameters = { branch?: string } | { pullRequest?: string };
-
 export interface BranchWithNewCodePeriod extends Branch {
   newCodePeriod?: NewCodeDefinition;
 }