Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqinghua
smart
Commits
c37fbafe
Commit
c37fbafe
authored
Nov 16, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log
parent
dbf69768
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
472 additions
and
164 deletions
+472
-164
alarm-log.component.html
src/main/webapp/app/alarm/alarm-log/alarm-log.component.html
+115
-100
alarm-log.component.ts
src/main/webapp/app/alarm/alarm-log/alarm-log.component.ts
+103
-38
alarm-set.component.html
src/main/webapp/app/alarm/alarm-set/alarm-set.component.html
+5
-5
alarm-set.component.ts
src/main/webapp/app/alarm/alarm-set/alarm-set.component.ts
+48
-1
alarm.service.ts
src/main/webapp/app/alarm/alarm.service.ts
+15
-0
alarm-group.component.ts
...bapp/app/alarm/modal/alarm-group/alarm-group.component.ts
+38
-8
alarm-target.component.html
.../app/alarm/modal/alarm-target/alarm-target.component.html
+15
-0
alarm-target.component.ts
...pp/app/alarm/modal/alarm-target/alarm-target.component.ts
+84
-0
send-set.component.html
src/main/webapp/app/alarm/send-set/send-set.component.html
+2
-2
app.main.module.ts
src/main/webapp/app/app.main.module.ts
+4
-3
basic-edit.component.ts
src/main/webapp/app/modal/basic-edit/basic-edit.component.ts
+43
-7
No files found.
src/main/webapp/app/alarm/alarm-log/alarm-log.component.html
View file @
c37fbafe
<div
nz-row
class=
"breadcrumbs"
>
<div
nz-col
nzSpan=
"16"
>
<nz-breadcrumb
class=
"padding-8-0"
>
<nz-breadcrumb-item>
首页
</nz-breadcrumb-item>
<nz-breadcrumb-item>
<a>
告警管理
</a>
</nz-breadcrumb-item>
<nz-breadcrumb-item>
告警记录
</nz-breadcrumb-item>
</nz-breadcrumb>
</div>
<div
nz-col
nzSpan=
"8"
class=
"text-right"
>
<button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-search"
></i></button>
<button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-sync"
></i></button>
<button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-arrows-alt"
></i></button>
</div>
<div
nz-row
class=
"breadcrumbs"
>
<div
nz-col
nzSpan=
"16"
>
<nz-breadcrumb
class=
"padding-8-0"
>
<nz-breadcrumb-item>
首页
</nz-breadcrumb-item>
<nz-breadcrumb-item>
<a>
告警管理
</a>
</nz-breadcrumb-item>
<nz-breadcrumb-item>
告警记录
</nz-breadcrumb-item>
</nz-breadcrumb>
</div>
<div
nz-col
nzSpan=
"8"
class=
"text-right"
>
<button
(
click
)="
search
()"
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-search"
></i></button>
<button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-sync"
></i></button>
<button
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-arrows-alt"
></i></button>
</div>
</div>
<div
nz-row
[
nzGutter
]="
4
"
class=
"search-form"
>
<div
nz-col
nzSpan=
"3"
>
<nz-select
style=
"width: 100%;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"选择发送方式"
[(
ngModel
)]="
obj
.
priorityName
"
>
<nz-option
nzLabel=
"告警"
nzValue=
"告警"
></nz-option>
<nz-option
nzLabel=
"严重"
nzValue=
"严重"
></nz-option>
</nz-select>
</div>
<div
nz-col
nzSpan=
"3"
>
<nz-select
style=
"width: 100%;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"选择告警组"
[(
ngModel
)]="
obj
.
groupid
"
>
<ng-container
*
ngFor=
"let item of groupList;"
>
<nz-option
nzLabel=
"{{item.name}}"
nzValue=
"{{item.groupid}}"
></nz-option>
</ng-container>
</nz-select>
</div>
<div
nz-col
nzSpan=
"3"
>
<nz-select
style=
"width: 100%;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"选择告警目标"
[(
ngModel
)]="
obj
.
equipmentType
"
>
<ng-container
*
ngFor=
"let item of warnCountList;"
>
<nz-option
nzLabel=
"{{item.name}}"
nzValue=
"{{item.name}}"
></nz-option>
</ng-container>
</nz-select>
</div>
<div
nz-col
nzSpan=
"7"
>
<nz-radio-group
style=
"width: 100%;"
[(
ngModel
)]="
timeType
"
(
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>
<div
nz-col
nzSpan=
"8"
*
ngIf=
"timeType == '5'"
>
<nz-date-picker
nzShowTime
[(
ngModel
)]="
obj
.
startTime
"
nzPlaceHolder=
"开始时间"
></nz-date-picker>
<nz-date-picker
nzShowTime
nzFormat=
"yyyy-MM-dd HH:mm:ss"
[(
ngModel
)]="
obj
.
endTime
"
nzPlaceHolder=
"结束时间"
></nz-date-picker>
</div>
</div>
<div
nz-row
class=
"search-form"
style=
"border-top: none;padding: 0 0 15px 0;"
>
<input
[(
ngModel
)]="
obj
.
name
"
nz-input
placeholder=
"搜索"
>
<button
(
click
)="
searchValue
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
></i>
搜索
</button>
<div
nz-col
nzSpan=
"3"
>
<nz-select
style=
"width: 100%;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"选择发送方式"
[(
ngModel
)]="
obj
.
mediatypeids
"
>
<ng-container
*
ngFor=
"let item of sendList"
>
<nz-option
nzLabel=
"{{item.description}}"
nzValue=
"{{item.mediatypeid}}"
></nz-option>
</ng-container>
</nz-select>
</div>
<div
nz-col
nzSpan=
"3"
>
<nz-select
style=
"width: 100%;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"选择告警组"
[(
ngModel
)]="
obj
.
alertGroupId
"
>
<ng-container
*
ngFor=
"let item of groupList;"
>
<nz-option
nzLabel=
"{{item.name}}"
nzValue=
"{{item.groupid}}"
></nz-option>
</ng-container>
</nz-select>
</div>
<div
nz-col
nzSpan=
"3"
>
<button
nz-button
(
click
)="
showTargetModal
()"
nzType=
"primary"
>
选择告警目标
</button>
</div>
<div
nz-col
nzSpan=
"7"
>
<nz-radio-group
style=
"width: 100%;"
[(
ngModel
)]="
timeType
"
(
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>
<div
nz-col
nzSpan=
"8"
*
ngIf=
"timeType == '5'"
>
<nz-date-picker
nzShowTime
[(
ngModel
)]="
obj
.
time_from
"
nzPlaceHolder=
"开始时间"
></nz-date-picker>
<nz-date-picker
nzShowTime
nzFormat=
"yyyy-MM-dd HH:mm:ss"
[(
ngModel
)]="
obj
.
time_till
"
nzPlaceHolder=
"结束时间"
></nz-date-picker>
</div>
</div>
<nz-table
#
nzTable
[
nzData
]="
logList
"
[
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
style=
"text-align: center"
>
操作
</th>
</tr>
</thead>
<tbody>
<tr
*
ngFor=
"let data of logList"
>
<td
class=
"round-tag"
>
<nz-tag
*
ngIf=
"data.priority == 4 || data.priority == 5"
[
nzColor
]="'#
fc0d1b
'"
></nz-tag>
<nz-tag
*
ngIf=
"data.priority == 2 || data.priority == 3"
[
nzColor
]="'#
fd9827
'"
></nz-tag>
</td>
<td>
名称
</td>
<td>
查看
</td>
<td>
查看
</td>
<td>
{{data.groupname}}
</td>
<td>
{{data.continuedTime}}
</td>
<!--<td>{{data.eventid}}</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>
<nz-table
#
nzTable
[
nzData
]="
logList
"
[
nzFrontPagination
]="
false
"
[
nzTotal
]="
totalNum
"
[
nzPageIndex
]="
pageNum
"
[
nzPageSize
]="
pageCount
"
(
nzPageIndexChange
)="
change
($
event
)"
>
<thead>
<tr>
<th
nzWidth=
"15%"
>
告警名称
</th>
<th>
告警时间
</th>
<th>
告警目标
</th>
<th>
告警内容
</th>
<th>
状态
</th>
<th>
发送方式
</th>
<th>
发送对象
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody>
<tr
*
ngFor=
"let data of logList"
>
<td
class=
"round-tag"
>
<nz-tag
[
nzColor
]="'#
fc0d1b
'"
></nz-tag>
{{data.subject}}
</td>
<td>
{{data.clock | date:"yyyy-MM-dd HH:mm:ss"}}
</td>
<td>
<ng-container
*
ngIf=
"data.hosts"
>
{{data.hosts[0].name}}
</ng-container>
</td>
<td
class=
"handle"
>
<span
(
click
)="
showDeleteModal
(
data
)"
>
查看
</span>
</td>
<td>
<span
*
ngIf=
"data.status == 0"
>
消息未发送
</span>
<span
*
ngIf=
"data.status == 1"
>
消息已发送
</span>
<span
*
ngIf=
"data.status == 2"
>
经多次重试后失败
</span>
</td>
<td>
{{data.continuedTime}}
</td>
<td>
{{data.sendto}}
</td>
<td
class=
"handle"
>
<span
(
click
)="
deleteLog
(
data
)"
>
删除
</span>
</td>
</tr>
</tbody>
</nz-table>
<smart-send-log
#
sendLog
></smart-send-log>
\ No newline at end of file
<!--告警内容-->
<nz-modal
[(
nzVisible
)]="
isVisible
"
[
nzFooter
]="
null
"
nzTitle=
"查看告警内容"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
[
nzOkLoading
]="
isOkLoading
"
>
<div
style=
"padding: 10px;"
>
<p>
主题:
</p>
<p>
{{title}}
</p>
<p>
消息:
</p>
<p>
{{content}}
</p>
</div>
</nz-modal>
<!--告警目标-->
<smart-alarm-target
#
smartAlarmTarget
></smart-alarm-target>
src/main/webapp/app/alarm/alarm-log/alarm-log.component.ts
View file @
c37fbafe
...
...
@@ -4,7 +4,8 @@ import {OverAllService} from '../../overAll/overAll.service';
import
{
DatePipe
}
from
'@angular/common'
;
import
{
AlarmService
}
from
'../alarm.service'
;
import
{
pageSize
}
from
'../../app.constants'
;
import
{
NzMessageService
}
from
'ng-zorro-antd'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
AlarmTargetComponent
}
from
'../modal/alarm-target/alarm-target.component'
;
@
Component
({
selector
:
'smart-alarm-log'
,
...
...
@@ -29,6 +30,7 @@ import {NzMessageService} from 'ng-zorro-antd';
export
class
AlarmLogComponent
implements
OnInit
{
@
ViewChild
(
'warnList'
)
warnList
:
WarnListComponent
;
@
ViewChild
(
'smartAlarmTarget'
)
smartAlarmTarget
:
AlarmTargetComponent
;
logList
=
[];
warnCountList
=
[];
groupList
=
[];
...
...
@@ -37,36 +39,46 @@ export class AlarmLogComponent implements OnInit {
pageCount
=
pageSize
;
totalNum
;
//发送方式
sendList
;
//条件
timeType
;
obj
=
{
priorityName
:
null
,
groupid
:
null
,
equipmentType
:
null
,
startTime
:
''
,
endTime
:
''
,
name
:
''
time_from
:
''
,
time_till
:
''
,
alertGroupId
:
''
,
mediatypeids
:
''
,
hostids
:
''
,
};
//modal
isVisible
=
false
;
title
;
content
;
constructor
(
public
alarmSer
:
AlarmService
,
public
overAllSer
:
OverAllService
,
public
message
:
NzMessageService
,
public
datePipe
:
DatePipe
)
{
public
datePipe
:
DatePipe
,
public
modalSer
:
NzModalService
)
{
}
ngOnInit
()
{
const
obj
=
{};
this
.
getType
();
this
.
getWarnGroup
();
this
.
getList
();
this
.
getList
(
this
.
obj
);
}
//
getList
(){
const
obj
=
{
//
获取list
getList
(
obj
){
const
data
=
{
"eventPage"
:
this
.
pageNum
,
"pageRecords"
:
this
.
pageCount
}
this
.
alarmSer
.
alertFind
(
obj
).
subscribe
(
"pageRecords"
:
this
.
pageCount
,
"alertGroupId"
:
obj
.
alertGroupId
,
"time_from"
:
obj
.
time_from
,
"time_till"
:
obj
.
time_till
,
"mediatypeids"
:[
obj
.
mediatypeids
],
"hostids"
:
null
};
this
.
alarmSer
.
alertFind
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
logList
=
res
.
data
.
data
;
...
...
@@ -89,60 +101,113 @@ export class AlarmLogComponent implements OnInit {
)
}
//获取
资源类型
//获取
告警组
getType
(){
this
.
overAllSer
.
findHostWarningCount
(
).
subscribe
(
this
.
alarmSer
.
mediaTypeFind
({}
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
warnCountList
=
res
.
data
;
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
this
.
sendList
=
res
.
data
;
}
}
)
}
//获取告警目标弹窗
getTarget
(){
}
//时间改变
changeType
(){
const
nowDate
=
new
Date
().
getTime
();
let
day1
,
day2
;
switch
(
this
.
timeType
){
case
'1'
:{
this
.
obj
.
startTime
=
this
.
datePipe
.
transform
(
nowDate
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
endTime
=
this
.
datePipe
.
transform
(
nowDate
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
this
.
obj
.
time_from
=
this
.
datePipe
.
transform
(
nowDate
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
time_till
=
this
.
datePipe
.
transform
(
nowDate
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
break
;
}
;
}
case
'2'
:{
day1
=
nowDate
-
1
*
24
*
60
*
60
*
1000
;
this
.
obj
.
startTime
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
endTime
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
this
.
obj
.
time_from
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
time_till
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
break
;
}
;
}
case
'3'
:{
day1
=
nowDate
-
3
*
24
*
60
*
60
*
1000
;
day2
=
nowDate
-
1
*
24
*
60
*
60
*
1000
;
this
.
obj
.
startTime
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
endTime
=
this
.
datePipe
.
transform
(
day2
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
this
.
obj
.
time_from
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
time_till
=
this
.
datePipe
.
transform
(
day2
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
break
;
}
;
}
case
'4'
:{
day1
=
nowDate
-
7
*
24
*
60
*
60
*
1000
;
day2
=
nowDate
-
1
*
24
*
60
*
60
*
1000
;
this
.
obj
.
startTime
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
endTime
=
this
.
datePipe
.
transform
(
day2
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
this
.
obj
.
time_from
=
this
.
datePipe
.
transform
(
day1
,
'yyyy-MM-dd'
)
+
' 00:00:00'
;
this
.
obj
.
time_till
=
this
.
datePipe
.
transform
(
day2
,
'yyyy-MM-dd'
)
+
' 23:59:59'
;
break
;
}
;
}
case
'5'
:{
break
;
}
;
}
}
}
//查询
searchValue
(){
this
.
obj
.
startTime
=
this
.
datePipe
.
transform
(
this
.
obj
.
startTime
,
'yyyy-MM-dd HH:mm:ss'
);
this
.
obj
.
endTime
=
this
.
datePipe
.
transform
(
this
.
obj
.
endTime
,
'yyyy-MM-dd HH:mm:ss'
);
this
.
warnList
.
getList
(
this
.
obj
);
search
(){
this
.
obj
.
time_from
=
this
.
datePipe
.
transform
(
this
.
obj
.
time_from
,
'ms'
)
+
''
;
this
.
obj
.
time_till
=
this
.
datePipe
.
transform
(
this
.
obj
.
time_till
,
'ms'
)
+
''
;
console
.
log
(
this
.
obj
);
this
.
getList
(
this
.
obj
);
}
change
(
e
){
this
.
pageNum
=
e
;
// this.getList(null);
}
//查看消息内容
showDeleteModal
(
data
){
this
.
isVisible
=
true
;
this
.
title
=
data
.
subject
;
this
.
content
=
data
.
message
;
}
//modal取消
handleCancel
(){
this
.
isVisible
=
false
;
}
//删除告警日志
deleteLog
(
data
){
this
.
modalSer
.
confirm
({
nzTitle
:
'删除'
,
nzContent
:
'<b style="color: red;">确认删除该告警组吗?</b>'
,
nzOkText
:
'确定'
,
nzOkType
:
'danger'
,
nzOnOk
:
()
=>
{
const
arr
=
{
ids
:[]
};
arr
.
ids
.
push
(
data
.
alertid
);
this
.
alarmSer
.
alertDelete
(
arr
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
}
);
},
nzCancelText
:
'取消'
,
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
),
})
}
//选择告警目标--主机
showTargetModal
(){
this
.
smartAlarmTarget
.
showModal
();
}
}
src/main/webapp/app/alarm/alarm-set/alarm-set.component.html
View file @
c37fbafe
...
...
@@ -22,7 +22,7 @@
<div
nz-row
class=
"search-form"
>
<div
nz-col
nzSpan=
"12"
>
<nz-select
style=
"width: 200px;"
nzShowSearch
nzAllowClear
nzPlaceHolder=
"选择告警组"
[(
ngModel
)]="
alertGroupId
"
(
ngModelChange
)="
getList
()"
>
<ng-container
*
ngFor=
"let item of groupList"
>
<ng-container
*
ngFor=
"let item of groupList
;let i = index;
"
>
<nz-option
nzLabel=
"{{item.name}}"
nzValue=
"{{item.id}}"
></nz-option>
</ng-container>
</nz-select>
...
...
@@ -30,17 +30,17 @@
<div
nz-col
nzSpan=
"12"
class=
"text-right"
>
<button
nz-button
nzType=
"default"
(
click
)="
showGroupModal
()"
><i
class=
"anticon anticon-plus"
></i>
添加
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-pause-circle-o"
></i>
编辑
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-play-circle-o"
></i>
删除
</button>
<button
nz-button
nzType=
"default"
(
click
)="
editGroup
()"
><i
class=
"anticon anticon-pause-circle-o"
></i>
编辑
</button>
<button
nz-button
nzType=
"default"
(
click
)="
deleteGroup
()"
><i
class=
"anticon anticon-play-circle-o"
></i>
删除
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-close-circle"
></i>
暂停
</button>
</div>
</div>
<div
nz-row
class=
"search-form"
>
<div
nz-col
nzSpan=
"16"
>
<button
(
click
)="
selectJ
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
></i>
新增告警推送
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
></i>
新增告警推送
</button>
</div>
</div>
<nz-table
#
nzTable
[
nzData
]="
setList
"
[
nzFrontPagination
]="
false
"
[
nzTotal
]="
totalNum
"
[
nzPageIndex
]="
pageNum
"
[
nzPageSize
]="
pageCount
"
(
nzPageIndexChange
)="
change
($
event
)"
[
nzLoading
]="
loading
"
>
<nz-table
#
nzTable
[
nzData
]="
setList
"
[
nzFrontPagination
]="
false
"
[
nzTotal
]="
totalNum
"
[
nzPageIndex
]="
pageNum
"
[
nzPageSize
]="
pageCount
"
(
nzPageIndexChange
)="
change
($
event
)"
>
<thead>
<tr>
<th
nzShowSort
>
名称
</th>
...
...
src/main/webapp/app/alarm/alarm-set/alarm-set.component.ts
View file @
c37fbafe
...
...
@@ -2,6 +2,7 @@ import {Component, OnInit, ViewChild} from '@angular/core';
import
{
AlarmService
}
from
'../alarm.service'
;
import
{
pageSize
}
from
'../../app.constants'
;
import
{
AlarmGroupComponent
}
from
'../modal/alarm-group/alarm-group.component'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
@
Component
({
selector
:
'smart-alarm-set'
,
...
...
@@ -18,7 +19,8 @@ export class AlarmSetComponent implements OnInit {
pageCount
=
pageSize
;
totalNum
;
constructor
(
private
alarmSer
:
AlarmService
)
{
constructor
(
private
alarmSer
:
AlarmService
,
private
modalSer
:
NzModalService
,
private
message
:
NzMessageService
)
{
}
ngOnInit
()
{
...
...
@@ -58,4 +60,49 @@ export class AlarmSetComponent implements OnInit {
showGroupModal
()
{
this
.
smartAlarmGroup
.
addModal
();
}
//删除告警组
deleteGroup
(){
this
.
modalSer
.
confirm
({
nzTitle
:
'删除'
,
nzContent
:
'<b style="color: red;">确认删除该告警组吗?</b>'
,
nzOkText
:
'确定'
,
nzOkType
:
'danger'
,
nzOnOk
:
()
=>
{
const
arr
=
{
ids
:[]
};
arr
.
ids
.
push
(
this
.
alertGroupId
);
this
.
alarmSer
.
alertGroupDelete
(
arr
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
}
);
},
nzCancelText
:
'取消'
,
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
),
})
}
//修改告警组
editGroup
(){
if
(
!
this
.
alertGroupId
){
this
.
message
.
info
(
'请选择需要编辑的分组'
);
return
false
;
}
let
arr
=
[];
this
.
groupList
.
forEach
(
res
=>
{
if
(
res
.
id
==
this
.
alertGroupId
){
arr
=
res
;
}
});
console
.
log
(
arr
);
this
.
smartAlarmGroup
.
editModal
(
arr
);
}
change
(
e
){}
}
src/main/webapp/app/alarm/alarm.service.ts
View file @
c37fbafe
...
...
@@ -19,6 +19,11 @@ export class AlarmService {
return
this
.
http
.
post
(
SERVER_API_URL
+
'/alert/find'
,
data
);
}
//删除告警推送日志
alertDelete
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/alert/delete'
,
data
);
}
//查询告警推送设置
actionFind
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/action/find'
,
data
);
...
...
@@ -59,6 +64,16 @@ export class AlarmService {
return
this
.
http
.
post
(
SERVER_API_URL
+
'/alertGroup/create'
,
data
);
}
//修改告警组
alertGroupUpdate
(
data
):
Observable
<
any
>
{
return
this
.
http
.
put
(
SERVER_API_URL
+
'/alertGroup/update'
,
data
);
}
//删除告警组
alertGroupDelete
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/alertGroup/delete'
,
data
);
}
//发送方式列表
mediaTypeFind
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/mediaType/find'
,
data
);
...
...
src/main/webapp/app/alarm/modal/alarm-group/alarm-group.component.ts
View file @
c37fbafe
...
...
@@ -19,6 +19,7 @@ export class AlarmGroupComponent implements OnInit {
title
;
isVisible
=
false
;
groupId
;
validateForm
:
FormGroup
;
name
;
...
...
@@ -32,6 +33,14 @@ export class AlarmGroupComponent implements OnInit {
this
.
initForm
();
}
//初始化
initForm
(){
this
.
validateForm
=
this
.
fb
.
group
({
name
:[
null
,[
Validators
.
required
]],
description
:[
null
]
})
}
//新增告警组
addModal
()
{
this
.
title
=
'新增告警组'
;
...
...
@@ -39,19 +48,21 @@ export class AlarmGroupComponent implements OnInit {
}
//编辑告警组
editModal
()
{
editModal
(
arr
)
{
this
.
title
=
'编辑告警组'
;
this
.
groupId
=
arr
.
id
;
this
.
isVisible
=
true
;
this
.
validateForm
.
patchValue
(
arr
);
}
//取消
handleCancel
()
{
this
.
isVisible
=
false
;
this
.
initForm
();
}
//确定
handleOk
()
{
// console.log(this.validateForm.valid);
for
(
const
i
in
this
.
validateForm
.
controls
)
{
this
.
validateForm
.
controls
[
i
].
markAsDirty
();
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
();
...
...
@@ -60,23 +71,42 @@ export class AlarmGroupComponent implements OnInit {
return
false
;
}
if
(
this
.
title
==
'编辑告警组'
){
this
.
update
();
}
else
{
this
.
create
();
}
}
create
(){
this
.
alarmSer
.
alertGroupCreate
(
this
.
validateForm
.
value
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
isVisible
=
false
;
this
.
add
.
emit
();
this
.
initForm
();
}
this
.
message
.
info
(
res
.
errMsg
);
}
)
}
//初始化
initForm
(){
this
.
validateForm
=
this
.
fb
.
group
({
name
:[
null
,[
Validators
.
required
]],
description
:[
null
]
})
update
(){
const
data
=
{
id
:
this
.
groupId
,
name
:
this
.
validateForm
.
value
.
name
,
description
:
this
.
validateForm
.
value
.
description
};
this
.
alarmSer
.
alertGroupUpdate
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
isVisible
=
false
;
this
.
add
.
emit
();
this
.
initForm
();
}
this
.
message
.
info
(
res
.
errMsg
);
}
)
}
}
src/main/webapp/app/alarm/modal/alarm-target/alarm-target.component.html
0 → 100644
View file @
c37fbafe
<nz-modal
[(
nzVisible
)]="
isVisible
"
[
nzFooter
]="
null
"
nzTitle=
"选择告警目标"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
>
<div
style=
"padding: 10px;"
>
<nz-tree
[(
ngModel
)]="
nodes
"
[
nzCheckable
]="
true
"
[
nzMultiple
]="
true
"
[
nzAsyncData
]
=
"
true
""
(
nzClick
)="
mouseAction
('
expand
',$
event
)"
(
nzExpandChange
)="
mouseAction
('
expand
',$
event
)"
>
</nz-tree>
</div>
</nz-modal>
\ No newline at end of file
src/main/webapp/app/alarm/modal/alarm-target/alarm-target.component.ts
0 → 100644
View file @
c37fbafe
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
OverAllService
}
from
'../../../overAll/overAll.service'
;
import
{
NzMessageService
,
NzTreeNode
,
NzFormatEmitEvent
}
from
'ng-zorro-antd'
;
import
{
ToTree
}
from
'../../../shared/common/toTree'
;
@
Component
({
selector
:
'smart-alarm-target'
,
templateUrl
:
'./alarm-target.component.html'
,
styles
:
[]
})
export
class
AlarmTargetComponent
implements
OnInit
{
isVisible
=
false
;
dataSet
;
nodes
;
constructor
(
private
overAllSer
:
OverAllService
,
private
message
:
NzMessageService
,
private
toTree
:
ToTree
)
{
}
ngOnInit
()
{
this
.
getGroup
();
}
getGroup
(){
this
.
overAllSer
.
findGroup
().
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
const
dataSet
=
res
.
data
;
dataSet
.
forEach
(
res
=>
{
res
.
title
=
res
.
name
;
res
.
key
=
res
.
groupid
;
});
this
.
toNode
(
dataSet
);
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
}
);
}
toNode
(
data
){
console
.
log
(
data
);
// const arr = this.toTree.listToTree(1,2,data)
this
.
nodes
=
data
.
map
(
res
=>
{
return
new
NzTreeNode
(
res
);
})
}
//下级
mouseAction
(
name
:
string
,
event
:
NzFormatEmitEvent
):
void
{
console
.
log
(
name
);
console
.
log
(
event
);
// if (name === 'expand') {
setTimeout
(
_
=>
{
// if (e.node.getChildren().length === 0 && e.node.isExpanded) {
// e.node.addChildren([
// {
// title: 'childAdd-1',
// key : '10031-' + (new Date()).getTime()
// },
// {
// title : 'childAdd-2',
// key : '10032-' + (new Date()).getTime(),
// isLeaf: true
// } ]);
// }
},
1000
);
// }
}
showModal
()
{
this
.
isVisible
=
true
;
}
handleOk
()
{
this
.
isVisible
=
false
;
}
handleCancel
()
{
this
.
isVisible
=
false
;
}
}
src/main/webapp/app/alarm/send-set/send-set.component.html
View file @
c37fbafe
...
...
@@ -19,10 +19,10 @@
</div>
</div>
<div
nz-row
class=
"search-form"
style=
"border-top: none;padding: 0 0 15px 0;"
>
<button
(
click
)="
searchValue
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
></i>
新增发送方式
</button>
<button
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
></i>
新增发送方式
</button>
</div>
<nz-table
#
nzTable
[
nzData
]="
sendList
"
[
nzFrontPagination
]="
false
"
[
nzTotal
]="
totalNum
"
[
nzPageIndex
]="
pageNum
"
[
nzPageSize
]="
pageCount
"
(
nzPageIndexChange
)="
change
($
event
)"
[
nzLoading
]="
loading
"
>
<nz-table
#
nzTable
[
nzData
]="
sendList
"
[
nzFrontPagination
]="
false
"
>
<thead>
<tr>
<th
nzShowSort
>
名称
</th>
...
...
src/main/webapp/app/app.main.module.ts
View file @
c37fbafe
...
...
@@ -43,6 +43,7 @@ import {SmartService} from './smart/smart.service';
import
{
WorkService
}
from
'./work/work.service'
;
import
{
AlarmGroupComponent
}
from
'./alarm/modal/alarm-group/alarm-group.component'
;
import
{
MediaTypeComponent
}
from
'./alarm/modal/media-type/media-type.component'
;
import
{
AlarmTargetComponent
}
from
'./alarm/modal/alarm-target/alarm-target.component'
;
@
NgModule
({
imports
:
[
...
...
@@ -86,7 +87,8 @@ import {MediaTypeComponent} from './alarm/modal/media-type/media-type.component'
NeTopologyComponent
,
FlowTrendComponent
,
AlarmGroupComponent
,
MediaTypeComponent
MediaTypeComponent
,
AlarmTargetComponent
],
providers
:[
OverAllService
,
...
...
@@ -97,8 +99,7 @@ import {MediaTypeComponent} from './alarm/modal/media-type/media-type.component'
OperationService
,
SmartService
,
WorkService
,
{
provide
:
NZ_I18N
,
useValue
:
zh_CN
}
{
provide
:
NZ_I18N
,
useValue
:
zh_CN
},
],
exports
:[
BasiCheckComponent
,
...
...
src/main/webapp/app/modal/basic-edit/basic-edit.component.ts
View file @
c37fbafe
...
...
@@ -44,13 +44,19 @@ export class BasicEditComponent implements OnInit {
macroTYpe
=
'macro'
;
//宏tabs
mainHost
=
'hostType1'
;
//主机tabs
constructor
(
private
fb
:
FormBuilder
,
private
overAllSer
:
OverAllService
,
p
rivate
message
:
NzMessageService
)
{
p
ublic
message
:
NzMessageService
)
{
}
ngOnInit
()
{
this
.
tabNum
=
0
;
this
.
initForm
();
this
.
getTemplate
();
this
.
getGroup
();
}
//获取分组
getGroup
(){
this
.
groupList
=
[];
this
.
overAllSer
.
getgroups
({}).
subscribe
(
(
res
)
=>
{
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
...
...
@@ -121,7 +127,26 @@ export class BasicEditComponent implements OnInit {
);
}
handEditleOk
():
void
{
//确定
handEditleOk
(){
if
(
!
this
.
validateForm
.
hostExtend
.
equipmentType
)
{
this
.
message
.
info
(
'请选择选择设备类型'
);
return
false
;
}
if
(
!
this
.
validateForm
.
hostExtend
.
secondLevelType
){
this
.
message
.
info
(
'请选择选择二级类型'
);
return
false
;
}
if
(
!
this
.
validateForm
.
name
){
this
.
message
.
info
(
'请输入显示名'
);
return
false
;
}
if
(
!
this
.
validateForm
.
host
){
this
.
message
.
info
(
'请输入IP地址'
);
return
false
;
}
//获取分组id
const
groupArr
=
[];
for
(
let
i
=
0
;
i
<
this
.
groupList
.
length
;
i
++
)
{
...
...
@@ -130,6 +155,14 @@ export class BasicEditComponent implements OnInit {
groupArr
.
push
(
groupid
);
}
}
this
.
interfaceslist
.
forEach
(
res
=>
{
if
(
res
.
bulk
){
res
.
bulk
=
'1'
;
}
else
{
res
.
bulk
=
'0'
;
}
});
this
.
validateForm
.
groups
=
groupArr
;
if
(
this
.
modalTitle
==
'编辑资源'
)
{
this
.
update
();
...
...
@@ -147,10 +180,11 @@ export class BasicEditComponent implements OnInit {
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
isBasicEdit
=
false
;
this
.
initForm
();
this
.
getGroup
();
this
.
done
.
emit
();
}
this
.
done
.
emit
();
this
.
message
.
info
(
res
.
errMsg
);
this
.
initForm
();
},
(
err
)
=>
{
this
.
message
.
info
(
'系统错误'
);
...
...
@@ -172,6 +206,7 @@ export class BasicEditComponent implements OnInit {
this
.
isBasicEdit
=
false
;
this
.
done
.
emit
();
this
.
initForm
();
this
.
getGroup
();
}
this
.
message
.
info
(
res
.
errMsg
);
},
...
...
@@ -185,6 +220,7 @@ export class BasicEditComponent implements OnInit {
handleEditCancel
():
void
{
this
.
isBasicEdit
=
false
;
this
.
initForm
();
this
.
getGroup
();
}
//tabs切换
...
...
@@ -210,7 +246,7 @@ export class BasicEditComponent implements OnInit {
type
:
'1'
,
port
:
'10050'
,
useip
:
1
,
bulk
:
0
,
bulk
:
false
,
};
this
.
interfaceslist
.
push
(
demo
);
}
...
...
@@ -229,7 +265,7 @@ export class BasicEditComponent implements OnInit {
}
case
'2'
:
{
this
.
interfaceslist
[
index
].
port
=
'161'
;
this
.
interfaceslist
[
index
].
bulk
=
1
;
this
.
interfaceslist
[
index
].
bulk
=
false
;
break
;
}
case
'3'
:
{
...
...
@@ -302,7 +338,7 @@ export class BasicEditComponent implements OnInit {
type
:
'1'
,
port
:
'10050'
,
useip
:
1
,
bulk
:
0
,
bulk
:
false
,
}
];
this
.
tabNum
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment