Commit 2c246503 authored by wangqinghua's avatar wangqinghua

template

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