mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Default dates to today and yesterday
This commit is contained in:
@@ -4,9 +4,23 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export function searchDateRange(date) {
|
export function searchDateRange(dateString) {
|
||||||
|
var date;
|
||||||
|
|
||||||
|
switch(dateString) {
|
||||||
|
case 'yesterday':
|
||||||
|
date = moment().subtract(1, 'day');
|
||||||
|
break;
|
||||||
|
case 'tomorrow':
|
||||||
|
date = moment().add(1, 'day');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
date = moment(dateString);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
from: moment(date).startOf('day'),
|
from: date.startOf('day'),
|
||||||
to: moment(date).endOf('day')
|
to: date.endOf('day')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export default {
|
|||||||
var hostIds = $route.current.params.hosts.split(',');
|
var hostIds = $route.current.params.hosts.split(',');
|
||||||
var moduleParam = $location.search().module || 'packages';
|
var moduleParam = $location.search().module || 'packages';
|
||||||
|
|
||||||
var leftDate = searchDateRange('2015-05-26');
|
var leftDate = searchDateRange('yesterday');
|
||||||
var rightDate = searchDateRange('2015-05-26');
|
var rightDate = searchDateRange();
|
||||||
|
|
||||||
if (hostIds.length === 1) {
|
if (hostIds.length === 1) {
|
||||||
hostIds = hostIds.concat(hostIds[0]);
|
hostIds = hostIds.concat(hostIds[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user