mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-02-02 02:58:13 -05:00
Improve restore from online UI. Fix #422.
This commit is contained in:
parent
bf555dc568
commit
13cadab9fa
@ -1,5 +1,9 @@
|
||||
angular.module('omega').controller 'IoCtrl', ($scope, $rootScope,
|
||||
$window, omegaTarget) ->
|
||||
$window, $http, omegaTarget) ->
|
||||
|
||||
omegaTarget.state('web.restoreOnlineUrl').then (url) ->
|
||||
if url
|
||||
$scope.restoreOnlineUrl = url
|
||||
|
||||
$scope.exportOptions = ->
|
||||
$rootScope.applyOptionsConfirm().then ->
|
||||
@ -21,6 +25,7 @@ angular.module('omega').controller 'IoCtrl', ($scope, $rootScope,
|
||||
$scope.importSuccess()
|
||||
), -> $scope.restoreLocalError()).finally ->
|
||||
$scope.restoringLocal = false
|
||||
|
||||
$scope.restoreLocalError = ->
|
||||
$rootScope.showAlert(
|
||||
type: 'error'
|
||||
@ -37,15 +42,20 @@ angular.module('omega').controller 'IoCtrl', ($scope, $rootScope,
|
||||
angular.element('#restore-local-file').click()
|
||||
return
|
||||
$scope.restoreOnline = ->
|
||||
$.ajax(
|
||||
url: $scope.restoreOnlineUrl,
|
||||
success: (content) -> $scope.$apply ->
|
||||
$scope.restoreLocal(content)
|
||||
error: $scope.downloadError,
|
||||
dataType: "text",
|
||||
cache: false,
|
||||
omegaTarget.state('web.restoreOnlineUrl', $scope.restoreOnlineUrl)
|
||||
$scope.restoringOnline = true
|
||||
$http(
|
||||
method: 'GET'
|
||||
url: $scope.restoreOnlineUrl
|
||||
cache: false
|
||||
timeout: 10000
|
||||
)
|
||||
responseType: "text"
|
||||
).then(((result) ->
|
||||
$rootScope.resetOptions(result.data).then (->
|
||||
$scope.importSuccess()
|
||||
), -> $scope.restoreLocalError()
|
||||
), $scope.downloadError).finally ->
|
||||
$scope.restoringOnline = false
|
||||
|
||||
$scope.enableOptionsSync = (args) ->
|
||||
enable = ->
|
||||
|
@ -34,7 +34,8 @@ section.settings-group
|
||||
.input-group.width-limit
|
||||
input.form-control(type='url' ng-model='restoreOnlineUrl' placeholder="{{'options_restoreOnlinePlaceholder' | tr}}")
|
||||
span.input-group-btn
|
||||
button.btn.btn-default(ng-click='restoreOnline()') {{'options_restoreOnlineSubmit' | tr}}
|
||||
button.btn.btn-default(ng-click='restoreOnline()' ladda='restoringOnline' data-spinner-color="#000000")
|
||||
| {{'options_restoreOnlineSubmit' | tr}}
|
||||
section.settings-group
|
||||
h3 {{'options_group_syncing' | tr}}
|
||||
div(ng-show='syncOptions == "pristine" || syncOptions == "disabled"')
|
||||
|
Loading…
Reference in New Issue
Block a user