diff options
author | Phil Hughes <me@iamphill.com> | 2018-02-02 10:47:58 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-02-05 09:40:59 +0000 |
commit | e6cd217df66f702f01cfcfa2ce645174957633ad (patch) | |
tree | 9f90f453443459a0e668258fe91e9a4d653bc1e9 /app/assets/javascripts | |
parent | 85e0bf39ced8659385aea9bbee94a9d21c5f6a70 (diff) | |
download | gitlab-ce-e6cd217df66f702f01cfcfa2ce645174957633ad.tar.gz |
Converted prometheus_metrics.js to use axios
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/prometheus_metrics/prometheus_metrics.js | 17 |
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) { |