From 4a9e9a5d98c5e3d0c938ef3be2027e08182b958c Mon Sep 17 00:00:00 2001 From: Ismail Cherri Date: Tue, 15 Oct 2024 17:57:26 +0200 Subject: [PATCH] SONAR-23188 Rename isLegacy into isStandardMode and useLegacyCCTMode into useStandardExperienceMode --- .../components/ChangeInCalculationPill.tsx | 6 +-- .../js/app/components/ComponentContainer.tsx | 6 +-- .../CalculationChangeMessage-test.tsx | 2 +- .../__tests__/ComponentContainer-test.tsx | 2 +- .../CalculationChangeMessage.tsx | 6 +-- .../components/metrics/RatingComponent.tsx | 11 ++--- .../apps/code/components/CodeAppRenderer.tsx | 10 ++--- .../apps/code/components/ComponentMeasure.tsx | 6 +-- .../apps/code/components/ComponentsHeader.tsx | 6 +-- .../coding-rules/components/FacetsList.tsx | 16 ++++---- .../components/RuleDetailsHeaderSide.tsx | 28 +++++++------ .../coding-rules/components/RuleListItem.tsx | 6 +-- .../main/js/apps/component-measures/hooks.ts | 6 +-- .../sidebar/DomainSubnavigation.tsx | 6 +-- .../component-measures/sidebar/Sidebar.tsx | 6 +-- .../main/js/apps/component-measures/utils.ts | 14 +++---- .../issues/components/IssueHeaderSide.tsx | 8 ++-- .../main/js/apps/issues/sidebar/Sidebar.tsx | 8 ++-- .../apps/overview/branches/ActivityPanel.tsx | 6 +-- .../apps/overview/branches/BranchOverview.tsx | 6 +-- .../branches/SoftwareImpactMeasureCard.tsx | 12 +++--- .../branches/SoftwareImpactMeasureRating.tsx | 6 +-- .../components/ProjectActivityApp.tsx | 17 ++++---- .../components/ProjectActivityAppRenderer.tsx | 6 +-- .../components/ProjectActivityGraphs.tsx | 6 +-- .../js/apps/projects/__tests__/utils-test.ts | 10 ++--- .../apps/projects/components/AllProjects.tsx | 41 ++++++++++--------- .../project-card/ProjectCardMeasures.tsx | 20 ++++----- .../js/apps/projects/filters/RatingFacet.tsx | 14 +++---- .../src/main/js/apps/projects/query.ts | 40 ++++++++++-------- .../src/main/js/apps/projects/utils.ts | 32 +++++++-------- .../compare/ComparisonResults.tsx | 8 ++-- .../quality-profiles/details/ProfileRules.tsx | 30 ++++++++------ .../GitHubAuthenticationTab.tsx | 2 +- .../GitHubConfigurationForm.tsx | 10 ++--- .../SourceViewer/SourceViewerHeader.tsx | 8 ++-- .../components/LineIssuesIndicator.tsx | 8 ++-- .../js/components/activity-graph/utils.ts | 12 ++++-- .../SoftwareImpactSeverityIcon.tsx | 6 +-- .../issue/components/IssueTitleBar.tsx | 6 +-- .../shared/AnalysisMissingInfoMessage.tsx | 6 +-- .../shared/SoftwareImpactPillList.tsx | 10 ++--- .../src/main/js/helpers/activity-graph.ts | 4 +- server/sonar-web/src/main/js/queries/rules.ts | 6 +-- .../sonar-web/src/main/js/queries/settings.ts | 2 +- 45 files changed, 255 insertions(+), 232 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/ChangeInCalculationPill.tsx b/server/sonar-web/src/main/js/app/components/ChangeInCalculationPill.tsx index deb82e402fe..e8b3fc1340f 100644 --- a/server/sonar-web/src/main/js/app/components/ChangeInCalculationPill.tsx +++ b/server/sonar-web/src/main/js/app/components/ChangeInCalculationPill.tsx @@ -23,7 +23,7 @@ import * as React from 'react'; import DocumentationLink from '../../components/common/DocumentationLink'; import { DocLink } from '../../helpers/doc-links'; import { translate } from '../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../queries/settings'; +import { useStandardExperienceMode } from '../../queries/settings'; import { ComponentQualifier } from '../../sonar-aligned/types/component'; interface Props { @@ -32,9 +32,9 @@ interface Props { export default function ChangeInCalculation({ qualifier }: Readonly) { const [isPopoverOpen, setIsPopoverOpen] = React.useState(false); - const { data: isLegacy, isLoading } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading } = useStandardExperienceMode(); - if (isLegacy || isLoading) { + if (isStandardMode || isLoading) { return null; } diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx index 5df87de7d47..af79c64c70b 100644 --- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx @@ -34,7 +34,7 @@ import { translateWithParameters } from '../../helpers/l10n'; import { HttpStatus } from '../../helpers/request'; import { getPortfolioUrl, getProjectUrl, getPullRequestUrl } from '../../helpers/urls'; import { useCurrentBranchQuery } from '../../queries/branch'; -import { useIsLegacyCCTMode } from '../../queries/settings'; +import { useStandardExperienceMode } from '../../queries/settings'; import { ProjectAlmBindingConfigurationErrors } from '../../types/alm-settings'; import { Branch } from '../../types/branch-like'; import { isFile } from '../../types/component'; @@ -73,8 +73,8 @@ function ComponentContainer({ hasFeature }: Readonly fixedInPullRequest ? component : undefined, ); - //prefetch isLegacyCCTMode - useIsLegacyCCTMode(); + //prefetch isStandardExperienceMode + useStandardExperienceMode(); const isInTutorials = pathname.includes('tutorials'); diff --git a/server/sonar-web/src/main/js/app/components/__tests__/CalculationChangeMessage-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/CalculationChangeMessage-test.tsx index 737f980634a..fa213e0394c 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/CalculationChangeMessage-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/CalculationChangeMessage-test.tsx @@ -53,7 +53,7 @@ it.each([ it.each([ ['Project', '/projects', ComponentQualifier.Project], ['Portfolios', '/portfolios', ComponentQualifier.Portfolio], -])('should not render on %s page if isLegacy', (_, path, qualifier) => { +])('should not render on %s page if isStandardMode', (_, path, qualifier) => { settingsHandler.set(SettingsKey.MQRMode, 'false'); render(path); expect(ui.alert.get()).toBeInTheDocument(); diff --git a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx index 10b7e06c5e8..5facef0fe93 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/ComponentContainer-test.tsx @@ -52,7 +52,7 @@ jest.mock('../../../api/components', () => ({ })); jest.mock('../../../queries/settings', () => ({ - useIsLegacyCCTMode: jest.fn(), + useStandardExperienceMode: jest.fn(), })); jest.mock('../../../api/navigation', () => ({ diff --git a/server/sonar-web/src/main/js/app/components/calculation-notification/CalculationChangeMessage.tsx b/server/sonar-web/src/main/js/app/components/calculation-notification/CalculationChangeMessage.tsx index 34e97a11306..14b082b1235 100644 --- a/server/sonar-web/src/main/js/app/components/calculation-notification/CalculationChangeMessage.tsx +++ b/server/sonar-web/src/main/js/app/components/calculation-notification/CalculationChangeMessage.tsx @@ -25,7 +25,7 @@ import DocumentationLink from '../../../components/common/DocumentationLink'; import DismissableAlert from '../../../components/ui/DismissableAlert'; import { DocLink } from '../../../helpers/doc-links'; import { translate } from '../../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { Dict } from '../../../types/types'; const SHOW_MESSAGE_PATHS: Dict = { @@ -37,9 +37,9 @@ const ALERT_KEY = 'sonarqube.dismissed_calculation_change_alert'; export default function CalculationChangeMessage() { const location = useLocation(); - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); - if (isLegacy || !Object.keys(SHOW_MESSAGE_PATHS).includes(location.pathname)) { + if (isStandardMode || !Object.keys(SHOW_MESSAGE_PATHS).includes(location.pathname)) { return null; } diff --git a/server/sonar-web/src/main/js/app/components/metrics/RatingComponent.tsx b/server/sonar-web/src/main/js/app/components/metrics/RatingComponent.tsx index f63301ef1f3..50714c4d1a1 100644 --- a/server/sonar-web/src/main/js/app/components/metrics/RatingComponent.tsx +++ b/server/sonar-web/src/main/js/app/components/metrics/RatingComponent.tsx @@ -27,7 +27,7 @@ import { getLeakValue } from '../../../components/measure/utils'; import { SOFTWARE_QUALITY_RATING_METRICS_MAP } from '../../../helpers/constants'; import { isDiffMetric } from '../../../helpers/measures'; import { useMeasureQuery } from '../../../queries/measures'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { BranchLike } from '../../../types/branch-like'; type SizeType = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; @@ -59,7 +59,7 @@ function isNewRatingMetric(metricKey: MetricKey) { } const useGetMetricKeyForRating = (ratingMetric: RatingMetricKeys): MetricKey | null => { - const { data: isLegacy, isLoading } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading } = useStandardExperienceMode(); const hasSoftwareQualityRating = !!SOFTWARE_QUALITY_RATING_METRICS_MAP[ratingMetric]; @@ -70,7 +70,7 @@ const useGetMetricKeyForRating = (ratingMetric: RatingMetricKeys): MetricKey | n if (isLoading) { return null; } - return isLegacy || !hasSoftwareQualityRating + return isStandardMode || !hasSoftwareQualityRating ? ratingMetric : SOFTWARE_QUALITY_RATING_METRICS_MAP[ratingMetric]; }; @@ -88,7 +88,7 @@ export default function RatingComponent(props: Readonly) { } = props; const metricKey = useGetMetricKeyForRating(ratingMetric as RatingMetricKeys); - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const { data: targetMeasure, isLoading: isLoadingTargetMeasure } = useMeasureQuery( { componentKey, metricKey: metricKey ?? '', branchLike }, { enabled: !forceMetric && !!metricKey }, @@ -98,7 +98,8 @@ export default function RatingComponent(props: Readonly) { { componentKey, metricKey: ratingMetric, branchLike }, { enabled: - forceMetric || (!isLegacy && !isNewRatingMetric(ratingMetric) && targetMeasure === null), + forceMetric || + (!isStandardMode && !isNewRatingMetric(ratingMetric) && targetMeasure === null), }, ); 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 c180e6fe1a7..03c701c5cb5 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 @@ -42,7 +42,7 @@ import { areCCTMeasuresComputed, areSoftwareQualityRatingsComputed, } from '../../../helpers/measures'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { BranchLike } from '../../../types/branch-like'; import { isApplication } from '../../../types/component'; import { Component, ComponentMeasure, Dict, Metric } from '../../../types/types'; @@ -102,7 +102,7 @@ export default function CodeAppRenderer(props: Readonly) { const showComponentList = sourceViewer === undefined && components.length > 0 && !showSearch; - const { data: isLegacy, isLoading: isLoadingLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading: isLoadingStandardMode } = useStandardExperienceMode(); const metricKeys = intersection( getCodeMetrics(component.qualifier, branchLike, { newCode: newCodeSelected }), @@ -117,10 +117,10 @@ export default function CodeAppRenderer(props: Readonly) { ); const filteredMetrics = difference(metricKeys, [ - ...(allComponentsHaveSoftwareQualityMeasures && !isLegacy + ...(allComponentsHaveSoftwareQualityMeasures && !isStandardMode ? OLD_TAXONOMY_METRICS : CCT_SOFTWARE_QUALITY_METRICS), - ...(allComponentsHaveRatings && !isLegacy + ...(allComponentsHaveRatings && !isStandardMode ? [...OLD_TAXONOMY_RATINGS, ...LEAK_OLD_TAXONOMY_RATINGS] : SOFTWARE_QUALITY_RATING_METRICS), ]).map((key) => metrics[key]); @@ -150,7 +150,7 @@ export default function CodeAppRenderer(props: Readonly) { )} - + {!allComponentsHaveSoftwareQualityMeasures && ( { - const metric = isLegacy ? m : (OLD_TO_NEW_TAXONOMY_METRICS_MAP[m] ?? m); + const metric = isStandardMode ? m : (OLD_TO_NEW_TAXONOMY_METRICS_MAP[m] ?? m); return translate( 'metric', diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/FacetsList.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/FacetsList.tsx index e29d4e44913..ec284499b1d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/FacetsList.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/FacetsList.tsx @@ -24,7 +24,7 @@ import { useAvailableFeatures } from '../../../app/components/available-features import SeverityFacet from '../../../components/facets/SeverityFacet'; import StandardSeverityFacet from '../../../components/facets/StandardSeverityFacet'; import { translate } from '../../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { Feature } from '../../../types/features'; import { Dict } from '../../../types/types'; import { LanguageFacet } from '../../issues/sidebar/LanguageFacet'; @@ -59,7 +59,7 @@ const MAX_INITIAL_LANGUAGES = 5; export default function FacetsList(props: FacetsListProps) { const { hasFeature } = useAvailableFeatures(); - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const languageDisabled = !props.hideProfileFacet && props.query.profile !== undefined; const inheritanceDisabled = @@ -82,7 +82,7 @@ export default function FacetsList(props: FacetsListProps) { disabledHelper={translate('coding_rules.filters.language.inactive')} /> - {isLegacy && ( + {isStandardMode && ( <> @@ -96,7 +96,7 @@ export default function FacetsList(props: FacetsListProps) { )} - {!isLegacy && ( + {!isStandardMode && ( <> @@ -110,7 +110,7 @@ export default function FacetsList(props: FacetsListProps) { )} - {!isLegacy && ( + {!isStandardMode && ( <> @@ -124,7 +124,7 @@ export default function FacetsList(props: FacetsListProps) { )} - {!isLegacy && ( + {!isStandardMode && ( <> @@ -138,7 +138,7 @@ export default function FacetsList(props: FacetsListProps) { )} - {isLegacy && ( + {isStandardMode && ( <> @@ -152,7 +152,7 @@ export default function FacetsList(props: FacetsListProps) { )} - {!isLegacy && ( + {!isStandardMode && ( <> diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsHeaderSide.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsHeaderSide.tsx index 8731166166f..25b8bc60b9b 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsHeaderSide.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsHeaderSide.tsx @@ -23,7 +23,7 @@ import React from 'react'; import { CleanCodeAttributePill } from '../../../components/shared/CleanCodeAttributePill'; import SoftwareImpactPillList from '../../../components/shared/SoftwareImpactPillList'; import { translate } from '../../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { IssueSeverity } from '../../../types/issues'; import { RuleDetails } from '../../../types/types'; @@ -35,7 +35,7 @@ export default function RuleDetailsHeaderSide({ ruleDetails }: Readonly) const hasCleanCodeAttribute = ruleDetails.cleanCodeAttributeCategory && ruleDetails.cleanCodeAttribute; const hasSoftwareImpact = ruleDetails.impacts.length > 0; - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); if (!hasCleanCodeAttribute && !hasSoftwareImpact) { return null; @@ -45,7 +45,9 @@ export default function RuleDetailsHeaderSide({ ruleDetails }: Readonly) {hasSoftwareImpact && ( ) )} - {ruleDetails.cleanCodeAttributeCategory && ruleDetails.cleanCodeAttribute && !isLegacy && ( - - - - )} + {ruleDetails.cleanCodeAttributeCategory && + ruleDetails.cleanCodeAttribute && + !isStandardMode && ( + + + + )} ); } diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx index 8d26d829b47..607c206990d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx @@ -42,7 +42,7 @@ import { useDeactivateRuleMutation, } from '../../../queries/quality-profiles'; import { useRuleDetailsQuery } from '../../../queries/rules'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { IssueSeverity } from '../../../types/issues'; import { Rule, RuleActivation } from '../../../types/types'; import ActivatedRuleActions from './ActivatedRuleActions'; @@ -85,7 +85,7 @@ export default function RuleListItem(props: Readonly) { const { mutate: deactivateRule } = useDeactivateRuleMutation((data) => onDeactivate(data.key, data.rule), ); - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const activation = data && ruleIsChanged @@ -249,7 +249,7 @@ export default function RuleListItem(props: Readonly) {
- {rule.cleanCodeAttributeCategory !== undefined && !isLegacy && ( + {rule.cleanCodeAttributeCategory !== undefined && !isStandardMode && ( ) { const { componentKey, domain, onChange, open, selected, showFullMeasures, measures } = props; - const { data: isLegacy = false } = useIsLegacyCCTMode(); + const { data: isStandardMode = false } = useStandardExperienceMode(); const helperMessageKey = `component_measures.domain_subnavigation.${domain.name}.help`; const helper = hasMessage(helperMessageKey) ? translate(helperMessageKey) : undefined; const items = addMeasureCategories(domain.name, domain.measures); @@ -114,7 +114,7 @@ export default function DomainSubnavigation(props: Readonly) { key={item.metric.key} componentKey={componentKey} measure={item} - name={getMetricSubnavigationName(item.metric, translateMetric, false, isLegacy)} + name={getMetricSubnavigationName(item.metric, translateMetric, false, isStandardMode)} onChange={onChange} selected={selected} /> diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx index ea39cb9d6d4..618c42a30d3 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx @@ -32,7 +32,7 @@ import * as React from 'react'; import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget'; import { translate } from '../../../helpers/l10n'; import useFollowScroll from '../../../hooks/useFollowScroll'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { Domain } from '../../../types/measures'; import { MeasureEnhanced } from '../../../types/types'; import { PROJECT_OVERVEW, Query, isProjectOverview, populateDomainsFromMeasures } from '../utils'; @@ -49,8 +49,8 @@ interface Props { export default function Sidebar(props: Readonly) { const { showFullMeasures, updateQuery, componentKey, selectedMetric, measures } = props; const { top: topScroll, scrolledOnce } = useFollowScroll(); - const { data: isLegacy } = useIsLegacyCCTMode(); - const domains = populateDomainsFromMeasures(measures, isLegacy); + const { data: isStandardMode } = useStandardExperienceMode(); + const domains = populateDomainsFromMeasures(measures, isStandardMode); const handleChangeMetric = React.useCallback( (metric: string) => { diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.ts b/server/sonar-web/src/main/js/apps/component-measures/utils.ts index 8a70d05b716..f277a75fd35 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/utils.ts +++ b/server/sonar-web/src/main/js/apps/component-measures/utils.ts @@ -102,7 +102,7 @@ const ISSUES_METRICS = [ ]; export const populateDomainsFromMeasures = memoize( - (measures: MeasureEnhanced[], isLegacy = false): Domain[] => { + (measures: MeasureEnhanced[], isStandardMode = false): Domain[] => { let populatedMeasures = measures .filter((measure) => !DEPRECATED_METRICS.includes(measure.metric.key as MetricKey)) .map((measure) => { @@ -118,7 +118,7 @@ export const populateDomainsFromMeasures = memoize( }; }); - if (!isLegacy && areLeakCCTMeasuresComputed(measures)) { + if (!isStandardMode && areLeakCCTMeasuresComputed(measures)) { populatedMeasures = populatedMeasures.filter( (measure) => !LEAK_OLD_TAXONOMY_METRICS.includes(measure.metric.key as MetricKey), ); @@ -129,7 +129,7 @@ export const populateDomainsFromMeasures = memoize( } // Both new and overall code will exist after next analysis - if (!isLegacy && areSoftwareQualityRatingsComputed(measures)) { + if (!isStandardMode && areSoftwareQualityRatingsComputed(measures)) { populatedMeasures = populatedMeasures.filter( (measure) => !OLD_TAXONOMY_RATINGS.includes(measure.metric.key as MetricKey) && @@ -141,7 +141,7 @@ export const populateDomainsFromMeasures = memoize( ); } - if (!isLegacy && areCCTMeasuresComputed(measures)) { + if (!isStandardMode && areCCTMeasuresComputed(measures)) { populatedMeasures = populatedMeasures.filter( (measure) => !OLD_TAXONOMY_METRICS.includes(measure.metric.key as MetricKey), ); @@ -159,13 +159,13 @@ export function getMetricSubnavigationName( metric: Metric, translateFn: (metric: Metric) => string, isDiff = false, - isLegacy = false, + isStandardMode = false, ) { // MQR mode and old taxonomy metrics, we return "Issues" for them anyway - if (!isLegacy && OLD_TAXONOMY_METRICS.includes(metric.key as MetricKey)) { + if (!isStandardMode && OLD_TAXONOMY_METRICS.includes(metric.key as MetricKey)) { return translate('component_measures.awaiting_analysis.name'); } - if (!isLegacy && LEAK_OLD_TAXONOMY_METRICS.includes(metric.key as MetricKey)) { + if (!isStandardMode && LEAK_OLD_TAXONOMY_METRICS.includes(metric.key as MetricKey)) { return translate('component_measures.leak_awaiting_analysis.name'); } diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssueHeaderSide.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssueHeaderSide.tsx index b30eb641b1f..81a093dabee 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssueHeaderSide.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssueHeaderSide.tsx @@ -24,7 +24,7 @@ import React from 'react'; import { CleanCodeAttributePill } from '../../../components/shared/CleanCodeAttributePill'; import SoftwareImpactPillList from '../../../components/shared/SoftwareImpactPillList'; import { translate } from '../../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { IssueSeverity } from '../../../types/issues'; import { Issue } from '../../../types/types'; @@ -33,14 +33,14 @@ interface Props { } export default function IssueHeaderSide({ issue }: Readonly) { - const { data: isLegacy, isLoading } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading } = useStandardExperienceMode(); return ( ) { /> - {!isLegacy && ( + {!isStandardMode && ( ) { } = props; const { settings } = useAppState(); const { hasFeature } = useAvailableFeatures(); - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const renderComponentFacets = () => { const hasFileOrDirectory = @@ -176,7 +176,7 @@ export function Sidebar(props: Readonly) { )} - {!isLegacy && !needIssueSync && ( + {!isStandardMode && !needIssueSync && ( <> ) { )} - {isLegacy && ( + {isStandardMode && ( <> ) { const { component, branch, branchesEnabled } = props; - const { data: isLegacy = false } = useIsLegacyCCTMode(); + const { data: isStandardMode = false } = useStandardExperienceMode(); const { graph: initialGraph } = getActivityGraph( BRANCH_OVERVIEW_ACTIVITY_GRAPH, props.component.key, @@ -283,7 +283,7 @@ export default function BranchOverview(props: Readonly) { }; const loadHistoryMeasures = React.useCallback(() => { - const graphMetrics = getHistoryMetrics(graph, [], isLegacy); + const graphMetrics = getHistoryMetrics(graph, [], isStandardMode); const metrics = uniq([...HISTORY_METRICS_LIST, ...graphMetrics]); return getAllTimeMachineData({ diff --git a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx index 3d381c9a414..3f3cb6f1dc1 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/SoftwareImpactMeasureCard.tsx @@ -31,7 +31,7 @@ import { getIssueTypeBySoftwareQuality, } from '../../../helpers/issues'; import { isDefined } from '../../../helpers/types'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { Branch } from '../../../types/branch-like'; import { SoftwareImpactMeasureData, SoftwareQuality } from '../../../types/clean-code-taxonomy'; import { QualityGateStatusConditionEnhanced } from '../../../types/quality-gates'; @@ -52,12 +52,12 @@ export function SoftwareImpactMeasureCard(props: Readonly m.metric.key === metricKey); - const measure = isLegacy + const measure = isStandardMode ? undefined : (JSON.parse(measureRaw?.value ?? 'null') as SoftwareImpactMeasureData); const alternativeMeasure = measures.find( @@ -87,8 +87,8 @@ export function SoftwareImpactMeasureCard(props: Readonly
- {!isLegacy && intl.formatMessage({ id: `software_quality.${softwareQuality}` })} - {alternativeMeasure && isLegacy && alternativeMeasure.metric.name} + {!isStandardMode && intl.formatMessage({ id: `software_quality.${softwareQuality}` })} + {alternativeMeasure && isStandardMode && alternativeMeasure.metric.name} {failed && ( @@ -100,7 +100,7 @@ export function SoftwareImpactMeasureCard(props: Readonly
{count ? ( - + ) { const { ratingMetricKey, componentKey, softwareQuality, branch } = props; - const { data: isLegacy = false } = useIsLegacyCCTMode(); + const { data: isStandardMode = false } = useStandardExperienceMode(); const intl = useIntl(); @@ -47,7 +47,7 @@ export function SoftwareImpactMeasureRating(props: Readonly; } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx index 21cc693dd84..b51a8650651 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx @@ -38,7 +38,7 @@ import useApplicationLeakQuery from '../../../queries/applications'; import { useCurrentBranchQuery } from '../../../queries/branch'; import { useAllMeasuresHistoryQuery } from '../../../queries/measures'; import { useAllProjectAnalysesQuery } from '../../../queries/project-analyses'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { isApplication, isProject } from '../../../types/component'; import { MeasureHistory, ParsedAnalysis } from '../../../types/project-activity'; import { Query, parseQuery, serializeUrlQuery } from '../utils'; @@ -73,7 +73,7 @@ export function ProjectActivityApp() { ); const { data: analysesData, isLoading: isLoadingAnalyses } = useAllProjectAnalysesQuery(enabled); - const { data: isLegacy, isLoading: isLoadingLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading: isLoadingStandardMode } = useStandardExperienceMode(); const { data: historyData, isLoading: isLoadingHistory } = useAllMeasuresHistoryQuery( { @@ -87,8 +87,11 @@ export function ProjectActivityApp() { const analyses = React.useMemo(() => analysesData ?? [], [analysesData]); const measuresHistory = React.useMemo( - () => (isLoadingLegacy ? [] : mergeRatingMeasureHistory(historyData, parseDate, isLegacy)), - [historyData, isLegacy, isLoadingLegacy], + () => + isLoadingStandardMode + ? [] + : mergeRatingMeasureHistory(historyData, parseDate, isStandardMode), + [historyData, isStandardMode, isLoadingStandardMode], ); const leakPeriodDate = React.useMemo(() => { @@ -139,11 +142,11 @@ export function ProjectActivityApp() { return ( component && ( - + h.value === undefined) } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppRenderer.tsx index f52fbbd5b72..de667ada90b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppRenderer.tsx @@ -42,7 +42,7 @@ interface Props { analysesLoading: boolean; graphLoading: boolean; initializing: boolean; - isLegacy?: boolean; + isStandardMode?: boolean; leakPeriodDate?: Date; measuresHistory: MeasureHistory[]; metrics: Metric[]; @@ -62,7 +62,7 @@ export default function ProjectActivityAppRenderer(props: Props) { graphLoading, metrics, project, - isLegacy, + isStandardMode, } = props; const { configuration, qualifier } = props.project; const canAdmin = @@ -103,7 +103,7 @@ export default function ProjectActivityAppRenderer(props: Props) { analyses={analyses} leakPeriodDate={leakPeriodDate} loading={graphLoading} - isLegacy={isLegacy} + isStandardMode={isStandardMode} measuresHistory={measuresHistory} metrics={metrics} project={project.key} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx index f059e203627..fa05b8f0303 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityGraphs.tsx @@ -55,7 +55,7 @@ import { PROJECT_ACTIVITY_GRAPH } from './ProjectActivityApp'; interface Props { analyses: ParsedAnalysis[]; - isLegacy?: boolean; + isStandardMode?: boolean; leakPeriodDate?: Date; loading: boolean; measuresHistory: MeasureHistory[]; @@ -219,7 +219,7 @@ export default class ProjectActivityGraphs extends React.PureComponent { - const { measuresHistory, isLegacy } = this.props; + const { measuresHistory, isStandardMode } = this.props; const qualityMeasuresHistory = measuresHistory.find((history) => CCT_SOFTWARE_QUALITY_METRICS.includes(history.metric), @@ -230,7 +230,7 @@ export default class ProjectActivityGraphs extends React.PureComponent diff --git a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts index f245ee977fe..ce5aedb63bd 100644 --- a/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts +++ b/server/sonar-web/src/main/js/apps/projects/__tests__/utils-test.ts @@ -84,7 +84,7 @@ describe('formatDuration', () => { describe('fetchProjects', () => { it('correctly converts the passed arguments to the desired query format', async () => { - await utils.fetchProjects({ isFavorite: true, query: {}, isLegacy: true }); + await utils.fetchProjects({ isFavorite: true, query: {}, isStandardMode: true }); expect(searchProjects).toHaveBeenCalledWith({ f: 'analysisDate,leakPeriodDate', @@ -103,7 +103,7 @@ describe('fetchProjects', () => { incorrect_property: 'should not appear in post data', search: 'foo', }, - isLegacy: true, + isStandardMode: true, }); expect(searchProjects).toHaveBeenCalledWith({ @@ -116,7 +116,7 @@ describe('fetchProjects', () => { }); it('correctly converts the passed arguments to the desired query format for non legacy', async () => { - await utils.fetchProjects({ isFavorite: true, query: {}, isLegacy: false }); + await utils.fetchProjects({ isFavorite: true, query: {}, isStandardMode: false }); expect(searchProjects).toHaveBeenCalledWith({ f: 'analysisDate,leakPeriodDate', @@ -135,7 +135,7 @@ describe('fetchProjects', () => { incorrect_property: 'should not appear in post data', search: 'foo', }, - isLegacy: false, + isStandardMode: false, }); expect(searchProjects).toHaveBeenCalledWith({ @@ -165,7 +165,7 @@ describe('fetchProjects', () => { paging: { total: 2 }, }); - await utils.fetchProjects({ isFavorite: true, query: {}, isLegacy: true }).then((r) => { + await utils.fetchProjects({ isFavorite: true, query: {}, isStandardMode: true }).then((r) => { expect(r).toEqual({ facets: { new_coverage: { NO_DATA: 0 }, diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx index 3d9eeead93c..d08bc398621 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx @@ -44,7 +44,7 @@ import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthent import { translate } from '../../../helpers/l10n'; import { get, save } from '../../../helpers/storage'; import { isDefined } from '../../../helpers/types'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { AppState } from '../../../types/appstate'; import { CurrentUser, isLoggedIn } from '../../../types/users'; import { Query, hasFilterParams, parseUrlQuery } from '../query'; @@ -59,7 +59,7 @@ interface Props { appState: AppState; currentUser: CurrentUser; isFavorite: boolean; - isLegacy: boolean; + isStandardMode: boolean; location: Location; router: Router; } @@ -106,21 +106,24 @@ export class AllProjects extends React.PureComponent { } fetchMoreProjects = () => { - const { isFavorite, isLegacy } = this.props; + const { isFavorite, isStandardMode } = this.props; const { pageIndex, projects, query } = this.state; if (isDefined(pageIndex) && pageIndex !== 0 && projects && Object.keys(query).length !== 0) { this.setState({ loading: true }); - fetchProjects({ isFavorite, query, pageIndex: pageIndex + 1, isLegacy }).then((response) => { - if (this.mounted) { - this.setState({ - loading: false, - pageIndex: pageIndex + 1, - projects: [...projects, ...response.projects], - }); - } - }, this.stopLoading); + fetchProjects({ isFavorite, query, pageIndex: pageIndex + 1, isStandardMode }).then( + (response) => { + if (this.mounted) { + this.setState({ + loading: false, + pageIndex: pageIndex + 1, + projects: [...projects, ...response.projects], + }); + } + }, + this.stopLoading, + ); } }; @@ -175,14 +178,14 @@ export class AllProjects extends React.PureComponent { }; handleQueryChange() { - const { isFavorite, isLegacy } = this.props; + const { isFavorite, isStandardMode } = this.props; const queryRaw = this.props.location.query; const query = parseUrlQuery(queryRaw); this.setState({ loading: true, query }); - fetchProjects({ isFavorite, query, isLegacy }).then((response) => { + fetchProjects({ isFavorite, query, isStandardMode }).then((response) => { // We ignore the request if the query changed since the time it was initiated // If that happened, another query will be initiated anyway if (this.mounted && queryRaw === this.props.location.query) { @@ -204,10 +207,10 @@ export class AllProjects extends React.PureComponent { }; loadSearchResultCount = (property: string, values: string[]) => { - const { isFavorite, isLegacy } = this.props; + const { isFavorite, isStandardMode } = this.props; const { query = {} } = this.state; - const data = convertToQueryData({ ...query, [property]: values }, isFavorite, isLegacy, { + const data = convertToQueryData({ ...query, [property]: values }, isFavorite, isStandardMode, { ps: 1, facets: property, }); @@ -352,10 +355,10 @@ function getStorageOptions() { return options; } -function AllProjectsWrapper(props: Readonly>) { +function AllProjectsWrapper(props: Readonly>) { const [searchParams, setSearchParams] = useSearchParams(); const savedOptions = getStorageOptions(); - const { data: isLegacy, isLoading } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading } = useStandardExperienceMode(); React.useEffect( () => { @@ -374,7 +377,7 @@ function AllProjectsWrapper(props: Readonly>) { return ( - + ); } diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx index 19dfe38e4dc..179b9b1bb6f 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCardMeasures.tsx @@ -31,7 +31,7 @@ import RatingComponent from '../../../../app/components/metrics/RatingComponent' import { duplicationRatingConverter } from '../../../../components/measure/utils'; import { translate } from '../../../../helpers/l10n'; import { isDefined } from '../../../../helpers/types'; -import { useIsLegacyCCTMode } from '../../../../queries/settings'; +import { useStandardExperienceMode } from '../../../../queries/settings'; import { Dict } from '../../../../types/types'; import ProjectCardMeasure from './ProjectCardMeasure'; @@ -116,7 +116,7 @@ function renderDuplication(props: ProjectCardMeasuresProps) { ); } -function renderRatings(props: ProjectCardMeasuresProps, isLegacy: boolean) { +function renderRatings(props: ProjectCardMeasuresProps, isStandardMode: boolean) { const { isNewCode, measures, componentKey } = props; const measuresByCodeLeak = isNewCode @@ -124,11 +124,11 @@ function renderRatings(props: ProjectCardMeasuresProps, isLegacy: boolean) { : [ { iconLabel: translate( - `metric.${isLegacy ? MetricKey.vulnerabilities : MetricKey.security_issues}.short_name`, + `metric.${isStandardMode ? MetricKey.vulnerabilities : MetricKey.security_issues}.short_name`, ), noShrink: true, metricKey: - isLegacy || measures[MetricKey.security_issues] === undefined + isStandardMode || measures[MetricKey.security_issues] === undefined ? MetricKey.vulnerabilities : MetricKey.security_issues, metricRatingKey: MetricKey.security_rating, @@ -136,10 +136,10 @@ function renderRatings(props: ProjectCardMeasuresProps, isLegacy: boolean) { }, { iconLabel: translate( - `metric.${isLegacy ? MetricKey.bugs : MetricKey.reliability_issues}.short_name`, + `metric.${isStandardMode ? MetricKey.bugs : MetricKey.reliability_issues}.short_name`, ), metricKey: - isLegacy || measures[MetricKey.reliability_issues] === undefined + isStandardMode || measures[MetricKey.reliability_issues] === undefined ? MetricKey.bugs : MetricKey.reliability_issues, metricRatingKey: MetricKey.reliability_rating, @@ -147,10 +147,10 @@ function renderRatings(props: ProjectCardMeasuresProps, isLegacy: boolean) { }, { iconLabel: translate( - `metric.${isLegacy ? MetricKey.code_smells : MetricKey.maintainability_issues}.short_name`, + `metric.${isStandardMode ? MetricKey.code_smells : MetricKey.maintainability_issues}.short_name`, ), metricKey: - isLegacy || measures[MetricKey.maintainability_issues] === undefined + isStandardMode || measures[MetricKey.maintainability_issues] === undefined ? MetricKey.code_smells : MetricKey.maintainability_issues, metricRatingKey: MetricKey.sqale_rating, @@ -202,7 +202,7 @@ function renderRatings(props: ProjectCardMeasuresProps, isLegacy: boolean) { export default function ProjectCardMeasures(props: ProjectCardMeasuresProps) { const { isNewCode, measures, componentQualifier } = props; - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const { ncloc } = measures; @@ -218,7 +218,7 @@ export default function ProjectCardMeasures(props: ProjectCardMeasuresProps) { const measureList = [ renderNewIssues(props), - ...renderRatings(props, !!isLegacy), + ...renderRatings(props, !!isStandardMode), renderCoverage(props), renderDuplication(props), ].filter(isDefined); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx b/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx index 5a0b704345b..a756bb4e0c3 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/RatingFacet.tsx @@ -25,7 +25,7 @@ import { formatMeasure } from '~sonar-aligned/helpers/measures'; import { MetricType } from '~sonar-aligned/types/metrics'; import { RawQuery } from '~sonar-aligned/types/router'; import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { Facet } from '../types'; import RangeFacetBase from './RangeFacetBase'; @@ -40,7 +40,7 @@ interface Props { export default function RatingFacet(props: Readonly) { const { facet, maxFacetValue, name, property, value } = props; - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const renderAccessibleLabel = React.useCallback( (option: number) => { @@ -66,7 +66,7 @@ export default function RatingFacet(props: Readonly) { facet={facet} header={translate('metric_domain', name)} description={ - hasDescription(property, isLegacy) + hasDescription(property, isStandardMode) ? translate(`projects.facets.${property.replace('new_', '')}.description`) : undefined } @@ -82,12 +82,12 @@ export default function RatingFacet(props: Readonly) { ); } -const hasDescription = (property: string, isLegacy = false) => { +const hasDescription = (property: string, isStandardMode = false) => { return [ 'maintainability', 'new_maintainability', 'security_review', - ...(isLegacy ? ['security', 'new_security', 'reliability', 'new_reliability'] : []), + ...(isStandardMode ? ['security', 'new_security', 'reliability', 'new_reliability'] : []), ].includes(property); }; @@ -99,7 +99,7 @@ function RatingOption({ option, property, }: Readonly<{ option: string | number; property: string }>) { - const { data: isLegacy, isLoading } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading } = useStandardExperienceMode(); const intl = useIntl(); const ratingFormatted = formatMeasure(option, MetricType.Rating); @@ -114,7 +114,7 @@ function RatingOption({ /> {intl.formatMessage({ - id: `projects.facets.rating_option.${propertyWithoutPrefix}${isLegacy && isSecurityOrReliability ? '.legacy' : ''}.${option}`, + id: `projects.facets.rating_option.${propertyWithoutPrefix}${isStandardMode && isSecurityOrReliability ? '.legacy' : ''}.${option}`, })} diff --git a/server/sonar-web/src/main/js/apps/projects/query.ts b/server/sonar-web/src/main/js/apps/projects/query.ts index 0a6edbb1563..cef18e8f55b 100644 --- a/server/sonar-web/src/main/js/apps/projects/query.ts +++ b/server/sonar-web/src/main/js/apps/projects/query.ts @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { ComponentQualifier } from '~sonar-aligned/types/component'; +import { MetricKey } from '~sonar-aligned/types/metrics'; import { RawQuery } from '~sonar-aligned/types/router'; import { propertyToMetricMap, propertyToMetricMapLegacy } from './utils'; @@ -59,12 +60,12 @@ export function parseUrlQuery(urlQuery: RawQuery): Query { new_security_review: getAsNumericRating(urlQuery['new_security_review']), maintainability: getAsNumericRating(urlQuery['maintainability']), new_maintainability: getAsNumericRating(urlQuery['new_maintainability']), - coverage: getAsNumericRating(urlQuery['coverage']), - new_coverage: getAsNumericRating(urlQuery['new_coverage']), + coverage: getAsNumericRating(urlQuery[MetricKey.coverage]), + new_coverage: getAsNumericRating(urlQuery[MetricKey.new_coverage]), duplications: getAsNumericRating(urlQuery['duplications']), new_duplications: getAsNumericRating(urlQuery['new_duplications']), size: getAsNumericRating(urlQuery['size']), - new_lines: getAsNumericRating(urlQuery['new_lines']), + new_lines: getAsNumericRating(urlQuery[MetricKey.new_lines]), languages: getAsStringArray(urlQuery['languages']), tags: getAsStringArray(urlQuery['tags']), qualifier: getAsQualifier(urlQuery['qualifier']), @@ -74,7 +75,11 @@ export function parseUrlQuery(urlQuery: RawQuery): Query { }; } -export function convertToFilter(query: Query, isFavorite: boolean, isLegacy: boolean): string { +export function convertToFilter( + query: Query, + isFavorite: boolean, + isStandardMode: boolean, +): string { const conditions: string[] = []; if (isFavorite) { @@ -82,19 +87,19 @@ export function convertToFilter(query: Query, isFavorite: boolean, isLegacy: boo } if (query['gate'] != null) { - conditions.push(mapPropertyToMetric('gate', isLegacy) + ' = ' + query['gate']); + conditions.push(`${mapPropertyToMetric('gate', isStandardMode)}=${query['gate']}`); } - ['coverage', 'new_coverage'].forEach((property) => - pushMetricToArray(query, property, conditions, convertCoverage, isLegacy), + [MetricKey.coverage, MetricKey.new_coverage].forEach((property) => + pushMetricToArray(query, property, conditions, convertCoverage, isStandardMode), ); ['duplications', 'new_duplications'].forEach((property) => - pushMetricToArray(query, property, conditions, convertDuplications, isLegacy), + pushMetricToArray(query, property, conditions, convertDuplications, isStandardMode), ); ['size', 'new_lines'].forEach((property) => - pushMetricToArray(query, property, conditions, convertSize, isLegacy), + pushMetricToArray(query, property, conditions, convertSize, isStandardMode), ); [ @@ -107,15 +112,15 @@ export function convertToFilter(query: Query, isFavorite: boolean, isLegacy: boo 'new_security_review', 'new_maintainability', ].forEach((property) => - pushMetricToArray(query, property, conditions, convertIssuesRating, isLegacy), + pushMetricToArray(query, property, conditions, convertIssuesRating, isStandardMode), ); ['languages', 'tags', 'qualifier'].forEach((property) => - pushMetricToArray(query, property, conditions, convertArrayMetric, isLegacy), + pushMetricToArray(query, property, conditions, convertArrayMetric, isStandardMode), ); if (query['search'] != null) { - conditions.push(`${mapPropertyToMetric('search', isLegacy)} = "${query['search']}"`); + conditions.push(`${mapPropertyToMetric('search', isStandardMode)} = "${query['search']}"`); } return conditions.join(' and '); @@ -235,8 +240,11 @@ function convertSize(metric: string, size: number): string { } } -function mapPropertyToMetric(property?: string, isLegacy = false): string | undefined { - return property && (isLegacy ? propertyToMetricMapLegacy : propertyToMetricMap)[property]; +function mapPropertyToMetric(property?: string, isStandardMode = false): string | undefined { + if (property === undefined) { + return; + } + return (isStandardMode ? propertyToMetricMapLegacy : propertyToMetricMap)[property]; } function pushMetricToArray( @@ -244,9 +252,9 @@ function pushMetricToArray( property: string, conditionsArray: string[], convertFunction: (metric: string, value: Query[string]) => string, - isLegacy: boolean, + isStandardMode: boolean, ): void { - const metric = mapPropertyToMetric(property, isLegacy); + const metric = mapPropertyToMetric(property, isStandardMode); if (query[property] !== undefined && metric !== undefined) { conditionsArray.push(convertFunction(metric, query[property])); } diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts index 709e2626f52..b32e4ca015d 100644 --- a/server/sonar-web/src/main/js/apps/projects/utils.ts +++ b/server/sonar-web/src/main/js/apps/projects/utils.ts @@ -206,19 +206,19 @@ export function fetchProjects({ isFavorite, query, pageIndex = 1, - isLegacy, + isStandardMode, }: { isFavorite: boolean; - isLegacy: boolean; + isStandardMode: boolean; pageIndex?: number; query: Query; }) { const ps = PAGE_SIZE; - const data = convertToQueryData(query, isFavorite, isLegacy, { + const data = convertToQueryData(query, isFavorite, isStandardMode, { p: pageIndex > 1 ? pageIndex : undefined, ps, - facets: defineFacets(query, isLegacy).join(), + facets: defineFacets(query, isStandardMode).join(), f: 'analysisDate,leakPeriodDate', }); @@ -226,7 +226,7 @@ export function fetchProjects({ .then((response) => Promise.all([Promise.resolve(response), fetchScannableProjects()])) .then(([{ components, facets, paging }, { scannableProjects }]) => { return { - facets: getFacetsMap(facets, isLegacy), + facets: getFacetsMap(facets, isStandardMode), projects: components.map((component) => ({ ...component, isScannable: scannableProjects.find((p) => p.key === component.key) !== undefined, @@ -244,23 +244,23 @@ export function defineMetrics(query: Query): string[] { return METRICS; } -function defineFacets(query: Query, isLegacy: boolean): string[] { +function defineFacets(query: Query, isStandardMode: boolean): string[] { if (query.view === 'leak') { - return isLegacy ? LEGACY_LEAK_FACETS : LEAK_FACETS; + return isStandardMode ? LEGACY_LEAK_FACETS : LEAK_FACETS; } - return isLegacy ? LEGACY_FACETS : FACETS; + return isStandardMode ? LEGACY_FACETS : FACETS; } export function convertToQueryData( query: Query, isFavorite: boolean, - isLegacy: boolean, + isStandardMode: boolean, defaultData = {}, ) { const data: RequestData = { ...defaultData }; - const filter = convertToFilter(query, isFavorite, isLegacy); - const sort = convertToSorting(query, isLegacy); + const filter = convertToFilter(query, isFavorite, isStandardMode); + const sort = convertToSorting(query, isStandardMode); if (filter) { data.filter = filter; @@ -321,11 +321,11 @@ export const propertyToMetricMap: Dict = { new_maintainability: 'new_software_quality_maintainability_rating', }; -function getFacetsMap(facets: Facet[], isLegacy: boolean) { +function getFacetsMap(facets: Facet[], isStandardMode: boolean) { const map: Dict> = {}; facets.forEach((facet) => { - const property = invert(isLegacy ? propertyToMetricMapLegacy : propertyToMetricMap)[ + const property = invert(isStandardMode ? propertyToMetricMapLegacy : propertyToMetricMap)[ facet.property ]; const { values } = facet; @@ -342,16 +342,16 @@ function getFacetsMap(facets: Facet[], isLegacy: boolean) { export function convertToSorting( { sort }: Query, - isLegacy: boolean, + isStandardMode: boolean, ): { asc?: boolean; s?: string } { if (sort?.startsWith('-')) { return { - s: (isLegacy ? propertyToMetricMapLegacy : propertyToMetricMap)[sort.substring(1)], + s: (isStandardMode ? propertyToMetricMapLegacy : propertyToMetricMap)[sort.substring(1)], asc: false, }; } - return { s: (isLegacy ? propertyToMetricMapLegacy : propertyToMetricMap)[sort ?? ''] }; + return { s: (isStandardMode ? propertyToMetricMapLegacy : propertyToMetricMap)[sort ?? ''] }; } const ONE_MINUTE = 60000; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx index 5ace834dc30..9af91ac5e32 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx @@ -27,7 +27,7 @@ import IssueSeverityIcon from '../../../components/icon-mappers/IssueSeverityIco import { CleanCodeAttributePill } from '../../../components/shared/CleanCodeAttributePill'; import SoftwareImpactPillList from '../../../components/shared/SoftwareImpactPillList'; import { getRulesUrl } from '../../../helpers/urls'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { IssueSeverity } from '../../../types/issues'; import { Dict } from '../../../types/types'; import ComparisonResultActivation from './ComparisonResultActivation'; @@ -224,9 +224,9 @@ export default function ComparisonResults(props: Readonly) { } function RuleCell({ rule, severity }: Readonly<{ rule: RuleCompare; severity?: string }>) { - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const shouldRenderSeverity = - isLegacy && + isStandardMode && Boolean(severity) && rule.left && rule.right && @@ -238,7 +238,7 @@ function RuleCell({ rule, severity }: Readonly<{ rule: RuleCompare; severity?: s {rule.name} - {!isLegacy && (rule.cleanCodeAttributeCategory || rule.impacts.length > 0) && ( + {!isStandardMode && (rule.cleanCodeAttributeCategory || rule.impacts.length > 0) && (
    {rule.cleanCodeAttributeCategory && (
  • diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx index eebcabef175..039fc4a7afe 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/details/ProfileRules.tsx @@ -33,9 +33,10 @@ import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip'; import { translate } from '../../../helpers/l10n'; import { isDefined } from '../../../helpers/types'; import { getRulesUrl } from '../../../helpers/urls'; +import { StaleTime } from '../../../queries/common'; import { useGetQualityProfile } from '../../../queries/quality-profiles'; import { useSearchRulesQuery } from '../../../queries/rules'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { CleanCodeAttributeCategory, SoftwareQuality } from '../../../types/clean-code-taxonomy'; import { SearchRulesResponse } from '../../../types/coding-rules'; import { RulesFacetName } from '../../../types/rules'; @@ -55,28 +56,31 @@ interface ByType { } export default function ProfileRules({ profile }: Readonly) { - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const activateMoreUrl = getRulesUrl({ qprofile: profile.key, activation: 'false' }); const { actions = {} } = profile; - const { data: allRules, isLoading: isAllRulesLoading } = useSearchRulesQuery({ - ps: 1, - languages: profile.language, - facets: isLegacy - ? `${RulesFacetName.Types}` - : `${RulesFacetName.CleanCodeAttributeCategories},${RulesFacetName.ImpactSoftwareQualities}`, - }); + const { data: allRules, isLoading: isAllRulesLoading } = useSearchRulesQuery( + { + ps: 1, + languages: profile.language, + facets: isStandardMode + ? `${RulesFacetName.Types}` + : `${RulesFacetName.CleanCodeAttributeCategories},${RulesFacetName.ImpactSoftwareQualities}`, + }, + { staleTime: StaleTime.LIVE }, + ); const { data: activatedRules, isLoading: isActivatedRulesLoading } = useSearchRulesQuery( { ps: 1, activation: 'true', - facets: isLegacy + facets: isStandardMode ? `${RulesFacetName.Types}` : `${RulesFacetName.CleanCodeAttributeCategories},${RulesFacetName.ImpactSoftwareQualities}`, qprofile: profile.key, }, - { enabled: !!allRules }, + { enabled: !!allRules, staleTime: StaleTime.LIVE }, ); const { data: sonarWayDiff, isLoading: isShowProfileLoading } = useGetQualityProfile( @@ -123,7 +127,7 @@ export default function ProfileRules({ profile }: Readonly) { {translate('quality_profile.rules.breakdown')} - {isLegacy && ( + {isStandardMode && ( ) {
    )} - {!isLegacy && ( + {!isStandardMode && ( <> { setIsFormOpen(false); }} diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubConfigurationForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubConfigurationForm.tsx index 693953ba25f..e4b71b2ea81 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubConfigurationForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/GitHubConfigurationForm.tsx @@ -48,7 +48,7 @@ import { interface Props { gitHubConfiguration?: GitHubConfigurationResponse; - isLegacyConfiguration: boolean; + isStandardModeConfiguration: boolean; onClose: () => void; } @@ -64,7 +64,7 @@ interface FormData { } export default function GitHubConfigurationForm(props: Readonly) { - const { gitHubConfiguration, isLegacyConfiguration, onClose } = props; + const { gitHubConfiguration, isStandardModeConfiguration, onClose } = props; const isCreate = gitHubConfiguration === undefined; const [errors, setErrors] = useState>>({}); @@ -158,13 +158,13 @@ export default function GitHubConfigurationForm(props: Readonly) { } }; - const helpMessage = isLegacyConfiguration ? `legacy_help.${AlmKeys.GitHub}` : 'help'; + const helpMessage = isStandardModeConfiguration ? `legacy_help.${AlmKeys.GitHub}` : 'help'; const formBody = (
    ) { onFieldChange={(_, value) => { setFormData((prev) => ({ ...prev, [key]: { ...prev[key], value } })); }} - isNotSet={isCreate || isLegacyConfiguration} + isNotSet={isCreate || isStandardModeConfiguration} error={errors[key]?.message} /> diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx index 2915ce50b29..ac85d31cb62 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.tsx @@ -58,7 +58,7 @@ import { omitNil } from '../../helpers/request'; import { getBaseUrl } from '../../helpers/system'; import { isDefined } from '../../helpers/types'; import { getBranchLikeUrl, getCodeUrl } from '../../helpers/urls'; -import { useIsLegacyCCTMode } from '../../queries/settings'; +import { useStandardExperienceMode } from '../../queries/settings'; import type { BranchLike } from '../../types/branch-like'; import { IssueType } from '../../types/issues'; import type { Measure, SourceViewerFile } from '../../types/types'; @@ -76,7 +76,7 @@ interface Props { export default function SourceViewerHeader(props: Readonly) { const intl = useIntl(); - const { data: isLegacy = false } = useIsLegacyCCTMode(); + const { data: isStandardMode = false } = useStandardExperienceMode(); const { showMeasures, branchLike, hidePinOption, openComponent, componentMeasures } = props; const { key, measures, path, project, projectName, q } = props.sourceViewerFile; @@ -87,7 +87,7 @@ export default function SourceViewerHeader(props: Readonly) { const rawSourcesLink = `${getBaseUrl()}/api/sources/raw?${query}`; const renderIssueMeasures = () => { - const areCCTMeasuresComputed = !isLegacy && areCCTMeasuresComputedFn(componentMeasures); + const areCCTMeasuresComputed = !isStandardMode && areCCTMeasuresComputedFn(componentMeasures); return ( componentMeasures && @@ -115,7 +115,7 @@ export default function SourceViewerHeader(props: Readonly) { }); const qualityTitle = intl.formatMessage({ - id: `metric.${isLegacy ? deprecatedMetric : metric}.short_name`, + id: `metric.${isStandardMode ? deprecatedMetric : metric}.short_name`, }); return ( diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx index a7d77852d73..17561817e60 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/LineIssuesIndicator.tsx @@ -22,7 +22,7 @@ import { uniq } from 'lodash'; import * as React from 'react'; import { useIntl } from 'react-intl'; import Tooltip from '../../../components/controls/Tooltip'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { Issue, SourceLine } from '../../../types/types'; const MOUSE_LEAVE_DELAY = 0.25; @@ -39,7 +39,7 @@ export function LineIssuesIndicator(props: LineIssuesIndicatorProps) { const { issues, issuesOpen, line, as = 'td' } = props; const hasIssues = issues.length > 0; const intl = useIntl(); - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); if (!hasIssues) { return ; @@ -49,7 +49,7 @@ export function LineIssuesIndicator(props: LineIssuesIndicatorProps) { const issueTypes = uniq(issues.map((issue) => issue.type)); let tooltipContent; - if (isLegacy ? issueTypes.length > 1 : issueAttributeCategories.length > 1) { + if (isStandardMode ? issueTypes.length > 1 : issueAttributeCategories.length > 1) { tooltipContent = intl.formatMessage( { id: 'source_viewer.issues_on_line.multiple_issues' }, { show: !issuesOpen }, @@ -57,7 +57,7 @@ export function LineIssuesIndicator(props: LineIssuesIndicatorProps) { } else { tooltipContent = intl.formatMessage( { - id: `source_viewer.issues_on_line.multiple_issues_same_category${isLegacy ? '.legacy' : ''}`, + id: `source_viewer.issues_on_line.multiple_issues_same_category${isStandardMode ? '.legacy' : ''}`, }, { show: !issuesOpen, diff --git a/server/sonar-web/src/main/js/components/activity-graph/utils.ts b/server/sonar-web/src/main/js/components/activity-graph/utils.ts index b1768446382..ebcc1aa3550 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/utils.ts +++ b/server/sonar-web/src/main/js/components/activity-graph/utils.ts @@ -91,20 +91,24 @@ export function getSeriesMetricType(series: Serie[]) { export function getDisplayedHistoryMetrics( graph: GraphType, customMetrics: string[], - isLegacy = false, + isStandardMode = false, ) { if (isCustomGraph(graph)) { return customMetrics; } - return isLegacy ? LEGACY_GRAPHS_METRICS_DISPLAYED[graph] : GRAPHS_METRICS_DISPLAYED[graph]; + return isStandardMode ? LEGACY_GRAPHS_METRICS_DISPLAYED[graph] : GRAPHS_METRICS_DISPLAYED[graph]; } -export function getHistoryMetrics(graph: GraphType, customMetrics: string[], isLegacy = false) { +export function getHistoryMetrics( + graph: GraphType, + customMetrics: string[], + isStandardMode = false, +) { if (isCustomGraph(graph)) { return customMetrics; } - return isLegacy ? LEGACY_GRAPHS_METRICS[graph] : GRAPHS_METRICS[graph]; + return isStandardMode ? LEGACY_GRAPHS_METRICS[graph] : GRAPHS_METRICS[graph]; } export function hasHistoryDataValue(series: Serie[]) { diff --git a/server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx b/server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx index 0d42c729b26..9f3ce0ca77b 100644 --- a/server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx @@ -27,7 +27,7 @@ import { } from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../queries/settings'; +import { useStandardExperienceMode } from '../../queries/settings'; import { SoftwareImpactSeverity } from '../../types/clean-code-taxonomy'; import { IssueSeverity } from '../../types/issues'; import { Dict } from '../../types/types'; @@ -51,7 +51,7 @@ const severityIcons: Dict<(props: IconProps) => React.ReactElement> = { }; export default function SoftwareImpactSeverityIcon({ severity, ...iconProps }: Readonly) { - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); if (typeof severity !== 'string' || !severityIcons[severity]) { return null; } @@ -62,7 +62,7 @@ export default function SoftwareImpactSeverityIcon({ severity, ...iconProps }: R {...iconProps} width={iconProps?.width ?? defaultIconSize} height={iconProps?.height ?? defaultIconSize} - aria-label={translate(isLegacy ? 'severity' : 'severity_impact', severity)} + aria-label={translate(isStandardMode ? 'severity' : 'severity_impact', severity)} /> ); } diff --git a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx index 73f51cee95e..46215799b4e 100644 --- a/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; -import { useIsLegacyCCTMode } from '../../../queries/settings'; +import { useStandardExperienceMode } from '../../../queries/settings'; import { BranchLike } from '../../../types/branch-like'; import { Issue } from '../../../types/types'; import { CleanCodeAttributePill } from '../../shared/CleanCodeAttributePill'; @@ -33,7 +33,7 @@ export interface IssueTitleBarProps { export default function IssueTitleBar(props: Readonly) { const { issue, displayWhyIsThisAnIssue, branchLike } = props; - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); return (
    @@ -45,7 +45,7 @@ export default function IssueTitleBar(props: Readonly) { />
    - {!isLegacy && ( + {!isStandardMode && ( )} diff --git a/server/sonar-web/src/main/js/components/shared/AnalysisMissingInfoMessage.tsx b/server/sonar-web/src/main/js/components/shared/AnalysisMissingInfoMessage.tsx index b0bb17d6cbf..c9dd40bf03a 100644 --- a/server/sonar-web/src/main/js/components/shared/AnalysisMissingInfoMessage.tsx +++ b/server/sonar-web/src/main/js/components/shared/AnalysisMissingInfoMessage.tsx @@ -22,7 +22,7 @@ import { FlagMessage } from 'design-system'; import * as React from 'react'; import { FormattedMessage, useIntl } from 'react-intl'; import { DocLink } from '../../helpers/doc-links'; -import { useIsLegacyCCTMode } from '../../queries/settings'; +import { useStandardExperienceMode } from '../../queries/settings'; import DocumentationLink from '../common/DocumentationLink'; interface AnalysisMissingInfoMessageProps { @@ -36,10 +36,10 @@ export default function AnalysisMissingInfoMessage({ qualifier, className, }: Readonly) { - const { data: isLegacy, isLoading } = useIsLegacyCCTMode(); + const { data: isStandardMode, isLoading } = useStandardExperienceMode(); const intl = useIntl(); - if (hide || isLoading || isLegacy) { + if (hide || isLoading || isStandardMode) { return null; } diff --git a/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx b/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx index 5fb953f5a66..0275abea56c 100644 --- a/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx +++ b/server/sonar-web/src/main/js/components/shared/SoftwareImpactPillList.tsx @@ -20,7 +20,7 @@ import classNames from 'classnames'; import React from 'react'; import { translate } from '../../helpers/l10n'; -import { useIsLegacyCCTMode } from '../../queries/settings'; +import { useStandardExperienceMode } from '../../queries/settings'; import { SoftwareImpact, SoftwareImpactSeverity, @@ -54,7 +54,7 @@ export default function SoftwareImpactPillList({ className, ...props }: Readonly) { - const { data: isLegacy } = useIsLegacyCCTMode(); + const { data: isStandardMode } = useStandardExperienceMode(); const getQualityLabel = (quality: SoftwareQuality) => translate('software_quality', quality); const sortingFn = (a: SoftwareImpact, b: SoftwareImpact) => { if (a.severity !== b.severity) { @@ -65,7 +65,7 @@ export default function SoftwareImpactPillList({ return (
      - {!isLegacy && + {!isStandardMode && softwareImpacts .slice() .sort(sortingFn) @@ -78,10 +78,10 @@ export default function SoftwareImpactPillList({ /> ))} - {!isLegacy && softwareImpacts.length === 0 && issueType === 'SECURITY_HOTSPOT' && ( + {!isStandardMode && softwareImpacts.length === 0 && issueType === 'SECURITY_HOTSPOT' && ( )} - {isLegacy && issueType && issueSeverity && ( + {isStandardMode && issueType && issueSeverity && ( )}
    diff --git a/server/sonar-web/src/main/js/helpers/activity-graph.ts b/server/sonar-web/src/main/js/helpers/activity-graph.ts index 62c3e9d46c4..d2273460103 100644 --- a/server/sonar-web/src/main/js/helpers/activity-graph.ts +++ b/server/sonar-web/src/main/js/helpers/activity-graph.ts @@ -25,14 +25,14 @@ import { SOFTWARE_QUALITY_RATING_METRICS_MAP } from './constants'; export const mergeRatingMeasureHistory = ( historyData: TimeMachineResponse | undefined, parseDateFn: (date: string) => Date, - isLegacy = false, + isStandardMode = false, ) => { const softwareQualityMeasures = Object.values(SOFTWARE_QUALITY_RATING_METRICS_MAP); const softwareQualityMeasuresMap = new Map< string, { history: { date: string; value?: string }[]; index: number; splitDate?: Date } >(); - if (isLegacy) { + if (isStandardMode) { return ( historyData?.measures ?.filter((m) => !softwareQualityMeasures.includes(m.metric)) diff --git a/server/sonar-web/src/main/js/queries/rules.ts b/server/sonar-web/src/main/js/queries/rules.ts index 07f83be487e..2525d85133a 100644 --- a/server/sonar-web/src/main/js/queries/rules.ts +++ b/server/sonar-web/src/main/js/queries/rules.ts @@ -17,11 +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 { - queryOptions, - useMutation, - useQueryClient, -} from '@tanstack/react-query'; +import { queryOptions, useMutation, useQueryClient } from '@tanstack/react-query'; import { createRule, deleteRule, getRuleDetails, searchRules, updateRule } from '../api/rules'; import { mapRestRuleToRule } from '../apps/coding-rules/utils'; import { SearchRulesResponse } from '../types/coding-rules'; diff --git a/server/sonar-web/src/main/js/queries/settings.ts b/server/sonar-web/src/main/js/queries/settings.ts index 83d02cbaf81..e9fb110dd44 100644 --- a/server/sonar-web/src/main/js/queries/settings.ts +++ b/server/sonar-web/src/main/js/queries/settings.ts @@ -57,7 +57,7 @@ export const useGetValueQuery = createQueryHook( }, ); -export const useIsLegacyCCTMode = () => { +export const useStandardExperienceMode = () => { return useGetValueQuery( { key: SettingsKey.MQRMode }, { staleTime: Infinity, select: (data) => data?.value === 'false' }, -- 2.39.5