render() {
const { edition, editionStatus } = this.props;
- const isInstalled = editionStatus && editionStatus.currentEditionKey === edition.key;
- const isInstalling = editionStatus && editionStatus.nextEditionKey === edition.key;
const installInProgress =
- editionStatus && editionStatus.installationStatus === 'AUTOMATIC_IN_PROGRESS';
+ editionStatus &&
+ ['AUTOMATIC_IN_PROGRESS', 'AUTOMATIC_READY'].includes(editionStatus.installationStatus);
+ const installReady = editionStatus && editionStatus.installationStatus === 'AUTOMATIC_READY';
+ const isInstalled = editionStatus && editionStatus.currentEditionKey === edition.key;
+ const isInstalling =
+ installInProgress && editionStatus && editionStatus.nextEditionKey === edition.key;
return (
<div className="boxed-group boxed-group-inner marketplace-edition">
{isInstalled &&
)}
{isInstalling && (
<span className="marketplace-edition-badge badge badge-normal-size">
- {translate('marketplace.installing')}
+ {installReady ? translate('marketplace.pending') : translate('marketplace.installing')}
</span>
)}
<div>
editionStatus: {
currentEditionKey: 'foo',
nextEditionKey: 'foo',
- installationStatus: 'NONE'
+ installationStatus: 'AUTOMATIC_IN_PROGRESS'
+ }
+ })
+ ).toMatchSnapshot();
+});
+
+it('should display pending badge', () => {
+ expect(
+ getWrapper({
+ editionStatus: {
+ currentEditionKey: '',
+ nextEditionKey: 'foo',
+ installationStatus: 'AUTOMATIC_READY'
}
})
).toMatchSnapshot();
expect(
getWrapper({
editionStatus: {
- currentEditionKey: 'foo',
- nextEditionKey: '',
+ currentEditionKey: '',
+ nextEditionKey: 'foo',
installationStatus: 'AUTOMATIC_IN_PROGRESS'
}
})
).toMatchSnapshot();
+ expect(
+ getWrapper({
+ editionStatus: {
+ currentEditionKey: '',
+ nextEditionKey: 'foo',
+ installationStatus: 'AUTOMATIC_READY'
+ }
+ })
+ ).toMatchSnapshot();
});
it('should disable uninstall button', () => {
expect(
getWrapper({
editionStatus: {
- currentEditionKey: '',
+ currentEditionKey: 'foo',
nextEditionKey: 'foo',
installationStatus: 'AUTOMATIC_IN_PROGRESS'
}
<span
className="marketplace-edition-badge badge badge-normal-size"
>
- <CheckIcon
- className="little-spacer-right text-text-top"
- size={14}
- />
- marketplace.installed
+ marketplace.installing
</span>
<div>
<h3
marketplace.learn_more
</a>
<button
- className="button-red"
disabled={true}
+ onClick={[Function]}
>
- marketplace.uninstall
+ marketplace.install
</button>
</div>
</div>
`;
-exports[`should disable uninstall button 1`] = `
+exports[`should disable install button 2`] = `
<div
className="boxed-group boxed-group-inner marketplace-edition"
>
<span
className="marketplace-edition-badge badge badge-normal-size"
>
- marketplace.installing
+ marketplace.pending
</span>
<div>
<h3
</div>
`;
+exports[`should disable uninstall button 1`] = `
+<div
+ className="boxed-group boxed-group-inner marketplace-edition"
+>
+ <span
+ className="marketplace-edition-badge badge badge-normal-size"
+ >
+ marketplace.installing
+ </span>
+ <div>
+ <h3
+ className="spacer-bottom"
+ >
+ Foo
+ </h3>
+ <p>
+ Foo desc
+ </p>
+ </div>
+ <div
+ className="marketplace-edition-action spacer-top"
+ >
+ <a
+ href="more_url"
+ target="_blank"
+ >
+ marketplace.learn_more
+ </a>
+ <button
+ className="button-red"
+ disabled={true}
+ >
+ marketplace.uninstall
+ </button>
+ </div>
+</div>
+`;
+
exports[`should display installed badge 1`] = `
<div
className="boxed-group boxed-group-inner marketplace-edition"
</a>
<button
className="button-red"
- disabled={false}
+ disabled={true}
>
marketplace.uninstall
</button>
</div>
`;
+exports[`should display pending badge 1`] = `
+<div
+ className="boxed-group boxed-group-inner marketplace-edition"
+>
+ <span
+ className="marketplace-edition-badge badge badge-normal-size"
+ >
+ marketplace.pending
+ </span>
+ <div>
+ <h3
+ className="spacer-bottom"
+ >
+ Foo
+ </h3>
+ <p>
+ Foo desc
+ </p>
+ </div>
+ <div
+ className="marketplace-edition-action spacer-top"
+ >
+ <a
+ href="more_url"
+ target="_blank"
+ >
+ marketplace.learn_more
+ </a>
+ <button
+ disabled={true}
+ onClick={[Function]}
+ >
+ marketplace.install
+ </button>
+ </div>
+</div>
+`;
+
exports[`should display the edition 1`] = `
<div
className="boxed-group boxed-group-inner marketplace-edition"
marketplace.install_x=Install {0}
marketplace.installed=Installed
marketplace.installing=Installing...
+marketplace.pending=Pending...
marketplace._installed=installed
marketplace.available_under_commercial_license=Available under our commercial editions
marketplace.learn_more=Learn more