mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-02-08 13:38:14 -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,
|
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 = ->
|
$scope.exportOptions = ->
|
||||||
$rootScope.applyOptionsConfirm().then ->
|
$rootScope.applyOptionsConfirm().then ->
|
||||||
@ -21,6 +25,7 @@ angular.module('omega').controller 'IoCtrl', ($scope, $rootScope,
|
|||||||
$scope.importSuccess()
|
$scope.importSuccess()
|
||||||
), -> $scope.restoreLocalError()).finally ->
|
), -> $scope.restoreLocalError()).finally ->
|
||||||
$scope.restoringLocal = false
|
$scope.restoringLocal = false
|
||||||
|
|
||||||
$scope.restoreLocalError = ->
|
$scope.restoreLocalError = ->
|
||||||
$rootScope.showAlert(
|
$rootScope.showAlert(
|
||||||
type: 'error'
|
type: 'error'
|
||||||
@ -37,15 +42,20 @@ angular.module('omega').controller 'IoCtrl', ($scope, $rootScope,
|
|||||||
angular.element('#restore-local-file').click()
|
angular.element('#restore-local-file').click()
|
||||||
return
|
return
|
||||||
$scope.restoreOnline = ->
|
$scope.restoreOnline = ->
|
||||||
$.ajax(
|
omegaTarget.state('web.restoreOnlineUrl', $scope.restoreOnlineUrl)
|
||||||
url: $scope.restoreOnlineUrl,
|
$scope.restoringOnline = true
|
||||||
success: (content) -> $scope.$apply ->
|
$http(
|
||||||
$scope.restoreLocal(content)
|
method: 'GET'
|
||||||
error: $scope.downloadError,
|
url: $scope.restoreOnlineUrl
|
||||||
dataType: "text",
|
cache: false
|
||||||
cache: false,
|
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
)
|
responseType: "text"
|
||||||
|
).then(((result) ->
|
||||||
|
$rootScope.resetOptions(result.data).then (->
|
||||||
|
$scope.importSuccess()
|
||||||
|
), -> $scope.restoreLocalError()
|
||||||
|
), $scope.downloadError).finally ->
|
||||||
|
$scope.restoringOnline = false
|
||||||
|
|
||||||
$scope.enableOptionsSync = (args) ->
|
$scope.enableOptionsSync = (args) ->
|
||||||
enable = ->
|
enable = ->
|
||||||
|
@ -34,7 +34,8 @@ section.settings-group
|
|||||||
.input-group.width-limit
|
.input-group.width-limit
|
||||||
input.form-control(type='url' ng-model='restoreOnlineUrl' placeholder="{{'options_restoreOnlinePlaceholder' | tr}}")
|
input.form-control(type='url' ng-model='restoreOnlineUrl' placeholder="{{'options_restoreOnlinePlaceholder' | tr}}")
|
||||||
span.input-group-btn
|
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
|
section.settings-group
|
||||||
h3 {{'options_group_syncing' | tr}}
|
h3 {{'options_group_syncing' | tr}}
|
||||||
div(ng-show='syncOptions == "pristine" || syncOptions == "disabled"')
|
div(ng-show='syncOptions == "pristine" || syncOptions == "disabled"')
|
||||||
|
Loading…
Reference in New Issue
Block a user