Create transient config provider, temp dir logic
Allows us to have a new config provider for each setup, with no overlap of the directories used, and automatic cleanup of those directories.
This commit is contained in:
parent
2d0a599aab
commit
db757edcd2
9 changed files with 70 additions and 37 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Component } from 'ng-metadata/core';
|
||||
import { Component, Inject } from 'ng-metadata/core';
|
||||
const templateUrl = require('./config-setup-app.component.html');
|
||||
|
||||
/**
|
||||
|
@ -17,12 +17,18 @@ export class ConfigSetupAppComponent {
|
|||
|
||||
private loadedConfig = false;
|
||||
|
||||
constructor() {
|
||||
constructor(@Inject('ApiService') private apiService) {
|
||||
this.state = 'choice';
|
||||
}
|
||||
|
||||
private chooseSetup(): void {
|
||||
this.state = 'setup';
|
||||
this.apiService.scStartNewConfig()
|
||||
.then(() => {
|
||||
this.state = 'setup';
|
||||
})
|
||||
.catch(this.apiService.errorDisplay(
|
||||
'Could not initialize new setup. Please report this error'
|
||||
));
|
||||
}
|
||||
|
||||
private chooseLoad(): void {
|
||||
|
|
|
@ -27,7 +27,7 @@ export class DownloadTarballModalComponent {
|
|||
// 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)
|
||||
this.ApiService.scGetConfigTarball(null, null, null, null, true).then(function(resp) {
|
||||
this.ApiService.scGetConfigTarball(null, null, null, null, 'blob').then(function(resp) {
|
||||
FileSaver.saveAs(resp, 'quay-config.tar.gz');
|
||||
}, errorDisplay);
|
||||
}
|
||||
|
|
|
@ -417,10 +417,6 @@ angular.module("quay-config")
|
|||
$scope.saveConfiguration = 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;
|
||||
|
||||
var data = {
|
||||
'config': $scope.config,
|
||||
'hostname': window.location.host,
|
||||
|
@ -441,7 +437,6 @@ angular.module("quay-config")
|
|||
|
||||
$('#validateAndSaveModal').modal('hide');
|
||||
|
||||
// $scope.configurationSaved({'config': $scope.config});
|
||||
$scope.setupCompleted();
|
||||
}, errorDisplay);
|
||||
};
|
||||
|
|
|
@ -212,17 +212,17 @@ 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, opt_blobresp) {
|
||||
apiService[operationName] = function(opt_options, opt_parameters, opt_background, opt_forceget, opt_responseType) {
|
||||
var one = Restangular.one(buildUrl(urlPath, opt_parameters));
|
||||
|
||||
if (opt_background || opt_blobresp) {
|
||||
if (opt_background || opt_responseType) {
|
||||
let httpConfig = {};
|
||||
|
||||
if (opt_background) {
|
||||
httpConfig['ignoreLoadingBar'] = true;
|
||||
}
|
||||
if (opt_blobresp) {
|
||||
httpConfig['responseType'] = 'blob';
|
||||
if (opt_responseType) {
|
||||
httpConfig['responseType'] = opt_responseType;
|
||||
}
|
||||
|
||||
one.withHttpConfig(httpConfig);
|
||||
|
|
Reference in a new issue