more user feedback while uploading update.sh file

pull/827/merge^2
Adrian Batzill 2020-06-20 10:11:49 +02:00
rodzic dd1dae0389
commit 9c14cf3499
2 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -238,6 +238,8 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
}
fd.append("update_file", file);
$scope.uploading_update = true;
$scope.$apply();
$http.post(URL_UPDATE_UPLOAD, fd, {
withCredentials: true,
@ -247,11 +249,14 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
transformRequest: angular.identity
}).success(function (data) {
alert("success. wait 5 minutes and refresh home page to verify new version.");
$scope.uploading_update = false;
$scope.$apply();
window.location.replace("/");
}).error(function (data) {
$scope.uploading_update = false;
$scope.$apply();
alert("error");
});
};
$scope.setOrientation = function(action) {

Wyświetl plik

@ -31,17 +31,21 @@
<div class="panel-body">
<!-- Upload. Temporary. -->
<div class="col-xs-12">
<span ng-show="update_files == ''">
<span ng-show="update_files == '' && !uploading_update"> <!-- default: offer file selection -->
<span style="position:relative; overflow: hidden;">
<span class="fake-btn fake-btn-block">Click to select System Update file</span>
<input style="opacity:0.0; position: absolute; top: 0; right: 0;" class="col-xs-12" type="file" name="update_file"
onchange="angular.element(this).scope().setUploadFile(this.files)"/>
</span>
</span>
<span ng-hide="update_files == ''">
<span ng-show="update_files != '' && !uploading_update"> <!-- once selected, btn to upload -->
<button class="btn btn-block" onclick="angular.element(this).scope().uploadFile()">
Install {{update_files[0].name}}</button>
</span>
<span ng-show="update_files != '' && uploading_update"> <!-- "uploading.." -->
<button class="btn btn-block">
Uploading {{update_files[0].name}}. Please wait...</button>
</span>
</div>
<div class="form-group reset-flow">
<div class="col-xs-12">