Tarball the config and give it to the front end
Download file as blob to avoid binary string encoding
This commit is contained in:
parent
7619ab44e5
commit
aa93d698b2
8 changed files with 66 additions and 1677 deletions
File diff suppressed because it is too large
Load diff
|
@ -1630,9 +1630,9 @@
|
|||
</span>
|
||||
|
||||
<button class="btn btn-primary"
|
||||
ng-click="saveConfiguration()"
|
||||
ng-click="generateConfigTarball()"
|
||||
ng-disabled="savingConfiguration">
|
||||
<i class="fa fa-upload" style="margin-right: 10px;"></i>Save Configuration
|
||||
<i class="fa fa-upload" style="margin-right: 10px;"></i>Generate Configuration
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -413,12 +413,12 @@ angular.module("quay-config")
|
|||
}
|
||||
};
|
||||
|
||||
$scope.saveConfiguration = function() {
|
||||
$scope.generateConfigTarball = function() {
|
||||
$scope.savingConfiguration = true;
|
||||
|
||||
// Make sure to note that fully verified setup is completed. We use this as a signal
|
||||
// in the setup tool.
|
||||
$scope.config['SETUP_COMPLETE'] = true;
|
||||
// $scope.config['SETUP_COMPLETE'] = true;
|
||||
|
||||
var data = {
|
||||
'config': $scope.config,
|
||||
|
@ -432,9 +432,14 @@ angular.module("quay-config")
|
|||
authPassword = null;
|
||||
});
|
||||
|
||||
ApiService.scUpdateConfig(data).then(function(resp) {
|
||||
// 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) {
|
||||
authPassword = null;
|
||||
|
||||
FileSaver.saveAs(resp, 'quay-config.tar.gz');
|
||||
|
||||
$scope.savingConfiguration = false;
|
||||
$scope.mapped.$hasChanges = false;
|
||||
|
||||
|
|
|
@ -212,12 +212,20 @@ angular.module('quay-config').factory('ApiService', ['Restangular', '$q', 'UtilS
|
|||
var urlPath = path['x-path'];
|
||||
|
||||
// Add the operation itself.
|
||||
apiService[operationName] = function(opt_options, opt_parameters, opt_background, opt_forceget) {
|
||||
apiService[operationName] = function(opt_options, opt_parameters, opt_background, opt_forceget, opt_blobresp) {
|
||||
var one = Restangular.one(buildUrl(urlPath, opt_parameters));
|
||||
if (opt_background) {
|
||||
one.withHttpConfig({
|
||||
'ignoreLoadingBar': true
|
||||
});
|
||||
|
||||
if (opt_background || opt_blobresp) {
|
||||
let httpConfig = {};
|
||||
|
||||
if (opt_background) {
|
||||
httpConfig['ignoreLoadingBar'] = true;
|
||||
}
|
||||
if (opt_blobresp) {
|
||||
httpConfig['responseType'] = 'blob';
|
||||
}
|
||||
|
||||
one.withHttpConfig(httpConfig);
|
||||
}
|
||||
|
||||
var opObj = one[opt_forceget ? 'get' : 'custom' + method.toUpperCase()](opt_options);
|
||||
|
|
Reference in a new issue