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, isPortfolioLike } from '../../types/component';
+import { isFile } from '../../types/component';
import { Feature } from '../../types/features';
import { Task, TaskStatuses, TaskTypes } from '../../types/tasks';
import { Component } from '../../types/types';
import { hasMessage, translate, translateWithParameters } from '../../../../helpers/l10n';
import { getPortfolioUrl, getProjectQueryUrl } from '../../../../helpers/urls';
import { useBranchesQuery } from '../../../../queries/branch';
-import { isApplication, isPortfolioLike, isProject } from '../../../../types/component';
+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 withAvailableFeatures, {
getProjectUrl,
getPullRequestUrl,
} from '../../../helpers/urls';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { Task } from '../../../types/tasks';
interface Props {
import withMetricsContext from '../../../app/components/metrics/withMetricsContext';
import { CodeScope, getCodeUrl, getProjectUrl } from '../../../helpers/urls';
import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../types/component';
+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 { 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, isPortfolioLike } from '../../../types/component';
+import { isApplication } from '../../../types/component';
import { Breadcrumb, Component, ComponentMeasure, Dict, Metric } from '../../../types/types';
import { getCodeMetrics } from '../utils';
import CodeBreadcrumbs from './CodeBreadcrumbs';
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, isPortfolioLike, isProject } from '../../../types/component';
+import { isApplication, isProject } from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
import { mostCommonPrefix } from '../utils';
*/
import { ContentCell, NumericalCell, RatingCell } from 'design-system';
import * as React from 'react';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
import {
CCT_SOFTWARE_QUALITY_METRICS,
OLD_TO_NEW_TAXONOMY_METRICS_MAP,
} from '../../../helpers/constants';
import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
interface ComponentsHeaderProps {
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 { isPortfolioLike, isView } from '../../../types/component';
+import { isView } from '../../../types/component';
import { ComponentMeasure } from '../../../types/types';
interface Props {
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getBranchLikeQuery } 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 { isPortfolioLike } from '../../types/component';
import { Breadcrumb, ComponentMeasure } from '../../types/types';
import {
addComponent,
import { translate } from '../../../helpers/l10n';
import { areLeakAndOverallCCTMeasuresComputed } from '../../../helpers/measures';
import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../types/component';
+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';
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 { isPortfolioLike, isProject } from '../../../types/component';
+import { isProject } from '../../../types/component';
import {
ASSIGNEE_ME,
Facet,
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, isPortfolioLike, isProject, isView } from '../../../types/component';
+import { isApplication, isProject, isView } from '../../../types/component';
import {
Facet,
ReferencedComponent,
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 { isPortfolioLike } from '../../../types/component';
import { Analysis, GraphType, MeasureHistory } from '../../../types/project-activity';
import { QualityGateStatus } from '../../../types/quality-gates';
import { Component, MeasureEnhanced, Metric, Period, QualityGate } from '../../../types/types';
import { isPullRequest } from '../../../helpers/branch-like';
import { translate } from '../../../helpers/l10n';
import { useBranchesQuery } from '../../../queries/branch';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import { Feature } from '../../../types/features';
import { Component } from '../../../types/types';
import BranchOverview from '../branches/BranchOverview';
import { translate } from '../../../../helpers/l10n';
import { isDefined } from '../../../../helpers/types';
import { useGithubProvisioningEnabledQuery } from '../../../../queries/identity-provider/github';
-import { isApplication, isPortfolioLike, isProject } from '../../../../types/component';
+import { isPortfolioLike } from '../../../../sonar-aligned/helpers/component';
+import { isApplication, isProject } from '../../../../types/component';
import { Component } from '../../../../types/types';
import ApplyTemplate from './ApplyTemplate';
import React from 'react';
import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { isPortfolioLike } from '~sonar-aligned/helpers/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
import {
useComponent,
import { useBranchesQuery } from '../../../queries/branch';
import { useAllMeasuresHistoryQuery } from '../../../queries/measures';
import { useAllProjectAnalysesQuery } from '../../../queries/project-analyses';
-import { isApplication, isPortfolioLike, isProject } from '../../../types/component';
+import { isApplication, isProject } from '../../../types/component';
import { MeasureHistory, ParsedAnalysis } from '../../../types/project-activity';
import { Query, parseQuery, serializeUrlQuery } from '../utils';
import ProjectActivityAppRenderer from './ProjectActivityAppRenderer';
import * as React from 'react';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { translate } from '../../../helpers/l10n';
-import { isPortfolioLike } from '../../../types/component';
+import { isPortfolioLike } from '../../../sonar-aligned/helpers/component';
import {
ApplicationAnalysisEventCategory,
ProjectAnalysisEventCategory,
import { deletePortfolio, deleteProject } from '../../api/project-management';
import ConfirmButton from '../../components/controls/ConfirmButton';
import { translate, translateWithParameters } from '../../helpers/l10n';
-import { isApplication, isPortfolioLike } from '../../types/component';
+import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
+import { isApplication } from '../../types/component';
import { Component } from '../../types/types';
interface Props {
import { Title } from 'design-system';
import * as React from 'react';
import { translate } from '../../helpers/l10n';
-import { isApplication, isPortfolioLike } from '../../types/component';
+import { isPortfolioLike } from '../../sonar-aligned/helpers/component';
+import { isApplication } from '../../types/component';
import { Component } from '../../types/types';
interface Props {
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, isPortfolioLike } from '../types/component';
+import { isApplication } from '../types/component';
import { MeasurePageView } from '../types/measures';
import { GraphType } from '../types/project-activity';
import { Dict } from '../types/types';
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, isPortfolioLike, isProject } from '../types/component';
+import { isApplication, isProject } from '../types/component';
import { Feature } from '../types/features';
import { Component, LightComponent } from '../types/types';
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`[Function isPortfolioLike] should work properly 1`] = `
+{
+ "APP": false,
+ "BRC": false,
+ "DEV": false,
+ "DIR": false,
+ "FIL": false,
+ "SVW": true,
+ "TRK": false,
+ "UTS": false,
+ "VW": true,
+}
+`;
--- /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.
+ */
+import { ComponentQualifier } from '~sonar-aligned/types/component';
+import { isPortfolioLike } from '../component';
+
+it.each([[isPortfolioLike]])(
+ '%p should work properly',
+ (utilityMethod: (componentQualifier: ComponentQualifier) => void) => {
+ const results = Object.values(ComponentQualifier).reduce(
+ (prev, qualifier) => ({ ...prev, [qualifier]: utilityMethod(qualifier) }),
+ {},
+ );
+ expect(results).toMatchSnapshot();
+ },
+);
--- /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.
+ */
+
+import { ComponentQualifier } from '~sonar-aligned/types/component';
+
+export function isPortfolioLike(
+ componentQualifier?: string | ComponentQualifier,
+): componentQualifier is ComponentQualifier.Portfolio | ComponentQualifier.SubPortfolio {
+ return (
+ componentQualifier === ComponentQualifier.Portfolio ||
+ componentQualifier === ComponentQualifier.SubPortfolio
+ );
+}
}
`;
-exports[`[Function isPortfolioLike] should work properly 1`] = `
-{
- "APP": false,
- "BRC": false,
- "DEV": false,
- "DIR": false,
- "FIL": false,
- "SVW": true,
- "TRK": false,
- "UTS": false,
- "VW": true,
-}
-`;
-
exports[`[Function isProject] should work properly 1`] = `
{
"APP": false,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { ComponentQualifier } from '~sonar-aligned/types/component';
-import { isApplication, isFile, isPortfolioLike, isProject, isView } from '../component';
+import { isApplication, isFile, isProject, isView } from '../component';
-it.each([[isFile], [isView], [isProject], [isApplication], [isPortfolioLike]])(
+it.each([[isFile], [isView], [isProject], [isApplication]])(
'%p should work properly',
(utilityMethod: (componentQualifier: ComponentQualifier) => void) => {
const results = Object.values(ComponentQualifier).reduce(
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { ComponentQualifier } from '~sonar-aligned/types/component';
+import { isPortfolioLike } from '../sonar-aligned/helpers/component';
import { Task } from './tasks';
import { Component, LightComponent } from './types';
path: string;
}
-export function isPortfolioLike(
- componentQualifier?: string | ComponentQualifier,
-): componentQualifier is ComponentQualifier.Portfolio | ComponentQualifier.SubPortfolio {
- return (
- componentQualifier === ComponentQualifier.Portfolio ||
- componentQualifier === ComponentQualifier.SubPortfolio
- );
-}
-
export function isApplication(
componentQualifier?: string | ComponentQualifier,
): componentQualifier is ComponentQualifier.Application {