diff --git a/res/app/control-panes/dashboard/upload/upload-controller.js b/res/app/control-panes/dashboard/upload/upload-controller.js index 0aebea31..427d7fc8 100644 --- a/res/app/control-panes/dashboard/upload/upload-controller.js +++ b/res/app/control-panes/dashboard/upload/upload-controller.js @@ -63,6 +63,50 @@ module.exports = function UploadCtrl($scope, $rootScope, SettingsService, gettex }) } + $scope.taskFinished = function () { + if ($scope.installEnabled) { + if ($scope.upload && $scope.upload.settled && + $scope.installation && $scope.installation.settled) { + return true + } + } else { + if ($scope.upload && $scope.upload.settled) { + return true + } + } + return false + } + + $scope.taskProgressMax = function () { + return $scope.taskProgressMaxDivisor() * 100 + } + + $scope.taskProgressMaxDivisor = function () { + if ($scope.installEnabled) { + return 2 + } else { + return 1 + } + } + + $scope.taskProgress = function () { + if ($scope.installEnabled) { + var sum = 0 + if ($scope.upload) { + sum += $scope.upload.progress + } + if ($scope.installation) { + sum += $scope.installation.progress + } + return sum + } else { + if ($scope.upload) { + return $scope.upload.progress + } + } + return 0 + } + // // $scope.installEnabled = true // SettingsService.bind($scope, { diff --git a/res/app/control-panes/dashboard/upload/upload.jade b/res/app/control-panes/dashboard/upload/upload.jade index 837adbf0..b802fee2 100644 --- a/res/app/control-panes/dashboard/upload/upload.jade +++ b/res/app/control-panes/dashboard/upload/upload.jade @@ -33,24 +33,22 @@ span employee: {{node.name}} age {{node.age}} pre(ng-if='upload.error') Error: {{ upload.error }} - - .upload-status(ng-if='upload && !upload.settled') - - div(ng-switch='upload.lastData') - strong(ng-switch-when='uploading') - span(translate) Uploading... - strong(ng-switch-when='processing') - span(translate) Processing... - strong(ng-switch-when='storing') - span(translate) Storing... + p(translate) Error + div(ng-switch='upload.error') + strong(ng-switch-when='fail_invalid_app_file') + span(translate) Uploaded file is not valid + strong(ng-switch-when='fail_download') + span(translate) Failed to download file + strong(ng-switch-when='fail_invalid_url') + span(translate) Cannot access specified URL strong(ng-switch-when='fail') span(translate) Upload failed - span(ng-hide='upload.settled') ({{upload.progress}}%) + //.upload-status(ng-if='upload && !upload.settled') progressbar(max='100', value='upload.progress', ng-if='!upload.settled', ng-class='{"active": !upload.settled}').progress-striped - .upload-status(ng-if='installation') + .upload-status(ng-if='upload || installation') accordion(close-others='false') accordion-group(is-open='true') @@ -63,28 +61,37 @@ i.fa.fa-trash-o span(translate) Uninstall - div(ng-switch='installation.lastData') - strong(ng-switch-when='pushing_app') - span(translate) Pushing app... - strong(ng-switch-when='installing_app') - span(translate) Installing app... - strong(ng-switch-when='launching_app') - span(translate) Launching activity... - strong(ng-switch-when='success') + div + span(ng-switch='upload.lastData') + strong(ng-switch-when='uploading') + span(translate) Uploading... + strong(ng-switch-when='processing') + span(translate) Processing... + strong(ng-switch-when='storing') + span(translate) Storing... + strong(ng-switch-when='fail') + span(translate) Upload failed - div(ng-include='"control-panes/dashboard/upload/activities/activities.jade"') + span(ng-switch='installation.lastData') + strong(ng-switch-when='pushing_app') + span(translate) Pushing app... + strong(ng-switch-when='installing_app') + span(translate) Installing app... + strong(ng-switch-when='launching_app') + span(translate) Launching activity... + strong(ng-switch-when='success') - button.btn.btn-sm.btn-primary-outline(btn-checkbox, ng-model='showManifest') - i.fa.fa-list - span(ng-if='showManifest') Hide Manifest - span(ng-if='!showManifest') Show Manifest - pre.manifest-text(ng-if='showManifest') {{ installation.manifest | json }} + div(ng-include='"control-panes/dashboard/upload/activities/activities.jade"') + button.btn.btn-sm.btn-primary-outline(btn-checkbox, ng-model='showManifest') + i.fa.fa-list + span(ng-if='showManifest') Hide Manifest + span(ng-if='!showManifest') Show Manifest + pre.manifest-text(ng-if='showManifest') {{ installation.manifest | json }} + strong(ng-switch-when='fail') + span(translate) Installation failed + span(ng-hide='taskFinished()') ({{taskProgress()/taskProgressMaxDivisor()}}%) - strong(ng-switch-when='fail') - span(translate) Installation failed - span(ng-hide='installation.settled') ({{installation.progress}}%) - - progressbar(max='100', value='installation.progress', ng-if='!installation.settled', - ng-class='{"active": !installation.settled}').progress-striped + progressbar(max='taskProgressMax()', value='taskProgress()', ng-if='!taskFinished()', + ng-class='{"active": taskFinished()}').progress-striped