Fix some issues
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
parent
4770ffed0d
commit
e4b21306b1
@ -2,7 +2,10 @@
|
|||||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||||
"dest": "../../dist/common",
|
"dest": "../../dist/common",
|
||||||
"lib": {
|
"lib": {
|
||||||
"entryFile": "src/public-api.ts"
|
"entryFile": "src/public-api.ts",
|
||||||
|
"umdModuleIds": {
|
||||||
|
"my-data": "my-data"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"whitelistedNonPeerDependencies": [
|
"whitelistedNonPeerDependencies": [
|
||||||
"."
|
"."
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<ul class="list-unstyled">
|
<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 }">
|
<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><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>
|
<div class="errormessage">{{file.errorMessage}}</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -10,7 +10,7 @@ import { AppConfig } from '../../shared/app.config';
|
|||||||
export class ResumableFileUploadService implements OnDestroy{
|
export class ResumableFileUploadService implements OnDestroy{
|
||||||
public files: Array<File> = new Array<File>();
|
public files: Array<File> = new Array<File>();
|
||||||
public isUploading = false;
|
public isUploading = false;
|
||||||
public totalProgress = "0";
|
public totalProgress = 0;
|
||||||
public isClosed = true;
|
public isClosed = true;
|
||||||
public isMinimized = false;
|
public isMinimized = false;
|
||||||
public parentCode: string;
|
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) {
|
handleState(state:UploadState) {
|
||||||
|
this.isUploading = true;
|
||||||
switch(state.status) {
|
switch(state.status) {
|
||||||
case "added": {
|
case "added": {
|
||||||
this.files.push(new File(state));
|
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;
|
};break;
|
||||||
case "uploading":
|
|
||||||
case "complete": {
|
case "complete": {
|
||||||
var file =this.files.find((f) => f.identifier == state.uploadId )
|
var file =this.files.find((f) => f.identifier == state.uploadId )
|
||||||
if(file) {
|
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;
|
};break;
|
||||||
}
|
}
|
||||||
|
this.refresh.next({});
|
||||||
}
|
}
|
||||||
|
|
||||||
addFiles = (files: any[], event: any, geoRefJson?: string, attributes?: any) => {
|
addFiles = (files: any[], event: any, geoRefJson?: string, attributes?: any) => {
|
||||||
@ -97,7 +123,7 @@ export class ResumableFileUploadService implements OnDestroy{
|
|||||||
export class File {
|
export class File {
|
||||||
private file: any;
|
private file: any;
|
||||||
public fileName: string;
|
public fileName: string;
|
||||||
public progress: string;
|
public progress: number;
|
||||||
public identifier: string;
|
public identifier: string;
|
||||||
public success: boolean;
|
public success: boolean;
|
||||||
public error: boolean;
|
public error: boolean;
|
||||||
@ -107,7 +133,7 @@ export class File {
|
|||||||
constructor(state: UploadState) {
|
constructor(state: UploadState) {
|
||||||
this.file = state;
|
this.file = state;
|
||||||
this.fileName = state.file.name;
|
this.fileName = state.file.name;
|
||||||
this.progress = (state.progress * 100) + '%';
|
this.progress = state.progress?state.progress:0;
|
||||||
this.identifier = state.uploadId;
|
this.identifier = state.uploadId;
|
||||||
this.success = false;
|
this.success = false;
|
||||||
this.error = false;
|
this.error = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user