Commit a75ad9c1 authored by wangqinghua's avatar wangqinghua

网站监测

parent 4f6f6ce6
...@@ -29,6 +29,11 @@ export class AlarmService { ...@@ -29,6 +29,11 @@ export class AlarmService {
return this.http.post(SERVER_API_URL + '/action/find',data); 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>{ actionUpdate(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/action/update',data); 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 ...@@ -62,6 +62,7 @@ import {PersonelManageComponent} from './work/personel-manage/personel-manage.co
import {WorkHandleComponent} from './work/work-handle/work-handle.component'; import {WorkHandleComponent} from './work/work-handle/work-handle.component';
import {WebsiteComponent} from './modal/website/website.component'; import {WebsiteComponent} from './modal/website/website.component';
import {NetworkDetailComponent} from './overAll/network-check/network-detail/network-detail.component'; import {NetworkDetailComponent} from './overAll/network-check/network-detail/network-detail.component';
import {FindUserComponent} from './alarm/modal/find-user/find-user.component';
@NgModule({ @NgModule({
imports: [ imports: [
...@@ -125,6 +126,7 @@ import {NetworkDetailComponent} from './overAll/network-check/network-detail/net ...@@ -125,6 +126,7 @@ import {NetworkDetailComponent} from './overAll/network-check/network-detail/net
WorkHandleComponent, WorkHandleComponent,
WebsiteComponent, WebsiteComponent,
NetworkDetailComponent, NetworkDetailComponent,
FindUserComponent
], ],
providers:[ providers:[
OverAllService, OverAllService,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="host">告警名称</nz-form-label> <nz-form-label [nzSpan]="4" nzRequired nzFor="host">告警名称</nz-form-label>
<nz-form-control [nzSpan]="14"> <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-control>
</nz-form-item> </nz-form-item>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="serviceid">告警分组</nz-form-label> <nz-form-label [nzSpan]="4" nzFor="serviceid">告警分组</nz-form-label>
<nz-form-control [nzSpan]="14"> <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-option nzValue="" nzLabel="无"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
...@@ -174,7 +174,8 @@ ...@@ -174,7 +174,8 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired nzFor="host1">发送对象</nz-form-label> <nz-form-label [nzSpan]="4" nzRequired nzFor="host1">发送对象</nz-form-label>
<nz-form-control [nzSpan]="14"> <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-control>
</nz-form-item> </nz-form-item>
...@@ -215,3 +216,6 @@ ...@@ -215,3 +216,6 @@
</nz-tab> </nz-tab>
</nz-tabset> </nz-tabset>
</nz-modal> </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({ @Component({
selector: 'smart-alarm-modal', selector: 'smart-alarm-modal',
templateUrl: './alarm-modal.component.html', templateUrl: './alarm-modal.component.html',
styles: [] styles: []
}) })
export class AlarmModalComponent implements OnInit { export class AlarmModalComponent implements OnInit {
@ViewChild('smartFindUser') smartFindUser:FindUserComponent;
modalTitle = '添加告警'; modalTitle = '添加告警';
tabNum = 0; tabNum = 0;
isShow = false; isShow = false;
sendOption = [ sendOption = [];
{ label: '邮件', value: 'Apple', checked: false }, userObj;
{ label: '短信', value: 'Pear', checked: false },
{ label: '微信', value: 'Orange', checked: false }
];
validateForm; validateForm;
constructor() { }
ngOnInit() { constructor(private alarmSer: AlarmService) {
this.validateForm = { }
name:null,
alertGroupId:null, 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(){ handleEditCancel() {
this.isShow = false; this.isShow = false;
} }
tabsChange(index){ tabsChange(index) {
this.tabNum = index; this.tabNum = index;
} }
handEditleOk(){ handEditleOk() {
this.isShow = false; 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