Add writing config to file, modal for validation
This commit is contained in:
parent
c7513199df
commit
8aa18a29a8
4 changed files with 43 additions and 44 deletions
|
@ -1,10 +1,7 @@
|
|||
import { Input, Component, Inject } from 'ng-metadata/core';
|
||||
import { Component, Inject } from 'ng-metadata/core';
|
||||
const templateUrl = require('./load-config.html');
|
||||
const styleUrl = require('./load-config.css');
|
||||
|
||||
declare let bootbox: any;
|
||||
declare let window: any;
|
||||
|
||||
@Component({
|
||||
selector: 'load-config',
|
||||
templateUrl,
|
||||
|
@ -13,6 +10,7 @@ declare let window: any;
|
|||
export class LoadConfigComponent {
|
||||
private isReady: boolean = false;
|
||||
private uploadFunc: Function;
|
||||
private state: 'load' | 'validate' = 'load';
|
||||
|
||||
private constructor(@Inject('ApiService') private apiService: any) {
|
||||
}
|
||||
|
@ -27,9 +25,14 @@ export class LoadConfigComponent {
|
|||
}
|
||||
|
||||
private uploadTarball() {
|
||||
this.uploadFunc(resp => {
|
||||
console.log('hi')
|
||||
console.log(resp)
|
||||
this.uploadFunc(success => {
|
||||
if (success) {
|
||||
this.state = 'validate';
|
||||
}
|
||||
else {
|
||||
this.apiService.errorDisplay('Could not upload configuration. Please reload the page and try again.\n' +
|
||||
'If this problem persists, please contact support')();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -42,6 +45,4 @@ export class LoadConfigComponent {
|
|||
private filesValidated(files, uploadFiles) {
|
||||
this.uploadFunc = uploadFiles;
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in a new issue