improve percentage for load/save

merge-requests/1/head
Julien Veyssier 2017-01-29 16:44:38 -03:00
parent 806fd3cc93
commit 77023a4f28
3 changed files with 8 additions and 6 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added ### Added
- add lat/lng fields in waypoint popup to view/edit coordinates with precise values - add lat/lng fields in waypoint popup to view/edit coordinates with precise values
[#10](https://gitlab.com/eneiluj/gpxedit-oc/issues/10) @eneiluj [#10](https://gitlab.com/eneiluj/gpxedit-oc/issues/10) @eneiluj
- show animation during exporting and saving
- show saving/loading ajax percentage
### Changed ### Changed

View File

@ -904,7 +904,7 @@ function loadFile(file){
path : file path : file
} }
var url = OC.generateUrl('/apps/gpxedit/getgpx'); var url = OC.generateUrl('/apps/gpxedit/getgpx');
$('#loadingpc').text('0 %'); $('#loadingpc').text('0');
showLoadingAnimation(); showLoadingAnimation();
gpxedit.currentAjax = $.ajax({ gpxedit.currentAjax = $.ajax({
type: "POST", type: "POST",
@ -916,7 +916,7 @@ function loadFile(file){
xhr.addEventListener("progress", function(evt) { xhr.addEventListener("progress", function(evt) {
if (evt.lengthComputable) { if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total * 100; var percentComplete = evt.loaded / evt.total * 100;
$('#loadingpc').text('('+parseInt(percentComplete)+' %)'); $('#loadingpc').text(parseInt(percentComplete));
} }
}, false); }, false);
@ -1139,7 +1139,7 @@ function saveAction(targetPath){
var saveFilePath = targetPath+'/'+$('input#saveName').val(); var saveFilePath = targetPath+'/'+$('input#saveName').val();
var gpxText = generateGpx(); var gpxText = generateGpx();
hideExportingAnimation(); hideExportingAnimation();
$('#savingpc').text('0 %'); $('#savingpc').text('0');
showSavingAnimation(); showSavingAnimation();
var req = { var req = {
path: saveFilePath, path: saveFilePath,
@ -1157,7 +1157,7 @@ function saveAction(targetPath){
if (evt.lengthComputable) { if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total * 100; var percentComplete = evt.loaded / evt.total * 100;
//Do something with upload progress here //Do something with upload progress here
$('#savingpc').text('('+parseInt(percentComplete)+' %)'); $('#savingpc').text(parseInt(percentComplete));
} }
}, false); }, false);

View File

@ -49,7 +49,7 @@ p($_['gpxedit_version']);
</div> </div>
<div id="loading"><p> <div id="loading"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i> <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('loading file')); ?>&nbsp;<i id="loadingpc"></i></p> <?php p($l->t('loading file')); ?>&nbsp;(<i id="loadingpc"></i> %)</p>
</div> </div>
<div id="exporting"><p> <div id="exporting"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i> <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
@ -57,7 +57,7 @@ p($_['gpxedit_version']);
</div> </div>
<div id="saving"><p> <div id="saving"><p>
<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i> <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
<?php p($l->t('saving file')); ?>&nbsp;<i id="savingpc"></i></p> <?php p($l->t('saving file')); ?>&nbsp;(<i id="savingpc"></i> %)</p>
</div> </div>
<?php <?php