Commit cfb94508 authored by wangqinghua's avatar wangqinghua

update

parent 4a988a1f
......@@ -33,7 +33,7 @@
</nz-form-item>
<ng-container *ngIf="isInterface">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="interfaceid">主机接口</nz-form-label>
<nz-form-label [nzSpan]="6" 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}}"
......@@ -67,7 +67,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="port">端口</nz-form-label>
<nz-form-label [nzSpan]="6" nzFor="port">端口</nz-form-label>
<nz-form-control [nzSpan]="14">
<input placeholder="输入端口" type="text" name="port" nz-input formControlName="port">
<nz-form-explain *ngIf="validateForm.get('port').dirty && validateForm.get('port').errors">请选择键值!</nz-form-explain>
......
......@@ -27,8 +27,6 @@ export class DiscoveryComponent implements OnInit {
checkList; //监测点分类
interval; //间隔时长
tabNum: number;
constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) {
}
......@@ -38,7 +36,6 @@ export class DiscoveryComponent implements OnInit {
}
initForm() {
this.tabNum = 0;
this.validateForm = this.fb.group({
hostid: [this.hostId],
name: [null, [Validators.required]],
......@@ -74,7 +71,7 @@ export class DiscoveryComponent implements OnInit {
this.hostId = hostId;
this.isVisiable = true;
this.itemId = discoveryid;
this.overAllSer.findItemDetail(discoveryid).subscribe(
this.overAllSer.findLldrule(discoveryid).subscribe(
(res) => {
const data = res.data[0];
data.type += '';
......@@ -102,7 +99,10 @@ export class DiscoveryComponent implements OnInit {
this.message.error('请输入必填信息');
return false;
}
this.validateForm.value.status = this.validateForm.value.status ? 1:0;
let d = this.validateForm.value.status == true ? 1 : 0;
this.validateForm.patchValue({
status:d
})
this.validateForm.value.hostid = this.hostId;
if (this.title == '添加自动发现') {
this.create();
......@@ -118,7 +118,6 @@ export class DiscoveryComponent implements OnInit {
if (res.errCode == 10000) {
this.message.success('创建自动发现成功');
this.done.emit();
this.tabNum = 1;
this.isVisiable = false;
} else {
this.message.error(res.errMsg);
......@@ -133,12 +132,12 @@ export class DiscoveryComponent implements OnInit {
//修改监控项
update() {
this.validateForm.addControl('itemid', new FormControl(this.itemId));
console.log(this.validateForm.value);
this.overAllSer.updateLldrule(this.validateForm.value).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.success('修改自动发现成功');
this.done.emit();
this.tabNum = 1;
this.isVisiable = false;
} else {
this.message.error(res.errMsg);
......
......@@ -21,6 +21,7 @@ export class StrategyComponent implements OnInit {
validateForm;
tempId; //模版Id
templateList = []; //模版组
templatesResoure; //old模版
tempList; //模版
......@@ -116,9 +117,12 @@ export class StrategyComponent implements OnInit {
if (data.parentTemplates) {
//模版回显
this.validateForm.templates = data.parentTemplates.map(e => {
let tempArr = [];
tempArr = data.parentTemplates.map(e => {
return e.templateid;
});
this.validateForm.templates = tempArr;
this.templatesResoure = tempArr;
}
}
);
......@@ -191,6 +195,16 @@ export class StrategyComponent implements OnInit {
}
update(arr) {
//比较监控模版是否发生变化
const clearArr = [];
this.templatesResoure.forEach(res => {
if (this.validateForm.templates.indexOf(res) == -1) {
const d = {
templateid:res
}
clearArr.push(d);
}
});
const data = {
templateid: this.tempId, //模版id
host: this.validateForm.host,
......@@ -202,7 +216,8 @@ export class StrategyComponent implements OnInit {
};
return d;
}),
macros: [],
templates_clear:clearArr,
macros: this.validateForm.macros,
hosts: [],
};
this.overAllSer.updateTemplates(data).subscribe(
......
......@@ -28,7 +28,9 @@
<button (click)="showAddModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>添加监控项原型</button>
</div>
<div nz-col nzSpan="18"></div>
<div nz-col nzSpan="3"></div>
<div nz-col nzSpan="3">
<button (click)="deleteBatchCheck()" nz-button nzType="default"><i class="anticon anticon-close-circle-o"></i>批量删除</button>
</div>
</div>
<nz-table #nzTable [nzData]="checkList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
......@@ -38,7 +40,6 @@
<th>名称</th>
<th>键值</th>
<th>间隔</th>
<th>类型</th>
<th>状态</th>
<th>操作</th>
</tr>
......@@ -49,11 +50,13 @@
<td class="round-tag tag-form">{{data.name}}</td>
<td>{{data.key_}}</td>
<td>{{data.usedcount}}</td>
<td>{{data.type}}</td>
<td>{{data.status}}</td>
<td>
<span>编辑</span>
<span>删除</span>
<span *ngIf="data.status == 0">启用</span>
<span *ngIf="data.status == 1">禁用</span>
</td>
<td class="main-color cursor">
<span (click)="showEditModal(data)">编辑</span>
<span (click)="deleteCheck(data)">删除</span>
</td>
</tr>
</tbody>
......
......@@ -110,7 +110,7 @@ export class CheckListComponent implements OnInit {
//单个删除
deleteCheck(item) {
this.commonSer.confirmThing('删除', '确定删除当前的自动发现', () => {
this.commonSer.confirmThing('删除', '确定删除当前的监控项原型', () => {
const data = {
ids: []
};
......
......@@ -105,12 +105,11 @@
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="itemtype">监测点分类</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select style="width: 80%;display: inline-block" nzPlaceHolder="选择监测点分类" name="itemtype"
<nz-select nzPlaceHolder="选择监测点分类" name="itemtype"
[nzSize]="nzSize" nzMode="tags" formControlName="applications">
<nz-option *ngFor="let item of checkList" [nzValue]="item.applicationid"
[nzLabel]="item.name"></nz-option>
</nz-select>
<button nz-button nzType="primary" (click)="showTypeModal()">新建分类</button>
</nz-form-control>
</nz-form-item>
<nz-form-item>
......
......@@ -31,10 +31,10 @@ export class TriggerPrototypeComponent implements OnInit {
initForm() {
this.triggerObj = {
expression:"",
priority:"2",
description:""
}
expression: '',
priority: '2',
description: ''
};
}
//新增
......@@ -45,14 +45,17 @@ export class TriggerPrototypeComponent implements OnInit {
}
//编辑
showEditModal(title,id, hostName) {
showEditModal(title, id, hostName) {
this.title = title;
this.triggerId = id;
this.isVisiable = true;
this.hostName = hostName;
this.overAllSer.findTriggerById(id).subscribe(
(res) => {
const data = res.data[0];
this.triggerObj.expression = data.expression;
this.triggerObj.description = data.description;
this.triggerObj.priority = data.priority + '';
}
);
}
......@@ -63,7 +66,7 @@ export class TriggerPrototypeComponent implements OnInit {
this.message.error('请输入阈值');
return false;
}
if(this.title == "新增阈值原型"){
if (this.title == '新增阈值原型') {
this.createTrigger();
}
if (this.title == '编辑阈值原型') {
......@@ -73,8 +76,8 @@ export class TriggerPrototypeComponent implements OnInit {
//校验是否填值
checkFun() {
if(!this.triggerObj.expression){
this.message.error("请输入表达式");
if (!this.triggerObj.expression) {
this.message.error('请输入表达式');
return false;
}
return true;
......@@ -98,7 +101,13 @@ export class TriggerPrototypeComponent implements OnInit {
//2.修改阈值
updateTrigger() {
this.overAllSer.updateTriggerPrototype(this.triggerObj).subscribe(res => {
const data = {
triggerid: this.triggerId,
expression: this.triggerObj.expression,
priority: this.triggerObj.priority,
description: this.triggerObj.description
};
this.overAllSer.updateTriggerPrototype(data).subscribe(res => {
if (res.errCode == 10000) {
this.message.success('修改阈值成功');
this.initForm();
......
......@@ -28,7 +28,9 @@
<button (click)="showAddModal()" nz-button nzType="default"><i class="anticon anticon-plus-circle-o"></i>添加阈值原型</button>
</div>
<div nz-col nzSpan="18"></div>
<div nz-col nzSpan="3"></div>
<div nz-col nzSpan="3">
<button (click)="deleteBatchTrigger()" nz-button nzType="default"><i class="anticon anticon-close-circle-o"></i>批量删除</button>
</div>
</div>
<nz-table #nzTable [nzData]="triggerList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
......
......@@ -104,7 +104,7 @@ export class TriggerListComponent implements OnInit {
}
showEditModal(data) {
this.smartTriggerPrototype.showEditModal('编辑阈值原型', data.id, this.tempName);
this.smartTriggerPrototype.showEditModal('编辑阈值原型', data.triggerid, this.tempName);
}
//单个删除
......
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