clean new war file extension check
parent
b40c664bce
commit
8600eb5f3c
|
@ -25,7 +25,6 @@ export class CampaignService {
|
|||
return this.http.post(this.config.apiCampaignPath, campaign)
|
||||
.map(res => res.json());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
deleteCampaign(id: string) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<label for="log">Logfile</label>
|
||||
<input id="log" name="log" class="ui-button form-control" type="file"
|
||||
(change)="fileChange($event)">
|
||||
<span class="label label-bg label-danger center-block" style="font-size:small" *ngIf="showImageError">
|
||||
<span class="label label-bg label-danger center-block" style="font-size:small" *ngIf="showFileError">
|
||||
Logfile muss im Format RPT, LOG oder TXT vorliegen
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
@ -18,7 +18,9 @@ export class WarSubmitComponent {
|
|||
|
||||
fileList: FileList;
|
||||
|
||||
showImageError = false;
|
||||
readonly validExtensions = ['.rpt', '.log', '.txt'];
|
||||
|
||||
showFileError = false;
|
||||
|
||||
showErrorLabel = false;
|
||||
|
||||
|
@ -35,14 +37,13 @@ export class WarSubmitComponent {
|
|||
}
|
||||
|
||||
fileChange(event) {
|
||||
if (!event.target.files[0].name.endsWith('.rpt')
|
||||
&& !event.target.files[0].name.endsWith('.log')
|
||||
&& !event.target.files[0].name.endsWith('.txt')) {
|
||||
this.showImageError = true;
|
||||
this.fileList = undefined;
|
||||
} else {
|
||||
this.showImageError = false;
|
||||
if (this.validExtensions.filter(ext => event.target.files[0] &&
|
||||
event.target.files[0].name.endsWith(ext)).length == 1) {
|
||||
this.showFileError = false;
|
||||
this.fileList = event.target.files;
|
||||
} else {
|
||||
this.showFileError = true;
|
||||
this.fileList = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue