Fix some issues
FarmMaps.Develop/FarmMapsLib/develop This commit looks good Details

pull/1/head
Willem Dantuma 2019-07-19 09:36:05 +02:00
parent 4770ffed0d
commit e4b21306b1
3 changed files with 36 additions and 7 deletions

View File

@ -2,7 +2,10 @@
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/common",
"lib": {
"entryFile": "src/public-api.ts"
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"my-data": "my-data"
}
},
"whitelistedNonPeerDependencies": [
"."

View File

@ -11,7 +11,7 @@
<ul class="list-unstyled">
<li *ngFor="let file of uploadService.files" class="upload-file busy" [ngClass]="{'done': file.success,'busy':file.success == false,'error': file.error }">
<div><span class="file-name" [attr.title]="file?.fileName">{{file.fileName}}</span><span class="fa fa-times" title="Cancel" (click)="uploadService.cancelFile(file)"></span><span class="fa fa-check"></span></div>
<div class="progress-container"><div class="progress-bar" [style.width]="file.progress"></div></div>
<div class="progress-container"><div class="progress-bar" [style.width]="file.progress+'%'"></div></div>
<div class="errormessage">{{file.errorMessage}}</div>
</li>
</ul>

View File

@ -10,7 +10,7 @@ import { AppConfig } from '../../shared/app.config';
export class ResumableFileUploadService implements OnDestroy{
public files: Array<File> = new Array<File>();
public isUploading = false;
public totalProgress = "0";
public totalProgress = 0;
public isClosed = true;
public isMinimized = false;
public parentCode: string;
@ -38,19 +38,45 @@ export class ResumableFileUploadService implements OnDestroy{
}
}
updatetotalprogress() {
var totalProgress =0;
for(var i =0;i<this.files.length;i++) {
totalProgress+=this.files[i].progress;
}
this.totalProgress=totalProgress/this.files.length;
}
handleState(state:UploadState) {
this.isUploading = true;
switch(state.status) {
case "added": {
this.files.push(new File(state));
this.isClosed=false;
};break;
case "uploading": {
var file =this.files.find((f) => f.identifier == state.uploadId )
if(file) {
file.progress = (state.progress?state.progress:0);
this.updatetotalprogress();
}
};break;
case "uploading":
case "complete": {
var file =this.files.find((f) => f.identifier == state.uploadId )
if(file) {
file.progress = (state.progress * 100) + '%';
file.progress = (state.progress?state.progress:0);
this.updatetotalprogress();
}
file.success=true;
};break;
case "error": {
var file =this.files.find((f) => f.identifier == state.uploadId )
if(file) {
file.error=true;
file.errorMessage = state.response;
}
};break;
}
this.refresh.next({});
}
addFiles = (files: any[], event: any, geoRefJson?: string, attributes?: any) => {
@ -97,7 +123,7 @@ export class ResumableFileUploadService implements OnDestroy{
export class File {
private file: any;
public fileName: string;
public progress: string;
public progress: number;
public identifier: string;
public success: boolean;
public error: boolean;
@ -107,7 +133,7 @@ export class File {
constructor(state: UploadState) {
this.file = state;
this.fileName = state.file.name;
this.progress = (state.progress * 100) + '%';
this.progress = state.progress?state.progress:0;
this.identifier = state.uploadId;
this.success = false;
this.error = false;