[prev in list] [next in list] [prev in thread] [next in thread]
List: openvas-cvs
Subject: [Openvas-commits] r29699 - in trunk/gsa: . src/html/classic/ng/src/web/pages/reports
From: scm-commit () wald ! intevation ! org
Date: 2017-09-28 11:03:44
Message-ID: 20170928110344.7B422907547B () wald ! intevation ! org
[Download RAW message or body]
Author: bricks
Date: 2017-09-28 13:03:44 +0200 (Thu, 28 Sep 2017)
New Revision: 29699
Modified:
trunk/gsa/ChangeLog
trunk/gsa/src/html/classic/ng/src/web/pages/reports/detailspage.js
Log:
* src/html/classic/ng/src/web/pages/reports/detailspage.js: Allow to cancel
current running report http requests.
Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2017-09-28 11:03:41 UTC (rev 29698)
+++ trunk/gsa/ChangeLog 2017-09-28 11:03:44 UTC (rev 29699)
@@ -1,5 +1,10 @@
2017-09-28 Björn Ricks <bjoern.ricks@greenbone.net>
+ * src/html/classic/ng/src/web/pages/reports/detailspage.js: Allow to cancel
+ current running report http requests.
+
+2017-09-28 Björn Ricks <bjoern.ricks@greenbone.net>
+
* src/html/classic/ng/src/gmp/http.js: Extend the default timeout to 5
minutes.
Modified: trunk/gsa/src/html/classic/ng/src/web/pages/reports/detailspage.js
===================================================================
--- trunk/gsa/src/html/classic/ng/src/web/pages/reports/detailspage.js 2017-09-28 \
11:03:41 UTC (rev 29698)
+++ trunk/gsa/src/html/classic/ng/src/web/pages/reports/detailspage.js 2017-09-28 \
11:03:44 UTC (rev 29699) @@ -26,6 +26,8 @@
import _ from 'gmp/locale.js';
import logger from 'gmp/log.js';
+import CancelToken from 'gmp/cancel.js';
+
import {first, has_value, is_defined} from 'gmp/utils.js';
import {RESULTS_FILTER_FILTER} from 'gmp/models/filter.js';
@@ -85,6 +87,7 @@
}
componentWillUnmount() {
+ this.cancelLastRequest();
this.clearTimer();
}
@@ -109,19 +112,32 @@
}
}
+ cancelLastRequest() {
+ if (is_defined(this.cancel)) {
+ this.cancel();
+ }
+ }
+
load(id, filter) {
log.debug('Loading report', id);
const {gmp} = this.context;
+ this.cancelLastRequest();
+
+ const token = new CancelToken(cancel => this.cancel = cancel);
+
this.setState({loading: true});
return gmp.report.get({id}, {
filter,
+ cancel_token: token,
extra_params: {
ignore_pagination: '1',
},
}).then(response => {
+ this.cancel = undefined;
+
const {data: entity, meta} = response;
const {report} = entity;
const {filter: loaded_filter} = report;
@@ -151,6 +167,10 @@
}
})
.catch(err => {
+ if (is_defined(err.isCancel) && err.isCancel()) {
+ return;
+ }
+
const rej = this.handleError(err);
this.setState({entity: undefined});
return rej;
_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic