diff options
author | 2022-03-21 14:11:42 +0800 | |
---|---|---|
committer | 2022-03-21 14:11:57 +0800 | |
commit | dc2d38249ca5ac3127c260745af6251604e35a80 (patch) | |
tree | 83b1f76b09492b96701486023fab9574f768c7e5 /usecaseui-portal/src/app/views/services/intent-based-services/intent-instance | |
parent | b44075625fe5d092e0f7048b254edc986dd26c0a (diff) |
feat: intent instance management
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I7d8047e7ccc86617399ce57a5be62907d09292eb
Issue-ID: REQ-1075
Diffstat (limited to 'usecaseui-portal/src/app/views/services/intent-based-services/intent-instance')
3 files changed, 247 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html new file mode 100644 index 00000000..ee71be03 --- /dev/null +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.html @@ -0,0 +1,64 @@ +<div class="intent-resource_tab"> + <div class="intent-resource-table-list"> + <nz-table + #basicTable [nzData]="listOfData" + [nzFrontPagination]="false" + nzShowSizeChanger + [nzPageSizeOptions]="[5,10,15,20]" + [nzTotal]='total' + [(nzPageSize)]="pageSize" + [(nzPageIndex)]='pageIndex' + [nzLoading]="loading" + (nzPageIndexChange)="searchData()" + (nzPageSizeChange)="searchData()" + [nzScroll]="{ x: '1500px' }" + nzTableLayout="fixed" + > + <thead> + <tr> + <th [nzLeft]="true">No</th> + <th>Intent Name</th> + <th>Intent Source</th> + <th>Customer</th> + <th nzEllipsis>Intent Content</th> + <th>Intent Config</th> + <th>Business Instance</th> + <th [nzRight]="true" [nzWidth]="300"></th> + </tr> + </thead> + <tbody> + <ng-template ngFor let-data [ngForOf]="basicTable.data" let-i="index"> + <tr> + <td [nzLeft]="true">{{i+1}}</td> + <td>{{ data.intentName }}</td> + <td>{{ data.intentSource }}</td> + <td>{{ data.customer }}</td> + <td [title]="data.intentContent" nzEllipsis> + {{ data.intentContent }} + </td> + <td>{{ data.intentConfig }}</td> + <td>{{ data.businessInstance }}</td> + <td [nzRight]="true"> + <button + nz-button + nzType="primary" + class="buy-button" + (click)="verificationIntentionInstance(data)" + > + check + </button> + <button + nz-button + nzType="primary" + class="buy-button" + (click)="deleteIntentionInstance(data)" + > + Delete + </button> + </td> + </tr> + </ng-template> + </tbody> + </nz-table> + </div> +</div>
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less new file mode 100644 index 00000000..f665fdb0 --- /dev/null +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.less @@ -0,0 +1,87 @@ +.intent-resource_tab { + width: 103%; + margin-left: 60px!important; + margin-top: -35px!important; + .ant-tabs-content.ant-tabs-content-animated{ + padding: 20px 0!important; + } +} +.slicing-resource-table{ + padding: 20px!important; +} +.intent-resource-table-list{ + padding: 20px!important; + nz-table{ + .ant-table-wrapper{ + .ant-table-body{ + th,td{ + word-break: break-word!important; + } + } + } + } +} +nz-select { + width: 200px; +} + +.task_status { + margin-bottom: 20px; + + span { + margin-right: 5%; + } +} + +.action-icon { + display: inline-block; + vertical-align: top; +} + +i.anticon { + cursor: pointer; + font-size: 18px; + padding: 2px 15px; + vertical-align: inherit !important; + + &:hover { + color: #147dc2; + } +} + +.cannotclick { + pointer-events: none; + color: #aaa; + opacity: 0.6; +} + +.buy-button { + float: right; + margin-right: 2%; +} +::ng-deep .ant-table-row .buy-button { + float: left; +} + +::ng-deep .ant-table-th-right-sticky { + width: 200px; +} +.ant-table-th-right-sticky, .ant-table-td-right-sticky { + position: -webkit-sticky; + position: sticky; + z-index: 1; + right: 0; +} +.ant-table-th-left-sticky, .ant-table-td-left-sticky { + position: -webkit-sticky; + position: sticky; + z-index: 1; + left: 0; +} +.ellipsisClass{ + display: inline-block; + max-width: 150px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +}
\ No newline at end of file diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts new file mode 100644 index 00000000..d13b9d7e --- /dev/null +++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-instance/intent-instance.component.ts @@ -0,0 +1,96 @@ +import { Component, OnInit } from "@angular/core"; +import { Router } from "@angular/router"; +import { NzMessageService } from "ng-zorro-antd"; +import { intentBaseService } from "../../../../core/services/intentBase.service"; + +@Component({ + selector: 'app-intent-instance', + templateUrl: './intent-instance.component.html', + styleUrls: ['./intent-instance.component.less'] +}) +export class IntentInstanceComponent implements OnInit { + + constructor( + private router:Router, + private myHttp: intentBaseService, + private nzMessage: NzMessageService + ) {} + + ngOnChanges() {} + + ngOnInit() { + this.pageIndex = 1; + this.pageSize = 10; + this.getIntentionInstanceList(); + } + + ngOnDestroy() {} + + // table lists + listOfData: any[] = []; + // pageSize or pageNum + pageIndex: number = 1; + pageSize: number = 10; + total: number = 0; + loading = false; + + // init source data + getIntentionInstanceList(): void { + this.myHttp.getIntentInstanceList({ + currentPage: this.pageIndex, + pageSize: this.pageSize + }).subscribe((response) => { + const { code, message, data:{ totalRecords, list } } = response; + if (code !== 200) { + this.nzMessage.error(message); + return; + } + + this.total = totalRecords; + this.listOfData = list; + }, (err) => { + console.log(err); + }); + } + + // change page message + searchData(): void { + this.getIntentionInstanceList(); + } + + verificationIntentionInstance(row): void { + this.myHttp.verifyIntentInstance({ + id: row.id + }).subscribe((response) => { + const { code, message, data } = response; + if (code !== 200) { + this.nzMessage.error(message); + return; + } + this.nzMessage.success(data); + this.resetParam2Query(); + }, (err) => { + console.log(err); + }); + } + + deleteIntentionInstance(row): void { + this.myHttp.delIntentInstance(row.id).subscribe((response) => { + const { code, message } = response; + if (code !== 200) { + this.nzMessage.error(message); + return; + } + this.nzMessage.success('Delete IntentionInstance Success'); + this.resetParam2Query(); + }, (err) => { + console.log(err); + }); + } + + resetParam2Query() { + this.pageIndex = 1; + this.pageSize = 10; + this.getIntentionInstanceList(); + } +}
\ No newline at end of file |