diff options
author | cyuamber <xuranyjy@chinamobile.com> | 2019-09-29 16:08:14 +0800 |
---|---|---|
committer | cyuamber <xuranyjy@chinamobile.com> | 2019-09-29 16:08:21 +0800 |
commit | 083b5b3df111e14225c2b254ec621a66793b9b8d (patch) | |
tree | 8483987bd60552bfcfb331172dd915fb30697343 /usecaseui-portal | |
parent | d936ec81029cd05c999a27898f29f4c37e7075aa (diff) |
feat: reduce unnecessary request code
Change-Id: I079e180a694a2110860054a89caa54464932d3a0
Issue-ID: USECASEUI-307
Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal')
-rw-r--r-- | usecaseui-portal/src/app/views/services/onboard-vnf-vm/onboard-vnf-vm.component.ts | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/usecaseui-portal/src/app/views/services/onboard-vnf-vm/onboard-vnf-vm.component.ts b/usecaseui-portal/src/app/views/services/onboard-vnf-vm/onboard-vnf-vm.component.ts index ed6f0d74..b57eab6a 100644 --- a/usecaseui-portal/src/app/views/services/onboard-vnf-vm/onboard-vnf-vm.component.ts +++ b/usecaseui-portal/src/app/views/services/onboard-vnf-vm/onboard-vnf-vm.component.ts @@ -20,7 +20,6 @@ import { onboardService } from '../../../core/services/onboard.service'; import { slideToRight } from '../../../shared/utils/animates'; import { NzMessageService, UploadFile, NzModalRef, NzModalService } from 'ng-zorro-antd'; import { filter } from 'rxjs/operators'; -import { Title } from '@angular/platform-browser'; @Component({ selector: 'app-onboard-vnf-vm', @@ -104,6 +103,7 @@ export class OnboardVnfVmComponent implements OnInit { handleTabChange(tab: string): void { this.currentTab = tab; this.fileList = []; + this.display = 'block'; delete this.file; switch (tab) { case 'NS': @@ -149,20 +149,8 @@ export class OnboardVnfVmComponent implements OnInit { // Drag and drop and click the upload button onClick(): void { this.display = 'none'; - switch (this.currentTab) { - case 'NS': - this.handleUpload(this.url.ns.replace("*_*", this.infoId)); - this.getTableData(); - break - case 'VNF': - this.handleUpload(this.url.vnf.replace("*_*", this.infoId)); - this.getTableVnfData() - break - case 'PNF': - this.handleUpload(this.url.pnf.replace("*_*", this.infoId)); - this.getTablePnfData(); - break - } + let tab = this.currentTab === 'NS' ? 'ns' : (this.currentTab === 'VNF' ? 'vnf' : 'pnf') + this.handleUpload(this.url[tab].replace("*_*", this.infoId)); } handleUpload(url: string): void { @@ -200,9 +188,9 @@ export class OnboardVnfVmComponent implements OnInit { (event: {}) => { this.file.progress = 100; this.file.status = false; - this.display = 'block'; this.uploading = false; this.msg.success('upload successfully.'); + this.currentTab === 'NS' ? this.getTableData() : (this.currentTab === 'VNF' ? this.getTableVnfData() : this.getTablePnfData()); }, err => { this.file.progress = 100; |