diff options
author | Viktor Vorona <viktor.vorona@sonarsource.com> | 2024-05-02 15:19:58 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-05-03 20:02:50 +0000 |
commit | c56851e2ee25bebffd05980dcabd5ae31c8ee1a0 (patch) | |
tree | 6b594892e085af043e273d1f66aa921473abbeba /server/sonar-web/src/main/js/apps | |
parent | d0eae15ce508fb65f718ef7167aa3cfca698a8e8 (diff) | |
download | sonarqube-c56851e2ee25bebffd05980dcabd5ae31c8ee1a0.tar.gz sonarqube-c56851e2ee25bebffd05980dcabd5ae31c8ee1a0.zip |
SONAR-22168 Align Component and mockComponent
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
20 files changed, 28 insertions, 27 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/bucket.ts b/server/sonar-web/src/main/js/apps/code/bucket.ts index 75c7c87f4f9..9a3827b70a7 100644 --- a/server/sonar-web/src/main/js/apps/code/bucket.ts +++ b/server/sonar-web/src/main/js/apps/code/bucket.ts @@ -17,7 +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 { Breadcrumb, ComponentMeasure, Dict } from '../../types/types'; +import { Breadcrumb } from '~sonar-aligned/types/component'; +import { ComponentMeasure, Dict } from '../../types/types'; let bucket: Dict<ComponentMeasure> = {}; let childrenBucket: Dict<{ 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 a13db26792f..72e81423955 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 @@ -20,13 +20,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 { Breadcrumb, 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 { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types'; +import { Component, ComponentMeasure, Dict, Metric } from '../../../types/types'; import { addComponent, addComponentBreadcrumbs, clearBucket } from '../bucket'; import { loadMoreChildren, retrieveComponent, retrieveComponentChildren } from '../utils'; import CodeAppRenderer from './CodeAppRenderer'; 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 2724ae69aca..3f514a8e076 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 @@ -32,6 +32,7 @@ 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 { Breadcrumb } from '~sonar-aligned/types/component'; import { Location } from '~sonar-aligned/types/router'; import ListFooter from '../../../components/controls/ListFooter'; import Suggestions from '../../../components/embed-docs-modal/Suggestions'; @@ -42,7 +43,7 @@ import { translate } from '../../../helpers/l10n'; import { areCCTMeasuresComputed } from '../../../helpers/measures'; import { BranchLike } from '../../../types/branch-like'; import { isApplication } from '../../../types/component'; -import { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types'; +import { Component, ComponentMeasure, Dict, Metric } from '../../../types/types'; import { getCodeMetrics } from '../utils'; import CodeBreadcrumbs from './CodeBreadcrumbs'; import Components from './Components'; diff --git a/server/sonar-web/src/main/js/apps/code/components/CodeBreadcrumbs.tsx b/server/sonar-web/src/main/js/apps/code/components/CodeBreadcrumbs.tsx index a72965b31b0..91e44b3a0a7 100644 --- a/server/sonar-web/src/main/js/apps/code/components/CodeBreadcrumbs.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/CodeBreadcrumbs.tsx @@ -19,8 +19,9 @@ */ import { Breadcrumbs } from 'design-system'; import * as React from 'react'; +import { Breadcrumb } from '~sonar-aligned/types/component'; import { BranchLike } from '../../../types/branch-like'; -import { Breadcrumb, ComponentMeasure } from '../../../types/types'; +import { ComponentMeasure } from '../../../types/types'; import ComponentName from './ComponentName'; interface Props { 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 31c82837035..69ca61edc07 100644 --- a/server/sonar-web/src/main/js/apps/code/utils.ts +++ b/server/sonar-web/src/main/js/apps/code/utils.ts @@ -19,12 +19,12 @@ */ import { getBranchLikeQuery, isPullRequest } from '~sonar-aligned/helpers/branch-like'; import { isPortfolioLike } from '~sonar-aligned/helpers/component'; -import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { Breadcrumb, ComponentQualifier } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import { getBreadcrumbs, getChildren, getComponent, getComponentData } from '../../api/components'; import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../helpers/constants'; import { BranchLike } from '../../types/branch-like'; -import { Breadcrumb, ComponentMeasure } from '../../types/types'; +import { ComponentMeasure } from '../../types/types'; import { addComponent, addComponentBreadcrumbs, 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 4bc135d62bb..2f1bf24ba55 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 @@ -77,6 +77,7 @@ export function IssueSourceViewerHeader(props: Readonly<Props>) { const { data: branchData, isLoading: isLoadingBranches } = useBranchesQuery( component ?? { key: project, + name: projectName, qualifier: ComponentQualifier.Project, }, ); diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/PermissionsProjectApp.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/PermissionsProjectApp.tsx index 7cc89368bb6..b5b89e9db02 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/PermissionsProjectApp.tsx +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/PermissionsProjectApp.tsx @@ -21,6 +21,7 @@ import { LargeCenteredLayout, PageContentFontWrapper } from 'design-system'; import { noop, without } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; +import { Visibility } from '~sonar-aligned/types/component'; import * as api from '../../../../api/permissions'; import withComponentContext from '../../../../app/components/componentContext/withComponentContext'; import VisibilitySelector from '../../../../components/common/VisibilitySelector'; @@ -34,7 +35,7 @@ import { } from '../../../../helpers/permissions'; import { useIsGitHubProjectQuery } from '../../../../queries/devops-integration'; import { useGithubProvisioningEnabledQuery } from '../../../../queries/identity-provider/github'; -import { ComponentContextShape, Visibility } from '../../../../types/component'; +import { ComponentContextShape } from '../../../../types/component'; import { Permissions } from '../../../../types/permissions'; import { Component, Paging, PermissionGroup, PermissionUser } from '../../../../types/types'; import '../../styles.css'; diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/PermissionsProject-it.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/PermissionsProject-it.tsx index 5e4461aac92..6c048379bc7 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/PermissionsProject-it.tsx +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/__tests__/PermissionsProject-it.tsx @@ -19,7 +19,7 @@ */ import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import AlmSettingsServiceMock from '../../../../../api/mocks/AlmSettingsServiceMock'; import GithubProvisioningServiceMock from '../../../../../api/mocks/GithubProvisioningServiceMock'; import PermissionsServiceMock from '../../../../../api/mocks/PermissionsServiceMock'; @@ -35,7 +35,7 @@ import { renderAppWithComponentContext, } from '../../../../../helpers/testReactTestingUtils'; import { AlmKeys } from '../../../../../types/alm-settings'; -import { ComponentContextShape, Visibility } from '../../../../../types/component'; +import { ComponentContextShape } from '../../../../../types/component'; import { Feature } from '../../../../../types/features'; import { Permissions } from '../../../../../types/permissions'; import { Component, PermissionGroup, PermissionUser, Provider } from '../../../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/permissions/test-utils.ts b/server/sonar-web/src/main/js/apps/permissions/test-utils.ts index 9bec30dc8bd..d382ec9e14d 100644 --- a/server/sonar-web/src/main/js/apps/permissions/test-utils.ts +++ b/server/sonar-web/src/main/js/apps/permissions/test-utils.ts @@ -20,8 +20,8 @@ import { waitFor } from '@testing-library/react'; import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup'; import selectEvent from 'react-select-event'; +import { Visibility } from '~sonar-aligned/types/component'; import { byRole, byText } from '../../helpers/testSelector'; -import { Visibility } from '../../types/component'; import { Permissions } from '../../types/permissions'; export function getPageObject(user: UserEvent) { diff --git a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx index dabdddeda8f..7349466c79a 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { screen } from '@testing-library/react'; -import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import BranchesServiceMock from '../../../api/mocks/BranchesServiceMock'; import CodingRulesServiceMock from '../../../api/mocks/CodingRulesServiceMock'; @@ -31,7 +31,6 @@ import { mockComponent } from '../../../helpers/mocks/component'; import { mockCurrentUser, mockLoggedInUser, mockMeasure } from '../../../helpers/testMocks'; import { renderAppWithComponentContext } from '../../../helpers/testReactTestingUtils'; import { byRole } from '../../../helpers/testSelector'; -import { Visibility } from '../../../types/component'; import { Component } from '../../../types/types'; import { CurrentUser } from '../../../types/users'; import routes from '../routes'; diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx index 642955b8ca5..382bf84c832 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx @@ -20,10 +20,9 @@ import classNames from 'classnames'; import { BasicSeparator, SubTitle } from 'design-system'; import React, { PropsWithChildren, useEffect, useState } from 'react'; -import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { getProjectLinks } from '../../../api/projectLinks'; import { translate } from '../../../helpers/l10n'; -import { Visibility } from '../../../types/component'; import { Component, Measure, ProjectLink } from '../../../types/types'; import MetaDescription from './components/MetaDescription'; import MetaKey from './components/MetaKey'; diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaQualityProfiles.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaQualityProfiles.tsx index 8153c194e7e..dc94c4d0417 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaQualityProfiles.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaQualityProfiles.tsx @@ -19,13 +19,14 @@ */ import { Badge, Link, SubHeading } from 'design-system'; import React, { useContext, useEffect } from 'react'; +import { ComponentQualityProfile } from '~sonar-aligned/types/component'; import { searchRules } from '../../../../api/rules'; import { LanguagesContext } from '../../../../app/components/languages/LanguagesContext'; import Tooltip from '../../../../components/controls/Tooltip'; import { translate, translateWithParameters } from '../../../../helpers/l10n'; import { getQualityProfileUrl } from '../../../../helpers/urls'; import { Languages } from '../../../../types/languages'; -import { ComponentQualityProfile, Dict } from '../../../../types/types'; +import { Dict } from '../../../../types/types'; interface Props { profiles: ComponentQualityProfile[]; diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaVisibility.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaVisibility.tsx index 8237ef6ce20..a6e5e2646a1 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaVisibility.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/components/MetaVisibility.tsx @@ -19,9 +19,9 @@ */ import { SubHeading } from 'design-system'; import * as React from 'react'; +import { Visibility } from '~sonar-aligned/types/component'; import PrivacyBadgeContainer from '../../../../components/common/PrivacyBadgeContainer'; import { translate } from '../../../../helpers/l10n'; -import { Visibility } from '../../../../types/component'; interface Props { qualifier: string; diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx index 832d7f41d6c..a55e30a8593 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/CreateApplication-test.tsx @@ -20,13 +20,12 @@ import userEvent from '@testing-library/user-event'; import * as React from 'react'; import { queryToSearchString } from '~sonar-aligned/helpers/urls'; -import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { createApplication } from '../../../../api/application'; import { getComponentNavigation } from '../../../../api/navigation'; import { mockAppState, mockLoggedInUser, mockRouter } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; import { byRole, byText } from '../../../../helpers/testSelector'; -import { Visibility } from '../../../../types/component'; import { FCProps } from '../../../../types/misc'; import { LoggedInUser } from '../../../../types/users'; import { ApplicationCreation } from '../ApplicationCreation'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx index 1f5cfda2ca2..44fe864f3b7 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/ProjectCard-test.tsx @@ -19,11 +19,10 @@ */ import { screen } from '@testing-library/react'; import React from 'react'; -import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { MetricKey } from '~sonar-aligned/types/metrics'; import { mockCurrentUser, mockLoggedInUser } from '../../../../../helpers/testMocks'; import { renderComponent } from '../../../../../helpers/testReactTestingUtils'; -import { Visibility } from '../../../../../types/component'; import { CurrentUser } from '../../../../../types/users'; import { Project } from '../../../types'; import ProjectCard from '../ProjectCard'; diff --git a/server/sonar-web/src/main/js/apps/projects/types.ts b/server/sonar-web/src/main/js/apps/projects/types.ts index 437faeb5870..4abea9916c0 100644 --- a/server/sonar-web/src/main/js/apps/projects/types.ts +++ b/server/sonar-web/src/main/js/apps/projects/types.ts @@ -17,8 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { ComponentQualifier } from '~sonar-aligned/types/component'; -import { Visibility } from '../../types/component'; +import { ComponentQualifier, Visibility } from '~sonar-aligned/types/component'; import { Dict } from '../../types/types'; export interface Project { diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx index 6f2eca87f86..5a37ed41b94 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ChangeDefaultVisibilityForm.tsx @@ -20,9 +20,9 @@ import { RadioButtonGroup } from '@sonarsource/echoes-react'; import { ButtonPrimary, FlagMessage, Modal } from 'design-system'; import React, { useState } from 'react'; +import { Visibility } from '~sonar-aligned/types/component'; import { translate } from '../../helpers/l10n'; import { useGithubProvisioningEnabledQuery } from '../../queries/identity-provider/github'; -import { Visibility } from '../../types/component'; export interface Props { defaultVisibility: Visibility; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx index 18673aae3f6..c9c57fc28ca 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Header.tsx @@ -21,8 +21,8 @@ import { ButtonPrimary, InteractiveIcon, PencilIcon, Title } from 'design-system import * as React from 'react'; import { useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; +import { Visibility } from '~sonar-aligned/types/component'; import { translate } from '../../helpers/l10n'; -import { Visibility } from '../../types/component'; import ChangeDefaultVisibilityForm from './ChangeDefaultVisibilityForm'; export interface Props { diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx index ae10d3abb8c..aa3412d0a13 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx @@ -22,6 +22,7 @@ import { debounce, uniq } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { throwGlobalError } from '~sonar-aligned/helpers/error'; +import { Visibility } from '~sonar-aligned/types/component'; import { Project, changeProjectDefaultVisibility, @@ -34,7 +35,6 @@ import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { toShortISO8601String } from '../../helpers/dates'; import { translate } from '../../helpers/l10n'; import { hasGlobalPermission } from '../../helpers/users'; -import { Visibility } from '../../types/component'; import { Permissions } from '../../types/permissions'; import { SettingsKey } from '../../types/settings'; import { LoggedInUser } from '../../types/users'; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx index 4d4b1a230eb..8fe725ef816 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/Search.tsx @@ -32,12 +32,12 @@ import { sortBy } from 'lodash'; import * as React from 'react'; import { OptionProps, SingleValueProps, components } from 'react-select'; import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip'; +import { Visibility } from '~sonar-aligned/types/component'; import { Project } from '../../api/project-management'; import withAppStateContext from '../../app/components/app-state/withAppStateContext'; import { translate } from '../../helpers/l10n'; import { LabelValueSelectOption } from '../../helpers/search'; import { AppState } from '../../types/appstate'; -import { Visibility } from '../../types/component'; import BulkApplyTemplateModal from './BulkApplyTemplateModal'; import DeleteModal from './DeleteModal'; |