From c800bda2f88d2ac9f37b2185e49faf8a113968a9 Mon Sep 17 00:00:00 2001 From: guochuyicmri Date: Thu, 16 May 2019 16:53:08 +0800 Subject: Package management interface development Change-Id: Ic77ca7d4c7fca3b165adce0ea4036e4054ef755e Issue-ID: USECASEUI-211 Signed-off-by: guochuyicmri --- .../onboard-vnf-vm/onboard-vnf-vm.component.html | 153 +++++++-------------- .../onboard-vnf-vm/onboard-vnf-vm.component.less | 10 +- .../onboard-vnf-vm/onboard-vnf-vm.component.ts | 113 ++++++++++++++- 3 files changed, 173 insertions(+), 103 deletions(-) (limited to 'usecaseui-portal/src/app/services/onboard-vnf-vm') diff --git a/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.html b/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.html index 1a76a726..31307abf 100644 --- a/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.html +++ b/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.html @@ -18,7 +18,7 @@
-
+

@@ -34,46 +34,29 @@

-
-
{{"i18nTextDefine_Uploaded_files" | translate}}
-
-
111
-
pnf-test.csar
+
{{"i18nTextDefine_Uploaded_files" | translate}}
+
+
- +
-
456
-
-
-
111
-
pnf-test.csar
-
- +
{{itemns.name}}
+
+ +
+
+ {{"i18nTextDefine_File_upload_completed" | translate}} + {{"i18nTextDefine_File_upload_failed" | translate}} +
+
+ +
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
- +
+

@@ -160,45 +144,29 @@

-
-
Uploaded files
-
-
111
-
pnf-test.csar
+
{{"i18nTextDefine_Uploaded_files" | translate}}
+
+
- +
-
456
-
-
-
111
-
pnf-test.csar
-
- +
{{itemns.name}}
+
+ +
+
+ {{"i18nTextDefine_File_upload_completed" | translate}} + {{"i18nTextDefine_File_upload_failed" | translate}} +
+
+ +
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
- +
+
+

@@ -272,45 +241,29 @@

-
-
Uploaded files
-
-
111
-
pnf-test.csar
+
{{"i18nTextDefine_Uploaded_files" | translate}}
+
+
- +
-
456
-
-
-
111
-
pnf-test.csar
-
- +
{{itemns.name}}
+
+ +
+
+ {{"i18nTextDefine_File_upload_completed" | translate}} + {{"i18nTextDefine_File_upload_failed" | translate}} +
+
+ +
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
-
-
-
111
-
pnf-test.csar
-
{{"i18nTextDefine_File_upload_completed" | translate}}
-
456
- +
+
{ this.fileListNS.push(file); - console.log('beforeUpload'); - console.log('fileListNS' + this.fileListNS); + console.log('beforeUpload'); + console.log(this.fileListNS.length); console.log('fileListNS' + JSON.stringify(this.fileListNS)); this.myhttp.getCreatensData("createNetworkServiceData",this.requestBody)//on-line // this.myhttp.getCreatensData("creatensDataNS") //local @@ -229,6 +230,12 @@ export class OnboardVnfVmComponent implements OnInit { } } + nsRightList = []; + nsNum=0; + vnfRightList = []; + vnfNum=0; + pnfRightList = []; + pnfNum=0; //put Upload Upload handleUpload(url,tab): void { console.log('startUpload') @@ -240,18 +247,84 @@ export class OnboardVnfVmComponent implements OnInit { formData.append('file', file); }); this.nsuploading = true; + let lastNs = this.fileListNS[this.fileListNS.length-1]; + let nsfile={ + name:lastNs.name, + uid:lastNs.uid, + progress:0, + status:true, + success:0 + }; + this.nsNum+=1; + this.nsRightList.push(nsfile); + let requeryNs = (nsfile) => { + setTimeout(() => { + nsfile.progress+=2; + if (nsfile.progress < 100) { + requeryNs(nsfile) + } else { + nsfile.progress = 100; + nsfile.status = false; + } + }, 100) + }; + requeryNs(nsfile); break case "VNF": this.fileListVNF.forEach((file: any) => { formData.append('file', file); }); this.vnfuploading = true; + let lastVnf = this.fileListVNF[this.fileListVNF.length-1]; + let vnffile={ + name:lastVnf.name, + uid:lastVnf.uid, + progress:0, + status:true, + success:0 + }; + this.vnfNum+=1; + this.vnfRightList.push(vnffile); + let requeryVnf = (vnffile) => { + setTimeout(() => { + vnffile.progress+=2; + if (vnffile.progress < 100) { + requeryVnf(vnffile) + } else { + vnffile.progress = 100; + vnffile.status = false; + } + }, 100) + }; + requeryVnf(vnffile); break case "PNF": this.fileListPNF.forEach((file: any) => { formData.append('file', file); }); this.pnfloading = true; + let lastPnf = this.fileListPNF[this.fileListPNF.length-1]; + let pnffile={ + name:lastPnf.name, + uid:lastPnf.uid, + progress:0, + status:true, + success:0 + }; + this.pnfNum+=1; + this.pnfRightList.push(pnffile); + let requeryPnf = (pnffile) => { + setTimeout(() => { + pnffile.progress+=2; + if (pnffile.progress < 100) { + requeryPnf(pnffile) + } else { + pnffile.progress = 100; + pnffile.status = false; + } + }, 100) + }; + requeryPnf(pnffile); break } @@ -277,11 +350,47 @@ export class OnboardVnfVmComponent implements OnInit { .pipe(filter(e => e instanceof HttpResponse)) .subscribe( (event: {}) => { + if(tab =="NS"){ + console.log(this.nsRightList[this.nsNum-1],"this.nsRightList") + this.nsRightList[this.nsNum-1].progress = 100; + this.nsRightList[this.nsNum-1].status = false; + this.nsRightList[this.nsNum-1].success=0; + } + if(tab =="VNF"){ + console.log(this.vnfRightList[this.vnfNum-1],"this.vnfRightList") + this.vnfRightList[this.vnfNum-1].progress = 100; + this.vnfRightList[this.vnfNum-1].status = false; + this.vnfRightList[this.vnfNum-1].success=0; + } + if(tab =="PNF"){ + console.log(this.pnfRightList[this.pnfNum-1],"this.pnfRightList") + this.pnfRightList[this.pnfNum-1].progress = 100; + this.pnfRightList[this.pnfNum-1].status = false; + this.pnfRightList[this.pnfNum-1].success=0; + } this.changeUploadingSta(tab) console.log('upload successfully') this.msg.success('upload successfully.'); }, err => { + if(tab =="NS"){ + console.log(this.nsRightList[this.nsNum-1]) + this.nsRightList[this.nsNum-1].progress = 100; + this.nsRightList[this.nsNum-1].status = false; + this.nsRightList[this.nsNum-1].success=1; + } + if(tab =="VNF"){ + console.log(this.vnfRightList[this.vnfNum-1],"this.vnfRightList") + this.vnfRightList[this.vnfNum-1].progress = 100; + this.vnfRightList[this.vnfNum-1].status = false; + this.vnfRightList[this.vnfNum-1].success=1; + } + if(tab =="PNF"){ + console.log(this.pnfRightList[this.pnfNum-1],"this.pnfRightList") + this.pnfRightList[this.pnfNum-1].progress = 100; + this.pnfRightList[this.pnfNum-1].status = false; + this.pnfRightList[this.pnfNum-1].success=1; + } this.changeUploadingSta(tab) console.log('upload failed') this.msg.error('upload failed.'); -- cgit 1.2.3-korg