* 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 'design-system';
+
+import { LinkStandalone } from '@sonarsource/echoes-react';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
import { useLocation } from 'react-router-dom';
-import { useDocUrl } from '../../helpers/docs';
+import { useUncataloguedDocUrl } from '../../helpers/docs';
const PAUSE_REDIRECT = 1;
export default function DocumentationRedirect() {
const location = useLocation();
- const url = useDocUrl(location.pathname.replace(/^\/documentation/, ''));
+ const url = useUncataloguedDocUrl(location.pathname.replace(/^\/documentation/, '')) as string;
return (
<>
<span className="global-loading-text">Redirecting...</span>
</div>
<div>
- <Link to={url}>Click here if you're not being redirected automatically</Link>
+ <LinkStandalone to={url}>
+ Click here if you're not being redirected automatically
+ </LinkStandalone>
</div>
</div>
</>
import { useIntl } from 'react-intl';
import InstanceMessage from '../../components/common/InstanceMessage';
import AppVersionStatus from '../../components/shared/AppVersionStatus';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
import { getEdition } from '../../helpers/editions';
import GlobalFooterBranding from './GlobalFooterBranding';
</li>
<li>
- <LinkStandalone highlight={LinkHighlight.CurrentColor} to={docUrl('/')}>
+ <LinkStandalone highlight={LinkHighlight.CurrentColor} to={docUrl(DocLink.Root)}>
{intl.formatMessage({ id: 'footer.documentation' })}
</LinkStandalone>
</li>
<li>
<LinkStandalone
highlight={LinkHighlight.CurrentColor}
- to={docUrl('/instance-administration/plugin-version-matrix/')}
+ to={docUrl(DocLink.InstanceAdminPluginVersionMatrix)}
>
{intl.formatMessage({ id: 'footer.plugins' })}
</LinkStandalone>
* 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 { DOC_URL } from '../../../helpers/doc-links';
import { AppState } from '../../../types/appstate';
export const DEFAULT_APP_STATE = {
settings: {},
version: '',
versionEOL: '',
- documentationUrl: 'https://docs.sonarsource.com/sonarqube/latest',
+ documentationUrl: DOC_URL,
};
export const AppStateContext = React.createContext<AppState>(DEFAULT_APP_STATE);
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
/* eslint-disable react/no-unused-prop-types */
import styled from '@emotion/styled';
import {
import { FormattedMessage } from 'react-intl';
import { queryToSearchString } from '~sonar-aligned/helpers/urls';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { IndexationNotificationType } from '../../../types/indexation';
import { TaskStatuses, TaskTypes } from '../../../types/tasks';
function renderIndexationDocPageLink() {
return (
- <DocumentationLink className="sw-whitespace-nowrap" to="/instance-administration/reindexing/">
+ <DocumentationLink className="sw-whitespace-nowrap" to={DocLink.InstanceAdminReindexation}>
<FormattedMessage id="indexation.features_partly_available.link" />
</DocumentationLink>
);
* 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 { HelperHintIcon } from 'design-system';
import React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
+import { DocLink } from '../../../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../../../helpers/l10n';
import { getApplicationAdminUrl } from '../../../../../helpers/urls';
import { useProjectBindingQuery } from '../../../../../queries/devops-integration';
data-test="only-one-branch-like"
links={[
{
- href: '/analyzing-source-code/branches/branch-analysis/',
+ href: DocLink.BranchAnalysis,
label: translate('branch_like_navigation.only_one_branch.documentation'),
},
{
- href: '/analyzing-source-code/pull-request-analysis',
+ href: DocLink.PullRequestAnalysis,
label: translate('branch_like_navigation.only_one_branch.pr_analysis'),
},
{
+ doc: false,
href: `/tutorials?id=${component.key}`,
- label: translate('branch_like_navigation.tutorial_for_ci'),
inPlace: true,
- doc: false,
+ label: translate('branch_like_navigation.tutorial_for_ci'),
},
]}
title={translate('branch_like_navigation.only_one_branch.title')}
import { Outlet } from 'react-router-dom';
import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget';
import { useCurrentLoginUser } from '../../app/components/current-user/CurrentUserContext';
-import Suggestions from '../../components/embed-docs-modal/Suggestions';
import { translate, translateWithParameters } from '../../helpers/l10n';
import Nav from './components/Nav';
import UserCard from './components/UserCard';
<LargeCenteredLayout as="main">
<PageContentFontWrapper className="sw-body-sm sw-py-8">
- <Suggestions suggestions="account" />
-
<Helmet
defaultTitle={title}
defer={false}
* 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 { Helmet } from 'react-helmet-async';
import { FormattedMessage } from 'react-intl';
import { queryToSearchString } from '~sonar-aligned/helpers/urls';
-import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { now } from '../../../helpers/dates';
import { translate } from '../../../helpers/l10n';
import '../style.css';
return (
<LargeCenteredLayout as="main" id="audit-logs-page">
<PageContentFontWrapper className="sw-body-sm sw-my-8">
- <Suggestions suggestions="audit-logs" />
<Helmet title={translate('audit_logs.page')} />
<Title>{translate('audit_logs.page')}</Title>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Spinner } from '@sonarsource/echoes-react';
import { LargeCenteredLayout, PageContentFontWrapper } from 'design-system';
import { debounce } from 'lodash';
import ListFooter from '../../../components/controls/ListFooter';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { toShortISO8601String } from '../../../helpers/dates';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { parseAsDate } from '../../../helpers/query';
import { Task, TaskStatuses } from '../../../types/tasks';
return (
<LargeCenteredLayout id="background-tasks">
<PageContentFontWrapper className="sw-my-4 sw-body-sm">
- <Suggestions suggestions="background_tasks" />
+ <Suggestions suggestion={DocLink.BackgroundTasks} />
<Helmet defer={false} title={translate('background_tasks.page')} />
<Spinner isLoading={!types}>
<Header component={component} />
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Title } from 'design-system';
import * as React from 'react';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { Component } from '../../../types/types';
import Workers from './Workers';
<Title className="sw-mb-4">{translate('background_tasks.page')}</Title>
<p className="sw-max-w-3/4">
{translate('background_tasks.page.description')}
- <DocumentationLink className="sw-ml-2" to="/analyzing-source-code/background-tasks/">
+ <DocumentationLink className="sw-ml-2" to={DocLink.BackgroundTasks}>
{translate('learn_more')}
</DocumentationLink>
</p>
import { Breadcrumb } from '~sonar-aligned/types/component';
import { Location } from '~sonar-aligned/types/router';
import ListFooter from '../../../components/controls/ListFooter';
-import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import AnalysisMissingInfoMessage from '../../../components/shared/AnalysisMissingInfoMessage';
import { CCT_SOFTWARE_QUALITY_METRICS, OLD_TAXONOMY_METRICS } from '../../../helpers/constants';
import { KeyboardKeys } from '../../../helpers/keycodes';
return (
<LargeCenteredLayout className="sw-py-8 sw-body-md" id="code-page">
- <Suggestions suggestions="code" />
<Helmet defer={false} title={sourceViewer !== undefined ? sourceViewer.name : defaultTitle} />
<A11ySkipTarget anchor="code_main" />
* 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,
FlagMessage,
import * as React from 'react';
import { Profile } from '../../../api/quality-profiles';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { sanitizeString } from '../../../helpers/sanitize';
import { useActivateRuleMutation } from '../../../queries/quality-profiles';
{translate('coding_rules.severity_deprecated')}
<DocumentationLink
className="sw-ml-2 sw-whitespace-nowrap"
- to="/user-guide/clean-code/introduction/"
+ to={DocLink.CleanCodeIntroduction}
>
{translate('learn_more')}
</DocumentationLink>
* 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 {
InputSearch,
import ListFooter from '../../../components/controls/ListFooter';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import '../../../components/search-navigator.css';
+import { DocLink } from '../../../helpers/doc-links';
import { isInput, isShortcut } from '../../../helpers/keyboardEventHelpers';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate, translateWithParameters } from '../../../helpers/l10n';
return (
<>
- <Suggestions suggestions="coding_rules" />
+ <Suggestions suggestion={DocLink.InstanceAdminQualityProfiles} />
{openRule ? (
<Helmet
defer={false}
* 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 { FacetBox, FacetItem, HelperHintIcon, Note, themeColor } from 'design-system';
import { sortBy } from 'lodash';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import { Profile } from '../../../api/quality-profiles';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { Dict } from '../../../types/types';
import { FacetItemsList } from '../../issues/sidebar/FacetItemsList';
content={translate('coding_rules.facet.qprofile.help')}
links={[
{
- href: '/instance-administration/quality-profiles/',
+ href: DocLink.InstanceAdminQualityProfiles,
label: translate('coding_rules.facet.qprofile.link'),
},
]}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Note, SeparatorCircleIcon, TextSubdued } from 'design-system';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import IssueSeverityIcon from '../../../components/icon-mappers/IssueSeverityIcon';
import IssueTypeIcon from '../../../components/icon-mappers/IssueTypeIcon';
import TagsList from '../../../components/tags/TagsList';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { IssueSeverity } from '../../../types/issues';
import { Dict, RuleDetails } from '../../../types/types';
}
links={[
{
- href: '/user-guide/rules/overview',
+ href: DocLink.RulesOverview,
label: translate('learn_more'),
},
]}
}
links={[
{
- href: '/user-guide/rules/overview',
+ href: DocLink.RulesOverview,
label: translate('learn_more'),
},
]}
* 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 {
Badge,
import SoftwareImpactPillList from '../../../components/shared/SoftwareImpactPillList';
import TypeHelper from '../../../components/shared/TypeHelper';
import TagsList from '../../../components/tags/TagsList';
+import { DocLink } from '../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getRuleUrl } from '../../../helpers/urls';
import { Rule } from '../../../types/types';
}
links={[
{
- href: '/user-guide/clean-code/introduction',
+ href: DocLink.CleanCodeIntroduction,
label: translate('learn_more'),
},
]}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { HelperHintIcon } from 'design-system';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon';
import { IMPACT_SEVERITIES } from '../../../helpers/constants';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import Facet, { BasicProps } from './Facet';
}
links={[
{
- href: '/user-guide/clean-code/introduction',
+ href: DocLink.CleanCodeIntroduction,
label: translate('learn_more'),
},
]}
return (
<LargeCenteredLayout id="component-measures" className="sw-pt-8">
- <Suggestions suggestions="component_measures" />
+ <Suggestions suggestionGroup="component_measures" />
<Helmet defer={false} title={translate('layout.measures')} />
<PageContentFontWrapper className="sw-body-sm">
<Spinner isLoading={this.state.loading} />
* 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,
ButtonSecondary,
import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
import { queryToSearchString } from '~sonar-aligned/helpers/urls';
import NewCodeDefinitionSelector from '../../../../components/new-code-definition/NewCodeDefinitionSelector';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { getProjectUrl } from '../../../../helpers/urls';
const intl = useIntl();
const location = useLocation();
const navigate = useNavigate();
- const getDocUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.NewCodeDefinition);
usePrompt({
when: isImporting,
message: translate('onboarding.create_project.please_dont_leave'),
id="onboarding.create_project.new_code_definition.description"
values={{
link: (
- <Link
- to={getDocUrl(
- '/project-administration/clean-as-you-code-settings/defining-new-code/',
- )}
- >
+ <Link to={docUrl}>
{translate('onboarding.create_project.new_code_definition.description.link')}
</Link>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import classNames from 'classnames';
import {
ButtonPrimary,
import * as React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { getValue } from '../../../../api/settings';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { GlobalSettingKeys } from '../../../../types/settings';
});
const intl = useIntl();
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.BranchAnalysis);
React.useEffect(() => {
async function fetchMainBranchName() {
id="onboarding.create_project.main_branch_name.description"
defaultMessage={translate('onboarding.create_project.main_branch_name.description')}
values={{
- learn_more: (
- <Link to={docUrl('/analyzing-source-code/branches/branch-analysis')}>
- {translate('learn_more')}
- </Link>
- ),
+ learn_more: <Link to={docUrl}>{translate('learn_more')}</Link>,
}}
/>
</Note>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { Title } from 'design-system/lib';
+
+import { Title } from 'design-system';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { GroupBase } from 'react-select';
* 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 { LightPrimary, Title } from 'design-system/lib';
+import { LightPrimary, Title } from 'design-system';
import React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { useLocation } from '~sonar-aligned/components/hoc/withRouter';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
export function MonorepoProjectHeader() {
</LightPrimary>
</div>
<div className="sw-mt-3">
- <LinkStandalone isExternal to={useDocUrl('/project-administration/monorepos/')}>
+ <LinkStandalone isExternal to={useDocUrl(DocLink.Monorepos)}>
<FormattedMessage id="onboarding.create_project.monorepo.doc_link" />
</LinkStandalone>
</div>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { InputSearch, LargeCenteredLayout, PageContentFontWrapper } from 'design-system';
import * as React from 'react';
import { useState } from 'react';
import GitLabSynchronisationWarning from '../../app/components/GitLabSynchronisationWarning';
import ListFooter from '../../components/controls/ListFooter';
import { ManagedFilter } from '../../components/controls/ManagedFilter';
-import Suggestions from '../../components/embed-docs-modal/Suggestions';
import { translate } from '../../helpers/l10n';
import { useGroupsQueries } from '../../queries/groups';
import { useIdentityProviderQuery } from '../../queries/identity-provider/common';
return (
<LargeCenteredLayout>
<PageContentFontWrapper className="sw-my-8 sw-body-sm">
- <Suggestions suggestions="user_groups" />
<Helmet defer={false} title={translate('user_groups.page')} />
<main>
<Header manageProvider={manageProvider?.provider} />
* 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, FlagMessage, Title } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { Provider } from '../../../types/types';
import GroupForm from './GroupForm';
values={{
provider: manageProvider,
link: (
- <DocumentationLink to="/instance-administration/authentication/overview/">
+ <DocumentationLink to={DocLink.AuthOverview}>
{translate('documentation')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { SpotlightTour, SpotlightTourStep } from 'design-system';
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { CurrentUserContext } from '../../../app/components/current-user/CurrentUserContext';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { SCREEN_POSITION_COMPUTE_DELAY } from '../../../components/common/ScreenPositionHelper';
+import { DocLink } from '../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { NoticeType } from '../../../types/users';
defaultMessage={translate('guiding.issue_list.5.content')}
values={{
link: (
- <DocumentationLink to="/user-guide/clean-code/introduction" className="sw-capitalize">
+ <DocumentationLink to={DocLink.CleanCodeIntroduction} className="sw-capitalize">
{translate('documentation')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { SpotlightTour, SpotlightTourStep } from 'design-system';
import React, { useState } from 'react';
import { useIntl } from 'react-intl';
import { useCurrentUser } from '../../../app/components/current-user/CurrentUserContext';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { SCREEN_POSITION_COMPUTE_DELAY } from '../../../components/common/ScreenPositionHelper';
+import { DocLink } from '../../../helpers/doc-links';
import { useDismissNoticeMutation } from '../../../queries/users';
import { IssueTransition } from '../../../types/issues';
import { Issue } from '../../../types/types';
}
const PLACEMENT_RIGHT = 'right';
-const DOC_LINK = '/user-guide/issues/#statuses';
export const SESSION_STORAGE_TRANSITION_GUIDE_KEY = 'issueNewStatusAndTransitionGuideStep';
const EXTRA_DELAY = 100;
const GUIDE_WIDTH = 360;
<span>{intl.formatMessage({ id: `guiding.issue_accept.${stepIndex}.content.1` })}</span>
<span>{intl.formatMessage({ id: `guiding.issue_accept.${stepIndex}.content.2` })}</span>
</div>
- <DocumentationLink to={DOC_LINK} className="sw-mt-1 sw-inline-block">
+ <DocumentationLink to={DocLink.IssueStatuses} className="sw-mt-1 sw-inline-block">
{intl.formatMessage({ id: `guiding.issue_accept.${stepIndex}.content.link` })}
</DocumentationLink>
</>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
ButtonSecondary,
DropdownMenu,
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import {
generateSonarLintUserToken,
id="issues.open_in_ide.failure"
values={{
link: (
- <DocumentationLink to="user-guide/sonarlint-connected-mode/">
+ <DocumentationLink to={DocLink.SonarLintConnectedMode}>
{translate('sonarlint-connected-mode-doc')}
</DocumentationLink>
),
* 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 EmptySearch from '../../../components/common/EmptySearch';
import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper';
import ListFooter from '../../../components/controls/ListFooter';
-import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import withIndexationContext, {
WithIndexationContextProps,
} from '../../../components/hoc/withIndexationContext';
<LargeCenteredLayout>
<PageContentFontWrapper className="sw-body-sm">
<div className="sw-w-full sw-flex" id="issues-page">
- <Suggestions suggestions="issues" />
-
{openIssue ? (
<Helmet
defer={false}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { addGlobalErrorMessage, addGlobalSuccessMessage } from 'design-system';
import { FormattedMessage } from 'react-intl';
import UserTokensMock from '../../../../api/mocks/UserTokensMock';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import {
openIssue as openSonarLintIssue,
probeSonarLintServers,
id="issues.open_in_ide.failure"
values={{
link: (
- <DocumentationLink to="user-guide/sonarlint-connected-mode/">
+ <DocumentationLink to={DocLink.SonarLintConnectedMode}>
sonarlint-connected-mode-doc
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { HelperHintIcon } from 'design-system';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon';
import { IMPACT_SEVERITIES } from '../../../helpers/constants';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { SoftwareImpactSeverity } from '../../../types/clean-code-taxonomy';
import { CommonProps, SimpleListStyleFacet } from './SimpleListStyleFacet';
}
links={[
{
- href: '/user-guide/clean-code/introduction',
+ href: DocLink.CleanCodeIntroduction,
label: translate('learn_more'),
},
]}
import InstanceMessage from '../../../components/common/InstanceMessage';
import DateFromNow from '../../../components/intl/DateFromNow';
import TimeFormatter from '../../../components/intl/TimeFormatter';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { getBaseUrl } from '../../../helpers/system';
import { isDefined } from '../../../helpers/types';
id="maintenance.sonarqube_is_under_maintenance.2"
values={{
link: (
- <DocumentationLink to="/setup-and-upgrade/upgrade-the-server/roadmap/">
+ <DocumentationLink to={DocLink.ServerUpgradeRoadmap}>
{translate('maintenance.sonarqube_is_under_maintenance_link.2')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
BasicSeparator,
FlagMessage,
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 { DocLink } from '../../helpers/doc-links';
import { translate } from '../../helpers/l10n';
import { EditionKey } from '../../types/editions';
import { PendingPluginResult, Plugin, RiskConsent } from '../../types/plugins';
return (
<LargeCenteredLayout as="main" id="marketplace-page">
<PageContentFontWrapper className="sw-body-sm sw-py-8">
- <Suggestions suggestions="marketplace" />
<Helmet title={translate('marketplace.page')} />
<Header currentEdition={currentEdition} />
<EditionBoxes currentEdition={currentEdition} />
defaultMessage={translate('marketplace.page.plugins.description2')}
values={{
link: (
- <DocumentationLink to="/instance-administration/marketplace/">
+ <DocumentationLink to={DocLink.InstanceAdminMarketplace}>
{translate('marketplace.page.plugins.description2.link')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Card, FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { getBranchLikeQuery } from '~sonar-aligned/helpers/branch-like';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getProjectQueryUrl } from '../../../helpers/urls';
}
export default function ApplicationNonCaycProjectWarning({ projects }: Props) {
- const caycUrl = useDocUrl('/user-guide/clean-as-you-code/');
+ const caycUrl = useDocUrl(DocLink.CaYC);
return (
<Card className="sw-mt-4 sw-body-sm">
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { DiscreetLink, FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
}
export default function CleanAsYouCodeWarning({ component }: Props) {
- const caycUrl = useDocUrl('/user-guide/clean-as-you-code/');
+ const caycUrl = useDocUrl(DocLink.CaYC);
return (
<>
* 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 { ComponentQualifier } from '~sonar-aligned/types/component';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { Image } from '../../../components/common/Image';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { CodeScope } from '../../../helpers/urls';
import { Branch } from '../../../types/branch-like';
id="overview.measures.empty_link"
values={{
learn_more_link: (
- <DocumentationLink to="/user-guide/clean-as-you-code/">
- {translate('learn_more')}
- </DocumentationLink>
+ <DocumentationLink to={DocLink.CaYC}>{translate('learn_more')}</DocumentationLink>
),
}}
/>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { SpotlightTour, SpotlightTourStep } from 'design-system';
import React from 'react';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
const constructContent = (first: string) => <p className="sw-mt-2">{translate(first)}</p>;
- const docUrl = useDocUrl('improving/clean-as-you-code/');
+ const docUrl = useDocUrl(DocLink.CaYC);
const steps: SpotlightTourStep[] = [
{
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Spinner } from '@sonarsource/echoes-react';
import { isBefore, sub } from 'date-fns';
import { ButtonLink, FlagMessage, LightLabel, Tabs } from 'design-system';
import { FormattedMessage } from 'react-intl';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { isDiffMetric } from '../../../helpers/measures';
import { CodeScope } from '../../../helpers/urls';
)}`}
<DocumentationLink
className="sw-ml-1 sw-whitespace-nowrap"
- to="/instance-administration/reindexing/"
+ to={DocLink.InstanceAdminReindexation}
>
{translate('learn_more')}
</DocumentationLink>
* 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 { Helmet } from 'react-helmet-async';
import { isPullRequest } from '~sonar-aligned/helpers/branch-like';
<Helmet defer={false} title={translate('overview.page')} />
{isPullRequest(branchLike) ? (
<main>
- <Suggestions suggestions="pull_requests" />
+ <Suggestions suggestionGroup="pull_requests" />
<PullRequestOverview pullRequest={branchLike} component={component} />
</main>
) : (
<main>
- <Suggestions suggestions="overview" />
+ <Suggestions suggestionGroup="overview" />
{!component.analysisDate && (
<EmptyOverview
* 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 { 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 { translate } from '../../../helpers/l10n';
import { AppState } from '../../../types/appstate';
import { Permission, PermissionTemplate } from '../../../types/types';
const { permissionTemplates, permissions, ready } = this.state;
return (
<>
- <Suggestions suggestions="permission_templates" />
<Helmet defer={false} title={translate('permission_templates.page')} />
{id === undefined ? (
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { LargeCenteredLayout, PageContentFontWrapper } from 'design-system';
import { without } from 'lodash';
import * as React from 'react';
import withAppStateContext, {
WithAppStateContextProps,
} from '../../../../app/components/app-state/withAppStateContext';
-import Suggestions from '../../../../components/embed-docs-modal/Suggestions';
import AllHoldersList from '../../../../components/permissions/AllHoldersList';
import { FilterOption } from '../../../../components/permissions/SearchForm';
import { translate } from '../../../../helpers/l10n';
return (
<LargeCenteredLayout id="project-permissions-page">
<PageContentFontWrapper className="sw-my-8 sw-body-sm">
- <Suggestions suggestions="global_permissions" />
<Helmet defer={false} title={translate('global_permissions.permission')} />
<PageHeader />
<AllHoldersList
* 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 {
LargeCenteredLayout,
import { Helmet } from 'react-helmet-async';
import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget';
import { ComponentQualifier } from '~sonar-aligned/types/component';
-import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { translate } from '../../../helpers/l10n';
import { MeasureHistory, ParsedAnalysis } from '../../../types/project-activity';
import { Component, Metric } from '../../../types/types';
const canDeleteAnalyses = configuration?.showHistory;
return (
<main className="sw-p-5" id="project-activity">
- <Suggestions suggestions="project_activity" />
<Helmet defer={false} title={translate('project_activity.page')} />
<A11ySkipTarget anchor="activity_main" />
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage } from 'design-system';
import { debounce, findLast, maxBy, minBy, sortBy } from 'lodash';
import * as React from 'react';
} from '../../../components/activity-graph/utils';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { CCT_SOFTWARE_QUALITY_METRICS } from '../../../helpers/constants';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import {
GraphType,
tagName="div"
values={{
learn_more: (
- <DocumentationLink
- className="sw-whitespace-nowrap"
- to="/user-guide/clean-code/code-analysis/"
- >
+ <DocumentationLink className="sw-whitespace-nowrap" to={DocLink.CodeAnalysis}>
{translate('learn_more')}
</DocumentationLink>
),
* 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, FlagMessage, Modal } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { useSetMainBranchMutation } from '../../../queries/branch';
import { Branch } from '../../../types/branch-like';
id="project_branch_pull_request.branch.main_branch.learn_more"
values={{
documentation: (
- <DocumentationLink to="/analyzing-source-code/branches/branch-analysis/#main-branch">
+ <DocumentationLink to={DocLink.MainBranchAnalysis}>
{translate('documentation')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
BasicSeparator,
DownloadButton,
import { getRegulatoryReportUrl } from '../../../api/regulatory-report';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { getBranchLikeDisplayName, getBranchLikeKey } from '../../../helpers/branch-like';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { LabelValueSelectOption } from '../../../helpers/search';
import { BranchLike } from '../../../types/branch-like';
defaultMessage={translate('regulatory_page.available_branches_info.more_info')}
values={{
doc_link: (
- <DocumentationLink to="/analyzing-source-code/branches/branch-analysis/#inactive-branches">
+ <DocumentationLink to={DocLink.InactiveBranches}>
{translate('regulatory_page.available_branches_info.more_info.doc_link')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { HeadingDark, Link, Title } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
export default function AppHeader(props: AppHeaderProps) {
const { canAdmin } = props;
- const toUrl = useDocUrl('/project-administration/clean-as-you-code-settings/defining-new-code/');
+ const toUrl = useDocUrl(DocLink.NewCodeDefinition);
return (
<header className="sw-mt-8 sw-mb-4">
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { sortBranches } from '../../../helpers/branch-like';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import {
DEFAULT_NEW_CODE_DEFINITION_TYPE,
return (
<LargeCenteredLayout id="new-code-rules-page">
- <Suggestions suggestions="project_baseline" />
+ <Suggestions suggestion={DocLink.NewCodeDefinition} />
<Helmet defer={false} title={translate('project_baseline.page')} />
* 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,
FlagMessage,
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
import DisableableSelectOption from '../../components/common/DisableableSelectOption';
import Suggestions from '../../components/embed-docs-modal/Suggestions';
+import { DocLink } from '../../helpers/doc-links';
import { translate } from '../../helpers/l10n';
import { isDiffMetric } from '../../helpers/measures';
import { LabelValueSelectOption } from '../../helpers/search';
return (
<LargeCenteredLayout id="project-quality-gate">
<PageContentFontWrapper className="sw-my-8 sw-body-sm">
- <Suggestions suggestions="project_quality_gate" />
+ <Suggestions suggestion={DocLink.CaYC} />
<Helmet defer={false} title={translate('project_quality_gate.page')} />
<A11ySkipTarget anchor="qg_main" />
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
ActionCell,
ButtonPrimary,
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
import { Profile } from '../../api/quality-profiles';
import Suggestions from '../../components/embed-docs-modal/Suggestions';
+import { DocLink } from '../../helpers/doc-links';
import { translate } from '../../helpers/l10n';
import { getRulesUrl } from '../../helpers/urls';
import { Component } from '../../types/types';
return (
<LargeCenteredLayout id="project-quality-profiles">
<PageContentFontWrapper className="sw-my-8 sw-body-sm">
- <Suggestions suggestions="project_quality_profiles" />
+ <Suggestions suggestion={DocLink.InstanceAdminQualityProfiles} />
<Helmet defer={false} title={translate('project_quality_profiles.page')} />
<A11ySkipTarget anchor="profiles_main" />
import A11ySkipTarget from '~sonar-aligned/components/a11y/A11ySkipTarget';
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { ComponentQualifier } from '~sonar-aligned/types/component';
-import { MetricKey } from '~sonar-aligned/types/metrics';
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 ScreenPositionHelper from '../../../components/common/ScreenPositionHelper';
-import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import '../../../components/search-navigator.css';
import handleRequiredAuthentication from '../../../helpers/handleRequiredAuthentication';
import { translate } from '../../../helpers/l10n';
render() {
return (
<StyledWrapper id="projects-page">
- <Suggestions suggestions={MetricKey.projects} />
<Helmet defer={false} title={translate('projects.page')} />
<h1 className="sw-sr-only">{translate('projects.page')}</h1>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { LargeCenteredLayout, PageContentFontWrapper } from 'design-system';
import { debounce, uniq } from 'lodash';
import * as React from 'react';
import { getValue } from '../../api/settings';
import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext';
import ListFooter from '../../components/controls/ListFooter';
-import Suggestions from '../../components/embed-docs-modal/Suggestions';
import { toShortISO8601String } from '../../helpers/dates';
import { translate } from '../../helpers/l10n';
import { hasGlobalPermission } from '../../helpers/users';
return (
<LargeCenteredLayout as="main" id="projects-management-page">
<PageContentFontWrapper className="sw-body-sm sw-my-8">
- <Suggestions suggestions="projects_management" />
<Helmet defer={false} title={translate('projects_management')} />
<Header
* 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 styled from '@emotion/styled';
import {
import { useNavigate, useParams } from 'react-router-dom';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import '../../../components/search-navigator.css';
+import { DocLink } from '../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { getQualityGateUrl } from '../../../helpers/urls';
import { useQualityGatesQuery } from '../../../queries/quality-gates';
)}
/>
<div className="sw-grid sw-gap-x-12 sw-gap-y-6 sw-grid-cols-12 sw-w-full">
- <Suggestions suggestions="quality_gates" />
+ <Suggestions suggestion={DocLink.CaYC} />
<StyledContentWrapper
className="sw-col-span-3 sw-px-4 sw-py-6 sw-border-y-0"
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { SpotlightTour, SpotlightTourStep } from 'design-system';
import React from 'react';
import { dismissNotice } from '../../../api/users';
import { CurrentUserContext } from '../../../app/components/current-user/CurrentUserContext';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { QualityGate } from '../../../types/types';
import { NoticeType } from '../../../types/users';
<p className="sw-mb-4">
{translate('quality_gates.cayc.condition_simplification_tour.page_3.content1')}
</p>
- <DocumentationLink to="/user-guide/issues/#resolutions">
+ <DocumentationLink to={DocLink.IssueResolutions}>
{translate('quality_gates.cayc.condition_simplification_tour.page_3.content2')}
</DocumentationLink>
</>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
CardWithPrimaryBackground,
CheckIcon,
import React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { OPTIMIZED_CAYC_CONDITIONS } from '../utils';
import QGRecommendedIcon from './QGRecommendedIcon';
id="quality_gates.cayc.banner.description1"
values={{
cayc_link: (
- <DocumentationLink to="/user-guide/clean-as-you-code/">
+ <DocumentationLink to={DocLink.CaYC}>
{translate('quality_gates.cayc')}
</DocumentationLink>
),
* 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, CardWithPrimaryBackground, SubHeadingHighlight } from 'design-system';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
import ModalButton from '../../../components/controls/ModalButton';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
interface Props {
}
values={{
cayc_link: (
- <DocumentationLink to="/user-guide/clean-as-you-code/">
+ <DocumentationLink to={DocLink.CaYC}>
{translate('quality_gates.cayc')}
</DocumentationLink>
),
* 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, Link, Modal, SubHeading, Title } from 'design-system';
import { sortBy } from 'lodash';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { useFixQualityGateMutation } from '../../../queries/quality-gates';
(condition) => metrics[condition.metric]?.name,
);
- const getDocUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.CaYC);
const updateCaycQualityGate = React.useCallback(async () => {
await fixQualityGate({ weakConditions, missingConditions });
: 'quality_gates.cayc.review_update_modal.description1'
}
values={{
- cayc_link: (
- <Link to={getDocUrl('/user-guide/clean-as-you-code/')}>
- {translate('quality_gates.cayc')}
- </Link>
- ),
+ cayc_link: <Link to={docUrl}>{translate('quality_gates.cayc')}</Link>,
}}
/>
</SubHeading>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
ButtonSecondary,
FlagMessage,
import { useMetrics } from '../../../app/components/metrics/withMetricsContext';
import DocumentationLink from '../../../components/common/DocumentationLink';
import ModalButton, { ModalProps } from '../../../components/controls/ModalButton';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { getLocalizedMetricName, translate } from '../../../helpers/l10n';
import { Feature } from '../../../types/features';
[metrics, qualityGate],
);
- const getDocUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.CaYC);
const isCompliantCustomQualityGate =
qualityGate.caycStatus !== CaycStatus.NonCompliant && !qualityGate.isBuiltIn;
const isOptimizing = isCompliantCustomQualityGate && !isQualityGateOptimized(qualityGate);
id="quality_gates.is_built_in.cayc.description"
values={{
link: (
- <DocumentationLink to="/user-guide/clean-as-you-code/">
+ <DocumentationLink to={DocLink.CaYC}>
{translate('clean_as_you_code')}
</DocumentationLink>
),
content={translate('quality_gates.conditions.help')}
links={[
{
- href: '/user-guide/clean-as-you-code/',
+ href: DocLink.CaYC,
label: translate('quality_gates.conditions.help.link'),
},
]}
id="quality_gates.cayc_unfollow.description"
defaultMessage={translate('quality_gates.cayc_unfollow.description')}
values={{
- cayc_link: (
- <Link to={getDocUrl('/user-guide/clean-as-you-code/')}>
- {translate('quality_gates.cayc')}
- </Link>
- ),
+ cayc_link: <Link to={docUrl}>{translate('quality_gates.cayc')}</Link>,
}}
/>
</SubHeading>
* 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, HelperHintIcon, Title } from 'design-system';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import ModalButton, { ModalProps } from '../../../components/controls/ModalButton';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import CreateQualityGateForm from './CreateQualityGateForm';
content={translate('quality_gates.help')}
links={[
{
- href: '/user-guide/quality-gates/',
+ href: DocLink.QualityGates,
label: translate('learn_more'),
},
]}
import { Actions, getExporters, searchQualityProfiles } from '../../../api/quality-profiles';
import withLanguagesContext from '../../../app/components/languages/withLanguagesContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { Languages } from '../../../types/languages';
import { QualityProfilesContextProps } from '../qualityProfilesContext';
render() {
return (
<LargeCenteredLayout className="sw-my-8">
- <Suggestions suggestions="quality_profiles" />
+ <Suggestions suggestion={DocLink.InstanceAdminQualityProfiles} />
<Helmet defer={false} title={translate('quality_profiles.page')} />
{this.renderChild()}
import { useIntl } from 'react-intl';
import { useLocation, useRouter } from '~sonar-aligned/components/hoc/withRouter';
import { Actions } from '../../../api/quality-profiles';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
import { Profile } from '../types';
const intl = useIntl();
const location = useLocation();
const router = useRouter();
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.InstanceAdminQualityProfiles);
const [modal, setModal] = React.useState<'' | 'createProfile' | 'restoreProfile'>('');
<div className="sw-body-sm">
{intl.formatMessage({ id: 'quality_profiles.intro' })}
- <Link className="sw-ml-2" to={docUrl('/instance-administration/quality-profiles/')}>
+ <Link className="sw-ml-2" to={docUrl}>
{intl.formatMessage({ id: 'learn_more' })}
</Link>
</div>
* 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 styled from '@emotion/styled';
import {
import { isBranch } from '~sonar-aligned/helpers/branch-like';
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
-import Suggestions from '../../components/embed-docs-modal/Suggestions';
import { translate } from '../../helpers/l10n';
import useFollowScroll from '../../hooks/useFollowScroll';
import { BranchLike } from '../../types/branch-like';
return (
<>
- <Suggestions suggestions={MetricKey.security_hotspots} />
-
<Helmet title={translate('hotspots.page')} />
<A11ySkipTarget anchor="security_hotspots_main" />
import * as React from 'react';
import DocumentationLink from '../../../components/common/DocumentationLink';
import { Image } from '../../../components/common/Image';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
export interface EmptyHotspotsPageProps {
{translate(`hotspots.${translationRoot}.description`)}
</Note>
{!(filtered || isStaticListOfHotspots) && (
- <DocumentationLink className="sw-mt-4" to="/user-guide/security-hotspots/">
+ <DocumentationLink className="sw-mt-4" to={DocLink.SecurityHotspots}>
{translate('hotspots.learn_more')}
</DocumentationLink>
)}
* 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 'design-system';
import * as React from 'react';
-import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
+import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
export function HotspotDisabledFilterTooltip() {
+ const docUrl = useDocUrl(DocLink.InstanceAdminReindexation);
+
return (
<div className="sw-body-sm sw-w-[190px]">
<p>
</p>
<hr className="sw-mx-0 sw-my-3 sw-p-0 sw-w-full" />
<span className="sw-body-sm-highlight">{translate('indexation.learn_more')}</span>
- <DocumentationLink
+ <Link
className="sw-ml-1"
onMouseDown={(e) => {
// This tooltip content is rendered in the context of a <Dropdown>, and <DropdownToggler>
// this link. We preventDefault() to avoid this behavior.
e.preventDefault();
}}
- to="/instance-administration/reindexing/"
+ to={docUrl}
>
{translate('indexation.reindexing')}
- </DocumentationLink>
+ </Link>
</div>
);
}
import { LightLabel } from 'design-system';
import * as React from 'react';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { AdditionalCategoryComponentProps } from './AdditionalCategories';
import CategoryDefinitionsList from './CategoryDefinitionsList';
<LightLabel>{translate('settings.analysis_scope.wildcards.single_char')}</LightLabel>
<div className="sw-col-span-2">
- <DocumentationLink to="/project-administration/analysis-scope/">
+ <DocumentationLink to={DocLink.AnalysisScope}>
{translate('learn_more')}
</DocumentationLink>
</div>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Spinner } from '@sonarsource/echoes-react';
import classNames from 'classnames';
import { ButtonPrimary, ButtonSecondary } from 'design-system';
import NewCodeDefinitionDaysOption from '../../../components/new-code-definition/NewCodeDefinitionDaysOption';
import NewCodeDefinitionPreviousVersionOption from '../../../components/new-code-definition/NewCodeDefinitionPreviousVersionOption';
import { NewCodeDefinitionLevels } from '../../../components/new-code-definition/utils';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import {
getNumberOfDaysDefaultValue,
id="settings.new_code_period.description3"
values={{
link: (
- <DocumentationLink to="/project-administration/clean-as-you-code-settings/defining-new-code/">
+ <DocumentationLink to={DocLink.NewCodeDefinition}>
{translate('settings.new_code_period.description3.link')}
</DocumentationLink>
),
* 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 { LargeCenteredLayout, PageContentFontWrapper, themeBorder } from 'design-system';
import { uniqBy } from 'lodash';
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 { translate } from '../../../helpers/l10n';
import { ExtendedSettingDefinition } from '../../../types/settings';
import { Component } from '../../../types/types';
return (
<LargeCenteredLayout id="settings-page">
- <Suggestions suggestions="settings" />
<Helmet defer={false} title={translate('settings.page')} />
<PageContentFontWrapper className="sw-my-8">
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
BasicSeparator,
ButtonSecondary,
import HelpTooltip from '~sonar-aligned/components/controls/HelpTooltip';
import DocumentationLink from '../../../../components/common/DocumentationLink';
import Tooltip from '../../../../components/controls/Tooltip';
-import { ALM_DOCUMENTATION_PATHS, IMPORT_COMPATIBLE_ALMS } from '../../../../helpers/constants';
+import { IMPORT_COMPATIBLE_ALMS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { getEdition, getEditionUrl } from '../../../../helpers/editions';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
import {
)}
values={{
link: (
- <DocumentationLink to={ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub]}>
+ <DocumentationLink to={DocLink.AlmGitHubIntegration}>
{translate('learn_more')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
ButtonSecondary,
FlagMessage,
} from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
import { AlmBindingDefinitionBase } from '../../../../types/alm-settings';
} = props;
const [showField, setShowField] = React.useState(!overwriteOnly);
- const toStatic = useDocUrl('/instance-administration/security/#settings-encryption');
+ const toStatic = useDocUrl(DocLink.InstanceAdminEncryption);
return (
<FormField
* 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 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys, AzureBindingDefinition } from '../../../../types/alm-settings';
+import { AzureBindingDefinition } from '../../../../types/alm-settings';
import { AlmBindingDefinitionFormField } from './AlmBindingDefinitionFormField';
export interface AzureFormProps {
export default function AzureForm(props: AzureFormProps) {
const { formData, onFieldChange } = props;
- const toStatic = useDocUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.Azure]);
+ const toStatic = useDocUrl(DocLink.AlmAzureIntegration);
return (
<>
<AlmBindingDefinitionFormField
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
-import { useDocUrl } from '../../../../helpers/docs';
+import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys, BitbucketCloudBindingDefinition } from '../../../../types/alm-settings';
+import { BitbucketCloudBindingDefinition } from '../../../../types/alm-settings';
import { BITBUCKET_CLOUD_WORKSPACE_ID_FORMAT } from '../../constants';
import { AlmBindingDefinitionFormField } from './AlmBindingDefinitionFormField';
formData.workspace && !BITBUCKET_CLOUD_WORKSPACE_ID_FORMAT.test(formData.workspace),
);
- const toStatic = useDocUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.BitbucketCloud]);
-
return (
<>
<FlagMessage variant="info" className="sw-mb-8">
</Link>
),
permission: <strong>Pull Requests: Read</strong>,
- doc_link: <Link to={toStatic}>{translate('learn_more')}</Link>,
+ doc_link: (
+ <DocumentationLink to={DocLink.AlmBitBucketCloudIntegration}>
+ {translate('learn_more')}
+ </DocumentationLink>
+ ),
}}
/>
</div>
* 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 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys, BitbucketServerBindingDefinition } from '../../../../types/alm-settings';
+import { BitbucketServerBindingDefinition } from '../../../../types/alm-settings';
import { AlmBindingDefinitionFormField } from './AlmBindingDefinitionFormField';
export interface BitbucketServerFormProps {
export default function BitbucketServerForm(props: BitbucketServerFormProps) {
const { formData } = props;
- const toStatic = useDocUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.BitbucketServer]);
+ const toStatic = useDocUrl(DocLink.AlmBitBucketServerIntegration);
return (
<>
<AlmBindingDefinitionFormField
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys, GithubBindingDefinition } from '../../../../types/alm-settings';
+import { GithubBindingDefinition } from '../../../../types/alm-settings';
import { AlmBindingDefinitionFormField } from './AlmBindingDefinitionFormField';
export interface GithubFormProps {
export default function GithubForm(props: GithubFormProps) {
const { formData, onFieldChange } = props;
- const toStatic = useDocUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.GitHub]);
+ const toStatic = useDocUrl(DocLink.AlmGitHubIntegration);
return (
<>
<FlagMessage variant="info" className="sw-mb-8">
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys, GitlabBindingDefinition } from '../../../../types/alm-settings';
+import { GitlabBindingDefinition } from '../../../../types/alm-settings';
import { AlmBindingDefinitionFormField } from './AlmBindingDefinitionFormField';
export interface GitlabFormProps {
export default function GitlabForm(props: GitlabFormProps) {
const { formData, onFieldChange } = props;
- const toStatic = useDocUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.GitLab]);
+ const toStatic = useDocUrl(DocLink.AlmGitLabIntegration);
return (
<>
<AlmBindingDefinitionFormField
| AlmKeys.GitLab
| AlmKeys.BitbucketServer;
-export const DOCUMENTATION_LINK_SUFFIXES = {
- [SAML]: 'saml/overview',
- [AlmKeys.GitHub]: 'github',
- [AlmKeys.GitLab]: 'gitlab',
- [AlmKeys.BitbucketServer]: 'bitbucket-cloud',
-};
-
function renderDevOpsIcon(key: string) {
return <Image alt={key} className="sw-mr-2" height={16} src={`/images/alm/${key}.svg`} />;
}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { ButtonSecondary, Modal } from 'design-system';
import { noop } from 'lodash';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import { useToggleGithubProvisioningMutation } from '../../../../queries/identity-provider/github';
import { useGetValueQuery, useResetSettingsMutation } from '../../../../queries/settings';
tagName="p"
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/github/">
+ <DocumentationLink to={DocLink.AlmGitHubAuth}>
<FormattedMessage id="documentation" />
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage } from 'design-system';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import { useGetValueQuery } from '../../../../queries/settings';
import { AlmKeys } from '../../../../types/alm-settings';
id="settings.authentication.gitlab.configuration.insecure"
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/bitbucket-cloud/#setting-your-authentication-settings-in-sonarqube">
+ <DocumentationLink to={DocLink.AlmBitBucketCloudSettings}>
{translate('documentation')}
</DocumentationLink>
),
defaultMessage={translate('settings.authentication.help')}
values={{
link: (
- <DocumentationLink to="/instance-administration/authentication/bitbucket-cloud/">
+ <DocumentationLink to={DocLink.AlmBitBucketCloudAuth}>
{translate('settings.authentication.help.link')}
</DocumentationLink>
),
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { AlmAuthDocLinkKeys } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import { useSaveValuesMutation } from '../../../../queries/settings';
import { AlmKeys } from '../../../../types/alm-settings';
import { ProvisioningType } from '../../../../types/provisioning';
import { Dict, Provider } from '../../../../types/types';
-import { AuthenticationTabs, DOCUMENTATION_LINK_SUFFIXES } from './Authentication';
+import { AuthenticationTabs } from './Authentication';
import AuthenticationFormField from './AuthenticationFormField';
import ConfirmProvisioningModal from './ConfirmProvisioningModal';
import { SettingValue } from './hook/useConfiguration';
id={`settings.authentication.${helpMessage}`}
values={{
link: (
- <DocumentationLink
- to={`/instance-administration/authentication/${DOCUMENTATION_LINK_SUFFIXES[tab]}/`}
- >
+ <DocumentationLink to={AlmAuthDocLinkKeys[tab]}>
{translate('settings.authentication.help.link')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Spinner } from 'design-system';
import { isEmpty, omitBy } from 'lodash';
import React, { FormEvent, useContext } from 'react';
import GitLabSynchronisationWarning from '../../../../app/components/GitLabSynchronisationWarning';
import { AvailableFeaturesContext } from '../../../../app/components/available-features/AvailableFeaturesContext';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
import { useIdentityProviderQuery } from '../../../../queries/identity-provider/common';
import {
useSyncWithGitLabNow,
useUpdateGitLabConfigurationMutation,
} from '../../../../queries/identity-provider/gitlab';
-import { AlmKeys } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import { GitLabConfigurationUpdateBody, ProvisioningType } from '../../../../types/provisioning';
import { DefinitionV2, SettingType } from '../../../../types/settings';
import { Provider } from '../../../../types/types';
-import { DOCUMENTATION_LINK_SUFFIXES } from './Authentication';
import AuthenticationFormField from './AuthenticationFormField';
import ConfigurationDetails from './ConfigurationDetails';
import ConfirmProvisioningModal from './ConfirmProvisioningModal';
id="settings.authentication.gitlab.provisioning_at_login.description"
values={{
documentation: (
- <DocumentationLink
- to={`/instance-administration/authentication/${
- DOCUMENTATION_LINK_SUFFIXES[AlmKeys.GitLab]
- }/#choosing-the-provisioning-method`}
- >
+ <DocumentationLink to={DocLink.AlmGitLabAuthProvisioningMethod}>
{translate(`learn_more`)}
</DocumentationLink>
),
)}
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/gitlab">
+ <DocumentationLink to={DocLink.AlmGitLabAuth}>
{translate('documentation')}
</DocumentationLink>
),
id="settings.authentication.gitlab.form.provisioning_with_gitlab.description"
values={{
documentation: (
- <DocumentationLink
- to={`/instance-administration/authentication/${
- DOCUMENTATION_LINK_SUFFIXES[AlmKeys.GitLab]
- }/#choosing-the-provisioning-method`}
- >
+ <DocumentationLink to={DocLink.AlmGitLabAuthProvisioningMethod}>
{translate(`learn_more`)}
</DocumentationLink>
),
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import {
useCreateGitLabConfigurationMutation,
} from '../../../../queries/identity-provider/gitlab';
import { GitLabConfigurationCreateBody, GitlabConfiguration } from '../../../../types/provisioning';
import { DefinitionV2, SettingType } from '../../../../types/settings';
-import { DOCUMENTATION_LINK_SUFFIXES } from './Authentication';
import AuthenticationFormField from './AuthenticationFormField';
interface Props {
id="settings.authentication.help"
values={{
link: (
- <DocumentationLink
- to={`/instance-administration/authentication/${DOCUMENTATION_LINK_SUFFIXES.gitlab}/`}
- >
+ <DocumentationLink to={DocLink.AlmGitLabAuth}>
{translate('settings.authentication.help.link')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { ButtonSecondary, FlagMessage, Highlight, Note, Spinner } from 'design-system';
import React, { FormEvent, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import GitHubSynchronisationWarning from '../../../../app/components/GitHubSynchronisationWarning';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate, translateWithParameters } from '../../../../helpers/l10n';
import { useIdentityProviderQuery } from '../../../../queries/identity-provider/common';
import {
import { ProvisioningType } from '../../../../types/provisioning';
import { ExtendedSettingDefinition } from '../../../../types/settings';
import { Provider } from '../../../../types/types';
-import { AuthenticationTabs, DOCUMENTATION_LINK_SUFFIXES } from './Authentication';
+import { AuthenticationTabs } from './Authentication';
import AuthenticationFormField from './AuthenticationFormField';
import AutoProvisioningConsent from './AutoProvisionningConsent';
import ConfigurationDetails from './ConfigurationDetails';
defaultMessage={translate('settings.authentication.github.form.legacy_configured')}
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/github">
+ <DocumentationLink to={DocLink.AlmGitHubAuth}>
{translate('settings.authentication.github.form.legacy_configured.link')}
</DocumentationLink>
),
id="settings.authentication.github.form.provisioning_at_login.description"
values={{
documentation: (
- <DocumentationLink
- to={`/instance-administration/authentication/${
- DOCUMENTATION_LINK_SUFFIXES[AlmKeys.GitHub]
- }/`}
- >
+ <DocumentationLink to={DocLink.AlmGitHubAuth}>
{translate('learn_more')}
</DocumentationLink>
),
)}
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/github">
+ <DocumentationLink to={DocLink.AlmGitHubAuth}>
{translate('documentation')}
</DocumentationLink>
),
id="settings.authentication.github.form.provisioning_with_github.description"
values={{
documentation: (
- <DocumentationLink
- to={`/instance-administration/authentication/${
- DOCUMENTATION_LINK_SUFFIXES[AlmKeys.GitHub]
- }/`}
- >
+ <DocumentationLink to={DocLink.AlmGitHubAuth}>
{translate('learn_more')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { ButtonSecondary, Spinner } from 'design-system';
import React, { FormEvent } from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../../components/common/DocumentationLink';
import ConfirmModal from '../../../../components/controls/ConfirmModal';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import { useIdentityProviderQuery } from '../../../../queries/identity-provider/common';
import { useToggleScimMutation } from '../../../../queries/identity-provider/scim';
id="settings.authentication.saml.form.provisioning.disabled"
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/saml/scim/overview">
+ <DocumentationLink to={DocLink.AlmSamlScimAuth}>
{translate('documentation')}
</DocumentationLink>
),
)}
values={{
documentation: (
- <DocumentationLink to="/instance-administration/authentication/saml/scim/overview">
+ <DocumentationLink to={DocLink.AlmSamlScimAuth}>
{translate('documentation')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, InputField, Note, RequiredIcon, SubHeading, Switch } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
import DocumentationLink from '../../../../components/common/DocumentationLink';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import { convertGithubApiUrlToLink, stripTrailingSlash } from '../../../../helpers/urls';
import {
help: true,
helpParams: {
doc_link: (
- <DocumentationLink to="/project-administration/monorepos/">
+ <DocumentationLink to={DocLink.Monorepos}>
{translate('learn_more')}
</DocumentationLink>
),
* 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,
ButtonSecondary,
import { FormattedMessage } from 'react-intl';
import { encryptValue } from '../../../api/settings';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
interface Props {
id="encryption.form_note"
values={{
moreInformationLink: (
- <DocumentationLink to="/instance-administration/security/">
+ <DocumentationLink to={DocLink.InstanceAdminSecurity}>
{translate('more_information')}
</DocumentationLink>
),
* 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,
ClipboardIconButton,
import { useCallback, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import DocumentationLink from '../../../components/common/DocumentationLink';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
interface Props {
id="encryption.secret_key_description"
values={{
moreInformationLink: (
- <DocumentationLink to="/instance-administration/security/">
+ <DocumentationLink to={DocLink.InstanceAdminSecurity}>
{translate('more_information')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { LargeCenteredLayout, PageContentFontWrapper } from 'design-system';
import * as React from 'react';
import { Helmet } from 'react-helmet-async';
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 { translate } from '../../../helpers/l10n';
import { SysInfoCluster, SysInfoStandalone } from '../../../types/types';
import '../styles.css';
const { loading, sysInfoData } = this.state;
return (
<LargeCenteredLayout as="main">
- <Suggestions suggestions="system_info" />
<Helmet defer={false} title={translate('system_info.page')} />
<PageContentFontWrapper className="sw-body-sm sw-pb-8">
<div>
* 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, FlagMessage, Link, Title } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
import { translate } from '../../helpers/l10n';
import UserForm from './components/UserForm';
}
export default function Header(props: Props) {
- const getDocUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.AuthOverview);
const [openUserForm, setOpenUserForm] = React.useState(false);
const { manageProvider } = props;
id="users.page.managed_description"
values={{
provider: manageProvider,
- link: (
- <Link to={getDocUrl('/instance-administration/authentication/overview/')}>
- {translate('documentation')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('documentation')}</Link>,
}}
/>
</span>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { subDays, subSeconds } from 'date-fns';
import {
HelperHintIcon,
import GitLabSynchronisationWarning from '../../app/components/GitLabSynchronisationWarning';
import ListFooter from '../../components/controls/ListFooter';
import { ManagedFilter } from '../../components/controls/ManagedFilter';
-import Suggestions from '../../components/embed-docs-modal/Suggestions';
import { now, toISO8601WithOffsetString } from '../../helpers/dates';
import { translate } from '../../helpers/l10n';
import { LabelValueSelectOption } from '../../helpers/search';
return (
<LargeCenteredLayout as="main" id="users-page">
<PageContentFontWrapper className="sw-my-8 sw-body-sm">
- <Suggestions suggestions="users" />
<Helmet defer={false} title={translate('users.page')} />
<Header manageProvider={manageProvider?.provider} />
{manageProvider?.provider === Provider.Github && <GitHubSynchronisationWarning short />}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
Checkbox,
DangerButtonPrimary,
} from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate, translateWithParameters } from '../../../helpers/l10n';
import { useDeactivateUserMutation } from '../../../queries/users';
};
const header = translate('users.deactivate_user');
- const docUrl = useDocUrl('/instance-administration/authentication/overview/');
+ const docUrl = useDocUrl(DocLink.AuthOverview);
return (
<Modal
* 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 {
LAYOUT_FOOTER_HEIGHT,
import { withRouter } from '~sonar-aligned/components/hoc/withRouter';
import { Location, Router } from '~sonar-aligned/types/router';
import { fetchWebApi } from '../../../api/web-api';
-import Suggestions from '../../../components/embed-docs-modal/Suggestions';
import { translate } from '../../../helpers/l10n';
import { WebApi } from '../../../types/types';
import '../styles/web-api.css';
return (
<LargeCenteredLayout>
<PageContentFontWrapper className="sw-body-sm sw-w-full sw-flex">
- <Suggestions suggestions="api_documentation" />
<Helmet defer={false} title={translate('api_documentation.page')} />
<div className="sw-w-full sw-flex">
<NavContainer
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { LargeCenteredLayout, PageContentFontWrapper, Spinner } from 'design-system';
import * as React from 'react';
import { useCallback, useEffect, useState } from 'react';
import { createWebhook, deleteWebhook, searchWebhooks, updateWebhook } from '../../../api/webhooks';
import withComponentContext from '../../../app/components/componentContext/withComponentContext';
import Suggestions from '../../../components/embed-docs-modal/Suggestions';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { Component } from '../../../types/types';
import { WebhookResponse } from '../../../types/webhook';
return (
<LargeCenteredLayout id="project-webhooks">
<PageContentFontWrapper className="sw-my-8 sw-body-sm">
- <Suggestions suggestions="webhooks" />
+ <Suggestions suggestion={DocLink.Webhooks} />
<Helmet defer={false} title={translate('webhooks.page')} />
<PageHeader>
<PageActions loading={loading} onCreate={handleCreate} webhooksCount={webhooks.length} />
* 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, Title } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
}
export default function PageHeader({ children }: Readonly<Props>) {
- const toUrl = useDocUrl('/project-administration/webhooks/');
+ const toUrl = useDocUrl(DocLink.Webhooks);
return (
<header className="sw-mb-2 sw-flex sw-items-center sw-justify-between">
* 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, LinkProps } from 'design-system';
+
+import { Link, LinkProps } from '@sonarsource/echoes-react';
import * as React from 'react';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
-type Props = Omit<LinkProps, 'to'> & { to: string; innerRef?: React.Ref<HTMLAnchorElement> };
+type Props = Omit<LinkProps, 'to'> & { to: DocLink; innerRef?: React.Ref<HTMLAnchorElement> };
export default function DocumentationLink({ to, innerRef, ...props }: Props) {
const toStatic = useDocUrl(to);
- return <Link ref={innerRef} to={toStatic} target="_blank" {...props} />;
+
+ return <Link ref={innerRef} to={toStatic} {...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 { ItemLink, OpenNewTabIcon } from 'design-system';
import * as React from 'react';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
interface Props {
- to: string;
- innerRef?: React.Ref<HTMLAnchorElement>;
children: React.ReactNode;
+ innerRef?: React.Ref<HTMLAnchorElement>;
+ to: DocLink;
}
export function DocItemLink({ to, innerRef, children }: Props) {
import { ItemDivider, ItemHeader, ItemLink, OpenNewTabIcon } from 'design-system';
import * as React from 'react';
+import { DocLink } from '../../helpers/doc-links';
import { translate } from '../../helpers/l10n';
import { SuggestionLink } from '../../types/types';
import { Image } from '../common/Image';
{suggestions.length !== 0 && (
<Suggestions firstItemRef={firstItemRef} suggestions={suggestions} />
)}
- <DocItemLink innerRef={suggestions.length === 0 ? firstItemRef : undefined} to="/">
+ <DocItemLink innerRef={suggestions.length === 0 ? firstItemRef : undefined} to={DocLink.Root}>
{translate('docs.documentation')}
</DocItemLink>
<ItemLink to="/web_api">{translate('api_documentation.page')}</ItemLink>
+++ /dev/null
-{
- "account": [],
- "api_documentation": [],
- "background_tasks": [
- {
- "link": "/analyzing-source-code/background-tasks/",
- "text": "About Background Tasks"
- }
- ],
- "code": [],
- "coding_rules": [
- {
- "link": "/instance-administration/quality-profiles/",
- "text": "Quality Profiles"
- }
- ],
- "component_measures": [
- {
- "link": "/user-guide/clean-as-you-code/",
- "text": "Clean as You Code"
- },
- {
- "link": "/user-guide/metric-definitions/",
- "text": "Metric Definitions"
- }
- ],
- "global_permissions": [],
- "issues": [],
- "marketplace": [],
- "overview": [
- {
- "link": "/analyzing-source-code/pull-request-analysis",
- "text": "Enable Pull Request Decoration"
- },
- {
- "link": "/analyzing-source-code/ci-integration/overview/",
- "text": "Set up CI analysis"
- },
- {
- "link": "/user-guide/clean-as-you-code/",
- "text": "Clean as You Code"
- },
- {
- "link": "/user-guide/sonarlint-connected-mode/",
- "text": "SonarLint Connected Mode"
- }
- ],
- "permission_templates": [],
- "profiles": [
- {
- "link": "/instance-administration/quality-profiles/",
- "text": "Quality Profiles"
- }
- ],
- "project_activity": [],
- "project_baseline": [
- {
- "link": "/project-administration/clean-as-you-code-settings/defining-new-code/",
- "text": "Defining New Code"
- }
- ],
- "project_quality_gate": [
- {
- "link": "/user-guide/clean-as-you-code/",
- "text": "Clean as You Code"
- }
- ],
- "project_quality_profiles": [
- {
- "link": "/instance-administration/quality-profiles/",
- "text": "About Quality Profiles"
- }
- ],
- "projects_management": [],
- "projects": [],
- "pull_requests": [
- {
- "link": "/user-guide/clean-as-you-code/",
- "text": "Clean as You Code"
- },
- {
- "link": "/analyzing-source-code/pull-request-analysis",
- "text": "Analyzing Pull Requests"
- },
- {
- "link": "/user-guide/sonarlint-connected-mode/",
- "text": "SonarLint connected mode"
- }
- ],
- "quality_gates": [
- {
- "link": "/user-guide/clean-as-you-code/",
- "text": "Clean as You Code"
- }
- ],
- "quality_profiles": [
- {
- "link": "/instance-administration/quality-profiles/",
- "text": "Quality Profiles"
- }
- ],
- "security_reports": [
- {
- "link": "/user-guide/security-reports/",
- "text": "About Security Reports"
- }
- ],
- "settings": [],
- "system_info": [],
- "user_groups": [],
- "users": [],
- "webhooks": [
- {
- "link": "/project-administration/webhooks/",
- "text": "About Webhooks"
- }
- ]
-}
* 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 { SuggestionsContext } from './SuggestionsContext';
+import { DocSection, DocSectionKey, DocTitleKey } from '../../helpers/doc-links';
+import { isDefined } from '../../helpers/types';
+import { SuggestionsContext, SuggestionsContextShape } from './SuggestionsContext';
-interface Props {
- suggestions: string;
-}
+type Props =
+ | {
+ suggestion: DocTitleKey;
+ suggestionGroup?: never;
+ }
+ | {
+ suggestion?: never;
+ suggestionGroup: DocSectionKey;
+ };
-export default function Suggestions({ suggestions }: Props) {
+export default function Suggestions({ suggestion, suggestionGroup }: Readonly<Props>) {
return (
<SuggestionsContext.Consumer>
{({ addSuggestions, removeSuggestions }) => (
<SuggestionsInner
addSuggestions={addSuggestions}
removeSuggestions={removeSuggestions}
- suggestions={suggestions}
+ suggestion={suggestion}
+ suggestionGroup={suggestionGroup}
/>
)}
</SuggestionsContext.Consumer>
}
interface SuggestionsInnerProps {
- addSuggestions: (key: string) => void;
- removeSuggestions: (key: string) => void;
- suggestions: string;
+ addSuggestions: SuggestionsContextShape['addSuggestions'];
+ removeSuggestions: SuggestionsContextShape['removeSuggestions'];
+ suggestion: Props['suggestion'];
+ suggestionGroup: Props['suggestionGroup'];
}
class SuggestionsInner extends React.PureComponent<SuggestionsInnerProps> {
componentDidMount() {
- this.props.addSuggestions(this.props.suggestions);
+ this.props.addSuggestions(this.getSuggestionListFromProps());
}
- componentDidUpdate(prevProps: Props) {
- if (prevProps.suggestions !== this.props.suggestions) {
- this.props.removeSuggestions(this.props.suggestions);
- this.props.addSuggestions(prevProps.suggestions);
- }
+ componentWillUnmount() {
+ this.props.removeSuggestions(this.getSuggestionListFromProps());
}
- componentWillUnmount() {
- this.props.removeSuggestions(this.props.suggestions);
+ getSuggestionListFromProps() {
+ const { suggestion, suggestionGroup } = this.props;
+
+ const suggestions: DocTitleKey[] = isDefined(suggestion) ? [suggestion] : [];
+
+ if (suggestionGroup) {
+ suggestions.push(...DocSection[suggestionGroup]);
+ }
+
+ return suggestions;
}
render() {
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { createContext } from 'react';
+import { DocTitleKey } from '../../helpers/doc-links';
import { SuggestionLink } from '../../types/types';
-interface SuggestionsContextShape {
- addSuggestions: (key: string) => void;
- removeSuggestions: (key: string) => void;
+export interface SuggestionsContextShape {
+ addSuggestions: (keys: DocTitleKey[]) => void;
+ removeSuggestions: (keys: DocTitleKey[]) => void;
suggestions: SuggestionLink[];
}
* 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 { Dict, SuggestionLink } from '../../types/types';
-import suggestionsJson from './EmbedDocsSuggestions.json';
+import { DocTitle, DocTitleKey } from '../../helpers/doc-links';
+import { SuggestionLink } from '../../types/types';
import { SuggestionsContext } from './SuggestionsContext';
-type SuggestionsJson = Dict<SuggestionLink[]>;
-
interface State {
suggestions: SuggestionLink[];
}
export default class SuggestionsProvider extends React.Component<React.PropsWithChildren, State> {
- keys: string[] = [];
+ keys: Array<DocTitleKey> = [];
state: State = { suggestions: [] };
fetchSuggestions = () => {
- const jsonList = suggestionsJson as SuggestionsJson;
let suggestions: SuggestionLink[] = [];
+
this.keys.forEach((key) => {
- if (jsonList[key]) {
- suggestions = [...jsonList[key], ...suggestions];
- }
+ suggestions = [{ link: key, text: DocTitle[key] }, ...suggestions];
});
this.setState({ suggestions });
};
- addSuggestions = (newKey: string) => {
- this.keys = [...this.keys, newKey];
+ addSuggestions = (newKeys: DocTitleKey[]) => {
+ newKeys.forEach((newKey) => {
+ if (!this.keys.includes(newKey)) {
+ this.keys = [...this.keys, newKey];
+ }
+ });
+
this.fetchSuggestions();
};
- removeSuggestions = (oldKey: string) => {
- this.keys = this.keys.filter((key) => key !== oldKey);
+ removeSuggestions = (oldKeys: DocTitleKey[]) => {
+ oldKeys.forEach((oldKey) => {
+ this.keys = this.keys.filter((key) => key !== oldKey);
+ });
+
this.fetchSuggestions();
};
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import * as React from 'react';
+import { DocLink, DocTitleKey } from '../../../helpers/doc-links';
import { renderComponent } from '../../../helpers/testReactTestingUtils';
import EmbedDocsPopupHelper from '../EmbedDocsPopupHelper';
import Suggestions from '../Suggestions';
function renderEmbedDocsPopup() {
function Test() {
- const [suggestions, setSuggestions] = React.useState<string[]>(['account']);
+ const [suggestions, setSuggestions] = React.useState<DocTitleKey[]>([]);
const addSuggestion = () => {
- setSuggestions([...suggestions, 'background_tasks']);
+ setSuggestions([...suggestions, DocLink.BackgroundTasks]);
};
return (
</button>
<EmbedDocsPopupHelper />
{suggestions.map((suggestion) => (
- <Suggestions key={suggestion} suggestions={suggestion} />
+ <Suggestions key={suggestion} suggestion={suggestion} />
))}
</SuggestionsProvider>
);
import { IconProps, TextSubdued } from 'design-system';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { IssueSeverity as IssueSeverityType } from '../../../types/issues';
import { Issue } from '../../../types/types';
content={<DeprecatedFieldTooltip field="severity" />}
links={[
{
- href: '/user-guide/issues',
+ href: DocLink.Issues,
label: translate('learn_more'),
},
]}
import { IconProps, TextSubdued } from 'design-system';
import * as React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import { Issue } from '../../../types/types';
import IssueTypeIcon from '../../icon-mappers/IssueTypeIcon';
content={<DeprecatedFieldTooltip field="type" />}
links={[
{
- href: '/user-guide/issues',
+ href: DocLink.Issues,
label: translate('learn_more'),
},
]}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { DismissableFlagMessage, Link } from 'design-system';
import React, { useCallback, useEffect, useState } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { MessageTypes, checkMessageDismissed, setMessageDismissed } from '../../api/messages';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
import { Component } from '../../types/types';
import { PreviouslyNonCompliantBranchNCD } from './utils';
export default function NCDAutoUpdateMessage(props: NCDAutoUpdateMessageProps) {
const { component, previouslyNonCompliantBranchNCDs } = props;
const intl = useIntl();
- const toUrl = useDocUrl(
- '/project-administration/clean-as-you-code-settings/defining-new-code/#new-code-definition-options',
- );
+ const toUrl = useDocUrl(DocLink.NewCodeDefinitionOptions);
const [dismissed, setDismissed] = useState(true);
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, Link } from 'design-system';
import * as React from 'react';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
import { translate } from '../../helpers/l10n';
export default function NewCodeDefinitionAnalysisWarning() {
- const toStatic = useDocUrl(
- '/project-administration/clean-as-you-code-settings/defining-new-code/',
- );
+ const toStatic = useDocUrl(DocLink.NewCodeDefinition);
return (
<FlagMessage variant="warning" className="sw-mb-4 sw-max-w-[800px]">
<div>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
DismissableFlagMessage,
FlagErrorIcon,
import { useCallback, useEffect, useMemo, useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { MessageTypes, checkMessageDismissed, setMessageDismissed } from '../../api/messages';
+import { DocLink } from '../../helpers/doc-links';
import { translate, translateWithParameters } from '../../helpers/l10n';
import {
NUMBER_OF_DAYS_MAX_VALUE,
days: currentDaysValue,
date: isDefined(updatedAt) && new Date(updatedAt).toLocaleDateString(),
link: (
- <DocumentationLink to="/project-administration/clean-as-you-code-settings/defining-new-code/#new-code-definition-options">
+ <DocumentationLink to={DocLink.NewCodeDefinitionOptions}>
{translate('learn_more')}
</DocumentationLink>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage } from 'design-system';
import * as React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
+import { DocLink } from '../../helpers/doc-links';
import DocumentationLink from '../common/DocumentationLink';
interface AnalysisMissingInfoMessageProps {
values={{
qualifier,
learn_more: (
- <DocumentationLink
- className="sw-whitespace-nowrap"
- to="/user-guide/clean-code/code-analysis/"
- >
+ <DocumentationLink className="sw-whitespace-nowrap" to={DocLink.CodeAnalysis}>
{intl.formatMessage({ id: 'learn_more' })}
</DocumentationLink>
),
import React, { useMemo } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import { useAppState } from '../../app/components/app-state/withAppStateContext';
+import { DocLink } from '../../helpers/doc-links';
import { useDocUrl } from '../../helpers/docs';
import { getInstanceVersionNumber } from '../../helpers/strings';
import { isCurrentVersionEOLActive } from '../../helpers/system';
return isCurrentVersionEOLActive(versionEOL);
}, [data?.installedVersionActive, versionEOL]);
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.ActiveVersions);
const intl = useIntl();
return intl.formatMessage(
{
version: getInstanceVersionNumber(version),
status: (
- <LinkStandalone
- className="sw-ml-1"
- highlight={LinkHighlight.CurrentColor}
- to={docUrl('/setup-and-upgrade/upgrade-the-server/active-versions/')}
- >
+ <LinkStandalone className="sw-ml-1" highlight={LinkHighlight.CurrentColor} to={docUrl}>
<FormattedMessage
id={`footer.version.status.${isActiveVersion ? 'active' : 'inactive'}`}
/>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Pill } from 'design-system';
import React from 'react';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
+import { DocLink } from '../../helpers/doc-links';
import { translate } from '../../helpers/l10n';
import { CleanCodeAttribute, CleanCodeAttributeCategory } from '../../types/clean-code-taxonomy';
}
links={[
{
- href: '/user-guide/clean-code/introduction',
+ href: DocLink.CleanCodeIntroduction,
label: translate('learn_more'),
},
]}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import classNames from 'classnames';
import { Pill } from 'design-system';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
+import { DocLink } from '../../helpers/doc-links';
import { translate } from '../../helpers/l10n';
import { SoftwareImpactSeverity } from '../../types/clean-code-taxonomy';
import SoftwareImpactSeverityIcon from '../icon-mappers/SoftwareImpactSeverityIcon';
}
links={[
{
- href: '/user-guide/clean-code/introduction',
+ href: DocLink.CleanCodeIntroduction,
label: translate('learn_more'),
},
]}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
'onboarding.tutorial.with.github_action.create_secret.monorepo_project_level_token_info.link',
),
monoRepoYamlDocLink: byRole('link', {
- name: 'onboarding.tutorial.with.github_action.monorepo.see_yaml_instructions',
+ name: /^onboarding\.tutorial\.with\.github_action\.monorepo\.see_yaml_instructions\b/,
}),
chooseTutorialLink: (mode: TutorialModes) =>
byRole('link', { name: `onboarding.tutorial.choose_method.${mode}` }),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys } from '../../../../types/alm-settings';
export default function AlertClassicEditor() {
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.AlmAzureIntegration);
return (
<FlagMessage variant="info" className="sw-mt-4">
defaultMessage={translate('onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info')}
values={{
doc_link: (
- <Link to={docUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.Azure])}>
+ <Link to={docUrl}>
{translate('onboarding.tutorial.with.azure_pipelines.BranchAnalysis.info.doc_link')}
</Link>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { BasicSeparator, FlagMessage, Link, NumberedListItem } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import withAvailableFeatures, {
WithAvailableFeaturesProps,
} from '../../../../app/components/available-features/withAvailableFeatures';
-import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
-import { AlmKeys } from '../../../../types/alm-settings';
import { Feature } from '../../../../types/features';
import SentenceWithHighlights from '../../components/SentenceWithHighlights';
export function PublishSteps(props: PublishStepsProps) {
const branchSupportEnabled = props.hasFeature(Feature.BranchSupport);
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.AlmAzureIntegration);
return (
<>
)}
values={{
link: (
- <Link to={docUrl(ALM_DOCUMENTATION_PATHS[AlmKeys.Azure])}>
+ <Link to={docUrl}>
{translate(
'onboarding.tutorial.with.azure_pipelines.BranchAnalysis.branch_protection.link',
)}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
defaultMessage={translate('onboarding.tutorial.cfamilly.compilation_database_info')}
values={{
link: (
- <Link to={docUrl('/analyzing-source-code/languages/c-family/')}>
+ <Link to={docUrl(DocLink.CFamily)}>
{translate('onboarding.tutorial.cfamilly.compilation_database_info.link')}
</Link>
),
defaultMessage={translate('onboarding.tutorial.cfamilly.speed_caching')}
values={{
link: (
- <Link to={docUrl('/analyzing-source-code/languages/c-family/#analysis-cache')}>
+ <Link to={docUrl(DocLink.CFamilyAnalysisCache)}>
{translate('onboarding.tutorial.cfamilly.speed_caching.link')}
</Link>
),
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import classNames from 'classnames';
import { FlagMessage, Link } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
}
export default function ProjectTokenScopeInfo({ className }: ProjectTokenScopeInfoProps) {
- const docUrl = useDocUrl('/user-guide/user-account/generating-and-using-tokens/');
+ const docUrl = useDocUrl(DocLink.AccountTokens);
return (
<FlagMessage variant="info" className={classNames('sw-mt-2', className)}>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { NumberedListItem } from 'design-system';
import * as React from 'react';
+import { DocLink } from '../../../../helpers/doc-links';
import { translate } from '../../../../helpers/l10n';
import DocumentationLink from '../../../common/DocumentationLink';
-const MONOREPO_DOC =
- '/devops-platform-integration/github-integration/monorepo/#workflow-file-example';
-
export default function MonorepoDocLinkFallback() {
return (
<NumberedListItem>
- <DocumentationLink className="sw-mt-4" to={MONOREPO_DOC}>
+ <DocumentationLink className="sw-mt-4" to={DocLink.AlmGitHubMonorepoWorkfileExample}>
{translate('onboarding.tutorial.with.github_action.monorepo.see_yaml_instructions')}
</DocumentationLink>
</NumberedListItem>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { FlagMessage, Link, ListItem, TutorialStep, UnorderedList } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
import { AlmKeys } from '../../../types/alm-settings';
export default function PreRequisitesStep(props: PreRequisitesStepProps) {
const { alm, branchesEnabled } = props;
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.CIJenkins);
return (
<TutorialStep title={translate('onboarding.tutorial.with.jenkins.prereqs.title')}>
id="onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide"
values={{
link: (
- <Link to={docUrl('/analyzing-source-code/ci-integration/jenkins-integration/')}>
+ <Link to={docUrl}>
{translate('onboarding.tutorial.with.jenkins.prereqs.step_by_step_guide.link')}
</Link>
),
* 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 { animated, config, useSpring } from '@react-spring/web';
import { BasicSeparator, FlagVisual, Link } from 'design-system';
import * as React from 'react';
+import { DocLink } from '../../../helpers/doc-links';
import { useDocUrl } from '../../../helpers/docs';
import { translate } from '../../../helpers/l10n';
import useIntersectionObserver from '../../../hooks/useIntersectionObserver';
</span>
<ul className="sw-flex sw-flex-col sw-gap-2 sw-mt-2">
<li>
- <Link to={docUrl('/analyzing-source-code/branches/branch-analysis/')}>
+ <Link to={docUrl(DocLink.BranchAnalysis)}>
{translate(
'onboarding.analysis.auto_refresh_after_analysis.check_these_links.branches',
)}
</li>
<li>
- <Link to={docUrl('/analyzing-source-code/pull-request-analysis')}>
+ <Link to={docUrl(DocLink.PullRequestAnalysis)}>
{translate(
'onboarding.analysis.auto_refresh_after_analysis.check_these_links.pr_analysis',
)}
import { SingleValue } from 'react-select';
import DocHelpTooltip from '~sonar-aligned/components/controls/DocHelpTooltip';
import { generateToken, getTokens, revokeToken } from '../../../api/user-tokens';
+import { DocLink } from '../../../helpers/doc-links';
import { translate } from '../../../helpers/l10n';
import {
EXPIRATION_OPTIONS,
content={translate('onboarding.token.name.help')}
links={[
{
- href: '/user-guide/user-account/generating-and-using-tokens/',
+ href: DocLink.AccountTokens,
label: translate('learn_more'),
},
]}
content={translate('onboarding.token.use_existing_token.help')}
links={[
{
- href: '/user-guide/user-account/generating-and-using-tokens/',
+ href: DocLink.AccountTokens,
label: translate('learn_more'),
},
]}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { CodeSnippet, Link, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { Component } from '../../../../types/types';
}
export default function DotNetExecute({ commands, component }: DotNetExecuteProps) {
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.SonarScannerDotNet);
return (
<>
defaultMessage={translate('onboarding.analysis.docs')}
id="onboarding.analysis.docs"
values={{
- link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner-for-dotnet/')}>
- {translate('onboarding.analysis.msbuild.docs_link')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('onboarding.analysis.msbuild.docs_link')}</Link>,
}}
/>
</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 { Link, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { InlineSnippet } from '../../components/InlineSnippet';
export default function DotNetFramework(props: DotNetProps) {
const { baseUrl, component, token } = props;
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.SonarScannerDotNet);
const commands = [
`SonarScanner.MSBuild.exe begin /k:"${component.key}" /d:sonar.host.url="${baseUrl}" /d:sonar.token="${token}"`,
id="onboarding.analysis.msbuild.text"
values={{
code: <InlineSnippet snippet="%PATH%" />,
- link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner-for-dotnet/')}>
- {translate('onboarding.analysis.msbuild.docs_link')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('onboarding.analysis.msbuild.docs_link')}</Link>,
}}
/>
</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 {
ClipboardIconButton,
CodeSnippet,
} from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { InlineSnippet } from '../../components/InlineSnippet';
export default function DownloadScanner(props: DownloadScannerProps) {
const { os, isLocal, token } = props;
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.SonarScanner);
return (
<div className="sw-mb-4">
dir: <InlineSnippet snippet="bin" />,
env_var: <InlineSnippet snippet={os === OSs.Windows ? '%PATH%' : 'PATH'} />,
link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner/')}>
- {translate('onboarding.analysis.sq_scanner.docs_link')}
- </Link>
+ <Link to={docUrl}>{translate('onboarding.analysis.sq_scanner.docs_link')}</Link>
),
}}
/>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { CodeSnippet, Link, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { OSs } from '../../types';
export default function ExecBuildWrapper(props: ExecBuildWrapperProps) {
const { os } = props;
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.CFamily);
return (
<>
id="onboarding.analysis.build_wrapper.docs"
values={{
link: (
- <Link to={docUrl('/analyzing-source-code/languages/c-family/')}>
- {translate('onboarding.analysis.build_wrapper.docs_link')}
- </Link>
+ <Link to={docUrl}>{translate('onboarding.analysis.build_wrapper.docs_link')}</Link>
),
}}
/>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { CodeSnippet, Link, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { Component } from '../../../../types/types';
export default function ExecScanner(props: ExecScannerProps) {
const { baseUrl, os, isLocal, component, token, cfamily } = props;
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.SonarScanner);
const q = quote(os);
const command = [
defaultMessage={translate('onboarding.analysis.sq_scanner.docs')}
id="onboarding.analysis.sq_scanner.docs"
values={{
- link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner/')}>
- {translate('onboarding.analysis.sq_scanner.docs_link')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('onboarding.analysis.sq_scanner.docs_link')}</Link>,
}}
/>
</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 { CodeSnippet, Link, Note, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { GRADLE_SCANNER_VERSION } from '../../../../helpers/constants';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { Component } from '../../../../types/types';
export default function JavaGradle(props: JavaGradleProps) {
const { baseUrl, component, token } = props;
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.SonarScannerGradle);
const command = [
'./gradlew sonar',
defaultMessage={translate('onboarding.analysis.java.gradle.latest_version')}
id="onboarding.analysis.java.gradle.latest_version"
values={{
- link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner-for-gradle/')}>
- {translate('here')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('here')}</Link>,
}}
/>
</Note>
defaultMessage={translate('onboarding.analysis.docs')}
id="onboarding.analysis.docs"
values={{
- link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner-for-gradle/')}>
- {translate('onboarding.analysis.java.gradle.docs_link')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('onboarding.analysis.java.gradle.docs_link')}</Link>,
}}
/>
</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 { CodeSnippet, Link, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../../../helpers/doc-links';
import { useDocUrl } from '../../../../helpers/docs';
import { translate } from '../../../../helpers/l10n';
import { Component } from '../../../../types/types';
`-Dsonar.token=${token}`,
];
- const docUrl = useDocUrl();
+ const docUrl = useDocUrl(DocLink.SonarScannerMaven);
return (
<div>
defaultMessage={translate('onboarding.analysis.docs')}
id="onboarding.analysis.docs"
values={{
- link: (
- <Link to={docUrl('/analyzing-source-code/scanners/sonarscanner-for-maven/')}>
- {translate('onboarding.analysis.java.maven.docs_link')}
- </Link>
- ),
+ link: <Link to={docUrl}>{translate('onboarding.analysis.java.maven.docs_link')}</Link>,
}}
/>
</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 { DownloadButton, Link, SubHeading } from 'design-system';
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
+import { DocLink } from '../../helpers/doc-links';
import {
getEdition,
getEditionDownloadFilename,
{translateWithParameters('system.download_x', lastUpgrade.version)}
</DownloadButton>
- <DocumentationLink className="sw-ml-2" to="/setup-and-upgrade/upgrade-the-server/roadmap/">
+ <DocumentationLink className="sw-ml-2" to={DocLink.ServerUpgradeRoadmap}>
{translate('system.how_to_upgrade')}
</DocumentationLink>
</div>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { ComponentQualifier } from '~sonar-aligned/types/component';
import { MetricKey } from '~sonar-aligned/types/metrics';
import { colors } from '../app/theme';
export const PROJECT_KEY_MAX_LEN = 400;
-export const ALM_DOCUMENTATION_PATHS = {
- [AlmKeys.Azure]: '/devops-platform-integration/azure-devops-integration/',
- [AlmKeys.BitbucketServer]:
- '/devops-platform-integration/bitbucket-integration/bitbucket-server-integration/',
- [AlmKeys.BitbucketCloud]:
- '/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/',
- [AlmKeys.GitHub]: '/devops-platform-integration/github-integration/',
- [AlmKeys.GitLab]: '/devops-platform-integration/gitlab-integration/',
-};
-
export const IMPORT_COMPATIBLE_ALMS = [
AlmKeys.Azure,
AlmKeys.BitbucketServer,
--- /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 { AlmKeys } from '../types/alm-settings';
+
+export const DOC_URL = 'https://docs.sonarsource.com/sonarqube/latest';
+
+export enum DocLink {
+ AccountTokens = '/user-guide/user-account/generating-and-using-tokens/',
+ ActiveVersions = '/setup-and-upgrade/upgrade-the-server/active-versions/',
+ AlmAzureIntegration = '/devops-platform-integration/azure-devops-integration/',
+ AlmBitBucketCloudAuth = '/instance-administration/authentication/bitbucket-cloud/',
+ AlmBitBucketCloudIntegration = '/devops-platform-integration/bitbucket-integration/bitbucket-cloud-integration/',
+ AlmBitBucketCloudSettings = '/instance-administration/authentication/bitbucket-cloud/#setting-your-authentication-settings-in-sonarqube',
+ AlmBitBucketServerIntegration = '/devops-platform-integration/bitbucket-integration/bitbucket-server-integration/',
+ AlmGitHubAuth = '/instance-administration/authentication/github/',
+ AlmGitHubIntegration = '/devops-platform-integration/github-integration/',
+ AlmGitHubMonorepoWorkfileExample = '/devops-platform-integration/github-integration/monorepo/#workflow-file-example',
+ AlmGitLabAuth = '/instance-administration/authentication/gitlab/',
+ AlmGitLabAuthProvisioningMethod = '/instance-administration/authentication/gitlab/#choosing-the-provisioning-method',
+ AlmGitLabIntegration = '/devops-platform-integration/gitlab-integration/',
+ AlmSamlAuth = '/instance-administration/authentication/saml/overview/',
+ AlmSamlScimAuth = '/instance-administration/authentication/saml/scim/overview/',
+ AnalysisScope = '/project-administration/analysis-scope/',
+ AuthOverview = '/instance-administration/authentication/overview/',
+ BackgroundTasks = '/analyzing-source-code/background-tasks/',
+ BranchAnalysis = '/analyzing-source-code/branches/branch-analysis/',
+ CaYC = '/user-guide/clean-as-you-code/',
+ CFamily = '/analyzing-source-code/languages/c-family/',
+ CFamilyAnalysisCache = '/analyzing-source-code/languages/c-family/#analysis-cache',
+ CIAnalysisSetup = '/analyzing-source-code/ci-integration/overview/',
+ CIJenkins = '/analyzing-source-code/ci-integration/jenkins-integration/',
+ CleanCodeIntroduction = '/user-guide/clean-code/introduction/',
+ CodeAnalysis = '/user-guide/clean-code/code-analysis/',
+ InactiveBranches = '/analyzing-source-code/branches/branch-analysis/#inactive-branches',
+ InstanceAdminEncryption = '/instance-administration/security/#settings-encryption',
+ InstanceAdminLicense = '/instance-administration/license-administration/',
+ InstanceAdminLoC = '/instance-administration/monitoring/lines-of-code/',
+ InstanceAdminMarketplace = '/instance-administration/marketplace/',
+ InstanceAdminPluginVersionMatrix = '/instance-administration/plugin-version-matrix/',
+ InstanceAdminQualityProfiles = '/instance-administration/quality-profiles/',
+ InstanceAdminReindexation = '/instance-administration/reindexing/',
+ InstanceAdminSecurity = '/instance-administration/security/',
+ IssueResolutions = '/user-guide/issues/#resolutions-deprecated',
+ Issues = '/user-guide/issues',
+ IssueStatuses = '/user-guide/issues/#statuses',
+ MainBranchAnalysis = '/analyzing-source-code/branches/branch-analysis/#main-branch',
+ MetricDefinitions = '/user-guide/metric-definitions/',
+ Monorepos = '/project-administration/monorepos/',
+ NewCodeDefinition = '/project-administration/clean-as-you-code-settings/defining-new-code/',
+ NewCodeDefinitionOptions = '/project-administration/clean-as-you-code-settings/defining-new-code/#new-code-definition-options',
+ Portfolios = '/user-guide/portfolios/',
+ PullRequestAnalysis = '/analyzing-source-code/pull-request-analysis',
+ QualityGates = '/user-guide/quality-gates/',
+ Root = '/',
+ RulesOverview = '/user-guide/rules/overview',
+ SecurityHotspots = '/user-guide/security-hotspots/',
+ SecurityReports = '/user-guide/security-reports/',
+ ServerUpgradeRoadmap = '/setup-and-upgrade/upgrade-the-server/roadmap/',
+ SonarLintConnectedMode = '/user-guide/sonarlint-connected-mode/',
+ SonarScanner = '/analyzing-source-code/scanners/sonarscanner/',
+ SonarScannerDotNet = '/analyzing-source-code/scanners/sonarscanner-for-dotnet/',
+ SonarScannerGradle = '/analyzing-source-code/scanners/sonarscanner-for-gradle/',
+ SonarScannerMaven = '/analyzing-source-code/scanners/sonarscanner-for-maven/',
+ Webhooks = '/project-administration/webhooks/',
+}
+
+export const DocTitle = {
+ [DocLink.BackgroundTasks]: 'About Background Tasks',
+ [DocLink.CaYC]: 'Clean as You Code',
+ [DocLink.CIAnalysisSetup]: 'Set up CI analysis',
+ [DocLink.InstanceAdminQualityProfiles]: 'About Quality Profiles',
+ [DocLink.MetricDefinitions]: 'Metric Definitions',
+ [DocLink.NewCodeDefinition]: 'Defining New Code',
+ [DocLink.PullRequestAnalysis]: 'Analyzing Pull Requests',
+ [DocLink.SecurityReports]: 'About Security Reports',
+ [DocLink.SonarLintConnectedMode]: 'SonarLint Connected Mode',
+ [DocLink.Webhooks]: 'About Webhooks',
+};
+
+export type DocTitleKey = keyof typeof DocTitle;
+
+const asDocSections = <T>(element: { [K in keyof T]: DocTitleKey[] }) => element;
+
+export const DocSection = asDocSections({
+ component_measures: [DocLink.CaYC, DocLink.MetricDefinitions],
+ overview: [
+ DocLink.PullRequestAnalysis,
+ DocLink.CIAnalysisSetup,
+ DocLink.CaYC,
+ DocLink.SonarLintConnectedMode,
+ ],
+ pull_requests: [DocLink.CaYC, DocLink.PullRequestAnalysis, DocLink.SonarLintConnectedMode],
+});
+
+export type DocSectionKey = keyof typeof DocSection;
+
+export const AlmAuthDocLinkKeys = {
+ [AlmKeys.BitbucketServer]: DocLink.AlmBitBucketCloudAuth,
+ [AlmKeys.GitHub]: DocLink.AlmGitHubAuth,
+ [AlmKeys.GitLab]: DocLink.AlmGitLabAuth,
+ saml: DocLink.AlmSamlAuth,
+};
* 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';
import { AppStateContext } from '../app/components/app-state/AppStateContext';
+import { DocLink } from './doc-links';
-export function getUrlForDoc(url: string, version: string, to: string) {
- const isSnapshot = version.indexOf('SNAPSHOT') !== -1;
- const path = to.replace(/^\//, '');
+// This is only meant to be used directly for DocumentationRedirect. For all other uses,
+// please use useDocUrl instead (it forces the use of a catalogued documentation link)
+export function useUncataloguedDocUrl(to?: string) {
+ const { version, documentationUrl: docUrl } = React.useContext(AppStateContext);
- return isSnapshot
- ? `${url.replace(url.slice(url.lastIndexOf('/')), '/latest')}/${path}`
- : `${url}/${path}`;
-}
+ const formatDocUrl = React.useCallback(
+ (href: string) => {
+ const isSnapshot = version.indexOf('SNAPSHOT') !== -1;
-export function useDocUrl(to: string): string;
-export function useDocUrl(): (to: string) => string;
-export function useDocUrl(to?: string) {
- const { version, documentationUrl } = React.useContext(AppStateContext);
+ const path = href.replace(/^\//, '');
- if (to) {
- return getUrlForDoc(documentationUrl, version, to);
- }
+ return isSnapshot
+ ? `${docUrl.replace(docUrl.slice(docUrl.lastIndexOf('/')), '/latest')}/${path}`
+ : `${docUrl}/${path}`;
+ },
+ [docUrl, version],
+ );
+
+ return to ? formatDocUrl(to) : formatDocUrl;
+}
- return (to: string) => getUrlForDoc(documentationUrl, version, to);
+export function useDocUrl(to: DocLink): string;
+export function useDocUrl(): (to: DocLink) => string;
+export function useDocUrl(to?: DocLink) {
+ return useUncataloguedDocUrl(to);
}
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import classNames from 'classnames';
import { HelperHintIcon } from 'design-system';
import { first, last } from 'lodash';
import DocumentationLink from '../../../components/common/DocumentationLink';
import Link from '../../../components/common/Link';
import Tooltip, { Placement } from '../../../components/controls/Tooltip';
+import { DocLink } from '../../../helpers/doc-links';
import { KeyboardKeys } from '../../../helpers/keycodes';
import { translate } from '../../../helpers/l10n';
className?: string;
content?: React.ReactNode;
linkTextLabel?: string;
- links?: Array<{ href: string; label?: string; inPlace?: boolean; doc?: boolean }>;
+ links?: Array<
+ { label?: string; inPlace?: boolean } & (
+ | { doc?: true; href: DocLink }
+ | { doc: false; href: string }
+ )
+ >;
placement?: Placement;
title?: string;
}
<div className="sw-mb-1" key={label}>
{index === 0 && linkTextLabel && `${linkTextLabel}: `}
{doc ? (
- <DocumentationLink to={href} innerRef={(ref) => (linksRef.current[index] = ref)}>
+ <DocumentationLink
+ to={href as DocLink} // the map above messed up type inference
+ innerRef={(ref) => (linksRef.current[index] = ref)}
+ >
{label}
</DocumentationLink>
) : (
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import userEvent from '@testing-library/user-event';
import * as React from 'react';
import { byRole, byTestId } from '../../../helpers/testSelector';
import Link from '../../../../components/common/Link';
+import { DocLink } from '../../../../helpers/doc-links';
import { renderComponent } from '../../../../helpers/testReactTestingUtils';
import DocHelpTooltip, { DocHelpTooltipProps } from '../DocHelpTooltip';
helpIcon: byTestId('help-tooltip-activator'),
helpLink: byRole('link', { name: 'Icon' }),
linkInTooltip: byRole('link', { name: 'Label' }),
- linkInTooltip2: byRole('link', { name: 'Label2' }),
+ linkInTooltip2: byRole('link', { name: /^Label2\b/ }),
afterLink: byRole('link', { name: 'Interactive element after' }),
};
content="Tooltip content"
links={[
{
- href: '/user-guide/clean-as-you-code/',
- label: 'Label',
doc: false,
+ href: '/user-guide/clean-as-you-code2/',
+ label: 'Label',
},
{
- href: '/user-guide/clean-as-you-code2/',
- label: 'Label2',
doc: true,
+ href: DocLink.CaYC,
inPlace: true,
+ label: 'Label2',
},
]}
{...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 { ComponentBase, ComponentQualifier } from '~sonar-aligned/types/component';
import { RuleDescriptionSection } from '../apps/coding-rules/rule';
+import { DocTitleKey } from '../helpers/doc-links';
import {
CleanCodeAttribute,
CleanCodeAttributeCategory,
}
export interface SuggestionLink {
- link: string;
- scope?: 'sonarcloud';
+ link: DocTitleKey;
text: string;
}