diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2019-07-11 15:15:35 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-07-11 20:21:09 +0200 |
commit | 60226e8e297485bcbe384dc766930da0a5a1c079 (patch) | |
tree | 84140c9f6d8d0828dbe4db676f8a06a5d6b4b077 /server/sonar-web/src/main/js/apps/marketplace | |
parent | 7ae6f6f0968febebf763cf073b09cb6dd2b218d7 (diff) | |
download | sonarqube-60226e8e297485bcbe384dc766930da0a5a1c079.tar.gz sonarqube-60226e8e297485bcbe384dc766930da0a5a1c079.zip |
SC-704 Extract components into sonar-ui-common (#1714)
* SC-704 Extract icons components to sonar-ui-common
* Better typings for theme
* Use sonar-ui-common in extensions
* Extract some helpers
* Extract l10n helper to sonar-ui-common
* Extract requests helper to sonar-ui-common
* Extract part of urls helper
* Move buttons, Tooltips and ScreenPositionFixers
* Move modal related components
* Move IdentityProviderLink
* Move GenericAvatar
* Move SizeRating
* Move charts and move deps to peerDeps
* Move nav
* Move formatMeasure
* Move Rating
* Move PageActions
* Move the rest of ui components
* Move more controls components
* Include theme inside extension build
* Add missing theme context provider in extensions
* Update react to same version everywhere
* Update sonar-ui-common
* Update eslint configuration
Diffstat (limited to 'server/sonar-web/src/main/js/apps/marketplace')
22 files changed, 40 insertions, 41 deletions
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 074eaa247a9..78aea8ccad8 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx @@ -20,6 +20,7 @@ import * as React from 'react'; import { sortBy, uniqBy } from 'lodash'; import Helmet from 'react-helmet'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import Header from './Header'; import EditionBoxes from './EditionBoxes'; import Footer from './Footer'; @@ -35,7 +36,6 @@ import { PluginPendingResult, getInstalledPlugins } from '../../api/plugins'; -import { translate } from '../../helpers/l10n'; import { withRouter, Location, Router } from '../../components/hoc/withRouter'; import './style.css'; diff --git a/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx b/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx index 6092a120d3f..df33131b6ae 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/AppContainer.tsx @@ -21,11 +21,10 @@ import * as React from 'react'; import { connect } from 'react-redux'; import App from './App'; import { getAppState, getGlobalSettingValue, Store } from '../../store/rootReducer'; -import { RawQuery } from '../../helpers/query'; import AdminContext from '../../app/components/AdminContext'; interface OwnProps { - location: { pathname: string; query: RawQuery }; + location: { pathname: string; query: T.RawQuery }; } interface StateToProps { diff --git a/server/sonar-web/src/main/js/apps/marketplace/Footer.tsx b/server/sonar-web/src/main/js/apps/marketplace/Footer.tsx index 81ae623a449..fa6d6fc1528 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/Footer.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/Footer.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { translateWithParameters } from '../../helpers/l10n'; +import { translateWithParameters } from 'sonar-ui-common/helpers/l10n'; interface Props { total: number; diff --git a/server/sonar-web/src/main/js/apps/marketplace/Header.tsx b/server/sonar-web/src/main/js/apps/marketplace/Header.tsx index acae838b2b3..5eb40c31d9d 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/Header.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/Header.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { translate } from '../../helpers/l10n'; +import { translate } from 'sonar-ui-common/helpers/l10n'; interface Props { currentEdition?: T.EditionKey; diff --git a/server/sonar-web/src/main/js/apps/marketplace/Search.tsx b/server/sonar-web/src/main/js/apps/marketplace/Search.tsx index 38bbc98b8f4..2d7a885cdfc 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/Search.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/Search.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import SearchBox from 'sonar-ui-common/components/controls/SearchBox'; +import RadioToggle from 'sonar-ui-common/components/controls/RadioToggle'; import { Query } from './utils'; -import RadioToggle from '../../components/controls/RadioToggle'; -import SearchBox from '../../components/controls/SearchBox'; -import { translate } from '../../helpers/l10n'; interface Props { query: Query; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx index 89fd4d47cf9..bf90ce5a917 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/EditionBox.tsx @@ -21,9 +21,9 @@ import * as React from 'react'; import tooltipDCE from 'Docs/tooltips/editions/datacenter.md'; import tooltipDE from 'Docs/tooltips/editions/developer.md'; import tooltipEE from 'Docs/tooltips/editions/enterprise.md'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; import { Edition, getEditionUrl } from '../utils'; -import { translate } from '../../../helpers/l10n'; -import { lazyLoad } from '../../../components/lazyLoad'; const DocMarkdownBlock = lazyLoad(() => import('../../../components/docs/DocMarkdownBlock')); diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx index 72a935bf5b1..d01fb6af074 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/LicensePromptModal.tsx @@ -20,9 +20,9 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router'; -import Modal from '../../../components/controls/Modal'; -import { translate } from '../../../helpers/l10n'; -import { ResetButtonLink } from '../../../components/ui/buttons'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import { ResetButtonLink } from 'sonar-ui-common/components/controls/buttons'; +import Modal from 'sonar-ui-common/components/controls/Modal'; interface Props { onClose: () => void; @@ -38,7 +38,7 @@ export default function LicensePromptModal({ onClose }: Props) { <div className="modal-body"> <FormattedMessage defaultMessage={translate('license.prompt.description')} - id={'license.prompt.description'} + id="license.prompt.description" values={{ url: ( <Link onClick={onClose} to="/admin/extension/license/app"> diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx index 996d73d4931..5ed93ff0ac5 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx @@ -18,13 +18,13 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import CheckIcon from 'sonar-ui-common/components/icons/CheckIcon'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import { Button } from 'sonar-ui-common/components/controls/buttons'; +import Checkbox from 'sonar-ui-common/components/controls/Checkbox'; import PluginUpdateButton from './PluginUpdateButton'; import { isPluginAvailable, isPluginInstalled } from '../utils'; import { Plugin, installPlugin, updatePlugin, uninstallPlugin } from '../../../api/plugins'; -import Checkbox from '../../../components/controls/Checkbox'; -import CheckIcon from '../../../components/icons-components/CheckIcon'; -import { Button } from '../../../components/ui/buttons'; -import { translate } from '../../../helpers/l10n'; interface Props { plugin: Plugin; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx index e5fe1325d37..f14283e3ff0 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import PluginChangeLogButton from './PluginChangeLogButton'; import PluginDescription from './PluginDescription'; import PluginLicense from './PluginLicense'; @@ -25,7 +26,6 @@ import PluginOrganization from './PluginOrganization'; import PluginStatus from './PluginStatus'; import PluginUrls from './PluginUrls'; import { PluginAvailable as IPluginAvailable } from '../../../api/plugins'; -import { translateWithParameters } from '../../../helpers/l10n'; interface Props { plugin: IPluginAvailable; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx index 827b17aad26..db5c5e47995 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLog.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import PluginChangeLogItem from './PluginChangeLogItem'; import { Release, Update } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; export interface Props { release: Release; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx index 30d184d481f..76149ba2f36 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogButton.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import EllipsisIcon from 'sonar-ui-common/components/icons/EllipsisIcon'; +import { ButtonLink } from 'sonar-ui-common/components/controls/buttons'; +import Dropdown from 'sonar-ui-common/components/controls/Dropdown'; import PluginChangeLog from './PluginChangeLog'; -import Dropdown from '../../../components/controls/Dropdown'; -import EllipsisIcon from '../../../components/icons-components/EllipsisIcon'; -import { ButtonLink } from '../../../components/ui/buttons'; import { Release, Update } from '../../../api/plugins'; interface Props { diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx index a848c47f2d2..63be648be04 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginChangeLogItem.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import Tooltip from 'sonar-ui-common/components/controls/Tooltip'; import DateFormatter from '../../../components/intl/DateFormatter'; -import Tooltip from '../../../components/controls/Tooltip'; import { Release, Update } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; interface Props { release: Release; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx index a04047ebf8b..a13b8c2d37e 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import PluginDescription from './PluginDescription'; import PluginLicense from './PluginLicense'; import PluginOrganization from './PluginOrganization'; @@ -25,7 +26,6 @@ import PluginStatus from './PluginStatus'; import PluginUpdates from './PluginUpdates'; import PluginUrls from './PluginUrls'; import { PluginInstalled as IPluginInstalled } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; interface Props { plugin: IPluginInstalled; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx index c7b05313075..f2898f44d51 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginLicense.tsx @@ -19,8 +19,8 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import Tooltip from '../../../components/controls/Tooltip'; -import { translate } from '../../../helpers/l10n'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import Tooltip from 'sonar-ui-common/components/controls/Tooltip'; interface Props { license?: string; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx index 048047534b6..3bacb493075 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginOrganization.tsx @@ -19,7 +19,7 @@ */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; -import { translate } from '../../../helpers/l10n'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import { Plugin } from '../../../api/plugins'; interface Props { diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginStatus.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginStatus.tsx index 23951456f14..5ea763109f8 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginStatus.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginStatus.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import PluginActions from './PluginActions'; import { Plugin } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; interface Props { plugin: Plugin; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx index 564347c70e3..8be60fa6678 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translateWithParameters } from 'sonar-ui-common/helpers/l10n'; +import { Button } from 'sonar-ui-common/components/controls/buttons'; import { Update } from '../../../api/plugins'; -import { Button } from '../../../components/ui/buttons'; -import { translateWithParameters } from '../../../helpers/l10n'; interface Props { disabled: boolean; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx index ac5fdc13461..c5e69f6b9c4 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx @@ -18,10 +18,10 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; +import Tooltip from 'sonar-ui-common/components/controls/Tooltip'; import PluginChangeLogButton from './PluginChangeLogButton'; -import Tooltip from '../../../components/controls/Tooltip'; import { Release, Update } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; interface Props { update: Update; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx index 2f7d243cdb7..8516ac00539 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdates.tsx @@ -18,9 +18,9 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import PluginUpdateItem from './PluginUpdateItem'; import { Update } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; interface Props { updates?: Update[]; diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx index 0815d31c0cf..2769c1a5d03 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUrls.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; +import { translate } from 'sonar-ui-common/helpers/l10n'; import { Plugin } from '../../../api/plugins'; -import { translate } from '../../../helpers/l10n'; interface Props { plugin: Plugin; diff --git a/server/sonar-web/src/main/js/apps/marketplace/routes.ts b/server/sonar-web/src/main/js/apps/marketplace/routes.ts index e8fbb4ccc8f..09ea09a60d9 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/routes.ts +++ b/server/sonar-web/src/main/js/apps/marketplace/routes.ts @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { lazyLoad } from '../../components/lazyLoad'; +import { lazyLoad } from 'sonar-ui-common/components/lazyLoad'; const routes = [ { diff --git a/server/sonar-web/src/main/js/apps/marketplace/utils.ts b/server/sonar-web/src/main/js/apps/marketplace/utils.ts index 78dc937ec3e..d2e5cbc1f04 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/utils.ts +++ b/server/sonar-web/src/main/js/apps/marketplace/utils.ts @@ -19,9 +19,9 @@ */ import { stringify } from 'querystring'; import { memoize } from 'lodash'; +import { cleanQuery, parseAsString, serializeString } from 'sonar-ui-common/helpers/query'; +import { omitNil } from 'sonar-ui-common/helpers/request'; import { Plugin, PluginAvailable, PluginInstalled, PluginPending } from '../../api/plugins'; -import { cleanQuery, parseAsString, RawQuery, serializeString } from '../../helpers/query'; -import { omitNil } from '../../helpers/request'; export enum EditionKey { community = 'community', @@ -114,14 +114,14 @@ export function isPluginPending(plugin: Plugin): plugin is PluginPending { export const DEFAULT_FILTER = 'all'; export const parseQuery = memoize( - (urlQuery: RawQuery): Query => ({ + (urlQuery: T.RawQuery): Query => ({ filter: parseAsString(urlQuery['filter']) || DEFAULT_FILTER, search: parseAsString(urlQuery['search']) }) ); export const serializeQuery = memoize( - (query: Query): RawQuery => + (query: Query): T.RawQuery => cleanQuery({ filter: query.filter === DEFAULT_FILTER ? undefined : serializeString(query.filter), search: query.search ? serializeString(query.search) : undefined |