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:
Sam Chow 2018-06-28 13:45:26 -04:00
parent 2d0a599aab
commit db757edcd2
9 changed files with 70 additions and 37 deletions

View file

@ -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 {

View file

@ -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);
}