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';
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';
} 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';
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';
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';
} 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';
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;
StandoutLink,
} from 'design-system';
import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { translate } from '../../../helpers/l10n';
import {
getBranchUrl,
getProjectUrl,
getPullRequestUrl,
} from '../../../helpers/urls';
-import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { Task } from '../../../types/tasks';
interface Props {
*/
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';
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';
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';
} 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';
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;
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';
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';
* 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';
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';
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,
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';
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';
* 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,
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';
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';
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 {
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';
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';
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 {
ProjectAnalysisEventCategory,
Analysis as TypeAnalysis,
} from '../../../types/project-activity';
-import { Status } from '../../../types/types';
import { AnalysisVariations } from './AnalysisVariations';
import Event from './Event';
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';
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;
*/
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';
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';
*/
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';
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 {
} 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';
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';
*/
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,
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';
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';
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';
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';
*/
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';
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';
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';
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';
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';
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';
} 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';
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 {
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 {
* 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));
}
* 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';
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,
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';
* 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;
+}
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 = {}) {
*/
export function getComponentSecurityHotspotsUrl(
componentKey: string,
- branchLike?: BranchLike,
+ branchLike?: BranchLikeBase,
query: Query = {},
): Partial<Path> {
const { inNewCodePeriod, hotspots, assignedToMe, files } = query;
* 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;
+}
--- /dev/null
+/*
+ * 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';
* 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;
* 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';
* 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;
* 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 {
export type StandardSecurityCategories = Dict<{ title: string; description?: string }>;
-export type Status = 'ERROR' | 'OK';
-
export interface SubscriptionPlan {
maxNcloc: number;
price: number;