fix date range formatting on flatpickr - 'to' wasnt displayed after choosing a range

This commit is contained in:
Nathan Woulfe
2019-07-04 11:48:02 +10:00
parent c4b5483d8c
commit a0bcfeddcc
2 changed files with 16 additions and 10 deletions

View File

@@ -43,14 +43,20 @@
vm.searchLogQuery = searchLogQuery;
vm.findMessageTemplate = findMessageTemplate;
function preFlightCheck(){
vm.loading = true;
function preFlightCheck(instance){
vm.loading = true;
//Do our pre-flight check (to see if we can view logs)
//IE the log file is NOT too big such as 1GB & crash the site
logViewerResource.canViewLogs(vm.startDate, vm.endDate).then(function(result){
vm.loading = false;
vm.canLoadLogs = result;
if (instance) {
instance.setDate(vm.period);
}
if(result){
//Can view logs - so initalise
init();
@@ -117,7 +123,7 @@
$q.all([savedSearches, numOfErrors, logCounts, commonMsgs]).then(function() {
vm.loading = false;
});
$timeout(function () {
navigationService.syncTree({ tree: "logViewer", path: "-1" });
});
@@ -146,9 +152,9 @@
mode: "range",
maxDate: "today",
conjunction: " to "
};
vm.dateRangeChange = function(selectedDates) {
};
vm.dateRangeChange = function(selectedDates, dateStr, instance) {
if(selectedDates.length > 0){
vm.startDate = selectedDates[0].toIsoDateString();
@@ -158,9 +164,9 @@
vm.period = [vm.startDate];
}else{
vm.period = [vm.startDate, vm.endDate];
}
preFlightCheck();
}
preFlightCheck(instance);
}
}

View File

@@ -78,7 +78,7 @@
class="datepicker"
ng-model="vm.period"
options="vm.config"
on-close="vm.dateRangeChange(selectedDates)">
on-close="vm.dateRangeChange(selectedDates, dateStr, instance)">
</umb-flatpickr>
</umb-box>