Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-02-02 13:47:58 +0300
committerPhil Hughes <me@iamphill.com>2018-02-05 12:40:59 +0300
commite6cd217df66f702f01cfcfa2ce645174957633ad (patch)
tree9f90f453443459a0e668258fe91e9a4d653bc1e9 /app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
parent85e0bf39ced8659385aea9bbee94a9d21c5f6a70 (diff)
Converted prometheus_metrics.js to use axios
Diffstat (limited to 'app/assets/javascripts/prometheus_metrics/prometheus_metrics.js')
-rw-r--r--app/assets/javascripts/prometheus_metrics/prometheus_metrics.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js b/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
index 55c93923cc8..59ad5b45855 100644
--- a/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
+++ b/app/assets/javascripts/prometheus_metrics/prometheus_metrics.js
@@ -1,3 +1,4 @@
+import axios from '../lib/utils/axios_utils';
import PANEL_STATE from './constants';
import { backOff } from '../lib/utils/common_utils';
@@ -81,24 +82,20 @@ export default class PrometheusMetrics {
loadActiveMetrics() {
this.showMonitoringMetricsPanelState(PANEL_STATE.LOADING);
backOff((next, stop) => {
- $.ajax({
- url: this.activeMetricsEndpoint,
- dataType: 'json',
- global: false,
- })
- .done((res) => {
- if (res && res.success) {
- stop(res);
+ axios.get(this.activeMetricsEndpoint)
+ .then(({ data }) => {
+ if (data && data.success) {
+ stop(data);
} else {
this.backOffRequestCounter = this.backOffRequestCounter += 1;
if (this.backOffRequestCounter < 3) {
next();
} else {
- stop(res);
+ stop(data);
}
}
})
- .fail(stop);
+ .catch(stop);
})
.then((res) => {
if (res && res.data && res.data.length) {