Commit 71b0c734 authored by wangqinghua's avatar wangqinghua

update

parent f1f6d9b7
......@@ -35,6 +35,7 @@ export class BasiCheckComponent implements OnInit {
title;
isCheck = false;
hostId; //主机ID
hostName; //主机name
itemId; //监控项id
interfaceList: any[];
validateForm:FormGroup;
......@@ -66,13 +67,13 @@ export class BasiCheckComponent implements OnInit {
}
ngOnInit() {
this.tabNum = 0;
this.initForm();
}
initForm(){
this.tabNum = 0;
this.validateForm = this.fb.group({
hostid:[null],
hostid:[this.hostId],
name:[null,[Validators.required]],
interfaceid:[null,[Validators.required]],
key_:[null,[Validators.required]],
......@@ -93,10 +94,11 @@ export class BasiCheckComponent implements OnInit {
}
//新增
showAddModal(hostId){
showAddModal(hostId,hostName){
this.title = '添加监测点';
this.isCheck = true;
this.hostId = hostId;
this.hostName = hostName;
//主机接口
this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => {
......@@ -157,6 +159,7 @@ export class BasiCheckComponent implements OnInit {
return false;
}
this.validateForm.value.applicationids = [this.validateForm.value.applicationids];
this.validateForm.value.hostid = this.hostId;
if(this.title == "添加监测点"){
this.create();
}
......@@ -225,10 +228,10 @@ export class BasiCheckComponent implements OnInit {
this.overAllSer.createItemType(obj).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('添加成功');
this.message.success('添加成功');
this.getItemType();
} else {
this.message.info(res.errMsg);
this.message.error(res.errMsg);
}
}
);
......@@ -271,17 +274,17 @@ export class BasiCheckComponent implements OnInit {
}
//阈值--start
save(){
saveTrigger(){
const data = {
condition:'',
faultCondition:''
};
if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => {
data.condition += '{' + this.validateForm.value.name + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
data.condition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
});
this.faultConditionList.forEach(res => {
data.faultCondition += '{' + this.validateForm.value.name + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value;
data.faultCondition += '{' + this.hostName + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value;
});
} else { //高级
data.condition = this.validateForm.value.condition_high;
......@@ -301,9 +304,15 @@ export class BasiCheckComponent implements OnInit {
faultCondition:data.faultCondition,
condition:data.condition
};
this.overAllSer.createTrigger(res).subscribe(res=>{
})
this.overAllSer.createTrigger(res).subscribe(
(response)=>{
if(response.errCode == 10000){
this.message.success("创建阈值成功");
}else{
this.message.error(response.errMsg);
}
}
)
}
//2.修改阈值
......
......@@ -164,7 +164,7 @@
<span (click)="showBasicEditModal(item)">添加资源</span>
</ng-container>
<ng-container *ngIf="item.level">
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
......@@ -265,7 +265,7 @@
<span (click)="showDeleteGroupConfirm(item)">删除</span>
</ng-container>
<ng-container *ngIf="item.level">
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
......@@ -353,7 +353,7 @@
</ng-container>
</td>
<td class="handle">
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="showBasicCheckModal(item.hostid,item.host)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown [nzTrigger]="'click'" class="table-dropdown">
......
......@@ -207,8 +207,8 @@ export class BasicComponent implements OnInit {
}
//添加监测点
showBasicCheckModal(hostid) {
this.smartCheck.showAddModal(hostid);
showBasicCheckModal(hostid,host) {
this.smartCheck.showAddModal(hostid,host);
}
//列表
......
......@@ -300,12 +300,12 @@ export class OverAllService {
}
//创建触发器
createTrigger(data){
createTrigger(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/item/createItemTrigger',data);
}
//修改触发器
updateTrigger(data){
updateTrigger(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/item/updateItemTrigger',data);
}
......
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