From 39e90e7d7b9c1739d705b6acf497670e82771e26 Mon Sep 17 00:00:00 2001 From: zhangab Date: Thu, 15 Nov 2018 18:36:12 +0800 Subject: Support NS Package Upload for VF-C Change-Id: If5c9e4d2de4d552805a74e9225a416bacdcbd354 Issue-ID: USECASEUI-156 Signed-off-by: zhangab --- usecaseui-portal/src/app/onboard.service.ts | 46 ++++++------ .../onboard-vnf-vm/onboard-vnf-vm.component.html | 18 +++-- .../onboard-vnf-vm/onboard-vnf-vm.component.ts | 85 +++++++++++++--------- 3 files changed, 83 insertions(+), 66 deletions(-) (limited to 'usecaseui-portal/src/app') diff --git a/usecaseui-portal/src/app/onboard.service.ts b/usecaseui-portal/src/app/onboard.service.ts index dfcd12f8..83ae6394 100644 --- a/usecaseui-portal/src/app/onboard.service.ts +++ b/usecaseui-portal/src/app/onboard.service.ts @@ -50,31 +50,31 @@ export class onboardService { //--------------------------------------------------------------------------------------- /* line up 线上*/ baseUrl = "/api/usecaseui-server/v1/uui-lcm/"; - // baseUrlUp = "/api/usecaseui/server/v1/"; url = { // 数据列表Data onboardTableData: this.baseUrl + "ns-packages", onboardDataVNF: this.baseUrl + "vnf-packages", onboardDataPNF: this.baseUrl + "pnf-packages", - //ns sdc + //ns sdc sdc_nsListData: this.baseUrl + "sdc-ns-packages", // GET - // vnf sdc + // vnf sdc sdc_vnfListData: this.baseUrl + "sdc-vf-packages", // GET - // createnspackages ? TODO - creatensData: this.baseUrl + "createNetworkServiceData", //POST - - // onboard ns sdc data - onboardNs: this.baseUrl + "ns-packages", //POST - //onboard VNF sdc data - onboardVNF: this.baseUrl + "vf-packages", //POST - - //Delete ns package - deleteNspack: this.baseUrl + "deleteNsdPackage?nsdInfoId=", - // Delete Vnf vfc package - deleteVnfPack: this.baseUrl + "deleteVnfPackage?vnfPkgId=", - // Delete Pnf package - deletePnfPack: this.baseUrl + "deletePnfPackage?pnfPkgId=", + // createnspackages ? TODO + creatensData: this.baseUrl + "_jsonData", //POST + + // onboard ns sdc data + onboardNs: this.baseUrl + "ns-packages", //POST + //onboard VNF sdc data + onboardVNF: this.baseUrl + "vf-packages", //POST + + //Delete ns package + deleteNspack: this.baseUrl + "deleteNsdPackage?nsdInfoId=", + // Delete Vnf vfc package + deleteVnfPack: this.baseUrl + "deleteVnfPackage?vnfPkgId=", + // Delete Pnf package + deletePnfPack: this.baseUrl + "deletePnfPackage?pnfPkgId=", + // // download ns package // downloadNsData: this.baseUrl + "downLoadNsPackage?nsdInfoId=XXXXX", // //download vnf package @@ -82,8 +82,8 @@ export class onboardService { } - //-----------------------------------Function-start------------------------------------------------------ - /* 查询数据列表 */ + //-----------------------------------Function-local-start------------------------------------------------------ + /* Query data list */ // NS Data getOnboardTableData() { // return this.http.get(this.url.onboardTableData); @@ -102,7 +102,7 @@ export class onboardService { getSDC_VNFTableData() { return this.http.get(this.url["sdc_vnfListData"]); } - + // PNF Data getOnboardTablePnfData() { return this.http.get(this.url.onboardDataPNF); @@ -111,7 +111,7 @@ export class onboardService { //create--Get the id after dragging the file before uploading //on-line post getCreatensData(url_upId,requestBody) { - return this.http.post(this.url.creatensData.replace("_jsonData",url_upId),requestBody); //线上 + return this.http.post(this.url.creatensData.replace("_jsonData",url_upId),requestBody); //on-line } //create--Get the id after dragging the file before uploading //local json get @@ -135,14 +135,14 @@ export class onboardService { // local test // return this.http.get(this.url.deleteNspack); // Online test - return this.http.delete(this.url["deleteNspack"] + paramsObj); + return this.http.delete(this.url.deleteNspack + paramsObj); } // Delete Vnf vfc package deleteVnfIdData(paramsObj) { // return this.http.get(this.url.deleteVnfPack); //online test - return this.http.delete(this.url["deleteVnfpack"] + paramsObj); + return this.http.delete(this.url.deleteVnfPack + paramsObj); } // Delete Pnf package 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 6a605bfa..105f399f 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 @@ -14,7 +14,7 @@ limitations under the License. --> - +

Onboard {{tabTitle}}

@@ -30,7 +30,7 @@ {{ nsuploading ? 'Uploading' : 'Start Upload' }} @@ -45,16 +45,18 @@ - {{item.nsdId}} + {{item.id}} {{item.uuid}} {{item.nsdName}} - 无 + 无 {{item.name}} {{item.nsdVersion}} + 无 {{ item.version }} {{item.nsdOnboardingState}} + {{status}} {{item.nsdOperationalState}} @@ -82,7 +84,7 @@ {{ vnfuploading ? 'Uploading' : 'Start Upload' }} @@ -100,15 +102,17 @@ {{item.id}} {{item.uuid}} {{item.vnfProductName}} + 无 {{item.name}} {{item.vnfdVersion}} + 无 {{item.version}} {{item.onboardingState}} {{item.usageState}} {{item.operationalState}} - + @@ -129,7 +133,7 @@ {{ pnfuploading ? 'Uploading' : 'Start Upload' }} diff --git a/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.ts b/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.ts index 5e5495e2..4e57fc64 100644 --- a/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.ts +++ b/usecaseui-portal/src/app/services/onboard-vnf-vm/onboard-vnf-vm.component.ts @@ -34,9 +34,9 @@ export class OnboardVnfVmComponent implements OnInit { //url url = { // line up - ns: 'http://172.30.3.100:30280/api/nsd/v1/ns_descriptors/'+this.nsdInfoId+'/nsd_content', - vnf: 'http://172.30.3.100:30280/api/vnfpkgm/v1/vnf_packages/'+this.vnfPkgId+'/package_content', - pnf: 'http://172.30.3.100:30280/api/nsd/v1/pnf_descriptors/'+this.pnfdInfoId+'/pnfd_content' + ns: '/api/nsd/v1/ns_descriptors/'+this.nsdInfoId+'/nsd_content', + vnf: '/api/vnfpkgm/v1/vnf_packages/'+this.vnfPkgId+'/package_content', + pnf: '/api/nsd/v1/pnf_descriptors/'+this.pnfdInfoId+'/pnfd_content' // 本地 // ns: 'https://jsonplaceholder.typicode.com/posts/', // vnf: 'https://jsonplaceholder.typicode.com/posts/', @@ -53,8 +53,12 @@ export class OnboardVnfVmComponent implements OnInit { tableData:any; sdcData:any; vfcData:any; - pageIndex = 1; - pageSize = 10; + nspageIndex = 1; + nspageSize = 10; + vnfpageIndex = 1; + vnfpageSize = 10; + pnfpageIndex = 1; + pnfpageSize = 10; total; nsloading = false; sortName = null; @@ -72,10 +76,12 @@ export class OnboardVnfVmComponent implements OnInit { } // 处理tab切换 请求数据 - handleTabChange(tab,nsdInfoId,url) { + handleTabChange(tab) { this.tabTitle = tab; console.log(tab); - console.log(nsdInfoId); + console.log('nsdInfoId--->'+ this.nsdInfoId); + console.log('vnfPkgId--->'+ this.vnfPkgId); + console.log('pnfdInfoId--->'+ this.pnfdInfoId); console.log(this.url); switch (tab) { case 'NS': @@ -91,12 +97,12 @@ export class OnboardVnfVmComponent implements OnInit { } - //before put 创建--上传之前将文件拖拽到页面时 + //before put create--Drag and drop files to the page before uploading requestBody = { "userDefinedData": { - "additionalProp1": "string", - "additionalProp2": "string", - "additionalProp3": "string" + "additionalProp1": "", + "additionalProp2": "", + "additionalProp3": "" } } // requestBody = {}; @@ -104,12 +110,14 @@ export class OnboardVnfVmComponent implements OnInit { beforeUploadNS = (file: UploadFile): boolean => { this.fileListNS.push(file); console.log('beforeUpload'); - // this.myhttp.getCreatensData("createNetworkServiceData",requestBody)//线上 - this.myhttp.getCreatensData("creatensDataNS",this.requestBody) //本地 + console.log('fileListNS' + this.fileListNS); + console.log('fileListNS' + JSON.stringify(this.fileListNS)); + this.myhttp.getCreatensData("createNetworkServiceData",this.requestBody)//on-line + // this.myhttp.getCreatensData("creatensDataNS") //local .subscribe((data) => { - console.log("拖拽文件后返回的数据NS-->", data); + console.log("Data returned after dragging a file NS-->", data); this.nsdInfoId = data["id"]; - console.log("拖拽文件后返回的数据的id-->",this.nsdInfoId); + console.log("Data returned after dragging a file id-->",this.nsdInfoId); }, (err) => { console.log(err); }) @@ -120,12 +128,14 @@ export class OnboardVnfVmComponent implements OnInit { beforeUploadVNF = (file: UploadFile): boolean => { this.fileListVNF.push(file); console.log('beforeUpload'); - // this.myhttp.getCreatensData("createVnfData",requestBody)//线上 - this.myhttp.getCreatensData("creatensDataVNF",this.requestBody) //本地 + console.log('fileListVNF--->' + this.fileListVNF); + console.log('fileListVNF--->' + JSON.stringify(this.fileListVNF)); + this.myhttp.getCreatensData("createVnfData",this.requestBody)//on-line + // this.myhttp.getCreatensData("creatensDataVNF") //local .subscribe((data) => { - console.log("拖拽文件后返回的数据VNF-->", data); + console.log("Data returned after dragging a file VNF-->", data); this.vnfPkgId = data["id"]; - console.log("拖拽文件后返回的数据的id-->",this.vnfPkgId); + console.log("Data returned after dragging a file id-->",this.vnfPkgId); }, (err) => { console.log(err); }) @@ -136,12 +146,13 @@ export class OnboardVnfVmComponent implements OnInit { beforeUploadPNF = (file: UploadFile): boolean => { this.fileListPNF.push(file); console.log('beforeUpload'); - // this.myhttp.getCreatensData("createPnfData",requestBody) //线上 - this.myhttp.getCreatensData("creatensDataPNF",this.requestBody) //本地 + console.log('fileListPNF--->' + this.fileListPNF); + this.myhttp.getCreatensData("createPnfData",this.requestBody) //on-line + // this.myhttp.getCreatensData("creatensDataPNF") //local .subscribe((data) => { - console.log("拖拽文件后返回的数据PNF-->", data); + console.log("Data returned after dragging a file PNF-->", data); this.pnfdInfoId = data["id"]; - console.log("拖拽文件后返回的数据的id-->",this.pnfdInfoId); + console.log("Data returned after dragging a file id-->",this.pnfdInfoId); }, (err) => { console.log(err); }) @@ -152,20 +163,20 @@ export class OnboardVnfVmComponent implements OnInit { switch (tab) { case 'NS': console.log(this.nsdInfoId); - // this.handleUpload('http://ip:port/api/nsd/v1/ns_descriptors/{nsdInfoId}/nsd_content'); - this.handleUpload(this.url.ns, tab); + this.handleUpload('/api/nsd/v1/ns_descriptors/'+this.nsdInfoId+'/nsd_content',tab); + // this.handleUpload(this.url.ns, tab); this.getTableData(); break case 'VNF': console.log(this.vnfPkgId); - // this.handleUpload('http://ip:port/api/vnfpkgm/v1/vnf_packages/{vnfPkgId}/package_content'); - this.handleUpload(this.url.vnf, tab); + this.handleUpload('/api/vnfpkgm/v1/vnf_packages/'+this.vnfPkgId+'/package_content',tab); + // this.handleUpload(this.url.vnf, tab); this.getTableVnfData() break case 'PNF': console.log(this.pnfdInfoId); - // this.handleUpload('http://ip:port/api/nsd/v1/pnf_descriptors/{pnfdInfoId}/pnfd_content'); - this.handleUpload(this.url.pnf, tab); + this.handleUpload('/api/nsd/v1/pnf_descriptors/'+this.pnfdInfoId+'/pnfd_content',tab); + // this.handleUpload(this.url.pnf, tab); this.getTablePnfData(); break } @@ -208,6 +219,8 @@ export class OnboardVnfVmComponent implements OnInit { reportProgress: true, withCredentials: true }); + console.log('req--->'+ JSON.stringify(req)); + console.log('formData--->'+ JSON.stringify(formData)); this.http .request(req) .pipe(filter(e => e instanceof HttpResponse)) @@ -286,7 +299,7 @@ changeUploadingSta(tab) { } // 获取pnf列表 - getTablePnfData() { + getTablePnfData() { this.myhttp.getOnboardTablePnfData() .subscribe((data) => { console.log("pnfList-->", data); @@ -396,13 +409,13 @@ changeUploadingSta(tab) { console.log("deleteService!"); this.myhttp.deleteNsIdData(pkgid) .subscribe((data) => { - console.log(44, data); + console.log("nsdel--->", data); }, (err) => { console.log(err); }) console.log(index) this.tableData.splice(index, 1) - console.log('数组长度',this.tableData.length) + console.log('tableData.length NS--->',this.tableData.length) this.getTableData() } @@ -412,13 +425,13 @@ changeUploadingSta(tab) { console.log("deleteVnfService!"); this.myhttp.deleteVnfIdData(pkgid) .subscribe((data) => { - console.log(44, data); + console.log('vnfdel--->', data); }, (err) => { console.log(err); }) console.log(index) this.tableData.splice(index, 1) - console.log(this.tableData.length) + console.log('tableData.length VNF--->'+ this.tableData.length) this.getTableVnfData() } @@ -428,13 +441,13 @@ changeUploadingSta(tab) { console.log("deletePnfService!"); this.myhttp.deletePnfIdData(pkgid) .subscribe((data) => { - console.log(44, data); + console.log('pnfdel--->', data); }, (err) => { console.log(err); }) console.log(index) this.tableData.splice(index, 1) - console.log(this.tableData.length) + console.log('tableData.length PNF--->'+this.tableData.length) this.getTablePnfData() } -- cgit 1.2.3-korg