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:
authorMike Greiling <mike@pixelcog.com>2018-10-10 09:27:42 +0300
committerMike Greiling <mike@pixelcog.com>2018-10-10 10:30:25 +0300
commit56914c1ac94c02ee336db5014649777d9d729711 (patch)
tree080cf7410d2a8e146bb1ab73b87bea33c6538a08 /app/assets/javascripts/monitoring/services
parentf7a3e8ff53449bc4ad4a19b3df5a6d19f391b180 (diff)
Prettify merge_conflicts monitoring and notebook modules
Diffstat (limited to 'app/assets/javascripts/monitoring/services')
-rw-r--r--app/assets/javascripts/monitoring/services/monitoring_service.js49
1 files changed, 28 insertions, 21 deletions
diff --git a/app/assets/javascripts/monitoring/services/monitoring_service.js b/app/assets/javascripts/monitoring/services/monitoring_service.js
index 260d424378e..24b4acaf6da 100644
--- a/app/assets/javascripts/monitoring/services/monitoring_service.js
+++ b/app/assets/javascripts/monitoring/services/monitoring_service.js
@@ -8,18 +8,20 @@ const MAX_REQUESTS = 3;
function backOffRequest(makeRequestCallback) {
let requestCounter = 0;
return backOff((next, stop) => {
- makeRequestCallback().then((resp) => {
- if (resp.status === statusCodes.NO_CONTENT) {
- requestCounter += 1;
- if (requestCounter < MAX_REQUESTS) {
- next();
+ makeRequestCallback()
+ .then(resp => {
+ if (resp.status === statusCodes.NO_CONTENT) {
+ requestCounter += 1;
+ if (requestCounter < MAX_REQUESTS) {
+ next();
+ } else {
+ stop(new Error('Failed to connect to the prometheus server'));
+ }
} else {
- stop(new Error('Failed to connect to the prometheus server'));
+ stop(resp);
}
- } else {
- stop(resp);
- }
- }).catch(stop);
+ })
+ .catch(stop);
});
}
@@ -33,7 +35,7 @@ export default class MonitoringService {
getGraphsData() {
return backOffRequest(() => axios.get(this.metricsEndpoint))
.then(resp => resp.data)
- .then((response) => {
+ .then(response => {
if (!response || !response.data) {
throw new Error(s__('Metrics|Unexpected metrics data response from prometheus endpoint'));
}
@@ -47,22 +49,27 @@ export default class MonitoringService {
}
return backOffRequest(() => axios.get(this.deploymentEndpoint))
.then(resp => resp.data)
- .then((response) => {
+ .then(response => {
if (!response || !response.deployments) {
- throw new Error(s__('Metrics|Unexpected deployment data response from prometheus endpoint'));
+ throw new Error(
+ s__('Metrics|Unexpected deployment data response from prometheus endpoint'),
+ );
}
return response.deployments;
});
}
getEnvironmentsData() {
- return axios.get(this.environmentsEndpoint)
- .then(resp => resp.data)
- .then((response) => {
- if (!response || !response.environments) {
- throw new Error(s__('Metrics|There was an error fetching the environments data, please try again'));
- }
- return response.environments;
- });
+ return axios
+ .get(this.environmentsEndpoint)
+ .then(resp => resp.data)
+ .then(response => {
+ if (!response || !response.environments) {
+ throw new Error(
+ s__('Metrics|There was an error fetching the environments data, please try again'),
+ );
+ }
+ return response.environments;
+ });
}
}