AW-6046 Angular improvement
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Injectable, OnDestroy } from '@angular/core';
|
||||
import { OAuthService } from 'angular-oauth2-oidc';
|
||||
import { Subject , Subscription } from 'rxjs';
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { UploadxService, UploadState,UploadxOptions} from 'ngx-uploadx';
|
||||
import { UploadState, UploadxOptions, UploadxService } from 'ngx-uploadx';
|
||||
import { Subject, Subscription } from 'rxjs';
|
||||
import { AppConfig } from '../../shared/app.config';
|
||||
|
||||
|
||||
@@ -19,7 +18,7 @@ export class ResumableFileUploadService implements OnDestroy{
|
||||
private _eventSub:Subscription;
|
||||
private initialized = false;
|
||||
|
||||
constructor(private httpClient: HttpClient,private oauthService: OAuthService,private uploadService: UploadxService,public appConfig: AppConfig) {
|
||||
constructor(private oauthService: OAuthService,private uploadService: UploadxService,public appConfig: AppConfig) {
|
||||
|
||||
}
|
||||
|
||||
@@ -41,11 +40,9 @@ export class ResumableFileUploadService implements OnDestroy{
|
||||
|
||||
updatetotalprogress() {
|
||||
let totalProgress =0;
|
||||
let n=0;
|
||||
for(let i =0;i<this.files.length;i++) {
|
||||
if(!this.files[i].error) {
|
||||
totalProgress+=this.files[i].progress;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
this.totalProgress=totalProgress/this.files.length;
|
||||
@@ -86,7 +83,7 @@ export class ResumableFileUploadService implements OnDestroy{
|
||||
this.refresh.next({});
|
||||
}
|
||||
|
||||
addFiles = (files: any[], event: any, metadata:any) => {
|
||||
addFiles = (files: any[], _event: any, metadata:any) => {
|
||||
for (const f of files) {
|
||||
const options:UploadxOptions = {metadata:metadata};
|
||||
this.uploadService.handleFiles(f,options);
|
||||
@@ -133,7 +130,6 @@ export class ResumableFileUploadService implements OnDestroy{
|
||||
}
|
||||
|
||||
export class File {
|
||||
private file: any;
|
||||
public fileName: string;
|
||||
public progress: number;
|
||||
public identifier: string;
|
||||
@@ -142,9 +138,7 @@ export class File {
|
||||
public error: boolean;
|
||||
public errorMessage: string;
|
||||
|
||||
|
||||
constructor(state: UploadState) {
|
||||
this.file = state;
|
||||
this.fileName = state.file.name;
|
||||
this.progress = state.progress?state.progress:0;
|
||||
this.identifier = state.uploadId;
|
||||
|
||||
Reference in New Issue
Block a user