Commit ac4ade89 authored by wangqinghua's avatar wangqinghua

告警模块

parent f327cbed
......@@ -24,33 +24,4 @@
<span>当前告警数:120</span>
</div>
</div>
<nz-table #nzTable [nzData]="eventList" nzSingleSort>
<thead>
<tr>
<th nzShowSort>产生时间</th>
<th >级别</th>
<th >名称</th>
<th nzWidth="15%">告警信息</th>
<th >类别</th>
<th >资源分组</th>
<th >持续时间</th>
<th >产生事件</th>
<th>状态</th>
<th>发送记录</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of warnList">
<td>{{data.lastchangeDate}}</td>
<td>级别</td>
<td>名称</td>
<td>{{data.description}}</td>
<td>类别</td>
<td>资源分组</td>
<td>{{data.continuedTime}}</td>
<td>产生事件</td>
<td>{{data.stateName}}</td>
<td><i nz-icon type="profile" theme="outline"></i></td>
</tr>
</tbody>
</nz-table>
\ No newline at end of file
<smart-warn-list #warnList></smart-warn-list>
\ No newline at end of file
import {Component, OnInit} from '@angular/core';
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';
@Component({
selector: 'smart-alarm-list',
templateUrl: './alarm-list.component.html',
styles: []
styles: [`
`]
})
export class AlarmListComponent implements OnInit {
@ViewChild('warnList') warnList:WarnListComponent;
eventList = [];
pageNum = 1;
pageCount = pageSize;
......@@ -17,19 +20,8 @@ export class AlarmListComponent implements OnInit {
}
ngOnInit() {
this.getList();
}
getList() {
const data = {
pageNum:this.pageNum,
pageCount:this.pageCount,
};
this.alarmSer.eventFind(data).subscribe(
(res) => {
}
);
const obj = {};
this.warnList.getList(obj);
}
}
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgxEchartsModule } from "ngx-echarts";
import { AlarmManageComponent } from './alarm-manage/alarm-manage.component';
import {AlarmListComponent} from './alarm-list/alarm-list.component';
import {AlarmLogComponent} from './alarm-log/alarm-log.component';
import {AlarmSetComponent} from './alarm-set/alarm-set.component';
import {NowAlarmComponent} from './now-alarm/now-alarm.component';
import {SendSetComponent} from './send-set/send-set.component';
import {AlarmService} from './alarm.service';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {SendLogComponent} from './modal/send-log/send-log.component';
@NgModule({
imports: [
CommonModule,
NgxEchartsModule,
FormsModule,
ReactiveFormsModule,
NgZorroAntdModule.forRoot()
],
declarations: [
AlarmManageComponent,
AlarmListComponent,
AlarmLogComponent,
AlarmSetComponent,
NowAlarmComponent,
SendSetComponent,
SendLogComponent
],
providers:[
AlarmService
]
})
export class AlarmModule { }
......@@ -25,44 +25,6 @@
</div>
</div>
<nz-table #nzTable [nzData]="warnList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<thead>
<tr>
<th nzShowSort>产生时间</th>
<th>级别</th>
<th>名称</th>
<th nzWidth="15%">告警信息</th>
<th>类别</th>
<th>资源分组</th>
<th>持续时间</th>
<th>产生事件</th>
<th>状态</th>
<th>发送记录</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of warnList">
<td>
<nz-timeline-item>{{data.clock}}</nz-timeline-item>
</td>
<td>
<ng-container *ngIf=" data.priority == 4 || data.priority == 5">
<nz-tag [nzColor]="'#cf5c4b'"></nz-tag>
</ng-container>
<ng-container *ngIf=" data.priority == 2 || data.priority == 3">
<nz-tag [nzColor]="'#f18633'"></nz-tag>
</ng-container>
</td>
<td>{{data.hostName}}</td>
<td>{{data.description}}</td>
<td>类别</td>
<td>资源分组</td>
<td>{{data.continuedTime}}</td>
<td>产生事件</td>
<td>{{data.stateName}}</td>
<td class="list-icon" (click)="showModal(data)"><i class="anticon anticon-profile"></i></td>
</tr>
</tbody>
</nz-table>
<smart-warn-list #warnList></smart-warn-list>
<smart-send-log #sendLog></smart-send-log>
\ No newline at end of file
......@@ -3,23 +3,19 @@ import {AlarmService} from '../alarm.service';
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';
@Component({
selector: 'smart-now-alarm',
templateUrl: './now-alarm.component.html',
styles: [
`
.list-icon{
font-size: 20px;
text-align: center;
color: #8cb6ce;
}
`
]
})
export class NowAlarmComponent implements OnInit {
@ViewChild('sendLog') sendLog:SendLogComponent;
warnList = [];
@ViewChild('warnList') warnList:WarnListComponent;
loading = false;
pageCount = pageSize;
......@@ -30,39 +26,22 @@ export class NowAlarmComponent implements OnInit {
}
ngOnInit() {
this.findWarning();
this.search();
}
findWarning() {
this.loading = true;
const data = {
obj:{
search(){
const obj = {
isWaring:'yes'
},
pageCount:this.pageCount,
pageNum:this.pageNum
};
this.alarmSer.eventFind(data).subscribe(
(res) => {
if (res.errCode = 10000) {
this.warnList = res.data.data;
this.totalNum = res.data.totalNum;
} else {
this.message.info(res.errMsg);
}
this.loading = false;
}
);
this.warnList.getList(obj);
}
change(e){
this.pageNum = e;
this.findWarning();
}
//打开modal
showModal(data){
this.sendLog.showModal(data);
}
}
import {RouterModule} from "@angular/router";
import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgxEchartsModule } from "ngx-echarts";
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {AlarmListComponent} from './alarm/alarm-list/alarm-list.component';
import {AlarmLogComponent} from './alarm/alarm-log/alarm-log.component';
import {AlarmManageComponent} from './alarm/alarm-manage/alarm-manage.component';
import {AlarmSetComponent} from './alarm/alarm-set/alarm-set.component';
import {SendLogComponent} from './alarm/modal/send-log/send-log.component';
import {NowAlarmComponent} from './alarm/now-alarm/now-alarm.component';
import {SendSetComponent} from './alarm/send-set/send-set.component';
import {BasicDetailComponent} from './overAll/basic/basic-detail/basic-detail.component';
import {BasicComponent} from './overAll/basic/basic.component';
import {MonitorComponent} from './overAll/monitor/monitor.component';
import {SecurityComponent} from './overAll/security/security.component';
import {AuditComponent} from './system/audit/audit.component';
import {ExamineComponent} from './system/examine/examine.component';
import {GroupComponent} from './system/group/group.component';
import {PowerComponent} from './system/power/power.component';
import {BasiCheckComponent} from './modal/basi-check/basi-check.component';
import {BasicEditComponent} from './modal/basic-edit/basic-edit.component';
import {BasicKeyComponent} from './modal/basic-key/basic-key.component';
import {CreateGroupComponent} from './modal/create-group/create-group.component';
import {NewTypeComponent} from './modal/new-type/new-type.component';
import {WarnListComponent} from './modal/warn-list/warn-list.component';
import {JhiMainComponent, NavbarComponent, SidebarComponent} from './layouts';
import {OverAllService} from './overAll/overAll.service';
import {SystemService} from './system/system.service';
import {AlarmService} from './alarm/alarm.service';
@NgModule({
imports: [
RouterModule,
CommonModule,
NgxEchartsModule,
FormsModule,
ReactiveFormsModule,
NgZorroAntdModule.forRoot()
],
declarations: [
JhiMainComponent,
NavbarComponent,
SidebarComponent,
AlarmListComponent,
AlarmLogComponent,
AlarmManageComponent,
AlarmSetComponent,
SendLogComponent,
NowAlarmComponent,
SendSetComponent,
BasicDetailComponent,
BasicComponent,
MonitorComponent,
SecurityComponent,
AuditComponent,
ExamineComponent,
GroupComponent,
PowerComponent,
BasiCheckComponent,
BasicEditComponent,
BasicKeyComponent,
CreateGroupComponent,
NewTypeComponent,
WarnListComponent,
],
providers:[
OverAllService,
SystemService,
AlarmService
],
exports:[
BasiCheckComponent,
BasicEditComponent,
BasicKeyComponent,
CreateGroupComponent,
NewTypeComponent,
WarnListComponent
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
})
export class AppMainModule { }
import './vendor.ts';
import { NgModule, Injector, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
......@@ -19,78 +18,46 @@ import { PaginationConfig } from './blocks/config/uib-pagination.config';
import { FileUploadModule } from 'ng2-file-upload';
import { CommonModule } from '@angular/common';
import { LayoutService } from "./layouts/layout.service";
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { NgxEchartsModule } from "ngx-echarts";
import {
JhiMainComponent,
NavbarComponent,
SidebarComponent,
FooterComponent,
ProfileService,
PageRibbonComponent,
ErrorComponent
} from './layouts';
import { SystemModule } from "./system/system.module";
import { SystemService } from "./system/system.service";
import {AppComponent} from "./app.component";
import {RouterModule} from "@angular/router";
import {DEBUG_INFO_ENABLED} from "./app.constants";
import { route } from "./app.route";
import {LoginGuard} from "./shared/common/loginGuard";
import {AlarmModule} from './alarm/alarm.module';
import {OverAllModule} from './overAll/overAll.module';
import {CreateGroupComponent} from './modal/create-group/create-group.component';
import {SecurityComponent} from './overAll/security/security.component';
import {MonitorComponent} from './overAll/monitor/monitor.component';
import {BasiCheckComponent} from './modal/basi-check/basi-check.component';
import {BasicComponent} from './overAll/basic/basic.component';
import {NewTypeComponent} from './modal/new-type/new-type.component';
import {BasicDetailComponent} from './overAll/basic/basic-detail/basic-detail.component';
import {BasicKeyComponent} from './modal/basic-key/basic-key.component';
import {BasicEditComponent} from './modal/basic-edit/basic-edit.component';
import {AppMainModule} from './app.main.module';
@NgModule({
imports: [
AlarmModule,
OverAllModule,
AppMainModule,
BrowserModule,
NgxEchartsModule,
HttpModule,
BrowserAnimationsModule,
SystemModule,
RouterModule,
Ng2Webstorage.forRoot({ prefix: 'jhi', separator: '-'}),
Ng2Webstorage.forRoot({ prefix: 'smart', separator: '-'}),
BootappSharedModule,
BootappHomeModule,
FileUploadModule,
CommonModule,
FormsModule,
ReactiveFormsModule,
NgZorroAntdModule.forRoot(),
RouterModule.forRoot(route, {useHash: true, enableTracing: DEBUG_INFO_ENABLED})
],
declarations: [
JhiMainComponent,
NavbarComponent,
ErrorComponent,
PageRibbonComponent,
FooterComponent,
SidebarComponent,
BasicComponent,
SecurityComponent,
MonitorComponent,
BasicDetailComponent,
BasiCheckComponent,
BasicKeyComponent,
BasicEditComponent,
CreateGroupComponent,
NewTypeComponent,
AppComponent,
],
providers: [
LayoutService,
SystemService,
ProfileService,
PaginationConfig,
LoginGuard,
......@@ -133,6 +100,8 @@ import {BasicEditComponent} from './modal/basic-edit/basic-edit.component';
],
bootstrap: [ AppComponent ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
exports:[
]
})
export class BootappAppModule {}
......@@ -32,8 +32,10 @@ export class SidebarComponent implements OnInit {
getMenu(){
this.layoutSer.getMenu().subscribe(
(res)=>{
if(res.errCode == 10000){
this.menuList =this.listToTree('id','parentId',res.data);
}
}
)
}
......
......@@ -109,7 +109,7 @@
<nz-form-control [nzSpan]="20">
<div nz-row [nzGutter]="12">
<ng-container *ngFor="let item of interfaceslist;let i = index;">
<nz-form-control nz-col [nzSpan]="4">
<nz-form-control nz-col [nzSpan]="2">
<nz-select name="main" nzPlaceHolder="选择接口类型" [(ngModel)]="item.main">
<nz-option nzValue="1" nzLabel="默认"></nz-option>
<nz-option nzValue="0" nzLabel="不默认"></nz-option>
......@@ -129,9 +129,12 @@
<nz-option nzValue="4" nzLabel="IPMI接口"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="3">
<nz-form-control nz-col [nzSpan]="2">
<input type="text" placeholder="端口" nz-input name="port" [(ngModel)]="item.port">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="3">
<label nz-checkbox [(ngModel)]="checked">使用大量请求</label>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<span class="cursor" (click)="deleteInterfaces(i)">X</span>
</nz-form-control>
......
<nz-table #nzTable [nzData]="warnList" [nzFrontPagination]="false" [nzTotal]="totalNum" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="change($event)" [nzLoading]="loading">
<thead>
<tr>
<th nzShowSort>产生时间</th>
<th>级别</th>
<th>名称</th>
<th nzWidth="15%">告警信息</th>
<th>类别</th>
<th>资源分组</th>
<th>持续时间</th>
<th>产生事件</th>
<th>状态</th>
<th style="text-align: center">发送记录</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of warnList">
<td>{{data.lastchangeDate}}</td>
<td>级别</td>
<td>名称</td>
<td>{{data.description}}</td>
<td>类别</td>
<td>资源分组</td>
<td>{{data.continuedTime}}</td>
<td>产生事件</td>
<td>{{data.stateName}}</td>
<td class="list-icon" (click)="showLog(data)"><i class="anticon anticon-profile"></i></td>
</tr>
</tbody>
</nz-table>
<smart-send-log #sendLog></smart-send-log>
\ No newline at end of file
import {Component, OnInit, ViewChild} from '@angular/core';
import {AlarmService} from '../../alarm/alarm.service';
import {pageSize} from '../../app.constants';
import {NzMessageService} from 'ng-zorro-antd';
import {SendLogComponent} from '../../alarm/modal/send-log/send-log.component';
@Component({
selector: 'smart-warn-list',
templateUrl: './warn-list.component.html',
styles: [
` .list-icon{
font-size: 20px;
text-align: center;
color: #8cb6ce;
}
`
]
})
export class WarnListComponent implements OnInit {
@ViewChild('sendLog') sendLog:SendLogComponent;
warnList = [];
obj;
pageNum = 1;
pageCount = pageSize;
totalNum;
loading = false;
constructor(public alarmSer:AlarmService,public message:NzMessageService) {
}
ngOnInit() {
// this.getList();
}
getList(obj) {
this.obj = obj;
this.loading = true;
const data = {
pageNum: this.pageNum,
pageCount: this.pageCount,
obj:obj
};
this.alarmSer.eventFind(data).subscribe(
(res) => {
if(res.errCode == 10000){
this.warnList = res.data.data;
this.totalNum = res.data.totalNum;
}else{
this.message.info(res.errMsg);
}
this.loading = false;
}
);
}
change(e){
this.pageNum = e;
this.getList(this.obj);
}
showLog(data){
this.sendLog.showModal(data);
}
}
......@@ -26,8 +26,7 @@
<!--<button nz-button nzType="default">编辑</button>-->
<button nz-button nzType="default">删除</button>
</div>
<nz-tabset >
<nz-tabset class="tabs-smart">
<nz-tab nzTitle="资源详情">
<section>
资源显示名称
......@@ -165,12 +164,12 @@
</nz-table>
</div>
</nz-tab>
<!--<nz-tab nzTitle="历史告警">-->
<!--</nz-tab>-->
<!--<nz-tab nzTitle="资产运维">-->
<!--Content of Tab Pane 3-->
<!--</nz-tab>-->
<nz-tab #thirdTabs nzTitle="历史告警" >
<smart-warn-list #warnList></smart-warn-list>
</nz-tab>
<nz-tab nzTitle="资产运维">
Content of Tab Pane 3
</nz-tab>
</nz-tabset>
</div>
......
import {Component, OnInit, ViewChild} from '@angular/core';
import {AfterViewInit, Component, ElementRef, OnInit, Renderer, ViewChild,} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {OverAllService} from '../../overAll.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
......@@ -6,6 +6,8 @@ import {NzMessageService} from 'ng-zorro-antd';
import {BasiCheckComponent} from '../../../modal/basi-check/basi-check.component';
import {NzModalService} from 'ng-zorro-antd';
import {pageSize} from '../../../app.constants';
import {WarnListComponent} from '../../../modal/warn-list/warn-list.component';
@Component({
selector: 'jhi-basic-detail',
......@@ -14,14 +16,16 @@ import {pageSize} from '../../../app.constants';
`
.checkTags {
position: absolute;
top: 16px;
top: 12px;
left: 233px;
}
`
]
})
export class BasicDetailComponent implements OnInit {
export class BasicDetailComponent implements OnInit, AfterViewInit {
@ViewChild('smartCheck') smartCheck: BasiCheckComponent;
@ViewChild('thirdTabs') thirdTabs: ElementRef;
@ViewChild('warnList') warnList: WarnListComponent;
loading = false;
hostId: string;
hostType: string;
......@@ -36,10 +40,9 @@ export class BasicDetailComponent implements OnInit {
secondOptionLeft;
secondOptionRight;
dataSet: any[];
tabs = ['资源详情', '监测点列表', '历史告警', '资产运维'];
panel1 = {active: true, name: '响应时间与丢包率', disabled: false};
panel2 = {active: true, disabled: false, name: 'CPU使用率及内存使用率'};
panel3 = {active: true, disabled: false, name: '磁盘使用率'};
panel2 = {active: true, name: 'CPU使用率及内存使用率'};
panel3 = {active: true, name: '磁盘使用率', disabled: false};
//监控点
isBasicEdit;
......@@ -66,17 +69,21 @@ export class BasicDetailComponent implements OnInit {
isGrapha = false;
chartOptionGrapha;
//分页
pageIndex = 1; //当前页数
pageSize = pageSize;
//分页--监控点
pageIndex = 1; //当前页数
totalNum; //总数据长度
totalPage; //总页数
applicationId; //分类ID
//分页--告警
warn_totalNum;
warn_pageNum = 1;
validateForm: FormGroup;
constructor(private routerInfo: ActivatedRoute, private message: NzMessageService,
private overAllSer: OverAllService,
private overAllSer: OverAllService, private renderer: Renderer,
private fb: FormBuilder, private modalService: NzModalService) {
}
......@@ -97,6 +104,14 @@ export class BasicDetailComponent implements OnInit {
this.getCheckList();
this.getCheckStatus();
this.findItemType();
//历史告警
const obj = {};
this.warnList.getList(obj);
}
ngAfterViewInit() {
// this.renderer.setElementStyle(this.thirdTabs.nativeElement,'margin-left','108px');
}
//平均响应时间
......@@ -593,7 +608,6 @@ export class BasicDetailComponent implements OnInit {
(res) => {
this.checkList = res.data.data;
this.totalNum = res.data.totalNum;
this.totalPage = res.data.totalPage;
this.loading = false;
}
);
......
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgxEchartsModule } from "ngx-echarts";
import {OverAllService} from './overAll.service';
@NgModule({
imports: [
CommonModule,
NgxEchartsModule
],
declarations: [
],
providers:[
OverAllService,
]
})
export class OverAllModule { }
......@@ -9,7 +9,6 @@ export class LoginGuard implements CanActivate {
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
console.log('canActivite');
let isLogin: boolean;
// 判断用户是否登入
const user = this.localStorage.retrieve('accessToken');
......
import {CUSTOM_ELEMENTS_SCHEMA, NgModule,} from '@angular/core';
import { CommonModule } from '@angular/common';
import {AuditComponent} from "./audit/audit.component";
import {ExamineComponent} from "./examine/examine.component";
import {GroupComponent} from "./group/group.component";
import {PowerComponent} from "./power/power.component";
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
NgZorroAntdModule.forRoot()
],
declarations: [
AuditComponent,
ExamineComponent,
GroupComponent,
PowerComponent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SystemModule { }
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