Create download modal following setup completion

This commit is contained in:
Sam Chow 2018-06-27 13:49:54 -04:00
parent aa93d698b2
commit 2d0a599aab
12 changed files with 142 additions and 52 deletions

View file

@ -1,7 +1,6 @@
<div class="config-setup-tool-element">
<div class="cor-loader" ng-if="!config"></div>
<div ng-show="true">
<!--<div ng-show="config && config['SUPER_USERS']">-->
<form id="configform" name="configform">
<!-- Custom SSL certificates -->
@ -1630,9 +1629,9 @@
</span>
<button class="btn btn-primary"
ng-click="generateConfigTarball()"
ng-click="saveConfiguration()"
ng-disabled="savingConfiguration">
<i class="fa fa-upload" style="margin-right: 10px;"></i>Generate Configuration
Next
</button>
</div>

View file

@ -27,7 +27,8 @@ angular.module("quay-config")
restrict: 'C',
scope: {
'isActive': '=isActive',
'configurationSaved': '&configurationSaved'
'configurationSaved': '&configurationSaved',
'setupCompleted': '&setupCompleted',
},
controller: function($rootScope, $scope, $element, $timeout, ApiService) {
var authPassword = null;
@ -413,7 +414,7 @@ angular.module("quay-config")
}
};
$scope.generateConfigTarball = function() {
$scope.saveConfiguration = function() {
$scope.savingConfiguration = true;
// Make sure to note that fully verified setup is completed. We use this as a signal
@ -432,20 +433,16 @@ angular.module("quay-config")
authPassword = null;
});
// We need to set the response type to 'blob', to ensure it's never encoded as a string
// (string encoded binary data can be difficult to transform with js)
// and to make it easier to save (FileSaver expects a blob)
ApiService.scGetConfigTarball(null, null, null, null, true).then(function(resp) {
ApiService.scUpdateConfig(data).then(function(resp) {
authPassword = null;
FileSaver.saveAs(resp, 'quay-config.tar.gz');
$scope.savingConfiguration = false;
$scope.mapped.$hasChanges = false;
$('#validateAndSaveModal').modal('hide');
$scope.configurationSaved({'config': $scope.config});
// $scope.configurationSaved({'config': $scope.config});
$scope.setupCompleted();
}, errorDisplay);
};