Commit 2c246503 authored by wangqinghua's avatar wangqinghua

template

parent d43ca8df
...@@ -229,13 +229,6 @@ ...@@ -229,13 +229,6 @@
<ng-container *ngIf="selectModal"> <ng-container *ngIf="selectModal">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="serviceid">恢复主题</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="host4" type="text" nz-input name="host1" [(ngModel)]="validateForm.r_shortdata">
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="serviceid">恢复信息</nz-form-label> <nz-form-label [nzSpan]="4" nzRequired nzFor="serviceid">恢复信息</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<textarea nz-input nzPlaceholder="恢复信息" [nzAutosize]="{ minRows: 4, maxRows: 4 }" [(ngModel)]="validateForm.r_longdata"></textarea> <textarea nz-input nzPlaceholder="恢复信息" [nzAutosize]="{ minRows: 4, maxRows: 4 }" [(ngModel)]="validateForm.r_longdata"></textarea>
......
...@@ -69,8 +69,7 @@ export class AlarmModalComponent implements OnInit { ...@@ -69,8 +69,7 @@ export class AlarmModalComponent implements OnInit {
serious:0, serious:0,
mediaTypeIds:[], mediaTypeIds:[],
def_longdata:null, def_longdata:null,
r_longdata:null, r_longdata:'' +
r_shortdata:'' +
'问题 {TRIGGER.NAME} 恢复于: {EVENT.TIME} {EVENT.DATE} \n' + '问题 {TRIGGER.NAME} 恢复于: {EVENT.TIME} {EVENT.DATE} \n' +
'主机: {HOST.NAME}\n' + '主机: {HOST.NAME}\n' +
'严重程度: {TRIGGER.SEVERITY}\n' + '严重程度: {TRIGGER.SEVERITY}\n' +
......
...@@ -91,12 +91,12 @@ export class CheckListComponent implements OnInit { ...@@ -91,12 +91,12 @@ export class CheckListComponent implements OnInit {
//新增监控项原型 //新增监控项原型
showAddModal(){ showAddModal(){
this.smartCheckProtoType.showAddModal(this.hostId,this.tempName,"添加监控项原型") this.smartCheckProtoType.showAddModal(this.hostId,this.discoveryids,"添加监控项原型")
} }
//编辑监控项原型 //编辑监控项原型
showEditModal(data){ showEditModal(data){
this.smartCheckProtoType.showEditModal(this.hostId,data.id,this.tempName,"编辑监控项原型") this.smartCheckProtoType.showEditModal(this.hostId,this.discoveryids,data.itemid,"编辑监控项原型")
} }
//单个删除 //单个删除
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
validateForm.value.type == '4' || validateForm.value.type == '6' || validateForm.value.type == '10' || validateForm.value.type == '12' || validateForm.value.type == '4' || validateForm.value.type == '6' || validateForm.value.type == '10' || validateForm.value.type == '12' ||
validateForm.value.type == '13' || validateForm.value.type == '14' || validateForm.value.type == '16' || validateForm.value.type == '17'"> validateForm.value.type == '13' || validateForm.value.type == '14' || validateForm.value.type == '16' || validateForm.value.type == '17'">
<nz-form-item> <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-form-control [nzSpan]="14">
<nz-select name="interfaceid" formControlName="interfaceid" nzPlaceHolder="选择主机接口"> <nz-select name="interfaceid" formControlName="interfaceid" nzPlaceHolder="选择主机接口">
<nz-option *ngFor="let item of interfaceList" nzValue="{{item.interfaceid}}" <nz-option *ngFor="let item of interfaceList" nzValue="{{item.interfaceid}}"
...@@ -49,23 +49,23 @@ ...@@ -49,23 +49,23 @@
</nz-form-item> </nz-form-item>
</ng-container> </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>-->
<nz-form-label [nzSpan]="6" nzFor="snmp_oid">SNMP OID</nz-form-label> <!--<nz-form-label [nzSpan]="6" nzFor="snmp_oid">SNMP OID</nz-form-label>-->
<nz-form-control [nzSpan]="14"> <!--<nz-form-control [nzSpan]="14">-->
<input id="snmp_oid" name="snmp_oid" type="text" nz-input formControlName="snmp_oid"> <!--<input id="snmp_oid" name="snmp_oid" type="text" nz-input formControlName="snmp_oid">-->
<!--<nz-form-explain *ngIf="validateForm.get('note').dirty && validateForm.get('note').errors">Please input your username!</nz-form-explain>--> <!--&lt;!&ndash;<nz-form-explain *ngIf="validateForm.get('note').dirty && validateForm.get('note').errors">Please input your username!</nz-form-explain>&ndash;&gt;-->
</nz-form-control> <!--</nz-form-control>-->
</nz-form-item> <!--</nz-form-item>-->
<nz-form-item> <!--<nz-form-item>-->
<nz-form-label [nzSpan]="6" nzFor="snmp_community">SNMP community</nz-form-label> <!--<nz-form-label [nzSpan]="6" nzFor="snmp_community">SNMP community</nz-form-label>-->
<nz-form-control [nzSpan]="14"> <!--<nz-form-control [nzSpan]="14">-->
<input id="snmp_community" name="units" type="text" nz-input <!--<input id="snmp_community" name="units" type="text" nz-input-->
formControlName="snmp_community"> <!--formControlName="snmp_community">-->
<!--<nz-form-explain *ngIf="validateForm.get('note').dirty && validateForm.get('note').errors">Please input your username!</nz-form-explain>--> <!--&lt;!&ndash;<nz-form-explain *ngIf="validateForm.get('note').dirty && validateForm.get('note').errors">Please input your username!</nz-form-explain>&ndash;&gt;-->
</nz-form-control> <!--</nz-form-control>-->
</nz-form-item> <!--</nz-form-item>-->
</ng-container> <!--</ng-container>-->
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired nzFor="key_">键值</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired nzFor="key_">键值</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
...@@ -126,6 +126,13 @@ ...@@ -126,6 +126,13 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</form> </form>
<nz-form-item>
<nz-form-label [nzSpan]="6">已启用</nz-form-label>
<nz-form-control [nzSpan]="14">
<label name="status" nz-checkbox formControlName="status"></label>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal> </nz-modal>
<!--键值查询--> <!--键值查询-->
......
...@@ -6,9 +6,9 @@ import {NewTypeComponent} from '../../../../modal/new-type/new-type.component'; ...@@ -6,9 +6,9 @@ import {NewTypeComponent} from '../../../../modal/new-type/new-type.component';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
@Component({ @Component({
selector: 'smart-check-prototype', selector: 'smart-check-prototype',
templateUrl: './check-prototype.component.html', templateUrl: './check-prototype.component.html',
styles: [] styles: []
}) })
export class CheckPrototypeComponent implements OnInit { export class CheckPrototypeComponent implements OnInit {
...@@ -21,7 +21,7 @@ export class CheckPrototypeComponent implements OnInit { ...@@ -21,7 +21,7 @@ export class CheckPrototypeComponent implements OnInit {
isInterface = true; //添加模版监测点的时候不需要主机接口 isInterface = true; //添加模版监测点的时候不需要主机接口
nzSize = 'large'; nzSize = 'large';
hostId; //主机ID hostId; //主机ID
hostName; //主机name discoveryid; //自动发现id
itemId; //监控项id itemId; //监控项id
interfaceList: any[]; interfaceList: any[];
valueMapList = []; valueMapList = [];
...@@ -30,11 +30,6 @@ export class CheckPrototypeComponent implements OnInit { ...@@ -30,11 +30,6 @@ export class CheckPrototypeComponent implements OnInit {
interval; //间隔时长 interval; //间隔时长
tabNum: number; tabNum: number;
triggerObj = {
condition: '',
faultCondition: '',
itemName: ''
};
constructor(private overAllSer: OverAllService, private fb: FormBuilder, constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) { private message: NzMessageService) {
...@@ -42,84 +37,72 @@ export class CheckPrototypeComponent implements OnInit { ...@@ -42,84 +37,72 @@ export class CheckPrototypeComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.initForm(); this.initForm();
this.getValuemap();
} }
initForm() { initForm() {
this.tabNum = 0; this.tabNum = 0;
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
hostid: [this.hostId],
name: [null, [Validators.required]], name: [null, [Validators.required]],
interfaceid: [null],
key_: [null, [Validators.required]], key_: [null, [Validators.required]],
value_type: [null, [Validators.required]], hostid: [null],
ruleid: [null],
type: [null, [Validators.required]], type: [null, [Validators.required]],
value_type: [null, [Validators.required]],
interfaceid: [null],
delay: [null, [Validators.required]],
units: [null], units: [null],
history: ['3600'], history: ['3600'],
trends: [null], trends: [null],
delay: [null, [Validators.required]],
snmp_oid: ['interfaces.ifTable.ifEntry.ifInOctets.1'],
snmp_community: ['public'],
applications: [null], applications: [null],
status: [null],
// snmp_oid: ['interfaces.ifTable.ifEntry.ifInOctets.1'],
// snmp_community: ['public'],
}); });
this.triggerObj = {
condition: '',
faultCondition: '',
itemName: ''
};
} }
//新增 /**
showAddModal(hostId, hostName,title) { * 新增监控项原型
* @param hostId 模版id
* @param discoveryid 自动发现id
* @param hostName 模版名称
* @param title 标题
*/
showAddModal(hostId,discoveryid, title) {
this.title = title; this.title = title;
this.isCheck = true; this.isCheck = true;
this.hostId = hostId; this.hostId = hostId;
this.hostName = hostName; this.overAllSer.findInterface(this.hostId).subscribe(
if(this.title == '添加监测点'){ (res) => {
//主机接口 this.interfaceList = res.data;
this.overAllSer.findInterface(this.hostId).subscribe( }
(res) => { );
this.interfaceList = res.data; this.isInterface = true;
}
);
this.isInterface = true;
}
if(this.title == '添加模版监测点'){
this.isInterface = false;
this.validateForm.get('interfaceid').clearValidators();
}
this.getItemType(); this.getItemType();
} }
//映射值 /**
getValuemap() { *
// this.overAllSer.findValuemap().subscribe( * @param hostId 模版id
// (res) => { * @param discoveryid 自动发现id
// if (res.errCode == 10000) { * @param itemId 监控项id
// this.valueMapList = res.data; * @param hostName 模版名称
// } else { * @param title 标题
// this.message.error(res.errMsg); */
// } showEditModal(hostId, discoveryid,itemId, title) {
// }
// );
}
//编辑
showEditModal(hostId, id, hostName,title) {
this.title = title; this.title = title;
this.hostId = hostId; this.hostId = hostId;
this.itemId = itemId;
this.isCheck = true; this.isCheck = true;
this.itemId = id; this.discoveryid = discoveryid;
this.hostName = hostName; this.overAllSer.findItemDetail(discoveryid).subscribe(
this.overAllSer.findItemDetail(id).subscribe(
(res) => { (res) => {
const data = res.data[0]; const data = res.data[0];
data.type += ''; data.type += '';
data.interfaceid += ''; data.interfaceid += '';
data.value_type += ''; data.value_type += '';
if(data.applications){ if (data.applications) {
data.applications = data.applications.map(e=>{ data.applications = data.applications.map(e => {
return e.applicationid; return e.applicationid;
}); });
} }
...@@ -151,8 +134,8 @@ export class CheckPrototypeComponent implements OnInit { ...@@ -151,8 +134,8 @@ export class CheckPrototypeComponent implements OnInit {
//添加 //添加
handleCheckOk() { handleCheckOk() {
const list = ['0','1','3','4','6','10','12','13','14','16','17']; const list = ['0', '1', '3', '4', '6', '10', '12', '13', '14', '16', '17'];
if(list.indexOf(this.validateForm.value.type) > -1){ if (list.indexOf(this.validateForm.value.type) > -1) {
this.validateForm.get('type').setValidators(Validators.required); this.validateForm.get('type').setValidators(Validators.required);
} }
for (let i in this.validateForm.controls) { for (let i in this.validateForm.controls) {
...@@ -163,21 +146,25 @@ export class CheckPrototypeComponent implements OnInit { ...@@ -163,21 +146,25 @@ export class CheckPrototypeComponent implements OnInit {
this.message.error('请输入必填信息'); this.message.error('请输入必填信息');
return false; return false;
} }
this.validateForm.value.applications = [this.validateForm.value.applications]; this.validateForm.patchValue({
this.validateForm.value.hostid = this.hostId; applications:this.validateForm.value.applications,
if (this.title == '添加监测点原型') { hostId:this.hostId,
ruleid:this.discoveryid,
status:this.validateForm.value.status ? 0 : 1
});
if (this.title == '添加监控项原型') {
this.create(); this.create();
} }
if (this.title == '编辑监测点原型') { if (this.title == '编辑监控项原型') {
this.update(); this.update();
} }
} }
create() { create() {
this.overAllSer.create(this.validateForm.value).subscribe( this.overAllSer.createItemPrototype(this.validateForm.value).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.success('创建监测点成功'); this.message.success('创建监控项原型成功');
this.done.emit(); this.done.emit();
this.tabNum = 1; this.tabNum = 1;
this.isCheck = false; this.isCheck = false;
...@@ -194,10 +181,10 @@ export class CheckPrototypeComponent implements OnInit { ...@@ -194,10 +181,10 @@ export class CheckPrototypeComponent implements OnInit {
//修改监控项 //修改监控项
update() { update() {
this.validateForm.addControl('itemid', new FormControl(this.itemId)); this.validateForm.addControl('itemid', new FormControl(this.itemId));
this.overAllSer.itemUpdata(this.validateForm.value).subscribe( this.overAllSer.updateItemPrototype(this.validateForm.value).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.success('修改监测点成功'); this.message.success('修改监控项原型成功');
this.done.emit(); this.done.emit();
this.tabNum = 1; this.tabNum = 1;
this.isCheck = false; this.isCheck = false;
......
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