aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/api/marketplace.ts1
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/App.tsx15
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionsStatusNotif-test.tsx10
-rw-r--r--server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionsStatusNotif-test.tsx.snap2
4 files changed, 13 insertions, 15 deletions
diff --git a/server/sonar-web/src/main/js/api/marketplace.ts b/server/sonar-web/src/main/js/api/marketplace.ts
index d067f7b3e22..8bb8a462a42 100644
--- a/server/sonar-web/src/main/js/api/marketplace.ts
+++ b/server/sonar-web/src/main/js/api/marketplace.ts
@@ -42,7 +42,6 @@ export interface EditionStatus {
| 'AUTOMATIC_IN_PROGRESS'
| 'MANUAL_IN_PROGRESS'
| 'AUTOMATIC_READY'
- | 'AUTOMATIC_FAILURE'
| 'UNINSTALL_IN_PROGRESS';
}
diff --git a/server/sonar-web/src/main/js/apps/marketplace/App.tsx b/server/sonar-web/src/main/js/apps/marketplace/App.tsx
index 0c008e09b7c..969c1c7135c 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/App.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/App.tsx
@@ -63,6 +63,7 @@ interface State {
export default class App extends React.PureComponent<Props, State> {
mounted: boolean;
+ timer?: NodeJS.Timer;
static contextTypes = {
router: PropTypes.object.isRequired
@@ -159,7 +160,6 @@ export default class App extends React.PureComponent<Props, State> {
editionStatus => {
if (this.mounted) {
this.updateEditionStatus(editionStatus);
- setTimeout(this.fetchEditionStatus, 5000);
}
},
() => {}
@@ -184,8 +184,19 @@ export default class App extends React.PureComponent<Props, State> {
);
};
- updateEditionStatus = (editionStatus: EditionStatus) =>
+ updateEditionStatus = (editionStatus: EditionStatus) => {
this.setState({ editionStatus: editionStatus });
+ if (this.timer) {
+ global.clearTimeout(this.timer);
+ this.timer = undefined;
+ }
+ if (editionStatus.installationStatus === 'AUTOMATIC_IN_PROGRESS') {
+ this.timer = global.setTimeout(() => {
+ this.fetchEditionStatus();
+ this.timer = undefined;
+ }, 2000);
+ }
+ };
updateQuery = (newQuery: Partial<Query>) => {
const query = serializeQuery({ ...parseQuery(this.props.location.query), ...newQuery });
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionsStatusNotif-test.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionsStatusNotif-test.tsx
index 0a3ca4c9acd..d86c8ac266c 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionsStatusNotif-test.tsx
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/EditionsStatusNotif-test.tsx
@@ -42,16 +42,6 @@ it('should display an in progress notif', () => {
expect(wrapper).toMatchSnapshot();
});
-it('should display an error notification', () => {
- const wrapper = shallow(
- <EditionsStatusNotif
- editionStatus={{ installationStatus: 'AUTOMATIC_FAILURE' }}
- updateEditionStatus={jest.fn()}
- />
- );
- expect(wrapper).toMatchSnapshot();
-});
-
it('should display a ready notification', () => {
const wrapper = shallow(
<EditionsStatusNotif
diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionsStatusNotif-test.tsx.snap b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionsStatusNotif-test.tsx.snap
index 70b4ce43ef0..e52e16c6fa7 100644
--- a/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionsStatusNotif-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/marketplace/components/__tests__/__snapshots__/EditionsStatusNotif-test.tsx.snap
@@ -18,8 +18,6 @@ exports[`should display a ready notification 1`] = `
</div>
`;
-exports[`should display an error notification 1`] = `<div />`;
-
exports[`should display an in progress notif 1`] = `
<div>
<div