summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/services/intent-based-services
diff options
context:
space:
mode:
authorliuwh7 <liuwh7@asiainfo.com>2022-03-04 14:13:19 +0800
committerliuwh7 <liuwh7@asiainfo.com>2022-03-04 14:13:24 +0800
commit125fb9b3811f9f580997545f92c93e0a01271abe (patch)
tree43ad20a5e8bd8bcdceeabc83bf794f0b81d1d595 /usecaseui-portal/src/app/views/services/intent-based-services
parent37545534852e50f6fa0d46b2371d58a986410375 (diff)
feat:intentBasedService predict
Signed-off-by: liuwh7 <liuwh7@asiainfo.com> Change-Id: I08e0d7a5141325f830bf522b42894b399ea6e7af Issue-ID: REQ-1075
Diffstat (limited to 'usecaseui-portal/src/app/views/services/intent-based-services')
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component.html6
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.html42
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.less22
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.spec.ts25
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts73
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/intent-based-services.component.html7
-rw-r--r--usecaseui-portal/src/app/views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component.ts11
7 files changed, 181 insertions, 5 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 2fe58cfc..b436bf32 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
@@ -50,8 +50,8 @@
<input
nz-input
nz-tooltip
- [id]="item.key"
- [name]="item.key"
+ [id]="item.rateName"
+ [name]="item.rateName"
[(ngModel)]="cloud_leased_line_info[item.key].bandwidth"
[placeholder]="item.placeholder ? item.placeholder : ''"
/>
@@ -59,7 +59,7 @@
<div>
<span>{{item.nodeName}}:</span>
<nz-select
- [name]="item.key"
+ [name]="item.nodeName"
[(ngModel)]="cloud_leased_line_info[item.key].name"
>
<nz-option
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.html
new file mode 100644
index 00000000..bdd59ea3
--- /dev/null
+++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.html
@@ -0,0 +1,42 @@
+<div class="subnet_params_container">
+ <div class="form_class">
+ <form nz-form class='text-form-class'>
+ <nz-form-item>
+ <nz-form-control [nzSpan]="24">
+ <textarea
+ [id]="communicationMessage"
+ nz-tooltip
+ nz-input
+ placeholder="Please input communicationMessage"
+ [nzAutosize]="{ minRows: 6, maxRows: 6 }"
+ [(ngModel)]="communicationMessage"
+ name="communicationMessage">
+ </textarea>
+ </nz-form-control>
+ </nz-form-item>
+ </form>
+ </div>
+ <div class="submit">
+ <button
+ nz-button
+ nzType="primary"
+ nzSize="middle"
+ (click)="submitFormMessage()"
+ [nzLoading]="isConfirmCreating"
+ form="createForm">
+ <span>
+ Submit
+ </span>
+ </button>
+ </div>
+ <app-cloud-leased-line-modal
+ [modelParams]="modalParam"
+ [cloudLeasedLineShowFlag]="cloudModalShowFlag"
+ (cancelEmitter)="modalClose()"
+ ></app-cloud-leased-line-modal>
+ <app-business-order
+ [modelParams]="modalParam"
+ [showModel]="businessModalShowFlag"
+ (cancel)="modalClose()"
+ ></app-business-order>
+</div>
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.less b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.less
new file mode 100644
index 00000000..e71b27cc
--- /dev/null
+++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.less
@@ -0,0 +1,22 @@
+.subnet_params_container {
+ // padding-left: 3%;
+ // padding-right: 3%;
+ .form_class {
+ padding: 0 100px;
+ }
+ .submit {
+ text-align: center;
+ margin-top: 30px;
+ }
+}
+.ant-form-item {
+ margin-top: 20px;
+ margin-bottom: -5px;
+}
+
+.validateRules{
+ color: red;
+}
+.error-input-border{
+ border-color: red!important;
+} \ No newline at end of file
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.spec.ts b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.spec.ts
new file mode 100644
index 00000000..ffdd130f
--- /dev/null
+++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { InputBusinessOrderComponent } from './input-business-order.component';
+
+describe('InputBusinessOrderComponent', () => {
+ let component: InputBusinessOrderComponent;
+ let fixture: ComponentFixture<InputBusinessOrderComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ InputBusinessOrderComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(InputBusinessOrderComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts
new file mode 100644
index 00000000..d88afa9c
--- /dev/null
+++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-predict/intent-based-predict.component.ts
@@ -0,0 +1,73 @@
+import { Component, OnInit } from '@angular/core';
+import { NzMessageService } from 'ng-zorro-antd';
+import { intentBaseService } from '../../../../core/services/intentBase.service';
+
+@Component({
+ selector: 'app-intent-based-predict',
+ templateUrl: './intent-based-predict.component.html',
+ styleUrls: ['./intent-based-predict.component.less']
+})
+export class IntentBasedPredictComponent implements OnInit {
+
+ constructor(
+ private myhttp: intentBaseService,
+ private msg: NzMessageService
+ ) {}
+
+ // textarea input predict param
+ communicationMessage: String = "";
+ // button loading
+ isConfirmCreating: boolean = false;
+ // modal param
+ modalParam: Object = {};
+ // cloud modal show flag
+ cloudModalShowFlag: boolean = false;
+ // business modal show flag
+ businessModalShowFlag: boolean = false;
+
+ ngOnInit() {
+ this.communicationMessage = '';
+ }
+
+ ngOnChange() {}
+
+ submitFormMessage(): void {
+ this.isConfirmCreating = true;
+ this.myhttp.intentBasedUnifyPredict({
+ "text": this.communicationMessage
+ }).subscribe(
+ (response) => {
+ this.isConfirmCreating = false;
+ const { code, message, data: { type, formData } } = response;
+ if (code !== 200) {
+ this.msg.error(message);
+ return;
+ }
+
+ this.modalParam = {
+ ...formData,
+ intentContent: this.communicationMessage
+ };
+
+ if (type === 'ccvpn') {
+ this.cloudModalShowFlag = true;
+ }
+
+ if (type === '5gs') {
+ this.businessModalShowFlag = true;
+ }
+ },
+ (err) => {
+ this.isConfirmCreating = false;
+ console.log(err);
+ }
+ )
+ }
+
+ modalClose() {
+ this.cloudModalShowFlag = false;
+ this.businessModalShowFlag = false;
+ this.modalParam = {};
+ this.communicationMessage = '';
+ }
+}
diff --git a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-services.component.html b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-services.component.html
index cd7e0fa7..e4262859 100644
--- a/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-services.component.html
+++ b/usecaseui-portal/src/app/views/services/intent-based-services/intent-based-services.component.html
@@ -1,7 +1,12 @@
<nz-tabset [nzSelectedIndex]="selectedIndex" (nzSelectChange)="handleTabChange($event)" class="slicing">
+ <nz-tab [nzTitle]="'i18nTextDefine_intentBaseService' | translate">
+ <app-intent-based-predict
+ *ngIf="selectedIndex === 0"
+ ></app-intent-based-predict>
+ </nz-tab>
<nz-tab [nzTitle]="'i18nTextDefine_cloudLeasedLine' | translate">
<app-cloud-leased-line
- *ngIf="selectedIndex === 0"
+ *ngIf="selectedIndex === 1"
></app-cloud-leased-line>
</nz-tab>
</nz-tabset> \ No newline at end of file
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 e91c57e7..8f9fd47c 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
@@ -63,7 +63,16 @@ export class SmartCloudLeasedModalComponent implements OnInit {
};
this.myhttp.intentInstancePredict(params).subscribe(
(response) => {
- this.handleCancel(false, response);
+ const { code, message, data } = response;
+ if (code !== 200) {
+ this.msg.error(message);
+ return;
+ }
+ let orderForm = {
+ ...data,
+ intentContent: this.communicationMessage
+ };
+ this.handleCancel(false, orderForm);
},
(err) => {
console.log(err);