@@ -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> | |||
); |
@@ -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> | |||
); | |||
} | |||
} |
@@ -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> | |||
`; | |||
@@ -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 |