aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2020-10-01 17:02:42 +0200
committersonartech <sonartech@sonarsource.com>2020-10-02 20:07:42 +0000
commit84de08d367995b0b9fa374fc2ab9871bde86c9d4 (patch)
tree786217a40b47db6cb6bb01e79641fd825ca0a749
parentdf26b4e4f95166e0fff7c0b6443c78d1da79469a (diff)
downloadsonarqube-84de08d367995b0b9fa374fc2ab9871bde86c9d4.tar.gz
sonarqube-84de08d367995b0b9fa374fc2ab9871bde86c9d4.zip
SONAR-12122 Let users know that a restart is needed before they (un)install a plugin
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginActions.tsx35
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateButton.tsx17
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap44
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
4 files changed, 56 insertions, 41 deletions
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 06319354ad5..ac08fd563d4 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
@@ -20,6 +20,7 @@
import * as React from 'react';
import { Button } from 'sonar-ui-common/components/controls/buttons';
import Checkbox from 'sonar-ui-common/components/controls/Checkbox';
+import Tooltip from 'sonar-ui-common/components/controls/Tooltip';
import CheckIcon from 'sonar-ui-common/components/icons/CheckIcon';
import { translate } from 'sonar-ui-common/helpers/l10n';
import { installPlugin, uninstallPlugin, updatePlugin } from '../../../api/plugins';
@@ -139,7 +140,7 @@ export default class PluginActions extends React.PureComponent<Props, State> {
)}
{loading && <i className="spinner spacer-right little-spacer-top little-spacer-bottom" />}
{isInstalledPlugin(plugin) && (
- <div className="display-inlin-block">
+ <>
{plugin.updates &&
plugin.updates.map((update, idx) => (
<PluginUpdateButton
@@ -149,21 +150,27 @@ export default class PluginActions extends React.PureComponent<Props, State> {
update={update}
/>
))}
- <Button
- className="js-uninstall button-red little-spacer-left"
- disabled={loading}
- onClick={this.handleUninstall}>
- {translate('marketplace.uninstall')}
- </Button>
- </div>
+ <Tooltip overlay={translate('marketplace.requires_restart')}>
+ <Button
+ className="js-uninstall button-red little-spacer-left"
+ disabled={loading}
+ onClick={this.handleUninstall}>
+ {translate('marketplace.uninstall')}
+ </Button>
+ </Tooltip>
+ </>
)}
{isAvailablePlugin(plugin) && (
- <Button
- className="js-install"
- disabled={loading || (plugin.termsAndConditionsUrl != null && !this.state.acceptTerms)}
- onClick={this.handleInstall}>
- {translate('marketplace.install')}
- </Button>
+ <Tooltip overlay={translate('marketplace.requires_restart')}>
+ <Button
+ className="js-install"
+ disabled={
+ loading || (plugin.termsAndConditionsUrl != null && !this.state.acceptTerms)
+ }
+ onClick={this.handleInstall}>
+ {translate('marketplace.install')}
+ </Button>
+ </Tooltip>
)}
</div>
);
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 e34e3f37bad..8d2144fccf3 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
@@ -19,7 +19,8 @@
*/
import * as React from 'react';
import { Button } from 'sonar-ui-common/components/controls/buttons';
-import { translateWithParameters } from 'sonar-ui-common/helpers/l10n';
+import Tooltip from 'sonar-ui-common/components/controls/Tooltip';
+import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n';
import { Update } from '../../../types/plugins';
interface Props {
@@ -39,12 +40,14 @@ export default class PluginUpdateButton extends React.PureComponent<Props> {
return null;
}
return (
- <Button
- className="js-update little-spacer-bottom"
- disabled={disabled}
- onClick={this.handleClick}>
- {translateWithParameters('marketplace.update_to_x', update.release.version)}
- </Button>
+ <Tooltip overlay={translate('marketplace.requires_restart')}>
+ <Button
+ className="js-update little-spacer-bottom"
+ disabled={disabled}
+ onClick={this.handleClick}>
+ {translateWithParameters('marketplace.update_to_x', update.release.version)}
+ </Button>
+ </Tooltip>
);
}
}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap
index 6f229d96527..d5a6548367e 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/PluginActions-test.tsx.snap
@@ -30,13 +30,17 @@ exports[`should render available plugin correctly 1`] = `
marketplace.terms_and_conditions
</a>
</p>
- <Button
- className="js-install"
- disabled={true}
- onClick={[Function]}
+ <Tooltip
+ overlay="marketplace.requires_restart"
>
- marketplace.install
- </Button>
+ <Button
+ className="js-install"
+ disabled={true}
+ onClick={[Function]}
+ >
+ marketplace.install
+ </Button>
+ </Tooltip>
</div>
`;
@@ -64,20 +68,20 @@ exports[`should render installed plugin correctly 1`] = `
<div
className="js-actions"
>
- <div
- className="display-inlin-block"
- >
- <PluginUpdateButton
- disabled={false}
- key="0"
- onClick={[Function]}
- update={
- Object {
- "requires": Array [],
- "status": "COMPATIBLE",
- }
+ <PluginUpdateButton
+ disabled={false}
+ key="0"
+ onClick={[Function]}
+ update={
+ Object {
+ "requires": Array [],
+ "status": "COMPATIBLE",
}
- />
+ }
+ />
+ <Tooltip
+ overlay="marketplace.requires_restart"
+ >
<Button
className="js-uninstall button-red little-spacer-left"
disabled={false}
@@ -85,7 +89,7 @@ exports[`should render installed plugin correctly 1`] = `
>
marketplace.uninstall
</Button>
- </div>
+ </Tooltip>
</div>
`;
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 2a0f4a15be5..2423825a8e4 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2609,6 +2609,7 @@ marketplace.developed_by_x=Developed by {organization}
marketplace.install_pending=Install Pending
marketplace.update_pending=Update Pending
marketplace.uninstall_pending=Uninstall Pending
+marketplace.requires_restart=This requires a restart
marketplace.updates=Updates
marketplace.update_status.COMPATIBLE=Compatible
marketplace.update_status.INCOMPATIBLE=Incompatible