Commit 0cfee493 authored by wangqinghua's avatar wangqinghua

告警模块

parent 202c661b
...@@ -19,26 +19,28 @@ ...@@ -19,26 +19,28 @@
</div> </div>
</div> </div>
<div nz-row class="search-form"> <div style="margin-bottom: 20px">
<div nz-col nzSpan="16"> <nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择级别" [(ngModel)]="selectedValue" (ngModelChange)="select()">
<span>当前告警数:120</span> <nz-option nzLabel="告警" nzValue="type"></nz-option>
</div> <nz-option nzLabel="严重" nzValue="group"></nz-option>
</div> </nz-select>
<div> <nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择分组" [(ngModel)]="selectedValue" (ngModelChange)="select()">
<!--<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择级别" [(ngModel)]="selectedValue" (ngModelChange)="select()" >--> <ng-container *ngFor="let item of groupList;">
<!--<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>--> <nz-option nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option>
<!--<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>--> </ng-container>
<!--</nz-select>--> </nz-select>
<!--<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择分组" [(ngModel)]="selectedValue" (ngModelChange)="select()" >--> <nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择资源类型" [(ngModel)]="selectedValue" (ngModelChange)="select()">
<!--<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>--> <ng-container *ngFor="let item of warnCountList;">
<!--<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>--> <nz-option nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option>
<!--</nz-select>--> </ng-container>
<!--<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择资源类型" [(ngModel)]="selectedValue" (ngModelChange)="select()" >--> </nz-select>
<!--<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>--> <nz-radio-group [(ngModel)]="itemTypeValue" (ngModelChange)="changeType()" [nzButtonStyle]="'solid'">
<!--<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>--> <label nz-radio-button nzValue="1">今天</label>
<!--</nz-select>--> <label nz-radio-button nzValue="2">昨天</label>
<!--<nz-radio-group [(ngModel)]="itemTypeValue" [nzButtonStyle]="'solid'">--> <label nz-radio-button nzValue="3">三天</label>
<!--<label *ngFor="let item of itemTypeList" (click)="changeType(item.applicationid)" nz-radio-button nzValue="{{item.applicationid}}">{{item.name}}</label>--> <label nz-radio-button nzValue="4">一周</label>
<!--</nz-radio-group>--> <label nz-radio-button nzValue="5">自定义</label>
</nz-radio-group>
</div> </div>
<smart-warn-list #warnList></smart-warn-list> <smart-warn-list #warnList></smart-warn-list>
\ No newline at end of file
...@@ -2,26 +2,67 @@ import {Component, OnInit, ViewChild} from '@angular/core'; ...@@ -2,26 +2,67 @@ import {Component, OnInit, ViewChild} from '@angular/core';
import {AlarmService} from '../alarm.service'; import {AlarmService} from '../alarm.service';
import {pageSize} from '../../app.constants'; import {pageSize} from '../../app.constants';
import {WarnListComponent} from '../../modal/warn-list/warn-list.component'; import {WarnListComponent} from '../../modal/warn-list/warn-list.component';
import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({ @Component({
selector: 'smart-alarm-list', selector: 'smart-alarm-list',
templateUrl: './alarm-list.component.html', templateUrl: './alarm-list.component.html',
styles: [` styles: [`
.tag-warn{
padding: 5px;
}
.tag-warn span{
border: 1px solid #ccc;
margin-right: 10px;
display: inline-block;
margin-bottom: 10px;
padding: 2px 4px;
border-radius: 4px;
}
:host ::ng-deep .tag-warn .ant-tag{
margin-right: 0px;
}
`] `]
}) })
export class AlarmListComponent implements OnInit { export class AlarmListComponent implements OnInit {
@ViewChild('warnList') warnList:WarnListComponent; @ViewChild('warnList') warnList: WarnListComponent;
eventList = []; eventList = [];
warnCountList = [];
groupList = [];
pageNum = 1; pageNum = 1;
pageCount = pageSize; pageCount = pageSize;
constructor(public alarmSer: AlarmService) { constructor(public alarmSer: AlarmService,public overAllSer:OverAllService,public message:NzMessageService) {
} }
ngOnInit() { ngOnInit() {
const obj = {}; const obj = {};
this.getType();
this.getWarnGroup();
this.warnList.getList(obj); this.warnList.getList(obj);
} }
getWarnGroup(){
this.overAllSer.findWarnAll().subscribe(
(res)=>{
if(res.errCode == 10000){
this.groupList = res.data;
}
}
)
}
getType(){
this.overAllSer.findHostWarningCount().subscribe(
(res)=>{
if(res.errCode == 10000){
this.warnCountList = res.data;
}else{
this.message.info(res.errMsg);
}
}
)
}
} }
...@@ -24,6 +24,13 @@ ...@@ -24,6 +24,13 @@
<span>当前告警数:120</span> <span>当前告警数:120</span>
</div> </div>
</div> </div>
<div class="tag-warn">
<span *ngFor="let item of warnCountList">
<nz-tag *ngIf="item.level == 4 || item.level == 5" [nzColor]="'#fc0d1b'"></nz-tag>
<nz-tag *ngIf="item.level == 2 || item.level == 3" [nzColor]="'#fd9827'"></nz-tag>
{{item.name}}({{item.size}})
</span>
</div>
<smart-warn-list #warnList></smart-warn-list> <smart-warn-list #warnList></smart-warn-list>
......
...@@ -4,12 +4,27 @@ import {NzMessageService} from 'ng-zorro-antd'; ...@@ -4,12 +4,27 @@ import {NzMessageService} from 'ng-zorro-antd';
import {SendLogComponent} from '../modal/send-log/send-log.component'; import {SendLogComponent} from '../modal/send-log/send-log.component';
import {pageSize} from '../../app.constants'; import {pageSize} from '../../app.constants';
import {WarnListComponent} from '../../modal/warn-list/warn-list.component'; import {WarnListComponent} from '../../modal/warn-list/warn-list.component';
import {OverAllService} from '../../overAll/overAll.service';
@Component({ @Component({
selector: 'smart-now-alarm', selector: 'smart-now-alarm',
templateUrl: './now-alarm.component.html', templateUrl: './now-alarm.component.html',
styles: [ styles: [
` `
.tag-warn{
padding: 5px;
}
.tag-warn span{
border: 1px solid #ccc;
margin-right: 10px;
display: inline-block;
margin-bottom: 10px;
padding: 2px 4px;
border-radius: 4px;
}
:host ::ng-deep .tag-warn .ant-tag{
margin-right: 0px;
}
` `
] ]
}) })
...@@ -17,16 +32,19 @@ export class NowAlarmComponent implements OnInit { ...@@ -17,16 +32,19 @@ export class NowAlarmComponent implements OnInit {
@ViewChild('sendLog') sendLog:SendLogComponent; @ViewChild('sendLog') sendLog:SendLogComponent;
@ViewChild('warnList') warnList:WarnListComponent; @ViewChild('warnList') warnList:WarnListComponent;
warnCountList = [];
loading = false; loading = false;
pageCount = pageSize; pageCount = pageSize;
pageNum = 1; pageNum = 1;
totalNum; totalNum;
constructor(public alarmSer: AlarmService, public message: NzMessageService) { constructor(public alarmSer: AlarmService, public message: NzMessageService,
public overAllSer:OverAllService) {
} }
ngOnInit() { ngOnInit() {
this.search(); this.search();
this.getType();
} }
search(){ search(){
...@@ -36,6 +54,18 @@ export class NowAlarmComponent implements OnInit { ...@@ -36,6 +54,18 @@ export class NowAlarmComponent implements OnInit {
this.warnList.getList(obj); this.warnList.getList(obj);
} }
getType(){
this.overAllSer.findHostWarningCount().subscribe(
(res)=>{
if(res.errCode == 10000){
this.warnCountList = res.data;
}else{
this.message.info(res.errMsg);
}
}
)
}
change(e){ change(e){
this.pageNum = e; this.pageNum = e;
} }
......
...@@ -3,8 +3,8 @@ import { ProdConfig } from './blocks/config/prod.config'; ...@@ -3,8 +3,8 @@ import { ProdConfig } from './blocks/config/prod.config';
import { BootappAppModule } from './app.module'; import { BootappAppModule } from './app.module';
import { registerLocaleData } from '@angular/common'; import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh'; import zh from '@angular/common/locales/zh';
registerLocaleData(zh);
registerLocaleData(zh);
ProdConfig(); ProdConfig();
if (module['hot']) { if (module['hot']) {
......
...@@ -32,12 +32,12 @@ export class PauseComponent implements OnInit { ...@@ -32,12 +32,12 @@ export class PauseComponent implements OnInit {
} }
handleOk() { handleOk() {
const params = this.hostId;
const data = { const data = {
hostId: Number(this.hostId),
startTime: this.datePipe.transform(this.data.startTime,'yyyy-MM-dd HH:MM:ss'), startTime: this.datePipe.transform(this.data.startTime,'yyyy-MM-dd HH:MM:ss'),
time: Number(this.data.time) time: Number(this.data.time)
}; };
this.overAllSer.tempStop(params, data).subscribe( this.overAllSer.tempStop(data).subscribe(
(res) => { (res) => {
// this.isShow = false; // this.isShow = false;
......
...@@ -28,7 +28,10 @@ ...@@ -28,7 +28,10 @@
<td>{{data.groupname}}</td> <td>{{data.groupname}}</td>
<td>{{data.continuedTime}}</td> <td>{{data.continuedTime}}</td>
<!--<td>{{data.eventid}}</td>--> <!--<td>{{data.eventid}}</td>-->
<td>{{data.stateName}}</td> <td>
<ng-container *ngIf="data.r_clock">已恢复</ng-container>
<ng-container *ngIf="!data.r_clock">告警中</ng-container>
</td>
<td class="list-icon" (click)="showLog(data)"><i class="anticon anticon-profile"></i></td> <td class="list-icon" (click)="showLog(data)"><i class="anticon anticon-profile"></i></td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<td class="cursor" [nzIndentSize]="item.level*20" [nzShowExpand]="!!item.list" <td class="cursor" [nzIndentSize]="item.level*20" [nzShowExpand]="!!item.list"
[(nzExpand)]="item.expand" (nzExpandChange)="collapse(expandDataCache[data.host],item,$event)"> [(nzExpand)]="item.expand" (nzExpandChange)="collapse(expandDataCache[data.host],item,$event)">
<span *ngIf="!item.level" (click)="getChildrenType(item)">{{item.equipmentType}}</span> <span *ngIf="!item.level" (click)="getChildrenType(item)">{{item.equipmentType}}</span>
<span *ngIf="item.level" (click)="goDetail(item)">{{item.equipmentType}}</span> <span *ngIf="item.level" (click)="goDetail(item)">{{item.name}}</span>
</td> </td>
<td class="round-tag"> <td class="round-tag">
<nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="'#fc0d1b'"></nz-tag>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span> <span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span> <span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span> <span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown> <nz-dropdown class="table-dropdown">
<a nz-dropdown>更多 <i class="anticon anticon-down"></i> <a nz-dropdown>更多 <i class="anticon anticon-down"></i>
</a> </a>
<ul nz-menu nzSelectable> <ul nz-menu nzSelectable>
...@@ -129,11 +129,16 @@ ...@@ -129,11 +129,16 @@
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span> <span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span> <span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span> <span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown> <nz-dropdown class="table-dropdown">
<a nz-dropdown>更多 <i class="anticon anticon-down"></i> <a nz-dropdown>更多 <i class="anticon anticon-down"></i>
</a> </a>
<ul nz-menu nzSelectable> <ul nz-menu nzSelectable>
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li> <li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="openHost(item)" nz-menu-item><a>
<ng-container *ngIf="item.status == 1">开启</ng-container>
<ng-container *ngIf="item.status == 0">停止</ng-container>
监控
</a></li>
<li nz-menu-item><a>查看监测点</a></li> <li nz-menu-item><a>查看监测点</a></li>
<li nz-menu-item><a>添加告警</a></li> <li nz-menu-item><a>添加告警</a></li>
</ul> </ul>
...@@ -161,3 +166,4 @@ ...@@ -161,3 +166,4 @@
<!--临时暂停--> <!--临时暂停-->
<smart-pause #smartPause></smart-pause> <smart-pause #smartPause></smart-pause>
<!--开启监控-->
...@@ -27,7 +27,11 @@ export interface TreeNodeInterface { ...@@ -27,7 +27,11 @@ export interface TreeNodeInterface {
@Component({ @Component({
selector: 'jhi-basic', selector: 'jhi-basic',
templateUrl: './basic.component.html', templateUrl: './basic.component.html',
styles: [] styles: [
`:host ::ng-deep .table-dropdown a{
font-weight: 300;
}`
]
}) })
export class BasicComponent implements OnInit { export class BasicComponent implements OnInit {
//组件 //组件
...@@ -278,7 +282,10 @@ export class BasicComponent implements OnInit { ...@@ -278,7 +282,10 @@ export class BasicComponent implements OnInit {
//根据设备类型查询主机资源 //根据设备类型查询主机资源
getChildrenType(item){ getChildrenType(item){
this.overAllSer.findHostByType(item.equipmentType).subscribe( const data = {
type:item.equipmentType
}
this.overAllSer.findHostByType(data).subscribe(
(res) => { (res) => {
this.dataSet[item.host].list = res.data; this.dataSet[item.host].list = res.data;
this.toTree(); this.toTree();
...@@ -315,4 +322,31 @@ export class BasicComponent implements OnInit { ...@@ -315,4 +322,31 @@ export class BasicComponent implements OnInit {
showTempStop(item){ showTempStop(item){
this.smartPause.showModal(item.hostid); this.smartPause.showModal(item.hostid);
} }
openHost(item){
this.modalService.confirm({
nzTitle: '监控',
nzContent: '确定开启监控设备'+item.name + '?',
nzOkText: '确定',
nzCancelText: '取消',
nzOnOk: () => {
let params1 = 0;
if(item.status == 1){
params1 = 0;
}
const params2 = item.hostid;
this.overAllSer.stopOrOpen(params1,params2).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('修改成功');
this.select();
} else {
this.message.info(res.errMsg);
}
}
);
},
nzOnCancel: () => console.log('Cancel')
});
}
} }
...@@ -15,8 +15,8 @@ export class OverAllService { ...@@ -15,8 +15,8 @@ export class OverAllService {
} }
//停止-开启监控 //停止-开启监控
stopOrOpen(data): Observable<any>{ stopOrOpen(params1,params2): Observable<any>{
return this.http.get(SERVER_API_URL + '/iomsp/host/stopOrOpen/',data); return this.http.get(SERVER_API_URL + '/host/stopOrOpen/'+ params1 + "/" + params2);
} }
//批量停止开启监控接口 //批量停止开启监控接口
...@@ -36,7 +36,7 @@ export class OverAllService { ...@@ -36,7 +36,7 @@ export class OverAllService {
//根据设备类型查询主机资源 //根据设备类型查询主机资源
findHostByType(data): Observable<any>{ findHostByType(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/host/selectAllHostByType/'+data); return this.http.post(SERVER_API_URL + '/host/selectAllHostByType/',data);
} }
//资源列表--查询主机 //资源列表--查询主机
...@@ -175,8 +175,17 @@ export class OverAllService { ...@@ -175,8 +175,17 @@ export class OverAllService {
} }
//临时暂停 //临时暂停
tempStop(params,data): Observable<any>{ tempStop(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/host/temp-stop/'+params, data); return this.http.post(SERVER_API_URL + '/host/temp-stop', data);
} }
//查询报警主机 和报警数量 以及最高报警级别
findHostWarningCount(): Observable<any>{
return this.http.get(SERVER_API_URL + '/statistics/findHostWarningCount');
}
//查询所有告警组
findWarnAll(): Observable<any>{
return this.http.get(SERVER_API_URL + '/alertGroup/findAll');
}
} }
\ No newline at end of file
...@@ -36,15 +36,6 @@ module.exports = (options) => ({ ...@@ -36,15 +36,6 @@ module.exports = (options) => ({
{ {
test: /manifest.webapp$/, test: /manifest.webapp$/,
loader: 'file-loader?name=manifest.webapp!web-app-manifest-loader' loader: 'file-loader?name=manifest.webapp!web-app-manifest-loader'
},
{
loader: 'less-loader', // compiles Less to CSS
options: {
modifyVars: {
'font-family': 'Microsoft YaHei',
},
javascriptEnabled: true,
},
} }
] ]
}, },
...@@ -90,7 +81,9 @@ module.exports = (options) => ({ ...@@ -90,7 +81,9 @@ module.exports = (options) => ({
{ from: './node_modules/swagger-ui/dist/lib', to: 'swagger-ui/dist/lib' }, { from: './node_modules/swagger-ui/dist/lib', to: 'swagger-ui/dist/lib' },
{ from: './node_modules/swagger-ui/dist/swagger-ui.min.js', to: 'swagger-ui/dist/swagger-ui.min.js' }, { from: './node_modules/swagger-ui/dist/swagger-ui.min.js', to: 'swagger-ui/dist/swagger-ui.min.js' },
{ from: './src/main/webapp/swagger-ui/', to: 'swagger-ui' }, { from: './src/main/webapp/swagger-ui/', to: 'swagger-ui' },
// { from: './src/main/webapp/favicon.ico', to: 'favicon.ico' },
{ from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' }, { from: './src/main/webapp/manifest.webapp', to: 'manifest.webapp' },
// jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array
{ from: './src/main/webapp/robots.txt', to: 'robots.txt' } { from: './src/main/webapp/robots.txt', to: 'robots.txt' }
]), ]),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
......
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