diff options
author | liuwh7 <liuwh7@asiainfo.com> | 2022-03-04 14:13:19 +0800 |
---|---|---|
committer | liuwh7 <liuwh7@asiainfo.com> | 2022-03-04 14:13:24 +0800 |
commit | 125fb9b3811f9f580997545f92c93e0a01271abe (patch) | |
tree | 43ad20a5e8bd8bcdceeabc83bf794f0b81d1d595 | |
parent | 37545534852e50f6fa0d46b2371d58a986410375 (diff) |
feat:intentBasedService predict
Signed-off-by: liuwh7 <liuwh7@asiainfo.com>
Change-Id: I08e0d7a5141325f830bf522b42894b399ea6e7af
Issue-ID: REQ-1075
13 files changed, 205 insertions, 16 deletions
diff --git a/usecaseui-portal/src/app/app.module.ts b/usecaseui-portal/src/app/app.module.ts index e4b3568d..1bf1b652 100644 --- a/usecaseui-portal/src/app/app.module.ts +++ b/usecaseui-portal/src/app/app.module.ts @@ -23,6 +23,7 @@ import { BrowserModule } from "@angular/platform-browser"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { TranslateLoader, TranslateModule } from "@ngx-translate/core"; import { TranslateHttpLoader } from "@ngx-translate/http-loader"; +import { EventQueueService } from "@src/app/core/services/eventQueue.service"; import { en_US, NgZorroAntdModule, NZ_I18N } from "ng-zorro-antd"; import { NgxEchartsModule } from "ngx-echarts"; import { AppRoutingModule } from "./app-routing.module"; @@ -72,6 +73,7 @@ import { PerformanceVnfComponent } from "./views/performance/performance-vnf/per import { PerformanceComponent } from "./views/performance/performance.component"; import { CloudLeasedLineModalComponent } from './views/services/intent-based-services/cloud-leased-line-modal/cloud-leased-line-modal.component'; import { CloudLeasedLineComponent } from './views/services/intent-based-services/cloud-leased-line/cloud-leased-line.component'; +import { IntentBasedPredictComponent } from './views/services/intent-based-services/intent-based-predict/intent-based-predict.component'; import { IntentBasedServicesComponent } from './views/services/intent-based-services/intent-based-services.component'; import { SmartCloudLeasedModalComponent } from './views/services/intent-based-services/smart-cloud-leased-modal/smart-cloud-leased-modal.component'; import { CcvpnCreationComponent } from "./views/services/services-list/ccvpn-creation/ccvpn-creation.component"; @@ -105,7 +107,6 @@ import { ManageServiceComponent } from "./views/services/sotn-management/manage- import { MonitorServiceComponent } from "./views/services/sotn-management/monitor-service/monitor-service.component"; import { OrderServiceComponent } from "./views/services/sotn-management/order-service/order-service.component"; import { SotnManagementComponent } from "./views/services/sotn-management/sotn-management.component"; -import { EventQueueService } from "@src/app/core/services/eventQueue.service"; export function HttpLoaderFactory(httpClient: HttpClient) { return new TranslateHttpLoader(httpClient, "./assets/i18n/", ".json"); @@ -174,6 +175,7 @@ registerLocaleData(en); Monitor5gComponent, MonitorManagementService, MonitorFacpsServiceComponent, + IntentBasedPredictComponent, IntentBasedServicesComponent, CloudLeasedLineComponent, CloudLeasedLineModalComponent, diff --git a/usecaseui-portal/src/app/core/services/intentBase.service.ts b/usecaseui-portal/src/app/core/services/intentBase.service.ts index eaa67b9d..7fb8104f 100644 --- a/usecaseui-portal/src/app/core/services/intentBase.service.ts +++ b/usecaseui-portal/src/app/core/services/intentBase.service.ts @@ -33,7 +33,8 @@ export class intentBaseService { activeIntentInstance: this.baseUrl + "/intent/activeIntentInstance", invalidIntentInstance: this.baseUrl + "/intent/invalidIntentInstance", queryAccessNodeInfo: this.baseUrl + "/intent/queryAccessNodeInfo", - intentInstancePredict: this.baseUrl + "/intent/predict" + intentInstancePredict: this.baseUrl + "/intent/predict", + intentBasedUnifyPredict: this.baseUrl + "/intent/unifyPredict" }; //The following APIs function are optimizable------------------------ @@ -83,4 +84,8 @@ export class intentBaseService { intentInstancePredict(requestBody) { return this.http.post<any>(this.url["intentInstancePredict"], requestBody); } + + intentBasedUnifyPredict(requestBody) { + return this.http.post<any>(this.url["intentBasedUnifyPredict"], requestBody); + } } 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); diff --git a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts index 9c3fe319..aa5a5db1 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/business-order/business-order.component.ts @@ -1,8 +1,8 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; -import { COMMUNICATION_FORM_ITEMS, MASKTEXT } from "./constants"; -import { Util } from "../../../../../shared/utils/utils"; -import { SlicingTaskServices } from "../../../../../core/services/slicingTaskServices"; import { NzMessageService } from "ng-zorro-antd"; +import { SlicingTaskServices } from "../../../../../core/services/slicingTaskServices"; +import { Util } from "../../../../../shared/utils/utils"; +import { COMMUNICATION_FORM_ITEMS, MASKTEXT } from "./constants"; @Component({ selector: "app-business-order", @@ -24,9 +24,7 @@ export class BusinessOrderComponent implements OnInit { this.slicing_order_info = { ...this.modelParams }; if (this.slicing_order_info.coverageArea) { areaList = []; - areaList.push( - this.slicing_order_info.coverageArea.split(" ").join(";") - ); + areaList.push(this.slicing_order_info.coverageArea); } } this.AreaFormatting(areaList); diff --git a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts index e64f687f..7b4d9d1b 100644 --- a/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts +++ b/usecaseui-portal/src/app/views/services/slicing-management/csmf-slicing-business-management/input-business-order/input-business-order.component.ts @@ -79,12 +79,18 @@ export class InputBusinessOrderComponent implements OnInit { "text": this.communicationMessage }; this.myhttp["analysisInputText"](params) - .subscribe((data) => { + .subscribe((response) => { this.clickRepeat = false; - if (data === 0) { + const { code, message, data } = response; + if (code !== 200) { + this.msg.error(message); return; } - let orderForm = { ...data }; + + let orderForm = { + ...data, + intentContent: this.communicationMessage + }; this.communicationMessage = ""; this.showModel = false; this.modalOpreation.emit({ "cancel": false, "param": orderForm }); diff --git a/usecaseui-portal/src/assets/i18n/cn.json b/usecaseui-portal/src/assets/i18n/cn.json index f4086084..ad9d855e 100644 --- a/usecaseui-portal/src/assets/i18n/cn.json +++ b/usecaseui-portal/src/assets/i18n/cn.json @@ -171,6 +171,7 @@ "i18nTextDefine_monitorService":"监控服务", "i18nTextDefine_manageService":"管理服务", "i18nTextDefine_cloudLeasedLine":"Cloud Leased Line", + "i18nTextDefine_intentBaseService":"Intent Based Services", "mdons-network-component":"--:", diff --git a/usecaseui-portal/src/assets/i18n/en.json b/usecaseui-portal/src/assets/i18n/en.json index 10fd2140..034262b2 100644 --- a/usecaseui-portal/src/assets/i18n/en.json +++ b/usecaseui-portal/src/assets/i18n/en.json @@ -165,6 +165,7 @@ "i18nTextDefine_monitorService":"Monitor Service", "i18nTextDefine_manageService":"Manage Service", "i18nTextDefine_cloudLeasedLine":"Cloud Leased Line", + "i18nTextDefine_intentBaseService":"Intent Based Services", "mdons-network-component":"--:", |