1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-29 18:52:22 +01:00

use an hidden form to post export data

This commit is contained in:
Sylvain 2016-07-05 17:23:14 +02:00
parent 4dcab27af2
commit d307f91983
3 changed files with 11 additions and 5 deletions

View File

@ -291,10 +291,12 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
# export requested
if info.type == 'current'
custom = buildCustomFilterQuery()
Export.stats $scope.selectedIndex.es_type_key,
buildElasticDataQuery($scope.type.active.key, custom, $scope.agePicker.start, $scope.agePicker.end, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected), $scope.sorting)
$scope.exportUrl = '/stats/'+$scope.selectedIndex.es_type_key+'/export'
$scope.exportQuery = buildElasticDataQuery($scope.type.active.key, custom, $scope.agePicker.start, $scope.agePicker.end, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected), $scope.sorting)
angular.element('#export-stats').submit()
else if info.type == 'global'
Export.stats 'global',
$scope.exportUrl = '/stats/global/export'
$scope.exportQuery =
"query":
"bool":
"must": [
@ -305,6 +307,7 @@ Application.Controllers.controller "StatisticsController", ["$scope", "$state",
"lte": moment(info.dates.end).format()
}
]
angular.element('#export-stats').submit()

View File

@ -289,3 +289,7 @@
</div>
</section>
<form id="export-stats" enctype="multipart/form-data" method="post" action="{{exportUrl}}" formtarget="_blank">
<input type="hidden" ng-value="exportQuery" name="body" >
</form>

View File

@ -4,5 +4,4 @@
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "application/vnd.ms-excel", :xls
Mime::Type.register "application/xlsx", :xlsx
Mime::Type.register "application/vnd.ms-excel", :xls