import { createPortal } from 'react-dom';
import { Helmet } from 'react-helmet-async';
import { Outlet } from 'react-router-dom';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { validateProjectAlmBinding } from '../../api/alm-settings';
import { getTasksForComponent } from '../../api/ce';
import { getComponentData } from '../../api/components';
import { getComponentNavigation } from '../../api/navigation';
-import { useLocation, useRouter } from '../../components/hoc/withRouter';
import { translateWithParameters } from '../../helpers/l10n';
import { HttpStatus } from '../../helpers/request';
import { getPortfolioUrl, getProjectUrl, getPullRequestUrl } from '../../helpers/urls';
*/
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
-import { Location, withRouter } from '../../components/hoc/withRouter';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { installScript } from '../../helpers/extensions';
import { getWebAnalyticsPageHandlerFromCache } from '../../helpers/extensionsHandler';
import { getInstance } from '../../helpers/system';
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
import { ButtonPrimary, Card, CenteredLayout, Title } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Router } from '~sonar-aligned/types/router';
import { setSimpleSettingValue } from '../../api/settings';
import { whenLoggedIn } from '../../components/hoc/whenLoggedIn';
-import { Router, withRouter } from '../../components/hoc/withRouter';
import { translate } from '../../helpers/l10n';
import { getBaseUrl } from '../../helpers/system';
import { hasGlobalPermission } from '../../helpers/users';
import userEvent from '@testing-library/user-event';
import React, { useContext } from 'react';
import { Route } from 'react-router-dom';
+import * as withRouter from '~sonar-aligned/components/hoc/withRouter';
import { validateProjectAlmBinding } from '../../../api/alm-settings';
import { getTasksForComponent } from '../../../api/ce';
import { getComponentData } from '../../../api/components';
import { getComponentNavigation } from '../../../api/navigation';
-import * as withRouter from '../../../components/hoc/withRouter';
import { mockProjectAlmBindingConfigurationErrors } from '../../../helpers/mocks/alm-settings';
import { mockBranch, mockPullRequest } from '../../../helpers/mocks/branch-like';
import { mockComponent } from '../../../helpers/mocks/component';
default: jest.fn(),
}));
-jest.mock('../../../components/hoc/withRouter', () => ({
+jest.mock('~sonar-aligned/components/hoc/withRouter', () => ({
__esModule: true,
- ...jest.requireActual('../../../components/hoc/withRouter'),
+ ...jest.requireActual('~sonar-aligned/components/hoc/withRouter'),
}));
const ui = {
jest.spyOn(withRouter, 'useRouter').mockReturnValue({
replace: mockedReplace,
push: jest.fn(),
+ navigate: jest.fn(),
+ searchParams: new URLSearchParams(),
+ setSearchParams: jest.fn(),
});
renderComponentContainer(
jest.spyOn(withRouter, 'useRouter').mockReturnValue({
replace: mockedReplace,
push: jest.fn(),
+ navigate: jest.fn(),
+ searchParams: new URLSearchParams(),
+ setSearchParams: jest.fn(),
});
jest.useFakeTimers();
jest.spyOn(withRouter, 'useRouter').mockReturnValue({
replace: mockedReplace,
push: jest.fn(),
+ navigate: jest.fn(),
+ searchParams: new URLSearchParams(),
+ setSearchParams: jest.fn(),
});
jest.useFakeTimers();
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { getWrappedDisplayName } from '../../../components/hoc/utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { AppState } from '../../../types/appstate';
import { AppStateContext } from './AppStateContext';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { getWrappedDisplayName } from '../../../components/hoc/utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { Feature } from '../../../types/features';
import { AvailableFeaturesContext } from './AvailableFeaturesContext';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { getWrappedDisplayName } from '../../../components/hoc/utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { ComponentContextShape, ComponentQualifier } from '../../../types/component';
import { ComponentContext } from './ComponentContext';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { getWrappedDisplayName } from '../../../components/hoc/utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { CurrentUserContext, CurrentUserContextInterface } from './CurrentUserContext';
export default function withCurrentUserContext<P>(
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
import { withTheme } from '@emotion/react';
import { QueryClient } from '@tanstack/react-query';
import { addGlobalErrorMessage, Theme } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { injectIntl, WrappedComponentProps } from 'react-intl';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { getExtensionStart } from '../../../helpers/extensions';
import { translate } from '../../../helpers/l10n';
import { getCurrentL10nBundle } from '../../../helpers/l10nBundle';
} from 'design-system';
import { debounce, uniqBy } from 'lodash';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Router } from '~sonar-aligned/types/router';
import { getSuggestions } from '../../../api/components';
import FocusOutHandler from '../../../components/controls/FocusOutHandler';
import OutsideClickHandler from '../../../components/controls/OutsideClickHandler';
import Tooltip from '../../../components/controls/Tooltip';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
import { PopupPlacement } from '../../../components/ui/popups';
import { isInput, isShortcut } from '../../../helpers/keyboardEventHelpers';
import { KeyboardKeys } from '../../../helpers/keycodes';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* eslint-disable react/no-unused-prop-types */
-
import styled from '@emotion/styled';
import {
FlagErrorIcon,
} from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import { IndexationNotificationType } from '../../../types/indexation';
import { TaskStatuses, TaskTypes } from '../../../types/tasks';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { getWrappedDisplayName } from '../../../components/hoc/utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { Languages } from '../../../types/languages';
import { LanguagesContext } from './LanguagesContext';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { getWrappedDisplayName } from '../../../components/hoc/utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { Dict, Metric } from '../../../types/types';
import { MetricsContext } from './MetricsContext';
PopupZLevel,
} 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 { useLocation } from '../../../../components/hoc/withRouter';
import { DEFAULT_ISSUES_QUERY } from '../../../../components/shared/utils';
import { isPullRequest } from '../../../../helpers/branch-like';
import { hasMessage, translate, translateWithParameters } from '../../../../helpers/l10n';
*/
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 { Router, withRouter } from '../../../../../components/hoc/withRouter';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
+import { Router } from '~sonar-aligned/types/router';
import {
getBrancheLikesAsTree,
isPullRequest,
} from '../../../../../helpers/branch-like';
import { KeyboardKeys } from '../../../../../helpers/keycodes';
import { translate } from '../../../../../helpers/l10n';
-import { getBranchLikeUrl, queryToSearch } from '../../../../../helpers/urls';
+import { getBranchLikeUrl } from '../../../../../helpers/urls';
import { BranchLike, BranchLikeTree } from '../../../../../types/branch-like';
import { ComponentQualifier } from '../../../../../types/component';
import { Component } 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 { Link, RadioButtonGroup } from '@sonarsource/echoes-react';
import { subDays } from 'date-fns';
import {
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { now } from '../../../helpers/dates';
import { translate } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import '../style.css';
import { HousekeepingPolicy, RangeOption } from '../utils';
import DownloadButton from './DownloadButton';
import { debounce } from 'lodash';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, RawQuery, Router } from '~sonar-aligned/types/router';
import {
cancelAllTasks,
cancelTask as cancelTaskAPI,
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import ListFooter from '../../../components/controls/ListFooter';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { toShortISO8601String } from '../../../helpers/dates';
import { translate } from '../../../helpers/l10n';
import { parseAsDate } from '../../../helpers/query';
import { Task, TaskStatuses } from '../../../types/tasks';
-import { Component, Paging, RawQuery } from '../../../types/types';
+import { Component, Paging } from '../../../types/types';
import { CURRENTS, DEBOUNCE_DELAY, DEFAULT_FILTERS, PAGE_SIZE } from '../constants';
import { Query, mapFiltersToParameters, updateTask } from '../utils';
import Header from './Header';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { changePassword } from '../../api/users';
import withAppStateContext from '../../app/components/app-state/withAppStateContext';
-import { Location, withRouter } from '../../components/hoc/withRouter';
import { AppState } from '../../types/appstate';
import ChangeAdminPasswordAppRenderer from './ChangeAdminPasswordAppRenderer';
import { DEFAULT_ADMIN_LOGIN, DEFAULT_ADMIN_PASSWORD } from './constants';
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
import { LinkStandalone } from '@sonarsource/echoes-react';
import {
ButtonPrimary,
} from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
-import { Location } from '../../components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { translate } from '../../helpers/l10n';
import { getReturnUrl } from '../../helpers/urls';
import Unauthorized from '../sessions/components/Unauthorized';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import withMetricsContext from '../../../app/components/metrics/withMetricsContext';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { CodeScope, getCodeUrl, getProjectUrl } from '../../../helpers/urls';
import { WithBranchLikesProps, useBranchesQuery } from '../../../queries/branch';
import { ComponentQualifier, isPortfolioLike } from '../../../types/component';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
+import { Location } from '~sonar-aligned/types/router';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
import ListFooter from '../../../components/controls/ListFooter';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location } from '../../../components/hoc/withRouter';
import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissingInfoMessage';
import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../../helpers/constants';
import { KeyboardKeys } from '../../../helpers/keycodes';
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react';
import { Badge, BranchIcon, LightLabel, Note, QualifierIcon } from 'design-system';
import * as React from 'react';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { translate } from '../../../helpers/l10n';
import { isDefined } from '../../../helpers/types';
-import { CodeScope, getComponentOverviewUrl, queryToSearch } from '../../../helpers/urls';
+import { CodeScope, getComponentOverviewUrl } from '../../../helpers/urls';
import { BranchLike } from '../../../types/branch-like';
import {
ComponentQualifier,
import { InputSearch, Spinner, ToggleButton } from 'design-system';
import { isEmpty, omit } from 'lodash';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { Location, Router } from '~sonar-aligned/types/router';
import { getTree } from '../../../api/components';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate } from '../../../helpers/l10n';
import { BranchLike } from '../../../types/branch-like';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { Location } from '~sonar-aligned/types/router';
import SourceViewer from '../../../components/SourceViewer/SourceViewer';
import withKeyboardNavigation from '../../../components/hoc/withKeyboardNavigation';
-import { Location } from '../../../components/hoc/withRouter';
import { BranchLike } from '../../../types/branch-like';
import { Measure } from '../../../types/types';
import { keyBy } from 'lodash';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, RawQuery, Router } from '~sonar-aligned/types/router';
import { Profile, searchQualityProfiles } from '../../../api/quality-profiles';
import { getRulesApp, searchRules } from '../../../api/rules';
import { getValue } from '../../../api/settings';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
import ListFooter from '../../../components/controls/ListFooter';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import '../../../components/search-navigator.css';
import { isInput, isShortcut } from '../../../helpers/keyboardEventHelpers';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { SecurityStandard } from '../../../types/security';
import { SettingsKey } from '../../../types/settings';
-import { Dict, Paging, RawQuery, Rule, RuleActivation } from '../../../types/types';
+import { Dict, Paging, Rule, RuleActivation } from '../../../types/types';
import { CurrentUser, isLoggedIn } from '../../../types/users';
import { FiltersHeader } from '../../issues/sidebar/FiltersHeader';
import {
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { RawQuery } from '~sonar-aligned/types/router';
import {
cleanQuery,
parseAsArray,
SoftwareImpactSeverity,
SoftwareQuality,
} from '../../types/clean-code-taxonomy';
-import { Dict, RawQuery, RuleInheritance } from '../../types/types';
+import { Dict, RuleInheritance } from '../../types/types';
export interface Query {
activation: boolean | undefined;
*/
import React, { useEffect } from 'react';
import { Route, useLocation, useNavigate } from 'react-router-dom';
-import { RawQuery } from '../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import CodingRulesApp from './components/CodingRulesApp';
import { parseQuery, serializeQuery } from './query';
import * as React from 'react';
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 { Location, Router } from '~sonar-aligned/types/router';
import { getMeasuresWithPeriod } from '../../../api/measures';
import { getAllMetrics } from '../../../api/metrics';
import { ComponentContext } from '../../../app/components/componentContext/ComponentContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { enhanceMeasure } from '../../../components/measure/utils';
import '../../../components/search-navigator.css';
import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissingInfoMessage';
import { Highlight, KeyboardHint } from 'design-system';
import * as React from 'react';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { Router } from '~sonar-aligned/types/router';
import { getComponentTree } from '../../../api/components';
import { getMeasures } from '../../../api/measures';
import SourceViewer from '../../../components/SourceViewer/SourceViewer';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
-import { Router } from '../../../components/hoc/withRouter';
import FilesCounter from '../../../components/ui/FilesCounter';
import { isSameBranchLike } from '../../../helpers/branch-like';
import { getComponentMeasureUniqueKey } from '../../../helpers/component';
*/
import * as React from 'react';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { Router } from '~sonar-aligned/types/router';
import { getComponentShow } from '../../../api/components';
-import { Router } from '../../../components/hoc/withRouter';
import { isSameBranchLike } from '../../../helpers/branch-like';
import { getProjectUrl } from '../../../helpers/urls';
import { BranchLike } from '../../../types/branch-like';
*/
import React from 'react';
import { Navigate, Route, useParams, useSearchParams } from 'react-router-dom';
+import { searchParamsToQuery } from '~sonar-aligned/helpers/router';
import NavigateWithParams from '../../app/utils/NavigateWithParams';
import { omitNil } from '../../helpers/request';
-import { searchParamsToQuery } from '../../helpers/urls';
import ComponentMeasuresApp from './components/ComponentMeasuresApp';
const routes = () => (
*/
import { groupBy, memoize, sortBy, toPairs } from 'lodash';
import { isBranch } from '~sonar-aligned/helpers/branch-like';
+import { RawQuery } from '~sonar-aligned/types/router';
import { enhanceMeasure } from '../../components/measure/utils';
import { isPullRequest } from '../../helpers/branch-like';
import {
Measure,
MeasureEnhanced,
Metric,
- RawQuery,
} from '../../types/types';
import { bubbles } from './config/bubbles';
import { domains } from './config/domains';
import { Accordion, FlagMessage, Link, SearchHighlighter, Spinner } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import ListFooter from '../../../../components/controls/ListFooter';
import { translate } from '../../../../helpers/l10n';
import { getBaseUrl } from '../../../../helpers/system';
-import { queryToSearch } from '../../../../helpers/urls';
import { AzureProject, AzureRepository } from '../../../../types/alm-integration';
import AlmRepoItem from '../components/AlmRepoItem';
import { CreateProjectModes } from '../types';
import { LabelValueSelectOption } from 'design-system';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { GroupBase } from 'react-select';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import {
getAzureProjects,
getAzureRepositories,
searchAzureRepositories,
} from '../../../../api/alm-integrations';
-import { useLocation, useRouter } from '../../../../components/hoc/withRouter';
import { AzureProject, AzureRepository } from '../../../../types/alm-integration';
import { AlmSettingsInstance } from '../../../../types/alm-settings';
import { DopSetting } from '../../../../types/dop-translation';
} from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { useAppState } from '../../../../app/components/app-state/withAppStateContext';
import { AvailableFeaturesContext } from '../../../../app/components/available-features/AvailableFeaturesContext';
import { translate } from '../../../../helpers/l10n';
-import { getGlobalSettingsUrl, queryToSearch } from '../../../../helpers/urls';
+import { getGlobalSettingsUrl } from '../../../../helpers/urls';
import { AzureProject, AzureRepository } from '../../../../types/alm-integration';
import { AlmKeys, AlmSettingsInstance } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { uniqBy } from 'lodash';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import ListFooter from '../../../../components/controls/ListFooter';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
-import { queryToSearch } from '../../../../helpers/urls';
import { AzureProject, AzureRepository } from '../../../../types/alm-integration';
import { Dict } from '../../../../types/types';
import { CreateProjectModes } from '../types';
*/
import { LabelValueSelectOption } from 'design-system';
import React, { useCallback, useMemo, useState } from 'react';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { searchForBitbucketCloudRepositories } from '../../../../api/alm-integrations';
-import { useLocation } from '../../../../components/hoc/withRouter';
import { BitbucketCloudRepository } from '../../../../types/alm-integration';
import { AlmKeys } from '../../../../types/alm-settings';
import { DopSetting } from '../../../../types/dop-translation';
import { LightPrimary, Title } from 'design-system';
import React, { useContext } from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { AvailableFeaturesContext } from '../../../../app/components/available-features/AvailableFeaturesContext';
import { translate } from '../../../../helpers/l10n';
-import { queryToSearch } from '../../../../helpers/urls';
import { BitbucketCloudRepository } from '../../../../types/alm-integration';
import { AlmKeys, AlmSettingsInstance } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { FlagMessage, InputSearch, LightPrimary, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import ListFooter from '../../../../components/controls/ListFooter';
import { translate } from '../../../../helpers/l10n';
import { getBaseUrl } from '../../../../helpers/system';
-import { queryToSearch } from '../../../../helpers/urls';
import { BitbucketCloudRepository } from '../../../../types/alm-integration';
import AlmRepoItem from '../components/AlmRepoItem';
import { REPOSITORY_PAGE_SIZE } from '../constants';
import { FlagMessage, InputSearch, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { translate } from '../../../../helpers/l10n';
-import { queryToSearch } from '../../../../helpers/urls';
import {
BitbucketProject,
BitbucketProjectRepositories,
import { Accordion, FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
import { getBaseUrl } from '../../../../helpers/system';
-import { queryToSearch } from '../../../../helpers/urls';
import { BitbucketProject, BitbucketRepository } from '../../../../types/alm-integration';
import AlmRepoItem from '../components/AlmRepoItem';
import { CreateProjectModes } from '../types';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { Location, Router } from '~sonar-aligned/types/router';
import {
getBitbucketServerProjects,
getBitbucketServerRepositories,
searchForBitbucketServerRepositories,
} from '../../../../api/alm-integrations';
-import { Location, Router } from '../../../../components/hoc/withRouter';
import {
BitbucketProject,
BitbucketProjectRepositories,
import { LargeCenteredLayout } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { getDopSettings } from '../../../api/dop-translation';
import withAvailableFeatures, {
WithAvailableFeaturesProps,
} from '../../../app/components/available-features/withAvailableFeatures';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings';
import { DopSetting } from '../../../types/dop-translation';
*/
import { LabelValueSelectOption } from 'design-system';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { getGithubOrganizations, getGithubRepositories } from '../../../../api/alm-integrations';
-import { useLocation, useRouter } from '../../../../components/hoc/withRouter';
import { GithubOrganization, GithubRepository } from '../../../../types/alm-integration';
import { AlmInstanceBase, AlmKeys } from '../../../../types/alm-settings';
import { DopSetting } from '../../../../types/dop-translation';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* eslint-disable react/no-unused-prop-types */
-
import { Link, Spinner } from '@sonarsource/echoes-react';
import { DarkLabel, FlagMessage, InputSelect, LightPrimary, Title } from 'design-system';
import React, { useContext, useEffect, useState } from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { useAppState } from '../../../../app/components/app-state/withAppStateContext';
import { AvailableFeaturesContext } from '../../../../app/components/available-features/AvailableFeaturesContext';
import { translate } from '../../../../helpers/l10n';
import { LabelValueSelectOption } from '../../../../helpers/search';
-import { queryToSearch } from '../../../../helpers/urls';
import { GithubOrganization, GithubRepository } from '../../../../types/alm-integration';
import { AlmKeys, AlmSettingsInstance } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
*/
import { LabelValueSelectOption } from 'design-system';
import React, { useCallback, useMemo } from 'react';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { getGitlabProjects } from '../../../../api/alm-integrations';
-import { useLocation } from '../../../../components/hoc/withRouter';
import { GitlabProject } from '../../../../types/alm-integration';
import { AlmKeys } from '../../../../types/alm-settings';
import { DopSetting } from '../../../../types/dop-translation';
import { LightPrimary, Title } from 'design-system';
import React, { useContext, useEffect, useState } from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { AvailableFeaturesContext } from '../../../../app/components/available-features/AvailableFeaturesContext';
import { translate } from '../../../../helpers/l10n';
-import { queryToSearch } from '../../../../helpers/urls';
import { GitlabProject } from '../../../../types/alm-integration';
import { AlmInstanceBase, AlmKeys, AlmSettingsInstance } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { FlagMessage, InputSearch, LightPrimary } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import ListFooter from '../../../../components/controls/ListFooter';
import Tooltip from '../../../../components/controls/Tooltip';
import { translate } from '../../../../helpers/l10n';
import { getBaseUrl } from '../../../../helpers/system';
-import { queryToSearch } from '../../../../helpers/urls';
import { GitlabProject } from '../../../../types/alm-integration';
import { Paging } from '../../../../types/types';
import AlmRepoItem from '../components/AlmRepoItem';
import { useEffect } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { useNavigate, unstable_usePrompt as usePrompt } from 'react-router-dom';
-import { useLocation } from '../../../../components/hoc/withRouter';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import NewCodeDefinitionSelector from '../../../../components/new-code-definition/NewCodeDefinitionSelector';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { getProjectUrl, queryToSearch } from '../../../../helpers/urls';
+import { getProjectUrl } from '../../../../helpers/urls';
import {
MutationArg,
useImportProjectMutation,
import React, { useEffect, useRef } from 'react';
import { FormattedMessage } from 'react-intl';
import { GroupBase } from 'react-select';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { throwGlobalError } from '~sonar-aligned/helpers/error';
import { getComponents } from '../../../../api/project-management';
-import { useLocation, useRouter } from '../../../../components/hoc/withRouter';
import { LabelValueSelectOption } from '../../../../helpers/search';
import { useProjectBindingsQuery } from '../../../../queries/dop-translation';
import { AlmKeys } from '../../../../types/alm-settings';
import { LightPrimary, Title } from 'design-system/lib';
import React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
-import { useLocation } from '../../../../components/hoc/withRouter';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { useDocUrl } from '../../../../helpers/docs';
export function MonorepoProjectHeader() {
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { useCallback, useEffect, useMemo, useState } from 'react';
-import { useLocation, useRouter } from '../../../components/hoc/withRouter';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { isDefined } from '../../../helpers/types';
import { AlmInstanceBase, AlmKeys } from '../../../types/alm-settings';
import { DopSetting } from '../../../types/dop-translation';
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
import styled from '@emotion/styled';
import { Checkbox, Spinner } from '@sonarsource/echoes-react';
import classNames from 'classnames';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { FormattedMessage } from 'react-intl';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { Location, RawQuery, Router } from '~sonar-aligned/types/router';
import { listIssues, searchIssues } from '../../../api/issues';
import { getRuleDetails } from '../../../api/rules';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
WithIndexationContextProps,
} from '../../../components/hoc/withIndexationContext';
import withIndexationGuard from '../../../components/hoc/withIndexationGuard';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import IssueTabViewer from '../../../components/rules/IssueTabViewer';
import '../../../components/search-navigator.css';
import { DEFAULT_ISSUES_QUERY } from '../../../components/shared/utils';
ReferencedRule,
} from '../../../types/issues';
import { SecurityStandard } from '../../../types/security';
-import { Component, Dict, Issue, Paging, RawQuery, RuleDetails } from '../../../types/types';
+import { Component, Dict, Issue, Paging, RuleDetails } from '../../../types/types';
import { CurrentUser, UserBase } from '../../../types/users';
import * as actions from '../actions';
import SubnavigationIssuesList from '../issues-subnavigation/SubnavigationIssuesList';
import { max, sortBy, values, without } from 'lodash';
import * as React from 'react';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { RawQuery } from '~sonar-aligned/types/router';
import ListFooter from '../../../components/controls/ListFooter';
import Tooltip from '../../../components/controls/Tooltip';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { queriesEqual } from '../../../helpers/query';
import { isDefined } from '../../../helpers/types';
import { MetricType } from '../../../types/metrics';
-import { Dict, Paging, RawQuery } from '../../../types/types';
+import { Dict, Paging } from '../../../types/types';
import { FacetItemsList } from './FacetItemsList';
import { ListStyleFacetFooter } from './ListStyleFacetFooter';
import { MultipleSelectionHint } from './MultipleSelectionHint';
*/
import { intersection, isArray, uniq } from 'lodash';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { RawQuery } from '~sonar-aligned/types/router';
import { getUsers } from '../../api/users';
import { DEFAULT_ISSUES_QUERY } from '../../components/shared/utils';
import {
} from '../../types/issues';
import { MetricType } from '../../types/metrics';
import { SecurityStandard } from '../../types/security';
-import { Dict, Flow, FlowType, Issue, Paging, RawQuery } from '../../types/types';
+import { Dict, Flow, FlowType, Issue, Paging } from '../../types/types';
import { RestUser } from '../../types/users';
const OWASP_ASVS_4_0 = 'owaspAsvs-4.0';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { FormattedMessage } from 'react-intl';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { getAvailablePlugins, getInstalledPlugins } from '../../api/plugins';
import { getValue, setSimpleSettingValue } from '../../api/settings';
import DocumentationLink from '../../components/common/DocumentationLink';
import ListFooter from '../../components/controls/ListFooter';
import Suggestions from '../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../components/hoc/withRouter';
import { translate } from '../../helpers/l10n';
import { EditionKey } from '../../types/editions';
import { PendingPluginResult, Plugin, RiskConsent } from '../../types/plugins';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import AdminContext from '../../app/components/AdminContext';
import withAppStateContext from '../../app/components/app-state/withAppStateContext';
-import { Location, withRouter } from '../../components/hoc/withRouter';
import { AppState } from '../../types/appstate';
import { EditionKey } from '../../types/editions';
import { GlobalSettingKeys } from '../../types/settings';
*/
import { findLastIndex, memoize } from 'lodash';
import { throwGlobalError } from '~sonar-aligned/helpers/error';
+import { RawQuery } from '~sonar-aligned/types/router';
import { getInstalledPlugins, getUpdatesPlugins } from '../../api/plugins';
import { cleanQuery, parseAsString, serializeString } from '../../helpers/query';
import { isDefined } from '../../helpers/types';
import { InstalledPlugin, Plugin, Update } from '../../types/plugins';
-import { RawQuery } from '../../types/types';
export interface Query {
filter: string;
PageContentFontWrapper,
} from 'design-system';
import * as React from 'react';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
-import { useLocation, useRouter } from '../../../components/hoc/withRouter';
import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissingInfoMessage';
import { parseDate } from '../../../helpers/dates';
import { areCCTMeasuresComputed, isDiffMetric } from '../../../helpers/measures';
import { Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext';
import DismissableAlert from '../../../components/ui/DismissableAlert';
import { translate } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import { useProjectBindingQuery } from '../../../queries/devops-integration';
import { ComponentQualifier } from '../../../types/component';
import { Component } 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 { Link } from '@sonarsource/echoes-react';
import { Note, getTabPanelId } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { Image } from '../../../components/common/Image';
import { translate } from '../../../helpers/l10n';
-import { CodeScope, queryToSearch } from '../../../helpers/urls';
+import { CodeScope } from '../../../helpers/urls';
import { Branch } from '../../../types/branch-like';
import { ComponentQualifier } from '../../../types/component';
import { NewCodeDefinitionType } from '../../../types/new-code-definition';
import React from 'react';
import { IntlShape } from 'react-intl';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { RawQuery } from '~sonar-aligned/types/router';
import { ISSUETYPE_METRIC_KEYS_MAP } from '../../helpers/issues';
import { translate } from '../../helpers/l10n';
import { parseAsString } from '../../helpers/query';
import { MetricKey, MetricType } from '../../types/metrics';
import { AnalysisMeasuresVariations, MeasureHistory } from '../../types/project-activity';
import { QualityGateStatusConditionEnhanced } from '../../types/quality-gates';
-import { Dict, RawQuery } from '../../types/types';
+import { Dict } from '../../types/types';
export const BRANCH_OVERVIEW_METRICS: string[] = [
// quality gate
import { ActionsDropdown, ItemButton, ItemLink, PopupZLevel } from 'design-system';
import { difference } from 'lodash';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
+import { Router } from '~sonar-aligned/types/router';
import {
deletePermissionTemplate,
setDefaultPermissionTemplate,
updatePermissionTemplate,
} from '../../../api/permissions';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import { PermissionTemplate } from '../../../types/types';
import { PERMISSION_TEMPLATES_PATH } from '../utils';
import DeleteForm from './DeleteForm';
*/
import { ButtonPrimary, FlagMessage, Spinner, Title } from 'design-system';
import React, { useState } from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { throwGlobalError } from '~sonar-aligned/helpers/error';
+import { Router } from '~sonar-aligned/types/router';
import { createPermissionTemplate } from '../../../api/permissions';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { useGithubProvisioningEnabledQuery } from '../../../queries/identity-provider/github';
import { PERMISSION_TEMPLATES_PATH } from '../utils';
*/
import { CodeSnippet, ContentCell, Link } from 'design-system';
import * as React from 'react';
-import { queryToSearch } from '../../../helpers/urls';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { PermissionTemplate } from '../../../types/types';
import { PERMISSION_TEMPLATES_PATH } from '../utils';
import Defaults from './Defaults';
*/
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { getPermissionTemplates } from '../../../api/permissions';
import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { AppState } from '../../../types/appstate';
import { Permission, PermissionTemplate } from '../../../types/types';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
import {
useComponent,
getHistoryMetrics,
isCustomGraph,
} from '../../../components/activity-graph/utils';
-import { useLocation, useRouter } from '../../../components/hoc/withRouter';
import { parseDate } from '../../../helpers/dates';
import useApplicationLeakQuery from '../../../queries/applications';
import { useBranchesQuery } from '../../../queries/branch';
*/
import { startOfDay } from 'date-fns';
import { isEqual, uniq } from 'lodash';
+import { RawQuery } from '~sonar-aligned/types/router';
import { DEFAULT_GRAPH } from '../../components/activity-graph/utils';
import { parseDate } from '../../helpers/dates';
import { MEASURES_REDIRECTION } from '../../helpers/measures';
} from '../../helpers/query';
import { MetricKey } from '../../types/metrics';
import { GraphType, ParsedAnalysis } from '../../types/project-activity';
-import { Dict, RawQuery } from '../../types/types';
+import { Dict } from '../../types/types';
export interface Query {
category: string;
import { DangerButtonPrimary, addGlobalSuccessMessage } from 'design-system';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+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 { Router, withRouter } from '../../components/hoc/withRouter';
import { translate, translateWithParameters } from '../../helpers/l10n';
import { isApplication, isPortfolioLike } from '../../types/component';
import { Component } 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 { Location } from '../../../../components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { BadgeOptions, BadgeType, getBadgeSnippet, getBadgeUrl } from '../utils';
jest.mock('../../../../helpers/urls', () => ({
import { LargeCenteredLayout, PageContentFontWrapper, Title } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Router } from '~sonar-aligned/types/router';
import { changeKey } from '../../api/components';
import RecentHistory from '../../app/components/RecentHistory';
import withComponentContext from '../../app/components/componentContext/withComponentContext';
-import { Router, withRouter } from '../../components/hoc/withRouter';
import { translate } from '../../helpers/l10n';
import { Component } from '../../types/types';
import UpdateForm from './UpdateForm';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { useSearchParams } from 'react-router-dom';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, RawQuery, Router } from '~sonar-aligned/types/router';
import { searchProjects } from '../../../api/components';
import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import '../../../components/search-navigator.css';
import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication';
import { translate } from '../../../helpers/l10n';
import { AppState } from '../../../types/appstate';
import { ComponentQualifier } from '../../../types/component';
import { MetricKey } from '../../../types/metrics';
-import { RawQuery } from '../../../types/types';
import { CurrentUser, isLoggedIn } from '../../../types/users';
import { Query, hasFilterParams, parseUrlQuery } from '../query';
import '../styles.css';
*/
import { ButtonSecondary } from 'design-system';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { throwGlobalError } from '~sonar-aligned/helpers/error';
+import { Router } from '~sonar-aligned/types/router';
import { getComponentNavigation } from '../../../api/navigation';
import withAppStateContext from '../../../app/components/app-state/withAppStateContext';
import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext';
import CreateApplicationForm from '../../../app/components/extensions/CreateApplicationForm';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { getComponentAdminUrl, getComponentOverviewUrl } from '../../../helpers/urls';
import { hasGlobalPermission } from '../../../helpers/users';
*/
import * as React from 'react';
import { useNavigate } from 'react-router-dom';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { searchProjects } from '../../../api/components';
import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext';
-import { useLocation } from '../../../components/hoc/withRouter';
import { get } from '../../../helpers/storage';
import { hasGlobalPermission } from '../../../helpers/users';
import { CurrentUser, isLoggedIn } from '../../../types/users';
import { FishVisual, Highlight, StandoutLink } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { translate } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import { Dict } from '../../../types/types';
import { Query } from '../query';
*/
import { ButtonPrimary, FishVisual, Highlight } from 'design-system';
import * as React from 'react';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Router } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { hasGlobalPermission } from '../../../helpers/users';
import { Permissions } from '../../../types/permissions';
*/
import { ToggleButton } from 'design-system';
import * as React from 'react';
+import { withRouter, WithRouterProps } from '~sonar-aligned/components/hoc/withRouter';
import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext';
-import { withRouter, WithRouterProps } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { save } from '../../../helpers/storage';
import { CurrentUser, isLoggedIn } from '../../../types/users';
*/
import { InputSearch, LightLabel, LightPrimary } from 'design-system';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import HomePageSelect from '../../../components/controls/HomePageSelect';
import Tooltip from '../../../components/controls/Tooltip';
import { translate } from '../../../helpers/l10n';
-import { RawQuery } from '../../../types/types';
import { CurrentUser, isLoggedIn } from '../../../types/users';
import ApplicationCreation from './ApplicationCreation';
import PerspectiveSelect from './PerspectiveSelect';
import { BasicSeparator, DangerButtonSecondary, StyledPageTitle } from 'design-system';
import { flatMap } from 'lodash';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
-import { Dict, RawQuery } from '../../../types/types';
+import { Dict } from '../../../types/types';
import CoverageFilter from '../filters/CoverageFilter';
import DuplicationsFilter from '../filters/DuplicationsFilter';
import LanguagesFilter from '../filters/LanguagesFilter';
import { ItemLink } from 'design-system';
import * as React from 'react';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { Image } from '../../../components/common/Image';
import { translate } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import { AlmKeys } from '../../../types/alm-settings';
export interface ProjectCreationMenuItemProps {
*/
import userEvent from '@testing-library/user-event';
import * as React from 'react';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { createApplication } from '../../../../api/application';
import { getComponentNavigation } from '../../../../api/navigation';
import { mockAppState, mockLoggedInUser, mockRouter } from '../../../../helpers/testMocks';
import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import { byRole, byText } from '../../../../helpers/testSelector';
-import { queryToSearch } from '../../../../helpers/urls';
import { ComponentQualifier, Visibility } from '../../../../types/component';
import { FCProps } from '../../../../types/misc';
import { LoggedInUser } from '../../../../types/users';
import { render, screen } from '@testing-library/react';
import * as React from 'react';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { searchProjects } from '../../../../api/components';
-import { useLocation } from '../../../../components/hoc/withRouter';
import { get } from '../../../../helpers/storage';
import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks';
import { hasGlobalPermission } from '../../../../helpers/users';
*/
import { CoverageIndicator } from 'design-system';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getCoverageRatingAverageValue, getCoverageRatingLabel } from '../../../helpers/ratings';
import { MetricKey } from '../../../types/metrics';
-import { RawQuery } from '../../../types/types';
import { Facet } from '../types';
import RangeFacetBase from './RangeFacetBase';
*/
import { DuplicationsIndicator } from 'design-system';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { duplicationValueToRating, getDuplicationsRatingLabel } from '../../../helpers/ratings';
-import { RawQuery } from '../../../types/types';
import { Facet } from '../types';
import RangeFacetBase from './RangeFacetBase';
*/
import { uniqBy } from 'lodash';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import withLanguagesContext from '../../../app/components/languages/withLanguagesContext';
import { translate } from '../../../helpers/l10n';
import { highlightTerm } from '../../../helpers/search';
import { Language, Languages } from '../../../types/languages';
-import { Dict, RawQuery } from '../../../types/types';
+import { Dict } from '../../../types/types';
import { ListStyleFacet } from '../../issues/sidebar/ListStyleFacet';
import { Facet } from '../types';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RawQuery } from '../../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { Facet } from '../types';
import RatingFacet from './RatingFacet';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { getSizeRatingLabel } from '../../../helpers/ratings';
import { MetricKey } from '../../../types/metrics';
-import { RawQuery } from '../../../types/types';
import { Facet } from '../types';
import RangeFacetBase from './RangeFacetBase';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RawQuery } from '../../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { Facet } from '../types';
import RatingFacet from './RatingFacet';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RawQuery } from '../../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { Facet } from '../types';
import RatingFacet from './RatingFacet';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RawQuery } from '../../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { Facet } from '../types';
import RatingFacet from './RatingFacet';
*/
import { FacetBox, FacetItem } from 'design-system';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { isDefined } from '../../../helpers/types';
import { ComponentQualifier } from '../../../types/component';
-import { RawQuery } from '../../../types/types';
import { FacetItemsList } from '../../issues/sidebar/FacetItemsList';
import { formatFacetStat } from '../../issues/utils';
import { Facet } from '../types';
import { without } from 'lodash';
import * as React from 'react';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { isDefined } from '../../../helpers/types';
-import { RawQuery, Status } from '../../../types/types';
+import { Status } from '../../../types/types';
import { FacetItemsList } from '../../issues/sidebar/FacetItemsList';
import { formatFacetStat } from '../../issues/utils';
import { Facet } from '../types';
import classNames from 'classnames';
import { FacetBox, FacetItem, HighlightedFacetItems, LightLabel } from 'design-system';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { isDefined } from '../../../helpers/types';
-import { RawQuery } from '../../../types/types';
import { FacetItemsList } from '../../issues/sidebar/FacetItemsList';
import { formatFacetStat } from '../../issues/utils';
import { Facet } from '../types';
import { MetricsRatingBadge, RatingEnum } from 'design-system';
import * as React from 'react';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { MetricType } from '../../../types/metrics';
-import { RawQuery } from '../../../types/types';
import { Facet } from '../types';
import RangeFacetBase from './RangeFacetBase';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RawQuery } from '../../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { Facet } from '../types';
import RatingFacet from './RatingFacet';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
-import { RawQuery } from '../../../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { Facet } from '../types';
import RatingFacet from './RatingFacet';
import { MetricsRatingBadge, RatingEnum } from 'design-system';
import * as React from 'react';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { MetricType } from '../../../types/metrics';
-import { Dict, RawQuery } from '../../../types/types';
+import { Dict } from '../../../types/types';
import { Facet } from '../types';
import RangeFacetBase from './RangeFacetBase';
*/
import { SizeIndicator } from 'design-system';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { getSizeRatingAverageValue, getSizeRatingLabel } from '../../../helpers/ratings';
-import { RawQuery } from '../../../types/types';
import { Facet } from '../types';
import RangeFacetBase from './RangeFacetBase';
*/
import { size } from 'lodash';
import * as React from 'react';
+import { RawQuery } from '~sonar-aligned/types/router';
import { searchProjectTags } from '../../../api/components';
-import { ListStyleFacet } from '../../../apps/issues/sidebar/ListStyleFacet';
import { translate } from '../../../helpers/l10n';
import { highlightTerm } from '../../../helpers/search';
-import { Dict, RawQuery } from '../../../types/types';
+import { Dict } from '../../../types/types';
+import { ListStyleFacet } from '../../issues/sidebar/ListStyleFacet';
import { Facet } from '../types';
interface Props {
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { RawQuery } from '~sonar-aligned/types/router';
import { ComponentQualifier } from '../../types/component';
-import { Dict, RawQuery } from '../../types/types';
+import { Dict } from '../../types/types';
type Level = 'ERROR' | 'WARN' | 'OK';
*/
import { ButtonPrimary, FormField, InputField, Modal } from 'design-system';
import * as React from 'react';
-import { useRouter } from '../../../components/hoc/withRouter';
+import { useRouter } from '~sonar-aligned/components/hoc/withRouter';
import MandatoryFieldsExplanation from '../../../components/ui/MandatoryFieldsExplanation';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
*/
import { ButtonSecondary, FormField, InputField, Modal } from 'design-system';
import * as React from 'react';
-import { useRouter } from '../../../components/hoc/withRouter';
+import { useRouter } from '~sonar-aligned/components/hoc/withRouter';
import MandatoryFieldsExplanation from '../../../components/ui/MandatoryFieldsExplanation';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
*/
import { DangerButtonPrimary, Modal } from 'design-system';
import * as React from 'react';
-import { useRouter } from '../../../components/hoc/withRouter';
+import { useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getQualityGatesUrl } from '../../../helpers/urls';
import { useDeleteQualityGateMutation } from '../../../queries/quality-gates';
import { ButtonPrimary, FormField, InputField, Modal } from 'design-system';
import * as React from 'react';
-import { useRouter } from '../../../components/hoc/withRouter';
+import { useRouter } from '~sonar-aligned/components/hoc/withRouter';
import MandatoryFieldsExplanation from '../../../components/ui/MandatoryFieldsExplanation';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
*/
import { ButtonSecondary, Spinner } from 'design-system';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { ChangelogResponse, getProfileChangelog } from '../../../api/quality-profiles';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { parseDate, toISO8601WithOffsetString } from '../../../helpers/dates';
import { translate } from '../../../helpers/l10n';
import { withQualityProfilesContext } from '../qualityProfilesContext';
*/
import { Spinner } from 'design-system';
import * as React from 'react';
-import { useLocation, useRouter } from '../../../components/hoc/withRouter';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { useProfilesCompareQuery } from '../../../queries/quality-profiles';
import { useGetValueQuery } from '../../../queries/settings';
import { SettingsKey } from '../../../types/settings';
} from 'design-system';
import { some } from 'lodash';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Router } from '~sonar-aligned/types/router';
import {
changeProfileParent,
copyProfile,
renameProfile,
setDefaultProfile,
} from '../../../api/quality-profiles';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/system';
import { getRulesUrl } from '../../../helpers/urls';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { Outlet, useSearchParams } from 'react-router-dom';
-import { useLocation } from '../../../components/hoc/withRouter';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import ProfileHeader from '../details/ProfileHeader';
import { useQualityProfilesContext } from '../qualityProfilesContext';
import { Badge, Breadcrumbs, HoverLink, Link, PageContentFontWrapper } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
-import { useLocation } from '../../../components/hoc/withRouter';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import DateFromNow from '../../../components/intl/DateFromNow';
import { AdminPageHeader } from '../../../components/ui/AdminPageHeader';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { useRef } from 'react';
import { useIntl } from 'react-intl';
import { SingleValue } from 'react-select';
+import { Location } from '~sonar-aligned/types/router';
import {
changeProfileParent,
copyProfile,
createQualityProfile,
getImporters,
} from '../../../api/quality-profiles';
-import { Location } from '../../../components/hoc/withRouter';
import MandatoryFieldsExplanation from '../../../components/ui/MandatoryFieldsExplanation';
import { parseAsOptionalString } from '../../../helpers/query';
import { useProfileInheritanceQuery } from '../../../queries/quality-profiles';
import { LabelValueSelectOption, SearchSelectDropdown } from 'design-system';
import * as React from 'react';
import { useIntl } from 'react-intl';
-import { useRouter } from '../../../components/hoc/withRouter';
+import { useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { PROFILE_PATH } from '../constants';
import { getProfilesForLanguagePath } from '../utils';
import { ButtonPrimary, ButtonSecondary, FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { useIntl } from 'react-intl';
+import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { Actions } from '../../../api/quality-profiles';
-import { useLocation, useRouter } from '../../../components/hoc/withRouter';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
import { Profile } from '../types';
*/
import React from 'react';
import { useOutletContext } from 'react-router-dom';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { Actions } from '../../api/quality-profiles';
-import { Exporter, Profile } from '../../apps/quality-profiles/types';
-import { getWrappedDisplayName } from '../../components/hoc/utils';
import { Language } from '../../types/languages';
+import { Exporter, Profile } from './types';
export interface QualityProfilesContextProps {
actions: Actions;
*/
import { differenceInYears } from 'date-fns';
import { sortBy } from 'lodash';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { Profile as BaseProfile } from '../../api/quality-profiles';
import { isValidDate, parseDate } from '../../helpers/dates';
-import { queryToSearch } from '../../helpers/urls';
import { PROFILE_COMPARE_PATH, PROFILE_PATH } from './constants';
import { Profile } 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 { Location, Router } from '~sonar-aligned/types/router';
import { getMeasures } from '../../api/measures';
import { getSecurityHotspotList, getSecurityHotspots } from '../../api/security-hotspots';
import withComponentContext from '../../app/components/componentContext/withComponentContext';
import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext';
import withIndexationGuard from '../../components/hoc/withIndexationGuard';
-import { Location, Router, withRouter } from '../../components/hoc/withRouter';
import { getLeakValue } from '../../components/measure/utils';
import { isPullRequest, isSameBranchLike } from '../../helpers/branch-like';
import { isInput } from '../../helpers/keyboardEventHelpers';
} from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { Location } from '~sonar-aligned/types/router';
import { Image } from '../../../components/common/Image';
-import { Location } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { sanitizeUserInput } from '../../../helpers/sanitize';
import { getReturnUrl } from '../../../helpers/urls';
import { addGlobalErrorMessage } from 'design-system';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { logIn } from '../../../api/auth';
import { getLoginMessage } from '../../../api/settings';
import { getIdentityProviders } from '../../../api/users';
-import { Location, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { getReturnUrl } from '../../../helpers/urls';
import { IdentityProvider } from '../../../types/types';
import { PopupZLevel, SearchSelectDropdown, SubHeading } from 'design-system';
import * as React from 'react';
import { Options } from 'react-select';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { translate } from '../../../helpers/l10n';
import { CATEGORY_OVERRIDES, LANGUAGES_CATEGORY } from '../constants';
import { getCategoryName } from '../utils';
import { uniqBy } from 'lodash';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { ExtendedSettingDefinition } from '../../../types/settings';
import { Component } from '../../../types/types';
import { debounce, keyBy } from 'lodash';
import lunr, { LunrIndex } from 'lunr';
import * as React from 'react';
-import { Router, withRouter } from '../../../components/hoc/withRouter';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Router } from '~sonar-aligned/types/router';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { ExtendedSettingDefinition } from '../../../types/settings';
import { Component, Dict } from '../../../types/types';
import { BasicSeparator, Note, SubTitle } from 'design-system';
import { groupBy, sortBy } from 'lodash';
import * as React from 'react';
-import { Location, withRouter } from '../../../components/hoc/withRouter';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { sanitizeStringRestricted } from '../../../helpers/sanitize';
import { SettingDefinitionAndValue } from '../../../types/settings';
import { Component } from '../../../types/types';
*/
import { noop } from 'lodash';
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import {
countBoundProjects,
deleteConfiguration,
import withAvailableFeatures, {
WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
-import { Location, Router, withRouter } from '../../../../components/hoc/withRouter';
import {
AlmBindingDefinitionBase,
AlmKeys,
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { useSearchParams } from 'react-router-dom';
+import { searchParamsToQuery } from '~sonar-aligned/helpers/router';
import withAvailableFeatures, {
WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
import { Image } from '../../../../components/common/Image';
import { translate } from '../../../../helpers/l10n';
-import { searchParamsToQuery } from '../../../../helpers/urls';
import { AlmKeys } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { ExtendedSettingDefinition } from '../../../../types/settings';
import { LargeCenteredLayout, PageContentFontWrapper } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { getSystemInfo } from '../../../api/system';
import UpdateNotification from '../../../app/components/update-notification/UpdateNotification';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { SysInfoCluster, SysInfoStandalone } from '../../../types/types';
import '../styles.css';
*/
import { each, memoize, omit, omitBy, pickBy, sortBy } from 'lodash';
import { formatMeasure } from '~sonar-aligned/helpers/measures';
+import { RawQuery } from '~sonar-aligned/types/router';
import { cleanQuery, parseAsArray, parseAsString, serializeStringArray } from '../../helpers/query';
import {
- RawQuery,
SysInfoAppNode,
SysInfoBase,
SysInfoCluster,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { memoize } from 'lodash';
+import { RawQuery } from '~sonar-aligned/types/router';
import { cleanQuery, parseAsString, serializeString } from '../../helpers/query';
-import { RawQuery } from '../../types/types';
export interface Query {
search: string;
*/
import { Badge, Card, LinkBox, LinkIcon, SubHeading, Tabs } from 'design-system';
import * as React from 'react';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { translate, translateWithParameters } from '../../../helpers/l10n';
-import { queryToSearch } from '../../../helpers/urls';
import { WebApi } from '../../../types/types';
import { getActionKey, serializeQuery } from '../utils';
import ActionChangelog from './ActionChangelog';
import { SubnavigationGroup, SubnavigationItem } from 'design-system';
import * as React from 'react';
import { useNavigate } from 'react-router-dom';
-import { queryToSearch } from '../../../helpers/urls';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { WebApi } from '../../../types/types';
import { Query, actionsFilter, isDomainPathActive, serializeQuery } from '../utils';
import DeprecatedBadge from './DeprecatedBadge';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { Params, useParams } from 'react-router-dom';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { fetchWebApi } from '../../../api/web-api';
import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
-import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
import { translate } from '../../../helpers/l10n';
import { WebApi } from '../../../types/types';
import '../styles/web-api.css';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { memoize } from 'lodash';
+import { RawQuery } from '~sonar-aligned/types/router';
import {
cleanQuery,
parseAsOptionalBoolean,
parseAsString,
serializeString,
} from '../../helpers/query';
-import { RawQuery, WebApi } from '../../types/types';
+import { WebApi } from '../../types/types';
export interface Query {
search: string;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { RawQuery } from '~sonar-aligned/types/router';
import { listIssues, searchIssues } from '../../../api/issues';
import { parseIssueFromResponse } from '../../../helpers/issues';
import { BranchLike } from '../../../types/branch-like';
-import { Issue, RawQuery } from '../../../types/types';
+import { Issue } from '../../../types/types';
import { DEFAULT_ISSUES_QUERY } from '../../shared/utils';
// maximum possible value
+++ /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 * as React from 'react';
-import { getWrappedDisplayName } from '../utils';
-
-it('should compute the name correctly', () => {
- expect(getWrappedDisplayName({} as any, 'myName')).toBe('myName(Component)');
-
- class DummyWrapper extends React.Component {}
-
- expect(getWrappedDisplayName(DummyWrapper, 'myName')).toBe('myName(DummyWrapper)');
-
- class DummyWrapper2 extends React.Component {
- static displayName = 'Foo';
- }
-
- expect(getWrappedDisplayName(DummyWrapper2, 'myName')).toBe('myName(Foo)');
-});
+++ /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 function getWrappedDisplayName<P>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
- hocName: string,
-) {
- const wrappedDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? 'Component';
- return `${hocName}(${wrappedDisplayName})`;
-}
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext';
import handleRequiredAuthentication from '../../helpers/handleRequiredAuthentication';
import { CurrentUser, isLoggedIn } from '../../types/users';
-import { getWrappedDisplayName } from './utils';
export function whenLoggedIn<P>(WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>) {
class Wrapper extends React.Component<P & { currentUser: CurrentUser }> {
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { LanguagesContext } from '../../app/components/languages/LanguagesContext';
-import { getWrappedDisplayName } from './utils';
export function withCLanguageFeature<P>(
WrappedComponent: React.ComponentType<
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { IndexationContext } from '../../app/components/indexation/IndexationContext';
import { IndexationContextInterface } from '../../types/indexation';
-import { getWrappedDisplayName } from './utils';
export interface WithIndexationContextProps {
indexationContext: IndexationContextInterface;
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { getComponentMeasureUniqueKey } from '../../helpers/component';
import { isInput, isShortcut } from '../../helpers/keyboardEventHelpers';
import { KeyboardKeys } from '../../helpers/keycodes';
import { ComponentMeasure } from '../../types/types';
-import { getWrappedDisplayName } from './utils';
export interface WithKeyboardNavigationProps {
components?: ComponentMeasure[];
*/
import { uniqWith } from 'lodash';
import * as React from 'react';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
import { addNotification, getNotifications, removeNotification } from '../../api/notifications';
import {
Notification,
NotificationGlobalType,
NotificationProjectType,
} from '../../types/notifications';
-import { getWrappedDisplayName } from './utils';
interface State {
channels: 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.
- */
-import * as React from 'react';
-import {
- Location as LocationRouter,
- Params,
- useLocation as useLocationRouter,
- useNavigate,
- useParams,
-} from 'react-router-dom';
-import { queryToSearch, searchParamsToQuery } from '../../helpers/urls';
-import { RawQuery } from '../../types/types';
-import { getWrappedDisplayName } from './utils';
-
-export interface Location extends LocationRouter {
- query: RawQuery;
-}
-
-export interface Router {
- replace: (location: string | Partial<Location>) => void;
- push: (location: string | Partial<Location>) => void;
-}
-
-export interface WithRouterProps {
- location: Location;
- params: Params;
- router: Router;
-}
-
-export function withRouter<P extends Partial<WithRouterProps>>(
- WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
-): React.ComponentType<React.PropsWithChildren<Omit<P, keyof WithRouterProps>>> {
- function ComponentWithRouterProp(props: P) {
- const router = useRouter();
- const params = useParams();
- const location = useLocation();
-
- return <WrappedComponent {...props} location={location} params={params} router={router} />;
- }
-
- (ComponentWithRouterProp as React.FC<React.PropsWithChildren<P>>).displayName =
- getWrappedDisplayName(WrappedComponent, 'withRouter');
-
- return ComponentWithRouterProp;
-}
-
-export function useRouter() {
- const navigate = useNavigate();
-
- const router = React.useMemo(
- () => ({
- replace: (path: string | Partial<Location>) => {
- if ((path as Location).query) {
- path.search = queryToSearch((path as Location).query);
- }
- navigate(path, { replace: true });
- },
- push: (path: string | Partial<Location>) => {
- if ((path as Location).query) {
- path.search = queryToSearch((path as Location).query);
- }
- navigate(path);
- },
- }),
- [navigate],
- );
-
- return router;
-}
-
-export function useLocation() {
- const location = useLocationRouter();
-
- return { ...location, query: searchParamsToQuery(new URLSearchParams(location.search)) };
-}
*/
import * as React from 'react';
import { findDOMNode } from 'react-dom';
-import { getWrappedDisplayName } from './utils';
+import { getWrappedDisplayName } from '~sonar-aligned/components/hoc/utils';
export interface WithScrollToProps {
selected?: boolean;
*/
import { IssueMessageHighlighting, StandoutLink } 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 { getComponentIssuesUrl } from '~sonar-aligned/helpers/urls';
import { ComponentContext } from '../../../app/components/componentContext/ComponentContext';
import { getIssuesUrl } from '../../../helpers/urls';
import { BranchLike } from '../../../types/branch-like';
import { Issue } from '../../../types/types';
-import { useLocation } from '../../hoc/withRouter';
export interface IssueMessageProps {
issue: Issue;
import { Banner, Link } from 'design-system';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { MessageTypes, checkMessageDismissed, setMessageDismissed } from '../../api/messages';
import { CurrentUserContextInterface } from '../../app/components/current-user/CurrentUserContext';
import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext';
import { NEW_CODE_PERIOD_CATEGORY } from '../../apps/settings/constants';
-import { queryToSearch } from '../../helpers/urls';
import { useNewCodeDefinitionQuery } from '../../queries/newCodeDefinition';
import { Component } from '../../types/types';
import {
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import * as React from 'react';
+import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
+import { Location } from '~sonar-aligned/types/router';
import { getAlmSettingsNoCatch } from '../../api/alm-settings';
import { getScannableProjects } from '../../api/components';
import { getValue } from '../../api/settings';
import { SettingsKey } from '../../types/settings';
import { Component } from '../../types/types';
import { LoggedInUser } from '../../types/users';
-import { Location, withRouter } from '../hoc/withRouter';
import TutorialSelectionRenderer from './TutorialSelectionRenderer';
import { TutorialModes } 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 { searchParamsToQuery } from '~sonar-aligned/helpers/router';
import {
getComponentIssuesUrl,
getComponentSecurityHotspotsUrl,
+ queryToSearch,
} from '~sonar-aligned/helpers/urls';
import { DEFAULT_ISSUES_QUERY } from '../../components/shared/utils';
import { AlmKeys } from '../../types/alm-settings';
getQualityGatesUrl,
getReturnUrl,
isRelativeUrl,
- queryToSearch,
- searchParamsToQuery,
stripTrailingSlash,
} from '../urls';
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import { isEqual, isNil, omitBy } from 'lodash';
-import { RawQuery } from '../types/types';
+import { RawQuery } from '~sonar-aligned/types/router';
import { isValidDate, parseDate, toISO8601WithOffsetString, toShortISO8601String } from './dates';
export function queriesEqual(a: RawQuery, b: RawQuery): boolean {
*/
import { omit } from 'lodash';
import { To } from 'react-router-dom';
+import { Location, Router } from '~sonar-aligned/types/router';
import { CompareResponse } from '../api/quality-profiles';
import { RuleDescriptionSections } from '../apps/coding-rules/rule';
import { REST_RULE_KEYS_TO_OLD_KEYS } from '../apps/coding-rules/utils';
import { Exporter, Profile, ProfileChangelogEvent } from '../apps/quality-profiles/types';
import { LogsLevels } from '../apps/system/utils';
-import { Location, Router } from '../components/hoc/withRouter';
import { AppState } from '../types/appstate';
import {
CleanCodeAttribute,
goBack: jest.fn(),
goForward: jest.fn(),
isActive: jest.fn(),
+ navigate: jest.fn(),
push: jest.fn(),
replace: jest.fn(),
+ searchParams: new URLSearchParams(),
setRouteLeaveHook: jest.fn(),
+ setSearchParams: jest.fn(),
...overrides,
} as Router;
}
createRoutesFromElements,
parsePath,
} from 'react-router-dom';
+import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import AdminContext from '../app/components/AdminContext';
import AppStateContextProvider from '../app/components/app-state/AppStateContextProvider';
import { AvailableFeaturesContext } from '../app/components/available-features/AvailableFeaturesContext';
import IndexationContextProvider from '../app/components/indexation/IndexationContextProvider';
import { LanguagesContext } from '../app/components/languages/LanguagesContext';
import { MetricsContext } from '../app/components/metrics/MetricsContext';
-import { useLocation } from '../components/hoc/withRouter';
import { AppState } from '../types/appstate';
import { ComponentContextShape } 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 { isArray, mapValues, omitBy } from 'lodash';
import { Path, To } from 'react-router-dom';
import { getBranchLikeQuery, isBranch, isMainBranch } from '~sonar-aligned/helpers/branch-like';
+import { queryToSearch } from '~sonar-aligned/helpers/urls';
import { getProfilePath } from '../apps/quality-profiles/utils';
import { DEFAULT_ISSUES_QUERY } from '../components/shared/utils';
import { BranchLike, BranchParameters } from '../types/branch-like';
import { ComponentQualifier, isApplication, isPortfolioLike } from '../types/component';
import { MeasurePageView } from '../types/measures';
import { GraphType } from '../types/project-activity';
-import { Dict, RawQuery } from '../types/types';
+import { Dict } from '../types/types';
import { HomePage } from '../types/users';
import { isPullRequest } from './branch-like';
import { serializeOptionalBoolean } from './query';
const PROJECT_BASE_URL = '/dashboard';
-export function queryToSearch(query: RawQuery = {}) {
- const arrayParams: Array<{ key: string; values: string[] }> = [];
-
- const stringParams = mapValues(query, (value, key) => {
- // array values are added afterwards
- if (isArray(value)) {
- arrayParams.push({ key, values: value });
- return '';
- }
-
- return value != null ? `${value}` : '';
- });
- const filteredParams = omitBy(stringParams, (v: string) => v.length === 0);
- const searchParams = new URLSearchParams(filteredParams);
-
- /*
- * Add each value separately
- * e.g. author: ['a', 'b'] should be serialized as
- * author=a&author=b
- */
- arrayParams.forEach(({ key, values }) => {
- values.forEach((value) => {
- searchParams.append(key, value);
- });
- });
-
- return `?${searchParams.toString()}`;
-}
-
export function getComponentOverviewUrl(
componentKey: string,
componentQualifier: ComponentQualifier | string,
return Boolean(url && regex.test(url));
}
-export function searchParamsToQuery(searchParams: URLSearchParams, omitKey: string[] = []) {
- const result: RawQuery = {};
-
- searchParams.forEach((value, key) => {
- if (omitKey.includes(key)) {
- return;
- }
- if (result[key]) {
- result[key] = ([] as string[]).concat(result[key], value);
- } else {
- result[key] = value;
- }
- });
-
- return result;
-}
-
export function convertToTo(link: string | Location) {
if (linkIsLocation(link)) {
return { pathname: link.pathname, search: queryToSearch(link.query) } as Partial<Path>;
import * as React from 'react';
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 { searchParamsToQuery } from '~sonar-aligned/helpers/router';
import {
deleteBranch,
deletePullRequest,
import { dismissAnalysisWarning, getAnalysisStatus } from '../api/ce';
import { getQualityGateProjectStatus } from '../api/quality-gates';
import { AvailableFeaturesContext } from '../app/components/available-features/AvailableFeaturesContext';
-import { useLocation } from '../components/hoc/withRouter';
import { isPullRequest } from '../helpers/branch-like';
import { extractStatusConditionsFromProjectStatus } from '../helpers/qualityGates';
-import { searchParamsToQuery } from '../helpers/urls';
import { Branch, BranchLike } from '../types/branch-like';
import { isApplication, isPortfolioLike, isProject } from '../types/component';
import { Feature } from '../types/features';
--- /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 * as React from 'react';
+import { getWrappedDisplayName } from '../utils';
+
+it('should compute the name correctly', () => {
+ expect(getWrappedDisplayName({} as any, 'myName')).toBe('myName(Component)');
+
+ class DummyWrapper extends React.Component {}
+
+ expect(getWrappedDisplayName(DummyWrapper, 'myName')).toBe('myName(DummyWrapper)');
+
+ class DummyWrapper2 extends React.Component {
+ static displayName = 'Foo';
+ }
+
+ expect(getWrappedDisplayName(DummyWrapper2, 'myName')).toBe('myName(Foo)');
+});
--- /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 React from 'react';
+
+export function getWrappedDisplayName<P>(
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
+ hocName: string,
+) {
+ const wrappedDisplayName = WrappedComponent.displayName ?? WrappedComponent.name ?? 'Component';
+ return `${hocName}(${wrappedDisplayName})`;
+}
--- /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 * as React from 'react';
+import { useMemo } from 'react';
+import {
+ Params,
+ useLocation as useLocationRouter,
+ useNavigate,
+ useParams,
+ useSearchParams,
+} from 'react-router-dom';
+import { searchParamsToQuery } from '../../helpers/router';
+import { queryToSearch } from '../../helpers/urls';
+import { Location, Router } from '../../types/router';
+import { getWrappedDisplayName } from './utils';
+
+export interface WithRouterProps {
+ location: Location;
+ params: Params;
+ router: Router;
+}
+
+export function withRouter<P extends Partial<WithRouterProps>>(
+ WrappedComponent: React.ComponentType<React.PropsWithChildren<P>>,
+): React.ComponentType<React.PropsWithChildren<Omit<P, keyof WithRouterProps>>> {
+ function ComponentWithRouterProp(props: Readonly<P>) {
+ const router = useRouter();
+ const params = useParams();
+ const location = useLocation();
+
+ return <WrappedComponent {...props} location={location} params={params} router={router} />;
+ }
+
+ (ComponentWithRouterProp as React.FC<React.PropsWithChildren<P>>).displayName =
+ getWrappedDisplayName(WrappedComponent, 'withRouter');
+
+ return ComponentWithRouterProp;
+}
+
+export function useRouter() {
+ const navigate = useNavigate();
+ const [searchParams, setSearchParams] = useSearchParams();
+
+ return React.useMemo(
+ () => ({
+ replace: (path: string | Partial<Location>) => {
+ if ((path as Location).query) {
+ path.search = queryToSearch((path as Location).query);
+ }
+ navigate(path, { replace: true });
+ },
+ push: (path: string | Partial<Location>) => {
+ if ((path as Location).query) {
+ path.search = queryToSearch((path as Location).query);
+ }
+ navigate(path);
+ },
+ navigate,
+ searchParams,
+ setSearchParams,
+ }),
+ [navigate, searchParams, setSearchParams],
+ );
+}
+
+export function useLocation() {
+ const location = useLocationRouter();
+
+ return useMemo(
+ () => ({ ...location, query: searchParamsToQuery(new URLSearchParams(location.search)) }),
+ [location],
+ );
+}
--- /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 { queryToSearch } from '../urls';
+
+describe('queryToSearch', () => {
+ it('should return query by default', () => {
+ expect(queryToSearch()).toBe('?');
+ });
+
+ it('should return query with string values', () => {
+ expect(queryToSearch({ key: 'value' })).toBe('?key=value');
+ });
+
+ it('should remove empty values', () => {
+ expect(queryToSearch({ key: 'value', anotherKey: '' })).toBe('?key=value');
+ });
+
+ it('should return query with array values', () => {
+ expect(queryToSearch({ key: ['value1', 'value2'] })).toBe('?key=value1&key=value2');
+ });
+});
--- /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 { RawQuery } from '../types/router';
+
+export function searchParamsToQuery(searchParams: URLSearchParams, omitKey: string[] = []) {
+ const result: RawQuery = {};
+
+ searchParams.forEach((value, key) => {
+ if (omitKey.includes(key)) {
+ return;
+ }
+ if (result[key]) {
+ result[key] = ([] as string[]).concat(result[key], value);
+ } else {
+ result[key] = value;
+ }
+ });
+
+ return result;
+}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { pick } from 'lodash';
-import { Query, queryToSearch } from '../../helpers/urls';
-
+import { isArray, mapValues, omitBy, pick } from 'lodash';
import { Path } from 'react-router-dom';
+import { Query } from '../../helpers/urls';
import { BranchLike } from '../../types/branch-like';
import { SecurityStandard } from '../../types/security';
-import { getBranchLikeQuery } from './branch-like';
+import { getBranchLikeQuery } from '../helpers/branch-like';
+import { RawQuery } from '../types/router';
+
+export function queryToSearch(query: RawQuery = {}) {
+ const arrayParams: Array<{ key: string; values: string[] }> = [];
+
+ const stringParams = mapValues(query, (value, key) => {
+ // array values are added afterwards
+ if (isArray(value)) {
+ arrayParams.push({ key, values: value });
+ return '';
+ }
+
+ return value != null ? `${value}` : '';
+ });
+ const filteredParams = omitBy(stringParams, (v: string) => v.length === 0);
+ const searchParams = new URLSearchParams(filteredParams);
+
+ /*
+ * Add each value separately
+ * e.g. author: ['a', 'b'] should be serialized as
+ * author=a&author=b
+ */
+ arrayParams.forEach(({ key, values }) => {
+ values.forEach((value) => {
+ searchParams.append(key, value);
+ });
+ });
+
+ return `?${searchParams.toString()}`;
+}
/**
* Generate URL for a component's issues page
*/
-
export function getComponentIssuesUrl(componentKey: string, query?: Query): Path {
return {
pathname: '/project/issues',
/**
* Generate URL for a component's security hotspot page
*/
-
export function getComponentSecurityHotspotsUrl(
componentKey: string,
branchLike?: BranchLike,
--- /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 {
+ Location as LocationRouter,
+ NavigateFunction,
+ URLSearchParamsInit,
+} from 'react-router-dom';
+
+export type RawQuery = Record<string, any>;
+
+export interface Location extends LocationRouter {
+ query: RawQuery;
+}
+
+export interface Router {
+ navigate: NavigateFunction;
+ replace: (location: string | Partial<Location>) => void;
+ push: (location: string | Partial<Location>) => void;
+ searchParams: URLSearchParams;
+ setSearchParams: (
+ nextInit: URLSearchParamsInit,
+ navigateOptions?: { replace?: boolean; state?: any },
+ ) => void;
+}
import { Theme } from '@emotion/react';
import { QueryClient } from '@tanstack/react-query';
import { IntlShape } from 'react-intl';
-import { Location, Router } from '../components/hoc/withRouter';
+import { Location, Router } from '~sonar-aligned/types/router';
import { AppState } from './appstate';
import { BranchLike } from './branch-like';
import { L10nBundle } from './l10nBundle';
caycStatus?: CaycStatus;
}
-export type RawQuery = Dict<any>;
-
export interface Rule {
cleanCodeAttributeCategory?: CleanCodeAttributeCategory;
cleanCodeAttribute?: CleanCodeAttribute;