aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/mod_import_progress.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2021-10-01 17:09:36 +0200
committerMario Vavti <mario@mariovavti.com>2021-10-01 17:09:36 +0200
commitb1eaa810ce37e4af88fdb41f0067b56f8725ef31 (patch)
tree7111312baf4f5b25f0ba968776b348fc33b47097 /view/js/mod_import_progress.js
parent6ed160e4fa05e880bc81720b626f2bdc68a20db8 (diff)
downloadvolse-hubzilla-b1eaa810ce37e4af88fdb41f0067b56f8725ef31.tar.gz
volse-hubzilla-b1eaa810ce37e4af88fdb41f0067b56f8725ef31.tar.bz2
volse-hubzilla-b1eaa810ce37e4af88fdb41f0067b56f8725ef31.zip
improve channel import progress page
Diffstat (limited to 'view/js/mod_import_progress.js')
-rw-r--r--view/js/mod_import_progress.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/view/js/mod_import_progress.js b/view/js/mod_import_progress.js
new file mode 100644
index 000000000..69e4c5242
--- /dev/null
+++ b/view/js/mod_import_progress.js
@@ -0,0 +1,64 @@
+$(document).ready(function() {
+
+ console.log('import_progress');
+
+ setInterval(get_progress, 5000);
+
+
+ function get_progress(){
+ console.log('get');
+
+ $.get('import_progress', function(data) {
+ update_progress(data);
+ });
+ }
+
+ function update_progress(data){
+ console.log('update');
+ console.log(data);
+ console.log(data.cprogress);
+ console.log(data.fprogress);
+
+
+ if (typeof data.cprogress == 'number') {
+ $('#cprogress-label').html(data.cprogress + '%');
+ $('#cprogress-bar').css('width', data.cprogress + '%');
+
+ if (data.cprogress == 100) {
+ $('#cprogress-resume').addClass('d-none');
+ $('#cprogress-complete').removeClass('d-none');
+ $('#cprogress-bar').removeClass('progress-bar-animated');
+ }
+ else if (data.cprogress < 100) {
+ $('#cprogress-resume').removeClass('d-none');
+ $('#cprogress-complete').addClass('d-none');
+ $('#cprogress-bar').addClass('progress-bar-animated');
+ }
+ }
+ else {
+ $('#cprogress-label').html(data.cprogress);
+ $('#cprogress-bar').css('width', '0%');
+
+ }
+
+ if (typeof data.fprogress == 'number') {
+ $('#fprogress-label').html(data.fprogress + '%');
+ $('#fprogress-bar').css('width', data.fprogress + '%');
+
+ if (data.fprogress == 100) {
+ $('#fprogress-resume').addClass('d-none');
+ $('#fprogress-complete').removeClass('d-none');
+ $('#fprogress-bar').removeClass('progress-bar-animated');
+ }
+ else if (data.fprogress < 100) {
+ $('#fprogress-resume').removeClass('d-none');
+ $('#fprogress-complete').addClass('d-none');
+ $('#fprogress-bar').addClass('progress-bar-animated');
+ }
+ }
+ else {
+ $('#fprogress-label').html(data.fprogress);
+ $('#fprogress-bar').css('width', '0%');
+ }
+ }
+});