import * as React from 'react'; | import * as React from 'react'; | ||||
import { Button } from 'sonar-ui-common/components/controls/buttons'; | import { Button } from 'sonar-ui-common/components/controls/buttons'; | ||||
import Checkbox from 'sonar-ui-common/components/controls/Checkbox'; | 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 CheckIcon from 'sonar-ui-common/components/icons/CheckIcon'; | ||||
import { translate } from 'sonar-ui-common/helpers/l10n'; | import { translate } from 'sonar-ui-common/helpers/l10n'; | ||||
import { installPlugin, uninstallPlugin, updatePlugin } from '../../../api/plugins'; | import { installPlugin, uninstallPlugin, updatePlugin } from '../../../api/plugins'; | ||||
)} | )} | ||||
{loading && <i className="spinner spacer-right little-spacer-top little-spacer-bottom" />} | {loading && <i className="spinner spacer-right little-spacer-top little-spacer-bottom" />} | ||||
{isInstalledPlugin(plugin) && ( | {isInstalledPlugin(plugin) && ( | ||||
<div className="display-inlin-block"> | |||||
<> | |||||
{plugin.updates && | {plugin.updates && | ||||
plugin.updates.map((update, idx) => ( | plugin.updates.map((update, idx) => ( | ||||
<PluginUpdateButton | <PluginUpdateButton | ||||
update={update} | 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) && ( | {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> | </div> | ||||
); | ); |
*/ | */ | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { Button } from 'sonar-ui-common/components/controls/buttons'; | 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'; | import { Update } from '../../../types/plugins'; | ||||
interface Props { | interface Props { | ||||
return null; | return null; | ||||
} | } | ||||
return ( | 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> | |||||
); | ); | ||||
} | } | ||||
} | } |
marketplace.terms_and_conditions | marketplace.terms_and_conditions | ||||
</a> | </a> | ||||
</p> | </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> | </div> | ||||
`; | `; | ||||
<div | <div | ||||
className="js-actions" | 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 | <Button | ||||
className="js-uninstall button-red little-spacer-left" | className="js-uninstall button-red little-spacer-left" | ||||
disabled={false} | disabled={false} | ||||
> | > | ||||
marketplace.uninstall | marketplace.uninstall | ||||
</Button> | </Button> | ||||
</div> | |||||
</Tooltip> | |||||
</div> | </div> | ||||
`; | `; | ||||
marketplace.install_pending=Install Pending | marketplace.install_pending=Install Pending | ||||
marketplace.update_pending=Update Pending | marketplace.update_pending=Update Pending | ||||
marketplace.uninstall_pending=Uninstall Pending | marketplace.uninstall_pending=Uninstall Pending | ||||
marketplace.requires_restart=This requires a restart | |||||
marketplace.updates=Updates | marketplace.updates=Updates | ||||
marketplace.update_status.COMPATIBLE=Compatible | marketplace.update_status.COMPATIBLE=Compatible | ||||
marketplace.update_status.INCOMPATIBLE=Incompatible | marketplace.update_status.INCOMPATIBLE=Incompatible |