@@ -24,12 +24,13 @@ import throwGlobalError from '../app/utils/throwGlobalError'; | |||
export interface Plugin { | |||
key: string; | |||
name: string; | |||
description: string; | |||
category?: string; | |||
description: string; | |||
editionBundled?: boolean; | |||
license?: string; | |||
organizationName?: string; | |||
organizationUrl?: string; | |||
homepageUrl?: string; | |||
organizationUrl?: string; | |||
issueTrackerUrl?: string; | |||
termsAndConditionsUrl?: string; | |||
} | |||
@@ -86,7 +87,7 @@ function getLastUpdates(updates: undefined | Update[]): Update[] { | |||
return []; | |||
} | |||
const lastUpdate = [ | |||
'INCOMPATIBLE', | |||
'COMPATIBLE', | |||
'REQUIRES_SYSTEM_UPGRADE', | |||
'DEPS_REQUIRE_SYSTEM_UPGRADE' | |||
].map(status => { |
@@ -18,11 +18,12 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import * as React from 'react'; | |||
import Checkbox from '../../components/controls/Checkbox'; | |||
import Checkbox from '../../../components/controls/Checkbox'; | |||
import CheckIcon from '../../../components/icons-components/CheckIcon'; | |||
import PluginUpdateButton from './PluginUpdateButton'; | |||
import { Plugin, installPlugin, updatePlugin, uninstallPlugin } from '../../api/plugins'; | |||
import { isPluginAvailable, isPluginInstalled } from './utils'; | |||
import { translate } from '../../helpers/l10n'; | |||
import { Plugin, installPlugin, updatePlugin, uninstallPlugin } from '../../../api/plugins'; | |||
import { isPluginAvailable, isPluginInstalled } from '../utils'; | |||
import { translate } from '../../../helpers/l10n'; | |||
interface Props { | |||
plugin: Plugin; | |||
@@ -71,6 +72,44 @@ export default class PluginActions extends React.PureComponent<Props, State> { | |||
render() { | |||
const { plugin } = this.props; | |||
const { loading } = this.state; | |||
if (plugin.editionBundled) { | |||
return ( | |||
<div className="js-actions"> | |||
{isPluginAvailable(plugin) && ( | |||
<div> | |||
<p className="little-spacer-bottom"> | |||
{translate('marketplace.available_under_commercial_license')} | |||
</p> | |||
<a href={plugin.homepageUrl} target="_blank"> | |||
{translate('marketplace.learn_more')} | |||
</a> | |||
</div> | |||
)} | |||
{isPluginInstalled(plugin) && ( | |||
<p> | |||
<CheckIcon className="little-spacer-right" /> | |||
{translate('marketplace.installed')} | |||
</p> | |||
)} | |||
{isPluginInstalled(plugin) && | |||
plugin.updates && | |||
plugin.updates.length > 0 && ( | |||
<div className="spacer-top button-group"> | |||
{plugin.updates.map((update, idx) => ( | |||
<PluginUpdateButton | |||
key={idx} | |||
onClick={this.handleUpdate} | |||
update={update} | |||
disabled={loading} | |||
/> | |||
))} | |||
</div> | |||
)} | |||
</div> | |||
); | |||
} | |||
return ( | |||
<div className="js-actions"> | |||
{isPluginAvailable(plugin) && |
@@ -18,11 +18,12 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import * as React from 'react'; | |||
import PluginChangeLogButton from './PluginChangeLogButton'; | |||
import PluginDescription from './PluginDescription'; | |||
import PluginLicense from './PluginLicense'; | |||
import PluginOrganization from './PluginOrganization'; | |||
import PluginStatus from './PluginStatus'; | |||
import PluginChangeLogButton from './PluginChangeLogButton'; | |||
import PluginUrls from './PluginUrls'; | |||
import { PluginAvailable } from '../../api/plugins'; | |||
import { translateWithParameters } from '../../helpers/l10n'; | |||
import { Query } from './utils'; | |||
@@ -64,6 +65,7 @@ export default function PluginAvailable({ plugin, refreshPending, status, update | |||
<td className="text-top width-20 big-spacer-right"> | |||
<ul> | |||
<PluginUrls plugin={plugin} /> | |||
<PluginLicense license={plugin.license} /> | |||
<PluginOrganization plugin={plugin} /> | |||
</ul> |
@@ -41,7 +41,7 @@ export default class PluginChangeLogButton extends React.PureComponent<Props, St | |||
}; | |||
toggleChangelog = (show?: boolean) => { | |||
if (show != undefined) { | |||
if (show !== undefined) { | |||
this.setState({ changelogOpen: show }); | |||
} else { | |||
this.setState(state => ({ changelogOpen: !state.changelogOpen })); |
@@ -20,9 +20,10 @@ | |||
import * as React from 'react'; | |||
import PluginDescription from './PluginDescription'; | |||
import PluginLicense from './PluginLicense'; | |||
import PluginStatus from './PluginStatus'; | |||
import PluginOrganization from './PluginOrganization'; | |||
import PluginStatus from './PluginStatus'; | |||
import PluginUpdates from './PluginUpdates'; | |||
import PluginUrls from './PluginUrls'; | |||
import { PluginInstalled } from '../../api/plugins'; | |||
import { translate } from '../../helpers/l10n'; | |||
import { Query } from './utils'; | |||
@@ -52,26 +53,7 @@ export default function PluginInstalled({ plugin, refreshPending, status, update | |||
<td className="text-top width-20 big-spacer-right"> | |||
<ul> | |||
{(plugin.homepageUrl || plugin.issueTrackerUrl) && ( | |||
<li className="little-spacer-bottom"> | |||
<ul className="list-inline"> | |||
{plugin.homepageUrl && ( | |||
<li> | |||
<a className="js-plugin-homepage" href={plugin.homepageUrl} target="_blank"> | |||
{translate('marketplace.homepage')} | |||
</a> | |||
</li> | |||
)} | |||
{plugin.issueTrackerUrl && ( | |||
<li> | |||
<a className="js-plugin-issues" href={plugin.issueTrackerUrl} target="_blank"> | |||
{translate('marketplace.issue_tracker')} | |||
</a> | |||
</li> | |||
)} | |||
</ul> | |||
</li> | |||
)} | |||
<PluginUrls plugin={plugin} /> | |||
<PluginLicense license={plugin.license} /> | |||
<PluginOrganization plugin={plugin} /> | |||
</ul> |
@@ -42,7 +42,7 @@ export default class PluginUpdateItem extends React.PureComponent<Props, State> | |||
}; | |||
toggleChangelog = (show?: boolean) => { | |||
if (show != undefined) { | |||
if (show !== undefined) { | |||
this.setState({ changelogOpen: show }); | |||
} else { | |||
this.setState(state => ({ changelogOpen: !state.changelogOpen })); |
@@ -0,0 +1,52 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2017 SonarSource SA | |||
* mailto:info AT sonarsource DOT com | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU Lesser General Public | |||
* License as published by the Free Software Foundation; either | |||
* version 3 of the License, or (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import * as React from 'react'; | |||
import { Plugin } from '../../api/plugins'; | |||
import { translate } from '../../helpers/l10n'; | |||
interface Props { | |||
plugin: Plugin; | |||
} | |||
export default function PluginUrls({ plugin }: Props) { | |||
if (!plugin.homepageUrl && !plugin.issueTrackerUrl) { | |||
return null; | |||
} | |||
return ( | |||
<li className="little-spacer-bottom"> | |||
<ul className="list-inline"> | |||
{plugin.homepageUrl && ( | |||
<li> | |||
<a className="js-plugin-homepage" href={plugin.homepageUrl} target="_blank"> | |||
{translate('marketplace.homepage')} | |||
</a> | |||
</li> | |||
)} | |||
{plugin.issueTrackerUrl && ( | |||
<li> | |||
<a className="js-plugin-issues" href={plugin.issueTrackerUrl} target="_blank"> | |||
{translate('marketplace.issue_tracker')} | |||
</a> | |||
</li> | |||
)} | |||
</ul> | |||
</li> | |||
); | |||
} |
@@ -2068,7 +2068,10 @@ marketplace.restart=Restart | |||
marketplace.revert=Revert | |||
marketplace.system_upgrades=System Upgrades | |||
marketplace.install=Install | |||
marketplace.installed=Installed | |||
marketplace._installed=installed | |||
marketplace.available_under_commercial_license=Available under our commercial editions | |||
marketplace.learn_more=Learn more | |||
marketplace.homepage=Homepage | |||
marketplace.issue_tracker=Issue Tracker | |||
marketplace.licensed_under_x=Licensed under {license} |