aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-13 11:22:57 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-23 08:01:13 -0700
commitd04f3466ac7eda479ddd559e8b245eff971c6ee2 (patch)
treedfaa9e6a7fb65776c9282caed5df871d5af6e047 /server/sonar-web/src/main
parent2dd24c26aec365b6a2afcb3c27f3b46798e9900d (diff)
downloadsonarqube-d04f3466ac7eda479ddd559e8b245eff971c6ee2.tar.gz
sonarqube-d04f3466ac7eda479ddd559e8b245eff971c6ee2.zip
SONAR-9934 Prevent user to install/update/uninstall plugins part of an edition
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/api/plugins.ts7
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginActions.tsx47
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginAvailable.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginChangeLogButton.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginInstalled.tsx24
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginUpdateItem.tsx2
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/PluginUrls.tsx52
7 files changed, 107 insertions, 31 deletions
diff --git a/server/sonar-web/src/main/js/api/plugins.ts b/server/sonar-web/src/main/js/api/plugins.ts
index 75004b3fc1d..9d2a96b3eec 100644
--- a/server/sonar-web/src/main/js/api/plugins.ts
+++ b/server/sonar-web/src/main/js/api/plugins.ts
@@ -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 => {
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginActions.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginActions.tsx
index d14cc83cd94..f2fce9f658e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/PluginActions.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginActions.tsx
@@ -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) &&
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginAvailable.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginAvailable.tsx
index 26c12116a49..c80f5969e62 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/PluginAvailable.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginAvailable.tsx
@@ -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>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginChangeLogButton.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginChangeLogButton.tsx
index ec87c9ea26c..61b309cb291 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/PluginChangeLogButton.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginChangeLogButton.tsx
@@ -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 }));
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginInstalled.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginInstalled.tsx
index 85202411f18..b9225f3820e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/PluginInstalled.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginInstalled.tsx
@@ -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>
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginUpdateItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginUpdateItem.tsx
index f4d9d19d1c8..ea5d581362d 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/PluginUpdateItem.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginUpdateItem.tsx
@@ -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 }));
diff --git a/server/sonar-web/src/main/js/apps/marketplace/PluginUrls.tsx b/server/sonar-web/src/main/js/apps/marketplace/PluginUrls.tsx
new file mode 100644
index 00000000000..adcdd816168
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/marketplace/PluginUrls.tsx
@@ -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>
+ );
+}