add progress

This commit is contained in:
aj 2017-08-25 23:48:14 +00:00
parent 419fd60f75
commit f057087d15
4 changed files with 13 additions and 2 deletions

@ -1 +1 @@
Subproject commit effee987beca6f0522a93533d65de1e7ed246987
Subproject commit a5742d1a2aa42db0993081269beea695049d2805

View File

@ -148,10 +148,18 @@ app.controller('websiteCtrl', [
, sld: vm.domain.sld
//, sub: vm.record.sub
, multipart: { site: vm.currentFiles[0] }
, progress: function (ev) {
// TODO must digest
vm.uploadPercent = Math.round((ev.loaded / ev.total) * 100);
// TODO GiB, MiB, KiB, etc
vm.uploadTotal = (ev.total / (1024 * 1024)).toFixed(2);
vm.uploadProgress = (ev.loaded / (1024 * 1024)).toFixed(2);
}
, unzip: vm.unzip
, strip: vm.stripZip
, path: vm.webPath
}).then(function (result) {
vm.uploadTotal = 0;
window.alert(JSON.stringify(result));
});
};

View File

@ -15,6 +15,7 @@ OAUTH3._pkgs['www@daplie.com'] = {
+ '?' + OAUTH3.utils.query.stringify({ tld: opts.tld, sld: opts.sld/*, sub: opts.sub*/, unzip: opts.unzip, strip: opts.strip, path: opts.path })
, session: session
, multipart: opts.multipart // special property to be figured out by browser request code
, progress: opts.progress
}).then(function (result) {
return result;
});

View File

@ -60,7 +60,9 @@
<!-- div ng-if="vm.isZip" ><label>Unzip directory</label> <input type="text" ng-model="vm.unzipPath" /></div -->
<div><label>Web path</label> <input type="text" ng-model="vm.webPath" /></div>
<div ng-if="vm.uploadTotal"><span ng-bind="vm.uploadPercent">99</span>% | <span ng-bind="vm.uploadProgress">1</span> MiB / <span ng-bind="vm.uploadTotal">100</span> MiB</div>
<div><label>Web path</label> <input type="text" ng-model="vm.webPath" /></div>
</div>
</div>
</div>