Commit db2204d9 authored by wangqinghua's avatar wangqinghua

template

parent c38ed6a2
......@@ -33,16 +33,18 @@
<nz-form-explain *ngIf="validateForm.get('type').dirty && validateForm.get('type').errors">请选择监测点类型!</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="interfaceid">主机接口</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="interfaceid" formControlName="interfaceid" nzPlaceHolder="选择主机接口">
<nz-option *ngFor="let item of interfaceList" nzValue="{{item.interfaceid}}"
nzLabel="{{item.ip}}:{{item.port}}"></nz-option>
</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 *ngIf="isInterface">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="interfaceid">主机接口</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="interfaceid" formControlName="interfaceid" nzPlaceHolder="选择主机接口">
<nz-option *ngFor="let item of interfaceList" nzValue="{{item.interfaceid}}"
nzLabel="{{item.ip}}:{{item.port}}"></nz-option>
</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 *ngIf="validateForm.value.type == 1 || validateForm.value.type == 4 || validateForm.value.type == 6">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="snmp_oid">SNMP OID</nz-form-label>
......
......@@ -35,6 +35,7 @@ export class BasiCheckComponent implements OnInit {
title;
isCheck = false;
isInterface = true;
nzSize = 'large';
hostId; //主机ID
hostName; //主机name
......@@ -71,10 +72,8 @@ export class BasiCheckComponent implements OnInit {
value_type: [null, [Validators.required]],
type: [null, [Validators.required]],
units: [null],
// formula: [null, [Validators.required]],
history: ['3600'],
trends: [null],
// valuemapid: ['0'],
delay: [null, [Validators.required]],
snmp_oid: ['interfaces.ifTable.ifEntry.ifInOctets.1'],
snmp_community: ['public'],
......@@ -88,17 +87,25 @@ export class BasiCheckComponent implements OnInit {
}
//新增
showAddModal(hostId, hostName) {
this.title = '添加监测点';
showAddModal(hostId, hostName,title) {
this.title = title;
if(this.title == '添加监测点'){
//主机接口
this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => {
this.interfaceList = res.data[0].interfaces;
}
);
this.isInterface = true;
this.validateForm.get('interfaceid').setValidators(Validators.email);
}
if(this.title == '添加模版监测点'){
this.isInterface = false;
this.validateForm.get('interfaceid').clearValidators();
}
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
//主机接口
this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => {
this.interfaceList = res.data[0].interfaces;
}
);
this.getItemType();
}
......@@ -171,7 +178,7 @@ export class BasiCheckComponent implements OnInit {
}
this.validateForm.value.applications = [this.validateForm.value.applications];
this.validateForm.value.hostid = this.hostId;
if (this.title == '添加监测点') {
if (this.title == '添加监测点' || this.title == "添加模版监测点") {
this.create();
}
if (this.title == '编辑监测点') {
......
......@@ -626,7 +626,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//添加监测点
showCheckModal() {
this.smartCheck.showAddModal(this.hostId,this.realName);
this.smartCheck.showAddModal(this.hostId,this.realName,'添加监测点');
}
//编辑监测点
......
......@@ -213,7 +213,7 @@ export class BasicComponent implements OnInit {
//添加监测点
showBasicCheckModal(hostid, host) {
this.smartCheck.showAddModal(hostid, host);
this.smartCheck.showAddModal(hostid, host,'添加监测点');
}
//列表
......
......@@ -77,14 +77,13 @@
<span (click)="showDeleteGroupConfirm(item)">删除</span>
</ng-container>
<ng-container *ngIf="item.level">
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="showBasicCheckModal(item.templateid,item.host)">添加监测点</span>
<span (click)="showTempEditModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
<a nz-dropdown>更多 <i class="anticon anticon-down"></i>
</a>
<ul nz-menu nzSelectable>
<li *ngIf="!item.monitorTask" (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li>
</ul>
......@@ -107,14 +106,13 @@
</td>
<td></td>
<td class="handle main-color">
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="showBasicCheckModal(item.templateid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
<a nz-dropdown>更多 <i class="anticon anticon-down"></i>
</a>
<ul nz-menu nzSelectable>
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li>
</ul>
......
......@@ -175,7 +175,7 @@ export class TemplateComponent implements OnInit {
//添加监测点
showBasicCheckModal(hostid, host) {
this.smartCheck.showAddModal(hostid, host);
this.smartCheck.showAddModal(hostid, host,"添加模版监测点");
}
toTree(index) {
......
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