Document getTimeDifferenceMinutes usage

Also added a finally clause to the getGraphsDataWithTime promise
This commit is contained in:
Jose Vargas 2019-04-03 16:10:39 -06:00
parent a6f9f79b73
commit 976f1feb28
3 changed files with 10 additions and 3 deletions

View file

@ -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() {

View file

@ -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:

View file

@ -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: {