Commit a75ad9c1 authored by wangqinghua's avatar wangqinghua

网站监测

parent 4f6f6ce6
......@@ -29,6 +29,11 @@ export class AlarmService {
return this.http.post(SERVER_API_URL + '/action/find',data);
}
//查找所有zabbix用户
zUserFind(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/zuser/find',data);
}
//修改告警推送设置
actionUpdate(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/action/update',data);
......
<nz-modal [nzWidth]="700" [(nzVisible)]="isVisible" nzTitle="选择键值" (nzOnCancel)="handleKeyCancel()" (nzOnOk)="handleKeyOk()">
<div nz-row>
<div nz-col [nzSpan]="16">
Agent用户
</div>
</div>
<div>
<nz-table #nzKeyTable [nzData]="objList">
<thead>
<tr>
<th width="30%">用户名</th>
<th>内容</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of nzKeyTable.data">
<td (click)="setUser(data)">{{data.alias}}</td>
<td>{{data.surname}}</td>
</tr>
</tbody>
</nz-table>
</div>
</nz-modal>
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
import {AlarmService} from '../../alarm.service';
@Component({
selector: 'smart-find-user',
templateUrl: './find-user.component.html',
styles: []
})
export class FindUserComponent implements OnInit {
@Output() set = new EventEmitter<any>();
isVisible = false;
objList;
constructor(private alarmSer: AlarmService) {
}
ngOnInit() {
this.getZabbixObj();
}
//获取发送对象 zabbix
getZabbixObj() {
this.alarmSer.zUserFind({}).subscribe(
(res) => {
if (res.errCode == 10000) {
this.objList = res.data;
}
}
);
}
showModal() {
this.isVisible = true;
}
setUser(item) {
this.isVisible = false;
this.set.emit(item);
}
}
......@@ -62,6 +62,7 @@ import {PersonelManageComponent} from './work/personel-manage/personel-manage.co
import {WorkHandleComponent} from './work/work-handle/work-handle.component';
import {WebsiteComponent} from './modal/website/website.component';
import {NetworkDetailComponent} from './overAll/network-check/network-detail/network-detail.component';
import {FindUserComponent} from './alarm/modal/find-user/find-user.component';
@NgModule({
imports: [
......@@ -125,6 +126,7 @@ import {NetworkDetailComponent} from './overAll/network-check/network-detail/net
WorkHandleComponent,
WebsiteComponent,
NetworkDetailComponent,
FindUserComponent
],
providers:[
OverAllService,
......
......@@ -7,7 +7,7 @@
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="host">告警名称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="host" type="text" nz-input name="host">
<input id="host" type="text" nz-input name="host" [(ngModel)]="validateForm.name">
</nz-form-control>
</nz-form-item>
......@@ -22,7 +22,7 @@
<nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="serviceid">告警分组</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="serviceid" nzPlaceHolder="告警分组">
<nz-select name="serviceid" nzPlaceHolder="告警分组" [(ngModel)]="validateForm.alertGroupId">
<nz-option nzValue="" nzLabel="无"></nz-option>
</nz-select>
</nz-form-control>
......@@ -174,7 +174,8 @@
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="host1">发送对象</nz-form-label>
<nz-form-control [nzSpan]="14">
<button nz-button nzType="primary">选择</button>
<button (click)="showUserModa()" nz-button nzType="primary">选择</button>
<span>{{userObj.alias}}</span>
</nz-form-control>
</nz-form-item>
......@@ -215,3 +216,6 @@
</nz-tab>
</nz-tabset>
</nz-modal>
<!--选择对象-->
<smart-find-user #smartFindUser (set)="getUser($event)"></smart-find-user>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {AlarmService} from '../../alarm/alarm.service';
import {FindUserComponent} from '../../alarm/modal/find-user/find-user.component';
@Component({
selector: 'smart-alarm-modal',
templateUrl: './alarm-modal.component.html',
styles: []
selector: 'smart-alarm-modal',
templateUrl: './alarm-modal.component.html',
styles: []
})
export class AlarmModalComponent implements OnInit {
@ViewChild('smartFindUser') smartFindUser:FindUserComponent;
modalTitle = '添加告警';
tabNum = 0;
isShow = false;
sendOption = [
{ label: '邮件', value: 'Apple', checked: false },
{ label: '短信', value: 'Pear', checked: false },
{ label: '微信', value: 'Orange', checked: false }
];
sendOption = [];
userObj;
validateForm;
constructor() { }
ngOnInit() {
this.validateForm = {
name:null,
alertGroupId:null,
constructor(private alarmSer: AlarmService) {
}
ngOnInit() {
this.initForm();
this.getSendFun();
}
};
}
//初始化
initForm() {
this.validateForm = {
name: null,
alertGroupId: null,
};
}
//获取发送方式
getSendFun() {
this.alarmSer.mediaTypeFind({}).subscribe(
(res) => {
if (res.errCode == 10000) {
this.sendOption = res.data;
this.sendOption.forEach(res => {
res.label = res.description;
res.value = res.mediatypeid;
res.checked = false;
});
}
}
);
}
showModal(data){
this.isShow = true;
}
//选择对象
showUserModa(){
this.smartFindUser.showModal();
}
//获取对象
getUser(data) {
this.userObj = data;
console.log(data);
}
showModal(data) {
this.isShow = true;
}
handleEditCancel(){
this.isShow = false;
handleEditCancel() {
this.isShow = false;
}
tabsChange(index){
this.tabNum = index;
tabsChange(index) {
this.tabNum = index;
}
handEditleOk(){
this.isShow = false;
handEditleOk() {
this.isShow = 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