summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-11-22 15:22:06 -0600
committerJose Ivan Vargas <jvargas@gitlab.com>2017-11-22 15:22:06 -0600
commit218c1d2e96a52a382f428608ec0b2124dc19195b (patch)
tree1567aa95274a3467628dfaf67580724f1f1ec7d3
parent743fd67f73875dac071287ef8bb91a2392359ba3 (diff)
downloadgitlab-ce-jivl-replace-vue-resource-prometheus-settings.tar.gz
replace $.ajax calls for axios in the prometheus settings integrationjivl-replace-vue-resource-prometheus-settings
-rw-r--r--app/assets/javascripts/prometheus_metrics/prometheus_metrics.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js b/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
index 55c93923cc8..72f8bb4c5ef 100644
--- a/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
+++ b/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
@@ -1,4 +1,5 @@
import PANEL_STATE from './constants';
+import axios from '../lib/utils/axios_utils';
import { backOff } from '../lib/utils/common_utils';
export default class PrometheusMetrics {
@@ -80,25 +81,26 @@ export default class PrometheusMetrics {
loadActiveMetrics() {
this.showMonitoringMetricsPanelState(PANEL_STATE.LOADING);
+ console.log('here...');
+ console.log(this.activeMetricsEndpoint);
backOff((next, stop) => {
- $.ajax({
- url: this.activeMetricsEndpoint,
- dataType: 'json',
- global: false,
- })
- .done((res) => {
- if (res && res.success) {
- stop(res);
+ console.log('backing off..');
+ axios.get(this.activeMetricsEndpoint)
+ .then(resp => resp.data)
+ .then((response) => {
+ console.log('response: ', response);
+ if (response && response.success) {
+ stop(response);
} else {
this.backOffRequestCounter = this.backOffRequestCounter += 1;
if (this.backOffRequestCounter < 3) {
next();
} else {
- stop(res);
+ stop(response);
}
}
})
- .fail(stop);
+ .catch(stop);
})
.then((res) => {
if (res && res.data && res.data.length) {
@@ -107,7 +109,8 @@ export default class PrometheusMetrics {
this.showMonitoringMetricsPanelState(PANEL_STATE.EMPTY);
}
})
- .catch(() => {
+ .catch((err) => {
+ console.log('empty data...', err);
this.showMonitoringMetricsPanelState(PANEL_STATE.EMPTY);
});
}