Commit 0cfee493 authored by wangqinghua's avatar wangqinghua

告警模块

parent 202c661b
......@@ -19,26 +19,28 @@
</div>
</div>
<div nz-row class="search-form">
<div nz-col nzSpan="16">
<span>当前告警数:120</span>
</div>
</div>
<div>
<!--<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择级别" [(ngModel)]="selectedValue" (ngModelChange)="select()" >-->
<!--<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>-->
<!--<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>-->
<!--</nz-select>-->
<!--<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择分组" [(ngModel)]="selectedValue" (ngModelChange)="select()" >-->
<!--<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>-->
<!--<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>-->
<!--</nz-select>-->
<!--<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择资源类型" [(ngModel)]="selectedValue" (ngModelChange)="select()" >-->
<!--<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>-->
<!--<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>-->
<!--</nz-select>-->
<!--<nz-radio-group [(ngModel)]="itemTypeValue" [nzButtonStyle]="'solid'">-->
<!--<label *ngFor="let item of itemTypeList" (click)="changeType(item.applicationid)" nz-radio-button nzValue="{{item.applicationid}}">{{item.name}}</label>-->
<!--</nz-radio-group>-->
<div style="margin-bottom: 20px">
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择级别" [(ngModel)]="selectedValue" (ngModelChange)="select()">
<nz-option nzLabel="告警" nzValue="type"></nz-option>
<nz-option nzLabel="严重" nzValue="group"></nz-option>
</nz-select>
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择分组" [(ngModel)]="selectedValue" (ngModelChange)="select()">
<ng-container *ngFor="let item of groupList;">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option>
</ng-container>
</nz-select>
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择资源类型" [(ngModel)]="selectedValue" (ngModelChange)="select()">
<ng-container *ngFor="let item of warnCountList;">
<nz-option nzLabel="{{item.name}}" nzValue="{{item.id}}"></nz-option>
</ng-container>
</nz-select>
<nz-radio-group [(ngModel)]="itemTypeValue" (ngModelChange)="changeType()" [nzButtonStyle]="'solid'">
<label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label>
<label nz-radio-button nzValue="3">三天</label>
<label nz-radio-button nzValue="4">一周</label>
<label nz-radio-button nzValue="5">自定义</label>
</nz-radio-group>
</div>
<smart-warn-list #warnList></smart-warn-list>
\ No newline at end of file
......@@ -2,26 +2,67 @@ import {Component, OnInit, ViewChild} from '@angular/core';
import {AlarmService} from '../alarm.service';
import {pageSize} from '../../app.constants';
import {WarnListComponent} from '../../modal/warn-list/warn-list.component';
import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-alarm-list',
templateUrl: './alarm-list.component.html',
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 {
@ViewChild('warnList') warnList:WarnListComponent;
@ViewChild('warnList') warnList: WarnListComponent;
eventList = [];
warnCountList = [];
groupList = [];
pageNum = 1;
pageCount = pageSize;
constructor(public alarmSer: AlarmService) {
constructor(public alarmSer: AlarmService,public overAllSer:OverAllService,public message:NzMessageService) {
}
ngOnInit() {
const obj = {};
this.getType();
this.getWarnGroup();
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 @@
<span>当前告警数:120</span>
</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>
......
......@@ -4,12 +4,27 @@ import {NzMessageService} from 'ng-zorro-antd';
import {SendLogComponent} from '../modal/send-log/send-log.component';
import {pageSize} from '../../app.constants';
import {WarnListComponent} from '../../modal/warn-list/warn-list.component';
import {OverAllService} from '../../overAll/overAll.service';
@Component({
selector: 'smart-now-alarm',
templateUrl: './now-alarm.component.html',
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 {
@ViewChild('sendLog') sendLog:SendLogComponent;
@ViewChild('warnList') warnList:WarnListComponent;
warnCountList = [];
loading = false;
pageCount = pageSize;
pageNum = 1;
totalNum;
constructor(public alarmSer: AlarmService, public message: NzMessageService) {
constructor(public alarmSer: AlarmService, public message: NzMessageService,
public overAllSer:OverAllService) {
}
ngOnInit() {
this.search();
this.getType();
}
search(){
......@@ -36,6 +54,18 @@ export class NowAlarmComponent implements OnInit {
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){
this.pageNum = e;
}
......
......@@ -3,8 +3,8 @@ import { ProdConfig } from './blocks/config/prod.config';
import { BootappAppModule } from './app.module';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
registerLocaleData(zh);
registerLocaleData(zh);
ProdConfig();
if (module['hot']) {
......
......@@ -32,12 +32,12 @@ export class PauseComponent implements OnInit {
}
handleOk() {
const params = this.hostId;
const data = {
hostId: Number(this.hostId),
startTime: this.datePipe.transform(this.data.startTime,'yyyy-MM-dd HH:MM:ss'),
time: Number(this.data.time)
};
this.overAllSer.tempStop(params, data).subscribe(
this.overAllSer.tempStop(data).subscribe(
(res) => {
// this.isShow = false;
......
......@@ -28,7 +28,10 @@
<td>{{data.groupname}}</td>
<td>{{data.continuedTime}}</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>
</tr>
</tbody>
......
......@@ -65,7 +65,7 @@
<td class="cursor" [nzIndentSize]="item.level*20" [nzShowExpand]="!!item.list"
[(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)="goDetail(item)">{{item.equipmentType}}</span>
<span *ngIf="item.level" (click)="goDetail(item)">{{item.name}}</span>
</td>
<td class="round-tag">
<nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="'#fc0d1b'"></nz-tag>
......@@ -85,7 +85,7 @@
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown>
<nz-dropdown class="table-dropdown">
<a nz-dropdown>更多 <i class="anticon anticon-down"></i>
</a>
<ul nz-menu nzSelectable>
......@@ -129,11 +129,16 @@
<span (click)="showBasicCheckModal(item.hostid)">添加监测点</span>
<span (click)="editBasicModal(item)">编辑</span>
<span (click)="showDeleteConfirm(item)">删除</span>
<nz-dropdown>
<nz-dropdown class="table-dropdown">
<a nz-dropdown>更多 <i class="anticon anticon-down"></i>
</a>
<ul nz-menu nzSelectable>
<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>
</ul>
......@@ -161,3 +166,4 @@
<!--临时暂停-->
<smart-pause #smartPause></smart-pause>
<!--开启监控-->
......@@ -27,7 +27,11 @@ export interface TreeNodeInterface {
@Component({
selector: 'jhi-basic',
templateUrl: './basic.component.html',
styles: []
styles: [
`:host ::ng-deep .table-dropdown a{
font-weight: 300;
}`
]
})
export class BasicComponent implements OnInit {
//组件
......@@ -278,7 +282,10 @@ export class BasicComponent implements OnInit {
//根据设备类型查询主机资源
getChildrenType(item){
this.overAllSer.findHostByType(item.equipmentType).subscribe(
const data = {
type:item.equipmentType
}
this.overAllSer.findHostByType(data).subscribe(
(res) => {
this.dataSet[item.host].list = res.data;
this.toTree();
......@@ -315,4 +322,31 @@ export class BasicComponent implements OnInit {
showTempStop(item){
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 {
}
//停止-开启监控
stopOrOpen(data): Observable<any>{
return this.http.get(SERVER_API_URL + '/iomsp/host/stopOrOpen/',data);
stopOrOpen(params1,params2): Observable<any>{
return this.http.get(SERVER_API_URL + '/host/stopOrOpen/'+ params1 + "/" + params2);
}
//批量停止开启监控接口
......@@ -36,7 +36,7 @@ export class OverAllService {
//根据设备类型查询主机资源
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 {
}
//临时暂停
tempStop(params,data): Observable<any>{
return this.http.post(SERVER_API_URL + '/host/temp-stop/'+params, data);
tempStop(data): Observable<any>{
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) => ({
{
test: /manifest.webapp$/,
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) => ({
{ 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: './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' },
// 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' }
]),
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