summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/views/intent-management/input-intent-state
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/src/app/views/intent-management/input-intent-state')
-rw-r--r--usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.html46
-rw-r--r--usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.less0
-rw-r--r--usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.spec.ts25
-rw-r--r--usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts94
4 files changed, 165 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.html b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.html
new file mode 100644
index 00000000..7d4db0d7
--- /dev/null
+++ b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.html
@@ -0,0 +1,46 @@
+<nz-modal [(nzVisible)]="showModel" nzTitle="Add Target" nzCentered (nzOnCancel)="handleCancel()"
+ (nzOnOk)="handleOk()" nzWidth="48%" nzHeight="600px" class="intent-management-modal">
+ <div class="subnet_params_container clearfix">
+ <p>
+ <span class="left">Target Name:</span>
+ <input nz-input id="target_name" [(ngModel)]="this.defaultParams['targetName']">
+ </p>
+ <div class="intent-table">
+ <p class="title">
+ Condition List
+ <button nz-button nzType="primary" class="add" (click)="inputTargetConditionShow()">
+ {{"i18nTextDefine_Create" | translate}} </button>
+ </p>
+ <nz-table
+ #basicTable [nzData]="listOfData"
+ [nzFrontPagination]="false"
+ [nzShowPagination]="false"
+ >
+ <thead>
+ <tr>
+ <th nzWidth="10%">No</th>
+ <th nzWidth="20%">Condition Name</th>
+ <th nzWidth="20%">Operator</th>
+ <th nzWidth="35%">Condition Value</th>
+ <th nzWidth="15%">{{"i18nTextDefine_Action" | translate}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <ng-template ngFor let-data [ngForOf]="basicTable.data" let-i="index">
+ <tr>
+ <td>{{i+1}}</td>
+ <td>{{ data.conditionName }}</td>
+ <td>{{ data.operator }}</td>
+ <td>{{ data.conditionValue }}</td>
+ <td>
+ <em class="anticon anticon-edit" (click)="editConditionList(data,i)"></em>
+ <em class="anticon anticon-delete" (click)="deleteConditionList(i)"></em>
+ </td>
+ </tr>
+ </ng-template>
+ </tbody>
+ </nz-table>
+ </div>
+ </div>
+</nz-modal>
+<app-input-intent-condition [showModel]="intentConditionShow" (modalOpreation)="inputIntentConditionClose($event)" [editConditionTableData]="editConditionTableList"></app-input-intent-condition>
diff --git a/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.less b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.less
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.less
diff --git a/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.spec.ts b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.spec.ts
new file mode 100644
index 00000000..d945e25d
--- /dev/null
+++ b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { InputIntentStateComponent } from './input-intent-state.component';
+
+describe('InputIntentStateComponent', () => {
+ let component: InputIntentStateComponent;
+ let fixture: ComponentFixture<InputIntentStateComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ InputIntentStateComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(InputIntentStateComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts
new file mode 100644
index 00000000..5686b4f3
--- /dev/null
+++ b/usecaseui-portal/src/app/views/intent-management/input-intent-state/input-intent-state.component.ts
@@ -0,0 +1,94 @@
+import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
+import { Util } from '../../../shared/utils/utils';
+
+@Component({
+ selector: 'app-input-intent-state',
+ templateUrl: './input-intent-state.component.html',
+ styleUrls: ['../intent-management.component.less']
+})
+export class InputIntentStateComponent implements OnInit {
+
+ constructor(
+ private Util: Util
+ ) { }
+
+ currentIndex:number = -1;
+ listOfData: any[] = [];
+ intentConditionShow: boolean = false;
+ editConditionTableList: Object={};
+
+ ngOnInit() {
+ this.operatorList = [
+ { label:'EQUALTO', value:'EQUALTO'},
+ { label:'LARGETHAN', value:'LARGETHAN'},
+ { label:'LESSTHAN', value:'LESSTHAN'}
+ ]
+ this.conditionType = 'value'
+ }
+ @Input() showModel: boolean;
+ @Output() modalOpreation = new EventEmitter();
+ @Input() editTargetTableData;
+
+ defaultParams:Object={
+ targetId:'',
+ targetName:'',
+ targetConditions:[]
+ };
+
+ operatorList: any[] = [];
+ conditionType: string;
+
+ ngOnChanges() {
+ if (this.showModel) {
+ if (JSON.stringify(this.editTargetTableData)!=='{}') {
+ this.defaultParams=this.editTargetTableData
+ }
+ }
+ }
+ handleCancel(): void {
+ this.modalOpreation.emit({ "cancel": true });
+ this.clearTargetConditionData()
+ }
+ handleOk(): void {
+ if(JSON.stringify(this.editTargetTableData)==='{}'){
+ this.defaultParams['targetId']=this.Util.getUuid()
+ }
+ this.modalOpreation.emit({ "cancel": false, "param": this.defaultParams });
+ this.clearTargetConditionData()
+ }
+ inputTargetConditionShow(): void {
+ this.intentConditionShow = true;
+ }
+ inputIntentConditionClose($event: any): void {
+ this.intentConditionShow = false;
+ this.editConditionTableList={}
+ if ($event.cancel) {
+ return;
+ }
+ if(this.currentIndex>-1){
+ this.listOfData[this.currentIndex]=$event.param
+ this.currentIndex=-1
+ }else{
+ this.listOfData.push($event.param)
+ }
+ this.defaultParams['targetConditions']=this.listOfData
+ }
+ editConditionList(data,i): void {
+ this.editConditionTableList=JSON.parse(JSON.stringify(data))
+ this.currentIndex=i
+ this.intentConditionShow = true
+ }
+ deleteConditionList(i): void{
+ this.listOfData.splice(i,1)
+ }
+ clearTargetConditionData(): void{
+ this.showModel = false;
+ this.defaultParams = {
+ targetId:'',
+ targetName:'',
+ targetConditions:[]
+ };
+ this.listOfData=[]
+ }
+
+}