Commit 2da51acc authored by wangqinghua's avatar wangqinghua

template

parent 0ea9cfa4
...@@ -75,6 +75,7 @@ export const route: Routes = [ ...@@ -75,6 +75,7 @@ export const route: Routes = [
{path: 'operationWork', component: OperationWorkComponent,data: { breadcrumb: '运维工作' },}, {path: 'operationWork', component: OperationWorkComponent,data: { breadcrumb: '运维工作' },},
{path: 'resourceAlarm', component: ResourceAlarmComponent,data: { breadcrumb: '资源告警统计' },}, {path: 'resourceAlarm', component: ResourceAlarmComponent,data: { breadcrumb: '资源告警统计' },},
{path: 'params', component: PararmsComponent,data: { breadcrumb: '参数配置' },}, {path: 'params', component: PararmsComponent,data: { breadcrumb: '参数配置' },},
{path: 'template', component: TemplateComponent,data: { breadcrumb: '模版配置' },},
{path: 'discoveryList', component: DiscoveryListComponent,data: { breadcrumb: '自动发现列表' },}, {path: 'discoveryList', component: DiscoveryListComponent,data: { breadcrumb: '自动发现列表' },},
{path: 'checkList', component: CheckListComponent,data: { breadcrumb: '监控项原型' },}, {path: 'checkList', component: CheckListComponent,data: { breadcrumb: '监控项原型' },},
{path: 'triggerList', component: TriggerListComponent,data: { breadcrumb: '触发器原型' },}, {path: 'triggerList', component: TriggerListComponent,data: { breadcrumb: '触发器原型' },},
......
...@@ -34,16 +34,20 @@ ...@@ -34,16 +34,20 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<ng-container *ngIf="isInterface"> <ng-container *ngIf="isInterface">
<nz-form-item> <ng-container *ngIf=" validateForm.value.type == '0' || validateForm.value.type == '1' || validateForm.value.type == '3' ||
<nz-form-label [nzSpan]="6" nzRequired nzFor="interfaceid">主机接口</nz-form-label> validateForm.value.type == '4' || validateForm.value.type == '6' || validateForm.value.type == '10' || validateForm.value.type == '12' ||
<nz-form-control [nzSpan]="14"> validateForm.value.type == '13' || validateForm.value.type == '14' || validateForm.value.type == '16' || validateForm.value.type == '17'">
<nz-select name="interfaceid" formControlName="interfaceid" nzPlaceHolder="选择主机接口"> <nz-form-item>
<nz-option *ngFor="let item of interfaceList" nzValue="{{item.interfaceid}}" <nz-form-label [nzSpan]="6" nzRequired nzFor="interfaceid">主机接口</nz-form-label>
nzLabel="{{item.ip}}:{{item.port}}"></nz-option> <nz-form-control [nzSpan]="14">
</nz-select> <nz-select name="interfaceid" formControlName="interfaceid" nzPlaceHolder="选择主机接口">
<nz-form-explain *ngIf="validateForm.get('interfaceid').dirty && validateForm.get('interfaceid').errors">请选择主机接口!</nz-form-explain> <nz-option *ngFor="let item of interfaceList" nzValue="{{item.interfaceid}}"
</nz-form-control> nzLabel="{{item.ip}}:{{item.port}}"></nz-option>
</nz-form-item> </nz-select>
<nz-form-explain *ngIf="validateForm.get('interfaceid').dirty && validateForm.get('interfaceid').errors">请选择主机接口!</nz-form-explain>
</nz-form-control>
</nz-form-item>
</ng-container>
</ng-container> </ng-container>
<ng-container *ngIf="validateForm.value.type == 1 || validateForm.value.type == 4 || validateForm.value.type == 6"> <ng-container *ngIf="validateForm.value.type == 1 || validateForm.value.type == 4 || validateForm.value.type == 6">
<nz-form-item> <nz-form-item>
......
...@@ -35,7 +35,7 @@ export class BasiCheckComponent implements OnInit { ...@@ -35,7 +35,7 @@ export class BasiCheckComponent implements OnInit {
title; title;
isCheck = false; isCheck = false;
isInterface = true; isInterface = true; //添加模版监测点的时候不需要主机接口
nzSize = 'large'; nzSize = 'large';
hostId; //主机ID hostId; //主机ID
hostName; //主机name hostName; //主机name
...@@ -67,7 +67,7 @@ export class BasiCheckComponent implements OnInit { ...@@ -67,7 +67,7 @@ export class BasiCheckComponent implements OnInit {
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
hostid: [this.hostId], hostid: [this.hostId],
name: [null, [Validators.required]], name: [null, [Validators.required]],
interfaceid: [null, [Validators.required]], interfaceid: [null],
key_: [null, [Validators.required]], key_: [null, [Validators.required]],
value_type: [null, [Validators.required]], value_type: [null, [Validators.required]],
type: [null, [Validators.required]], type: [null, [Validators.required]],
...@@ -89,23 +89,23 @@ export class BasiCheckComponent implements OnInit { ...@@ -89,23 +89,23 @@ export class BasiCheckComponent implements OnInit {
//新增 //新增
showAddModal(hostId, hostName,title) { showAddModal(hostId, hostName,title) {
this.title = title; this.title = title;
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
if(this.title == '添加监测点'){ if(this.title == '添加监测点'){
//主机接口 //主机接口
this.overAllSer.findDetailed(this.hostId).subscribe( this.overAllSer.findInterface(this.hostId).subscribe(
(res) => { (res) => {
this.interfaceList = res.data[0].interfaces; this.interfaceList = res.data;
} }
); );
this.isInterface = true; this.isInterface = true;
this.validateForm.get('interfaceid').setValidators(Validators.email);
} }
if(this.title == '添加模版监测点'){ if(this.title == '添加模版监测点'){
this.isInterface = false; this.isInterface = false;
this.validateForm.get('interfaceid').clearValidators(); this.validateForm.get('interfaceid').clearValidators();
} }
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
this.getItemType(); this.getItemType();
} }
...@@ -145,9 +145,9 @@ export class BasiCheckComponent implements OnInit { ...@@ -145,9 +145,9 @@ export class BasiCheckComponent implements OnInit {
); );
//主机接口 //主机接口
this.overAllSer.findDetailed(this.hostId).subscribe( this.overAllSer.findInterface(this.hostId).subscribe(
(res) => { (res) => {
this.interfaceList = res.data[0].interfaces; this.interfaceList = res.data;
} }
); );
this.getItemType(); this.getItemType();
...@@ -168,6 +168,10 @@ export class BasiCheckComponent implements OnInit { ...@@ -168,6 +168,10 @@ export class BasiCheckComponent implements OnInit {
//添加 //添加
handleCheckOk() { handleCheckOk() {
const list = ['0','1','3','4','6','10','12','13','14','16','17'];
if(list.indexOf(this.validateForm.value.type) > -1){
this.validateForm.get('type').setValidators(Validators.required);
}
for (let i in this.validateForm.controls) { for (let i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity(); this.validateForm.controls[i].updateValueAndValidity();
......
...@@ -47,7 +47,7 @@ export class DiscoveryComponent implements OnInit { ...@@ -47,7 +47,7 @@ export class DiscoveryComponent implements OnInit {
snmp_oid: ['interfaces.ifTable.ifEntry.ifInOctets.1'], snmp_oid: ['interfaces.ifTable.ifEntry.ifInOctets.1'],
snmp_community: ['public'], snmp_community: ['public'],
port: [this.hostId], port: [this.hostId],
interfaceid: [null, [Validators.required]], interfaceid: [null,],
delay: [null, [Validators.required]], delay: [null, [Validators.required]],
description: [null], description: [null],
lifetime: [null], lifetime: [null],
......
...@@ -7,6 +7,9 @@ import { Component, OnInit } from '@angular/core'; ...@@ -7,6 +7,9 @@ import { Component, OnInit } from '@angular/core';
}) })
export class CheckListComponent implements OnInit { export class CheckListComponent implements OnInit {
tempName;
disName;
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
模版配置 模版配置
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
模版:{{name}} 模版:{{tempName}}
</nz-breadcrumb-item> </nz-breadcrumb-item>
</nz-breadcrumb> </nz-breadcrumb>
</div> </div>
......
...@@ -20,7 +20,7 @@ export class DiscoveryListComponent implements OnInit { ...@@ -20,7 +20,7 @@ export class DiscoveryListComponent implements OnInit {
hostId; hostId;
childrenList; childrenList;
name; tempName;
allChecked = false; allChecked = false;
selectList = []; selectList = [];
...@@ -33,7 +33,7 @@ export class DiscoveryListComponent implements OnInit { ...@@ -33,7 +33,7 @@ export class DiscoveryListComponent implements OnInit {
this.routerInfo.queryParams.subscribe( this.routerInfo.queryParams.subscribe(
(res) => { (res) => {
this.hostId = res.hostId; this.hostId = res.hostId;
this.name = res.name this.tempName = res.name
} }
); );
} }
......
...@@ -7,6 +7,9 @@ import { Component, OnInit } from '@angular/core'; ...@@ -7,6 +7,9 @@ import { Component, OnInit } from '@angular/core';
}) })
export class TriggerListComponent implements OnInit { export class TriggerListComponent implements OnInit {
tempName;
disName;
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment