From 5c53289c4b21a17b5e97eea39312fcdca050c03f Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Wed, 4 May 2022 17:22:54 +0200 Subject: [PATCH] SONAR-16206 Improve code sharing for security reports --- .../js/app/components/GlobalContainer.tsx | 6 +++--- .../app/components/ProjectAdminContainer.tsx | 2 +- .../__tests__/GlobalContainer-test.tsx | 2 +- .../components/extensions/exposeLibraries.ts | 4 ++-- .../app/components/nav/global/GlobalNav.tsx | 2 +- .../src/main/js/apps/account/Account.tsx | 4 ++-- .../components/AuditAppRenderer.tsx | 2 +- .../components/BackgroundTasksApp.tsx | 2 +- .../main/js/apps/code/components/CodeApp.tsx | 4 ++-- .../js/apps/coding-rules/components/App.tsx | 4 ++-- .../component-measures/components/App.tsx | 2 +- .../components/MeasureContent.tsx | 2 +- .../components/MeasureOverview.tsx | 2 +- .../component-measures/sidebar/Sidebar.tsx | 2 +- .../apps/create/project/CreateProjectPage.tsx | 2 +- .../js/apps/documentation/components/App.tsx | 2 +- .../main/js/apps/groups/components/App.tsx | 2 +- .../js/apps/issues/components/IssuesApp.tsx | 4 ++-- .../src/main/js/apps/marketplace/App.tsx | 2 +- .../branches/BranchOverviewRenderer.tsx | 2 +- .../main/js/apps/overview/components/App.tsx | 2 +- .../permission-templates/components/App.tsx | 2 +- .../permissions/global/components/App.tsx | 2 +- .../components/ProjectActivityApp.tsx | 4 ++-- .../apps/projectBaseline/components/App.tsx | 2 +- .../ProjectQualityGateAppRenderer.tsx | 4 ++-- .../ProjectQualityProfilesAppRenderer.tsx | 4 ++-- .../apps/projects/components/AllProjects.tsx | 4 ++-- .../ProjectManagementApp.tsx | 2 +- .../js/apps/quality-gates/components/App.tsx | 2 +- .../components/QualityProfilesApp.tsx | 2 +- .../SecurityHotspotsAppRenderer.tsx | 4 ++-- .../components/SettingsAppRenderer.tsx | 2 +- .../main/js/apps/system/components/App.tsx | 2 +- .../src/main/js/apps/users/UsersApp.tsx | 2 +- .../js/apps/web-api/components/WebApiApp.tsx | 4 ++-- .../main/js/apps/webhooks/components/App.tsx | 2 +- .../{app => }/components/a11y/A11yContext.tsx | 10 ++++++--- .../components/a11y/A11yProvider.tsx | 2 +- .../components/a11y/A11ySkipLinks.css | 0 .../components/a11y/A11ySkipLinks.tsx | 0 .../components/a11y/A11ySkipTarget.tsx | 4 ++-- .../a11y/__tests__/A11yProvider-test.tsx | 2 +- .../a11y/__tests__/A11ySkipLinks-test.tsx | 0 .../a11y/__tests__/A11ySkipTarget-test.tsx | 0 .../__snapshots__/A11ySkipLinks-test.tsx.snap | 0 .../A11ySkipTarget-test.tsx.snap | 0 .../embed-docs-modal/EmbedDocsPopup.tsx | 8 +++---- .../embed-docs-modal/EmbedDocsPopupHelper.tsx | 10 ++++----- .../embed-docs-modal/Suggestions.tsx | 0 .../embed-docs-modal/SuggestionsContext.ts | 10 ++++++--- .../embed-docs-modal/SuggestionsProvider.tsx | 9 ++++---- .../__tests__/EmbedDocsPopup-test.tsx | 0 .../__tests__/SuggestionsProvider-test.tsx | 21 ------------------- .../EmbedDocsPopup-test.tsx.snap | 0 55 files changed, 81 insertions(+), 95 deletions(-) rename server/sonar-web/src/main/js/{app => }/components/a11y/A11yContext.tsx (85%) rename server/sonar-web/src/main/js/{app => }/components/a11y/A11yProvider.tsx (97%) rename server/sonar-web/src/main/js/{app => }/components/a11y/A11ySkipLinks.css (100%) rename server/sonar-web/src/main/js/{app => }/components/a11y/A11ySkipLinks.tsx (100%) rename server/sonar-web/src/main/js/{app => }/components/a11y/A11ySkipTarget.tsx (95%) rename server/sonar-web/src/main/js/{app => }/components/a11y/__tests__/A11yProvider-test.tsx (97%) rename server/sonar-web/src/main/js/{app => }/components/a11y/__tests__/A11ySkipLinks-test.tsx (100%) rename server/sonar-web/src/main/js/{app => }/components/a11y/__tests__/A11ySkipTarget-test.tsx (100%) rename server/sonar-web/src/main/js/{app => }/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap (100%) rename server/sonar-web/src/main/js/{app => }/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap (100%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/EmbedDocsPopup.tsx (93%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/EmbedDocsPopupHelper.tsx (86%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/Suggestions.tsx (100%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/SuggestionsContext.ts (86%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/SuggestionsProvider.tsx (89%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx (100%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx (73%) rename server/sonar-web/src/main/js/{app => }/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap (100%) diff --git a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx index b02e8c98ebc..6bc280ca84f 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx @@ -18,11 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import A11yProvider from '../../components/a11y/A11yProvider'; +import A11ySkipLinks from '../../components/a11y/A11ySkipLinks'; +import SuggestionsProvider from '../../components/embed-docs-modal/SuggestionsProvider'; import Workspace from '../../components/workspace/Workspace'; -import A11yProvider from './a11y/A11yProvider'; -import A11ySkipLinks from './a11y/A11ySkipLinks'; import BranchStatusContextProvider from './branch-status/BranchStatusContextProvider'; -import SuggestionsProvider from './embed-docs-modal/SuggestionsProvider'; import GlobalFooter from './GlobalFooter'; import IndexationContextProvider from './indexation/IndexationContextProvider'; import IndexationNotification from './indexation/IndexationNotification'; diff --git a/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx b/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx index 6f150e21f8c..b806154db88 100644 --- a/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/ProjectAdminContainer.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; import { BranchLike } from '../../types/branch-like'; import { Component } from '../../types/types'; import handleRequiredAuthorization from '../utils/handleRequiredAuthorization'; -import A11ySkipTarget from './a11y/A11ySkipTarget'; interface Props { children: JSX.Element; diff --git a/server/sonar-web/src/main/js/app/components/__tests__/GlobalContainer-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/GlobalContainer-test.tsx index 6643512ad52..e094b6512df 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/GlobalContainer-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/GlobalContainer-test.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { mockLocation } from '../../../helpers/testMocks'; import GlobalContainer, { Props } from '../GlobalContainer'; -jest.mock('../embed-docs-modal/SuggestionsProvider', () => { +jest.mock('../../../components/embed-docs-modal/SuggestionsProvider', () => { class SuggestionsProvider extends React.Component { render() { return this.props.children; diff --git a/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts b/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts index b534527ce4f..98ee13683b4 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts +++ b/server/sonar-web/src/main/js/app/components/extensions/exposeLibraries.ts @@ -19,6 +19,7 @@ */ import { FormattedMessage } from 'react-intl'; import NotFound from '../../../app/components/NotFound'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import DonutChart from '../../../components/charts/DonutChart'; import ActionsDropdown, { ActionsDropdownItem } from '../../../components/controls/ActionsDropdown'; import BoxedTabs from '../../../components/controls/BoxedTabs'; @@ -45,6 +46,7 @@ import Select, { SearchSelect } from '../../../components/controls/Select'; import SelectList, { SelectListFilter } from '../../../components/controls/SelectList'; import SimpleModal from '../../../components/controls/SimpleModal'; import Tooltip from '../../../components/controls/Tooltip'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import AlertErrorIcon from '../../../components/icons/AlertErrorIcon'; import AlertSuccessIcon from '../../../components/icons/AlertSuccessIcon'; import AlertWarnIcon from '../../../components/icons/AlertWarnIcon'; @@ -118,8 +120,6 @@ import { getMeasureHistoryUrl, getRulesUrl } from '../../../helpers/urls'; -import A11ySkipTarget from '../a11y/A11ySkipTarget'; -import Suggestions from '../embed-docs-modal/Suggestions'; const exposeLibraries = () => { const global = window as any; diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx index 0c7b6d964cc..6dd85f5fde4 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNav.tsx @@ -18,11 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import EmbedDocsPopupHelper from '../../../../components/embed-docs-modal/EmbedDocsPopupHelper'; import NavBar from '../../../../components/ui/NavBar'; import { CurrentUser } from '../../../../types/users'; import { rawSizes } from '../../../theme'; import withCurrentUserContext from '../../current-user/withCurrentUserContext'; -import EmbedDocsPopupHelper from '../../embed-docs-modal/EmbedDocsPopupHelper'; import Search from '../../search/Search'; import './GlobalNav.css'; import GlobalNavBranding from './GlobalNavBranding'; diff --git a/server/sonar-web/src/main/js/apps/account/Account.tsx b/server/sonar-web/src/main/js/apps/account/Account.tsx index 32a51188466..1a7b5fcd4eb 100644 --- a/server/sonar-web/src/main/js/apps/account/Account.tsx +++ b/server/sonar-web/src/main/js/apps/account/Account.tsx @@ -19,9 +19,9 @@ */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import A11ySkipTarget from '../../app/components/a11y/A11ySkipTarget'; import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import handleRequiredAuthentication from '../../helpers/handleRequiredAuthentication'; import { translate } from '../../helpers/l10n'; import { CurrentUser, LoggedInUser } from '../../types/users'; diff --git a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx index a89dbc8b53c..c8f087b80c3 100644 --- a/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/audit-logs/components/AuditAppRenderer.tsx @@ -22,9 +22,9 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import DateRangeInput from '../../../components/controls/DateRangeInput'; import Radio from '../../../components/controls/Radio'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; import '../style.css'; import { HousekeepingPolicy, now, RangeOption } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx index f70fdc81ecf..82bc95ab111 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.tsx @@ -27,7 +27,7 @@ import { getStatus, getTypes } from '../../../api/ce'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { Location, Router } from '../../../components/hoc/withRouter'; import { toShortNotSoISOString } from '../../../helpers/dates'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx b/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx index c6e55679357..69481261394 100644 --- a/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/CodeApp.tsx @@ -25,12 +25,12 @@ import { debounce, intersection } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { InjectedRouter } from 'react-router'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import withBranchStatusActions from '../../../app/components/branch-status/withBranchStatusActions'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import withMetricsContext from '../../../app/components/metrics/withMetricsContext'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import ListFooter from '../../../components/controls/ListFooter'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { Alert } from '../../../components/ui/Alert'; import { isPullRequest, isSameBranchLike } from '../../../helpers/branch-like'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx index 5c62cdb4463..5e052bab42c 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx @@ -23,13 +23,13 @@ import { Helmet } from 'react-helmet-async'; import { withRouter, WithRouterProps } from 'react-router'; import { Profile, searchQualityProfiles } from '../../../api/quality-profiles'; import { getRulesApp, searchRules } from '../../../api/rules'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import FiltersHeader from '../../../components/common/FiltersHeader'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; import ListFooter from '../../../components/controls/ListFooter'; import SearchBox from '../../../components/controls/SearchBox'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import BackIcon from '../../../components/icons/BackIcon'; import '../../../components/search-navigator.css'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx index 422ef0a65ef..c44ff041d5f 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/App.tsx @@ -26,9 +26,9 @@ import { withRouter, WithRouterProps } from 'react-router'; import { getMeasuresWithPeriod } from '../../../api/measures'; import { getAllMetrics } from '../../../api/metrics'; import withBranchStatusActions from '../../../app/components/branch-status/withBranchStatusActions'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; import HelpTooltip from '../../../components/controls/HelpTooltip'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { enhanceMeasure } from '../../../components/measure/utils'; import '../../../components/search-navigator.css'; import { Alert } from '../../../components/ui/Alert'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx index de90a337509..37abf52ec71 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx @@ -21,7 +21,7 @@ import * as React from 'react'; import { InjectedRouter } from 'react-router'; import { getComponentTree } from '../../../api/components'; import { getMeasures } from '../../../api/measures'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import SourceViewer from '../../../components/SourceViewer/SourceViewer'; import PageActions from '../../../components/ui/PageActions'; import { getBranchLikeQuery, isSameBranchLike } from '../../../helpers/branch-like'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx index 466423cc0ad..8d04180dc07 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureOverview.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { getComponentLeaves } from '../../../api/components'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import SourceViewer from '../../../components/SourceViewer/SourceViewer'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import PageActions from '../../../components/ui/PageActions'; diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx index 0fa48324dc7..ce346568958 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/Sidebar.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import { translate } from '../../../helpers/l10n'; import { Dict, MeasureEnhanced } from '../../../types/types'; import { groupByDomains, KNOWN_DOMAINS, PROJECT_OVERVEW, Query } from '../utils'; diff --git a/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx b/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx index c7e1c62d258..1c793becabc 100644 --- a/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx @@ -21,8 +21,8 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { WithRouterProps } from 'react-router'; import { getAlmSettings } from '../../../api/alm-settings'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import withAppStateContext from '../../../app/components/app-state/withAppStateContext'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import { translate } from '../../../helpers/l10n'; import { getProjectUrl } from '../../../helpers/urls'; import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings'; diff --git a/server/sonar-web/src/main/js/apps/documentation/components/App.tsx b/server/sonar-web/src/main/js/apps/documentation/components/App.tsx index 9c840260421..a594ce38dec 100644 --- a/server/sonar-web/src/main/js/apps/documentation/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/documentation/components/App.tsx @@ -24,8 +24,8 @@ import { Helmet } from 'react-helmet-async'; import { Link } from 'react-router'; import { getInstalledPlugins } from '../../../api/plugins'; import { getPluginStaticFileContent } from '../../../api/static'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import NotFound from '../../../app/components/NotFound'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; import DocMarkdownBlock from '../../../components/docs/DocMarkdownBlock'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/groups/components/App.tsx b/server/sonar-web/src/main/js/apps/groups/components/App.tsx index 31cf74682af..ac751d235a8 100644 --- a/server/sonar-web/src/main/js/apps/groups/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/groups/components/App.tsx @@ -20,9 +20,9 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { createGroup, deleteGroup, searchUsersGroups, updateGroup } from '../../../api/user_groups'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import ListFooter from '../../../components/controls/ListFooter'; import SearchBox from '../../../components/controls/SearchBox'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; import { omitNil } from '../../../helpers/request'; import { Group, Paging } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx index 543bf234d68..cf030276b8a 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesApp.tsx @@ -23,8 +23,7 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; import { searchIssues } from '../../../api/issues'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import EmptySearch from '../../../components/common/EmptySearch'; import FiltersHeader from '../../../components/common/FiltersHeader'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; @@ -32,6 +31,7 @@ import { Button } from '../../../components/controls/buttons'; import Checkbox from '../../../components/controls/Checkbox'; import HelpTooltip from '../../../components/controls/HelpTooltip'; import ListFooter from '../../../components/controls/ListFooter'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { Location, Router } from '../../../components/hoc/withRouter'; import '../../../components/search-navigator.css'; import { Alert } from '../../../components/ui/Alert'; diff --git a/server/sonar-web/src/main/js/apps/marketplace/App.tsx b/server/sonar-web/src/main/js/apps/marketplace/App.tsx index d7f470d2cfd..65076bc8a40 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx @@ -29,7 +29,7 @@ import { getPluginUpdates } from '../../api/plugins'; import { getValues, setSimpleSettingValue } from '../../api/settings'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { Location, Router, withRouter } from '../../components/hoc/withRouter'; import { Alert } from '../../components/ui/Alert'; import DeferredSpinner from '../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx index a041e1f7cf5..e55f0fd8b7b 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import { parseDate } from '../../../helpers/dates'; import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; import { ApplicationPeriod } from '../../../types/application'; diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.tsx b/server/sonar-web/src/main/js/apps/overview/components/App.tsx index 192ecf0eaa5..91c19c67eb3 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/App.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import withAppStateContext from '../../../app/components/app-state/withAppStateContext'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { lazyLoadComponent } from '../../../components/lazyLoadComponent'; import { isPullRequest } from '../../../helpers/branch-like'; import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx index 178579337eb..7e16f3c2522 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/App.tsx @@ -22,7 +22,7 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { getPermissionTemplates } from '../../../api/permissions'; import withAppStateContext from '../../../app/components/app-state/withAppStateContext'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; import { AppState } from '../../../types/appstate'; import { Permission, PermissionTemplate } from '../../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx index 60d89d36cb0..127c324562a 100644 --- a/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/permissions/global/components/App.tsx @@ -21,7 +21,7 @@ import { without } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import * as api from '../../../../api/permissions'; -import Suggestions from '../../../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../../helpers/l10n'; import { Paging, PermissionGroup, PermissionUser } from '../../../../types/types'; import '../../styles.css'; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx index cfa8707d466..b1fa4fa47ad 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { parseDate } from '../../../helpers/dates'; import { translate } from '../../../helpers/l10n'; import { MeasureHistory } from '../../../types/project-activity'; diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx b/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx index 4c123c72f03..5e28f80a41d 100644 --- a/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectBaseline/components/App.tsx @@ -22,7 +22,7 @@ import { debounce } from 'lodash'; import * as React from 'react'; import { getNewCodePeriod, resetNewCodePeriod, setNewCodePeriod } from '../../../api/newCodePeriod'; import withAppStateContext from '../../../app/components/app-state/withAppStateContext'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import AlertSuccessIcon from '../../../components/icons/AlertSuccessIcon'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { isBranch, sortBranches } from '../../../helpers/branch-like'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx index d765f530a84..9c211b81b73 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityGate/ProjectQualityGateAppRenderer.tsx @@ -22,13 +22,13 @@ import { Helmet } from 'react-helmet-async'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router'; import { components, OptionProps } from 'react-select'; -import A11ySkipTarget from '../../app/components/a11y/A11ySkipTarget'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; import DisableableSelectOption from '../../components/common/DisableableSelectOption'; import { SubmitButton } from '../../components/controls/buttons'; import HelpTooltip from '../../components/controls/HelpTooltip'; import Radio from '../../components/controls/Radio'; import Select, { BasicSelectOption } from '../../components/controls/Select'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { Alert } from '../../components/ui/Alert'; import { translate } from '../../helpers/l10n'; import { isDiffMetric } from '../../helpers/measures'; diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx index 0d61bf57fcb..28445dfe0e3 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProjectQualityProfilesAppRenderer.tsx @@ -22,10 +22,10 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { Link } from 'react-router'; import { Profile } from '../../api/quality-profiles'; -import A11ySkipTarget from '../../app/components/a11y/A11ySkipTarget'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; import { Button } from '../../components/controls/buttons'; import HelpTooltip from '../../components/controls/HelpTooltip'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import EditIcon from '../../components/icons/EditIcon'; import PlusCircleIcon from '../../components/icons/PlusCircleIcon'; import { translate } from '../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx index 202a721c916..a60da0bc7b4 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx @@ -20,12 +20,12 @@ import { omitBy } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; import withAppStateContext from '../../../app/components/app-state/withAppStateContext'; import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; import ListFooter from '../../../components/controls/ListFooter'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; import '../../../components/search-navigator.css'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx index 3f489112b8b..020448c3f73 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectManagementApp.tsx @@ -24,8 +24,8 @@ import { getComponents, Project } from '../../api/components'; import { changeProjectDefaultVisibility } from '../../api/permissions'; import { getValues } from '../../api/settings'; import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; import ListFooter from '../../components/controls/ListFooter'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { toShortNotSoISOString } from '../../helpers/dates'; import { translate } from '../../helpers/l10n'; import { hasGlobalPermission } from '../../helpers/users'; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx index 06b96e5814d..c7cb7fcc3fb 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/App.tsx @@ -21,8 +21,8 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { WithRouterProps } from 'react-router'; import { fetchQualityGates } from '../../../api/quality-gates'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import '../../../components/search-navigator.css'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; import { translate } from '../../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx index a5f66e43e18..7be27e7b99c 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/QualityProfilesApp.tsx @@ -20,8 +20,8 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { Actions, getExporters, searchQualityProfiles } from '../../../api/quality-profiles'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import withLanguagesContext from '../../../app/components/languages/withLanguagesContext'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; import { Languages } from '../../../types/languages'; import '../styles.css'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx index efdbc427ba0..f09495eb815 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/SecurityHotspotsAppRenderer.tsx @@ -19,9 +19,9 @@ */ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import A11ySkipTarget from '../../app/components/a11y/A11ySkipTarget'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../components/a11y/A11ySkipTarget'; import ScreenPositionHelper from '../../components/common/ScreenPositionHelper'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import DeferredSpinner from '../../components/ui/DeferredSpinner'; import { isBranch } from '../../helpers/branch-like'; import { translate } from '../../helpers/l10n'; diff --git a/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx index 9008a85bf37..4d5a07307e0 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/SettingsAppRenderer.tsx @@ -20,8 +20,8 @@ import { uniqBy } from 'lodash'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { Location, withRouter } from '../../../components/hoc/withRouter'; import { translate } from '../../../helpers/l10n'; import { ExtendedSettingDefinition } from '../../../types/settings'; diff --git a/server/sonar-web/src/main/js/apps/system/components/App.tsx b/server/sonar-web/src/main/js/apps/system/components/App.tsx index f4a319102d4..9beb5cee6c6 100644 --- a/server/sonar-web/src/main/js/apps/system/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/App.tsx @@ -21,8 +21,8 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { withRouter, WithRouterProps } from 'react-router'; import { getSystemInfo } from '../../../api/system'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; 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'; diff --git a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx index 5ddcdda1afe..e788902f316 100644 --- a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx +++ b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx @@ -21,8 +21,8 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { getIdentityProviders, searchUsers } from '../../api/users'; import withCurrentUserContext from '../../app/components/current-user/withCurrentUserContext'; -import Suggestions from '../../app/components/embed-docs-modal/Suggestions'; import ListFooter from '../../components/controls/ListFooter'; +import Suggestions from '../../components/embed-docs-modal/Suggestions'; import { Location, Router, withRouter } from '../../components/hoc/withRouter'; import { translate } from '../../helpers/l10n'; import { IdentityProvider, Paging } from '../../types/types'; diff --git a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx index 6ddb808e86d..c295e6438c2 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/WebApiApp.tsx @@ -22,9 +22,9 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { Link, withRouter, WithRouterProps } from 'react-router'; import { fetchWebApi } from '../../../api/web-api'; -import A11ySkipTarget from '../../../app/components/a11y/A11ySkipTarget'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import A11ySkipTarget from '../../../components/a11y/A11ySkipTarget'; import ScreenPositionHelper from '../../../components/common/ScreenPositionHelper'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; import { addSideBarClass, removeSideBarClass } from '../../../helpers/pages'; import { scrollToElement } from '../../../helpers/scrolling'; diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx index 7e057bf0cbc..d2875d66824 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/webhooks/components/App.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { createWebhook, deleteWebhook, searchWebhooks, updateWebhook } from '../../../api/webhooks'; -import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; +import Suggestions from '../../../components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; import { LightComponent, Webhook } from '../../../types/types'; import PageActions from './PageActions'; diff --git a/server/sonar-web/src/main/js/app/components/a11y/A11yContext.tsx b/server/sonar-web/src/main/js/components/a11y/A11yContext.tsx similarity index 85% rename from server/sonar-web/src/main/js/app/components/a11y/A11yContext.tsx rename to server/sonar-web/src/main/js/components/a11y/A11yContext.tsx index 345b9caeb3c..3bf2444f4e0 100644 --- a/server/sonar-web/src/main/js/app/components/a11y/A11yContext.tsx +++ b/server/sonar-web/src/main/js/components/a11y/A11yContext.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { createContext } from 'react'; -import { A11ySkipLink } from '../../../types/types'; +import { A11ySkipLink } from '../../types/types'; export interface A11yContextShape { addA11ySkipLink: (link: A11ySkipLink) => void; @@ -27,7 +27,11 @@ export interface A11yContextShape { } export const A11yContext = createContext({ - addA11ySkipLink: () => {}, - removeA11ySkipLink: () => {}, + addA11ySkipLink: () => { + /* Implemented by Provider */ + }, + removeA11ySkipLink: () => { + /* Implemented by Provider */ + }, links: [] }); diff --git a/server/sonar-web/src/main/js/app/components/a11y/A11yProvider.tsx b/server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx similarity index 97% rename from server/sonar-web/src/main/js/app/components/a11y/A11yProvider.tsx rename to server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx index 59906929985..f515d9f15f7 100644 --- a/server/sonar-web/src/main/js/app/components/a11y/A11yProvider.tsx +++ b/server/sonar-web/src/main/js/components/a11y/A11yProvider.tsx @@ -19,7 +19,7 @@ */ import { sortBy } from 'lodash'; import * as React from 'react'; -import { A11ySkipLink } from '../../../types/types'; +import { A11ySkipLink } from '../../types/types'; import { A11yContext } from './A11yContext'; interface State { diff --git a/server/sonar-web/src/main/js/app/components/a11y/A11ySkipLinks.css b/server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.css similarity index 100% rename from server/sonar-web/src/main/js/app/components/a11y/A11ySkipLinks.css rename to server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.css diff --git a/server/sonar-web/src/main/js/app/components/a11y/A11ySkipLinks.tsx b/server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx similarity index 100% rename from server/sonar-web/src/main/js/app/components/a11y/A11ySkipLinks.tsx rename to server/sonar-web/src/main/js/components/a11y/A11ySkipLinks.tsx diff --git a/server/sonar-web/src/main/js/app/components/a11y/A11ySkipTarget.tsx b/server/sonar-web/src/main/js/components/a11y/A11ySkipTarget.tsx similarity index 95% rename from server/sonar-web/src/main/js/app/components/a11y/A11ySkipTarget.tsx rename to server/sonar-web/src/main/js/components/a11y/A11ySkipTarget.tsx index 3cd3b14949b..59f56c9eb24 100644 --- a/server/sonar-web/src/main/js/app/components/a11y/A11ySkipTarget.tsx +++ b/server/sonar-web/src/main/js/components/a11y/A11ySkipTarget.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { translate } from '../../../helpers/l10n'; -import { A11ySkipLink } from '../../../types/types'; +import { translate } from '../../helpers/l10n'; +import { A11ySkipLink } from '../../types/types'; import { A11yContext } from './A11yContext'; interface Props { diff --git a/server/sonar-web/src/main/js/app/components/a11y/__tests__/A11yProvider-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx similarity index 97% rename from server/sonar-web/src/main/js/app/components/a11y/__tests__/A11yProvider-test.tsx rename to server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx index 70a6dc437f6..5f4041d1ce3 100644 --- a/server/sonar-web/src/main/js/app/components/a11y/__tests__/A11yProvider-test.tsx +++ b/server/sonar-web/src/main/js/components/a11y/__tests__/A11yProvider-test.tsx @@ -19,7 +19,7 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { waitAndUpdate } from '../../../../helpers/testUtils'; +import { waitAndUpdate } from '../../../helpers/testUtils'; import { A11yContextShape } from '../A11yContext'; import A11yProvider from '../A11yProvider'; diff --git a/server/sonar-web/src/main/js/app/components/a11y/__tests__/A11ySkipLinks-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx similarity index 100% rename from server/sonar-web/src/main/js/app/components/a11y/__tests__/A11ySkipLinks-test.tsx rename to server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipLinks-test.tsx diff --git a/server/sonar-web/src/main/js/app/components/a11y/__tests__/A11ySkipTarget-test.tsx b/server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx similarity index 100% rename from server/sonar-web/src/main/js/app/components/a11y/__tests__/A11ySkipTarget-test.tsx rename to server/sonar-web/src/main/js/components/a11y/__tests__/A11ySkipTarget-test.tsx diff --git a/server/sonar-web/src/main/js/app/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap b/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/app/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap rename to server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipLinks-test.tsx.snap diff --git a/server/sonar-web/src/main/js/app/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap b/server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/app/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap rename to server/sonar-web/src/main/js/components/a11y/__tests__/__snapshots__/A11ySkipTarget-test.tsx.snap diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx similarity index 93% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx rename to server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx index 1a2b64ac260..0f8d1db103c 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopup.tsx @@ -19,10 +19,10 @@ */ import * as React from 'react'; import { Link } from 'react-router'; -import { DropdownOverlay } from '../../../components/controls/Dropdown'; -import { translate } from '../../../helpers/l10n'; -import { getBaseUrl } from '../../../helpers/system'; -import { SuggestionLink } from '../../../types/types'; +import { translate } from '../../helpers/l10n'; +import { getBaseUrl } from '../../helpers/system'; +import { SuggestionLink } from '../../types/types'; +import { DropdownOverlay } from '../controls/Dropdown'; import { SuggestionsContext } from './SuggestionsContext'; interface Props { diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopupHelper.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx similarity index 86% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopupHelper.tsx rename to server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx index e0249a6e9f1..f34140b5172 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopupHelper.tsx +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/EmbedDocsPopupHelper.tsx @@ -18,11 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { ButtonLink } from '../../../components/controls/buttons'; -import Toggler from '../../../components/controls/Toggler'; -import HelpIcon from '../../../components/icons/HelpIcon'; -import { lazyLoadComponent } from '../../../components/lazyLoadComponent'; -import { translate } from '../../../helpers/l10n'; +import { translate } from '../../helpers/l10n'; +import { ButtonLink } from '../controls/buttons'; +import Toggler from '../controls/Toggler'; +import HelpIcon from '../icons/HelpIcon'; +import { lazyLoadComponent } from '../lazyLoadComponent'; const EmbedDocsPopup = lazyLoadComponent(() => import('./EmbedDocsPopup')); diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/Suggestions.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/Suggestions.tsx similarity index 100% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/Suggestions.tsx rename to server/sonar-web/src/main/js/components/embed-docs-modal/Suggestions.tsx diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsContext.ts b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts similarity index 86% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsContext.ts rename to server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts index fcb5c85561b..e389713676b 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsContext.ts +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsContext.ts @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { createContext } from 'react'; -import { SuggestionLink } from '../../../types/types'; +import { SuggestionLink } from '../../types/types'; interface SuggestionsContextShape { addSuggestions: (key: string) => void; @@ -27,7 +27,11 @@ interface SuggestionsContextShape { } export const SuggestionsContext = createContext({ - addSuggestions: () => {}, - removeSuggestions: () => {}, + addSuggestions: () => { + /* Implemented by Provider */ + }, + removeSuggestions: () => { + /* Implemented by Provider */ + }, suggestions: [] }); diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx similarity index 89% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx rename to server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx index ffc6788ab0c..89481d2ab81 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/SuggestionsProvider.tsx @@ -19,8 +19,7 @@ */ import suggestionsJson from 'Docs/EmbedDocsSuggestions.json'; import * as React from 'react'; -import { isSonarCloud } from '../../../helpers/system'; -import { Dict, SuggestionLink } from '../../../types/types'; +import { Dict, SuggestionLink } from '../../types/types'; import { SuggestionsContext } from './SuggestionsContext'; type SuggestionsJson = Dict; @@ -41,9 +40,9 @@ export default class SuggestionsProvider extends React.Component<{}, State> { suggestions = [...jsonList[key], ...suggestions]; } }); - if (!isSonarCloud()) { - suggestions = suggestions.filter(suggestion => suggestion.scope !== 'sonarcloud'); - } + + suggestions = suggestions.filter(suggestion => suggestion.scope !== 'sonarcloud'); + this.setState({ suggestions }); }; diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx similarity index 100% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx rename to server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/EmbedDocsPopup-test.tsx diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx similarity index 73% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx rename to server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx index 194ee3d19d9..4cff54080c4 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx +++ b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx @@ -19,7 +19,6 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { isSonarCloud } from '../../../../helpers/system'; import SuggestionsProvider from '../SuggestionsProvider'; jest.mock( @@ -34,10 +33,7 @@ jest.mock( { virtual: true } ); -jest.mock('../../../../helpers/system', () => ({ isSonarCloud: jest.fn() })); - it('should add & remove suggestions', () => { - (isSonarCloud as jest.Mock).mockReturnValue(false); const wrapper = shallow(
@@ -58,20 +54,3 @@ it('should add & remove suggestions', () => { instance.removeSuggestions('pageA'); expect(wrapper.state('suggestions')).toEqual([{ link: '/qux', text: 'Qux' }]); }); - -it('should show sonarcloud pages', () => { - (isSonarCloud as jest.Mock).mockReturnValue(true); - const wrapper = shallow( - -
- - ); - const instance = wrapper.instance(); - expect(wrapper.state('suggestions')).toEqual([]); - - instance.addSuggestions('pageA'); - expect(wrapper.state('suggestions')).toEqual([ - { link: '/foo', text: 'Foo' }, - { link: '/bar', text: 'Bar', scope: 'sonarcloud' } - ]); -}); diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap b/server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap rename to server/sonar-web/src/main/js/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap -- 2.39.5