Add the "Export device configuration" button instead of the export link. Make the button export JSON by default and BIN when pressed with Shift.

This commit is contained in:
László Monda
2018-03-29 18:44:09 +02:00
parent 2476049681
commit bf94370f2f
2 changed files with 11 additions and 3 deletions

View File

@@ -9,9 +9,9 @@
<ul class="list-unstyled btn-list"> <ul class="list-unstyled btn-list">
<li> <li>
Export device configuration in <button class="btn btn-default"
<span role="button" class="btn-link" (click)="saveConfigurationInJSONFormat()">JSON</span> or (click)="exportUserConfiguration($event)">Export device configuration
<span role="button" class="btn-link" (click)="saveConfigurationInBINFormat()">binary</span> format. </button>
</li> </li>
<li> <li>
<label class="btn btn-default btn-file"> <label class="btn btn-default btn-file">

View File

@@ -34,6 +34,14 @@ export class DeviceConfigurationComponent {
this.store.dispatch(new SaveUserConfigInBinaryFileAction()); this.store.dispatch(new SaveUserConfigInBinaryFileAction());
} }
exportUserConfiguration(event: MouseEvent) {
if (event.shiftKey) {
this.saveConfigurationInBINFormat();
} else {
this.saveConfigurationInJSONFormat();
}
}
changeFile(event): void { changeFile(event): void {
const files = event.srcElement.files; const files = event.srcElement.files;
const fileReader = new FileReader(); const fileReader = new FileReader();