summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Vargas <jvargas@gitlab.com>2019-04-03 16:10:39 -0600
committerJose Vargas <jvargas@gitlab.com>2019-04-04 14:53:03 -0600
commit976f1feb28265bfc427a00e7031275f49aa7f877 (patch)
treec19195eea183089a6e2ce2ebb36c695094726794
parenta6f9f79b73ec1893e00a41ae20c3e17bd33cccb4 (diff)
downloadgitlab-ce-976f1feb28265bfc427a00e7031275f49aa7f877.tar.gz
Also added a finally clause to the getGraphsDataWithTime promise
-rw-r--r--app/assets/javascripts/monitoring/components/dashboard.vue5
-rw-r--r--app/assets/javascripts/monitoring/utils.js6
-rw-r--r--spec/javascripts/monitoring/dashboard_spec.js2
3 files changed, 10 insertions, 3 deletions
diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue
index 529f82b4ae1..d7055097a63 100644
--- a/app/assets/javascripts/monitoring/components/dashboard.vue
+++ b/app/assets/javascripts/monitoring/components/dashboard.vue
@@ -178,11 +178,12 @@ export default {
.then(data => {
this.store.storeMetrics(data);
this.selectedTimeWindow = this.timeWindows[timeFrame];
- this.showEmptyState = false;
})
.catch(() => {
- this.showEmptyState = false;
Flash(s__('Metrics|Not enough data to display'));
+ })
+ .finally(() => {
+ this.showEmptyState = false;
});
},
onSidebarMutation() {
diff --git a/app/assets/javascripts/monitoring/utils.js b/app/assets/javascripts/monitoring/utils.js
index b01bee66d9e..e379827b769 100644
--- a/app/assets/javascripts/monitoring/utils.js
+++ b/app/assets/javascripts/monitoring/utils.js
@@ -1,5 +1,11 @@
import { timeWindows, msPerMinute } from './constants';
+/**
+ * method that converts a predetermined time window to minutes
+ * defaults to 8 hours as the default option
+ * @param {String} timeWindow - The time window to convert to minutes
+ * @returns {number} The time window in minutes
+ */
const getTimeDifferenceMinutes = timeWindow => {
switch (timeWindow) {
case timeWindows.thirtyMinutes:
diff --git a/spec/javascripts/monitoring/dashboard_spec.js b/spec/javascripts/monitoring/dashboard_spec.js
index 1436bcb466e..ce2c6c43c0f 100644
--- a/spec/javascripts/monitoring/dashboard_spec.js
+++ b/spec/javascripts/monitoring/dashboard_spec.js
@@ -224,7 +224,7 @@ describe('Dashboard', () => {
});
});
- it('rewnders the time window dropdown with a set of options', done => {
+ it('renders the time window dropdown with a set of options', done => {
const component = new DashboardComponent({
el: document.querySelector('.prometheus-graphs'),
propsData: {