initial import for Open Source 🎉
This commit is contained in:
parent
1898c361f3
commit
9c0dd3b722
2048 changed files with 218743 additions and 0 deletions
|
@ -0,0 +1,37 @@
|
|||
<div>
|
||||
<div class="co-dialog modal fade initial-setup-modal in" id="setupModal" style="display: block;">
|
||||
<div class="modal-backdrop fade in" style="height: 1000px;"></div>
|
||||
<div class="modal-dialog fade in">
|
||||
<div class="modal-content">
|
||||
<!-- Header -->
|
||||
<div class="modal-header">
|
||||
<span class="cor-step-bar">
|
||||
<span class="cor-step active" title="Configure Database" text="1"></span>
|
||||
<span class="cor-step" title="Setup Database" icon="database"></span>
|
||||
<span class="cor-step" title="Create Superuser" text="2"></span>
|
||||
<span class="cor-step" title="Configure Registry" text="3"></span>
|
||||
<span class="cor-step" title="Validate Configuration" text="4"></span>
|
||||
<span class="cor-step" title="Setup Complete" icon="download"></span>
|
||||
</span>
|
||||
<h4 class="modal-title"><span>Load Config</span></h4>
|
||||
</div>
|
||||
<!-- Body -->
|
||||
<div class="modal-body">
|
||||
<span>Please upload the previous configuration</span>
|
||||
<div class="file-upload-box"
|
||||
api-endpoint="configapp/tarconfig"
|
||||
select-message="Select a previous configuration to modify. Must be in tar.gz format"
|
||||
files-selected="$ctrl.handleTarballSelected(files, callback)"
|
||||
files-cleared="$ctrl.handleFilesCleared()"
|
||||
files-validated="$ctrl.tarballValidatedByUploadBox(files, uploadFiles)"
|
||||
extensions="['application/gzip', '.gz']"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" ng-click="$ctrl.uploadTarball()" ng-disabled="!$ctrl.readyToSubmit">
|
||||
Upload Configuration
|
||||
</button>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,58 @@
|
|||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Inject,
|
||||
Output,
|
||||
} from 'ng-metadata/core';
|
||||
const templateUrl = require('./load-config.component.html');
|
||||
|
||||
declare var bootbox: any;
|
||||
|
||||
@Component({
|
||||
selector: 'load-config',
|
||||
templateUrl,
|
||||
})
|
||||
export class LoadConfigComponent {
|
||||
private readyToSubmit: boolean = false;
|
||||
private uploadFunc: Function;
|
||||
@Output() public configLoaded: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
private handleTarballSelected(files: File[], callback: Function) {
|
||||
this.readyToSubmit = true;
|
||||
callback(true)
|
||||
}
|
||||
|
||||
private handleTarballCleared() {
|
||||
this.readyToSubmit = false;
|
||||
}
|
||||
|
||||
private uploadTarball() {
|
||||
this.uploadFunc(success => {
|
||||
if (success) {
|
||||
this.configLoaded.emit({});
|
||||
} else {
|
||||
bootbox.dialog({
|
||||
"message": 'Could not upload configuration. Please check you have provided a valid tar file' +
|
||||
'If this problem persists, please contact support',
|
||||
"title": 'Error Loading Configuration',
|
||||
"buttons": {
|
||||
"close": {
|
||||
"label": "Close",
|
||||
"className": "btn-primary"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* When files are validated, this is called by the child to give us
|
||||
* the callback function to upload
|
||||
* @param files: files to upload
|
||||
* @param uploadFiles: function to call to upload files
|
||||
*/
|
||||
private tarballValidatedByUploadBox(files, uploadFiles) {
|
||||
this.uploadFunc = uploadFiles;
|
||||
}
|
||||
}
|
Reference in a new issue