diff options
author | liuwh7 <liuwh7@asiainfo.com> | 2021-10-13 11:19:07 +0800 |
---|---|---|
committer | liuwh7 <liuwh7@asiainfo.com> | 2021-10-13 11:19:25 +0800 |
commit | 0f94d079d5698b21aad9409ee23b82e84cd0f547 (patch) | |
tree | f6d0bb8b86377991bbfc4c65bc5c0d1f7a9145e6 /usecaseui-portal/src/app/views/services/intent-based-services | |
parent | 01a512d33806fe9d25c1f3140114d10ed94d133b (diff) |
feat: modify intent based service
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I9974fb12163823288292cfc9ded92fefec3767eb
Issue-ID: USECASEUI-605
Diffstat (limited to 'usecaseui-portal/src/app/views/services/intent-based-services')
4 files changed, 78 insertions, 19 deletions
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html index 9bb9ffa4..64924b9f 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html @@ -40,8 +40,8 @@ *ngIf="item.type === 'select'" > <nz-option - [nzValue]="option.key" - [nzLabel]="option.title" + [nzValue]="option" + [nzLabel]="option" *ngFor="let option of cloudPointOptions" > </nz-option> @@ -67,8 +67,8 @@ [(ngModel)]="cloud_leased_line_info[item.key].name" > <nz-option - [nzValue]="option.key" - [nzLabel]="option.title" + [nzValue]="option" + [nzLabel]="option" *ngFor="let option of nodeLists" > </nz-option> diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts index 0f0afc79..90bcf9b0 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.ts @@ -51,7 +51,12 @@ export class CloudLeasedLineModalComponent implements OnInit { queryAccessNodeInfo() { this.myHttp.queryAccessNodeInfo().subscribe( (response) => { - console.log(response); + const { code, data } = response; + if (code !== 200) { + return; + } + this.cloudPointOptions = [...data.cloudAccessNodeList]; + this.nodeLists = [...data.accessNodeList]; }, (err) => { console.log(err); diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts index bf046545..28e312af 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component.ts @@ -32,17 +32,22 @@ export class CloudLeasedLineComponent implements OnInit { 2: 'Deleted', 3: 'Inactive' } - // 列表数据源 + // table lists listOfData: any[] = []; - // 分页信息及总数 + // pageSize or pageNum pageIndex: number = 1; pageSize: number = 10; total: number = 0; loading = false; - // 控制弹窗展示变量 + // cantrol dialog show or hidden cloudLeasedLineShowFlag: boolean = false; smartCloudLeasedLineShowFlag: boolean = false; - // 初始化查询数据源 + // resolve to dialog + resolveResult: any = null; + intervalTime: number = 5000; + progressingTimer: any[] = []; + + // init source data getCloudLeasedLineList(): void { this.myHttp.getInstanceList({ currentPage: this.pageIndex, @@ -54,39 +59,85 @@ export class CloudLeasedLineComponent implements OnInit { return; } this.total = data.totalRecords; - this.listOfData = [...data.list]; + if (data.list === 0) { + return; + } + + this.listOfData = data.list.map((item, index) => { + if (item.status === 'Incomplete') { + const updateStatus = (prodata) => { + item.status = prodata.status || item.status; + }; + + const obj = { serviceId: item.id }; + this.queryStatus(obj, index, updateStatus).then(() => { + item.status = "Completed"; + this.getCloudLeasedLineList(); + }); + } + return item; + }); }, (err) => { console.log(err); }); } - // 分页信息变更查询数据 + + queryStatus(obj: any, index: number, callback: any) { + return new Promise((res) => { + const requery = () => { + const param = [obj.id]; + this.myHttp.getInstanceStatus(param).subscribe((response) => { + if ( + response.data.status && response.data.status === 'Incomplete') { + callback(response.data); + let progressSetTimeOut = setTimeout(() => { + requery(); + }, this.intervalTime); + this.progressingTimer.push({ + id: obj.id, + timer: progressSetTimeOut, + }); + } else { + this.progressingTimer.forEach((item) => { + if (item.serviceId === obj.serviceId) { + clearInterval(item.timer); + } + }); + res(response.data); + } + }); + }; + requery(); + }); + } + + // change page message searchData(): void { this.getCloudLeasedLineList(); } - // 解析结果传递到create弹窗 - resolveResult: any; - // 弹窗加载 + + // dialog show cloudLeasedLineShow(): void { this.cloudLeasedLineShowFlag = true; } - // 弹窗关闭 + // dialog close cloudLeasedLineClose(): void { this.cloudLeasedLineShowFlag = false; this.pageIndex = 1; this.pageSize = 10; this.getCloudLeasedLineList(); } - // smart 弹窗加载 + // smart dialog show smartCloudLeasedLineShow(): void { this.smartCloudLeasedLineShowFlag = true; } - // smart 弹窗关闭 + // smart dialog close smartCloudLeasedLineClose(data): void { this.smartCloudLeasedLineShowFlag = false; if (data.cancel) { return; } - this.cloudLeasedLineShowFlag = true; + this.resolveResult = { name: 'test', instanceId: '123456', @@ -96,8 +147,10 @@ export class CloudLeasedLineComponent implements OnInit { }, cloudPointName: 'aaa', }; + + this.cloudLeasedLineShowFlag = true; } - // 跳转监控管理页面 + // to monitor page goMonitorService(): void { this.router.navigateByUrl('/fcaps/monitor_service'); } diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component.ts index 014a1c4c..16a3843b 100644 --- a/usecaseui-portal/src/app/views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component.ts +++ b/usecaseui-portal/src/app/views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component.ts @@ -58,6 +58,7 @@ export class SmartCloudLeasedModalComponent implements OnInit { submitFormMessage(): void { let params = { "title": "predict", + "modelType": 'ccvpn', "text": this.communicationMessage }; this.myhttp.intentInstancePredict(params).subscribe( |