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
f20ba31c
Commit
f20ba31c
authored
Jan 10, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构 jtopo
parent
86b2b4c5
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
448 additions
and
210 deletions
+448
-210
strategy.component.html
src/main/webapp/app/modal/strategy/strategy.component.html
+139
-0
strategy.component.ts
src/main/webapp/app/modal/strategy/strategy.component.ts
+235
-7
ne-topology.component.ts
...bapp/app/netTopology/ne-topology/ne-topology.component.ts
+1
-5
basic-detail.component.html
...pp/overAll/basic/basic-detail/basic-detail.component.html
+25
-25
basic-detail.component.ts
.../app/overAll/basic/basic-detail/basic-detail.component.ts
+2
-7
basic.component.ts
src/main/webapp/app/overAll/basic/basic.component.ts
+0
-7
overAll.service.ts
src/main/webapp/app/overAll/overAll.service.ts
+8
-3
template.component.html
src/main/webapp/app/overAll/template/template.component.html
+10
-79
template.component.ts
src/main/webapp/app/overAll/template/template.component.ts
+28
-77
No files found.
src/main/webapp/app/modal/strategy/strategy.component.html
View file @
f20ba31c
<nz-modal
[
nzWidth
]="
880
"
[
nzFooter
]="
null
"
[(
nzVisible
)]="
isVisible
"
[
nzTitle
]="
title
"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
>
<nz-tabset
[
nzSelectedIndex
]="
tabNum
"
(
nzSelectedIndexChange
)="
tabsChange
($
event
)"
style=
"padding-bottom: 25px;min-height: 500px"
>
<nz-tab
nzTitle=
"模版"
>
<div
nz-form
>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzRequired
nzFor=
"checkName"
>
模版真实名称
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<input
name=
"checkName"
type=
"text"
nz-input
[(
ngModel
)]="
validateForm
.
host
"
>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzRequired
nzFor=
"checkName"
>
模板显示名称
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<input
name=
"checkName"
type=
"text"
nz-input
[(
ngModel
)]="
validateForm
.
name
"
>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzRequired
nzFor=
"templateList"
>
所在分组
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<nz-checkbox-group
[(
ngModel
)]="
templateList
"
name=
"templateList"
></nz-checkbox-group>
</nz-form-control>
</nz-form-item>
</div>
<div
class=
"modal-footer-btn"
>
<button
nz-button
(
click
)="
tabsChange
(
1
)"
nzType=
"primary"
>
下一步
</button>
</div>
</nz-tab>
<nz-tab
nzTitle=
"链接的模版"
>
<div
nz-form
>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
4
"
nzFor=
"templates"
>
需要链接的模板
</nz-form-label>
<nz-form-control
[
nzSpan
]="
14
"
>
<nz-select
name=
"templates"
style=
"width: 100%"
[(
ngModel
)]="
validateForm
.
templates
"
[
nzSize
]="
nzSize
"
nzMode=
"tags"
nzPlaceHolder=
"选择监控策略"
>
<nz-option
*
ngFor=
"let option of tempList"
[
nzLabel
]="
option
.
name
"
[
nzValue
]="
option
.
templateid
"
></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div
class=
"modal-footer-btn"
>
<button
nz-button
(
click
)="
tabsChange
(
0
)"
nzType=
"primary"
>
上一步
</button>
<button
nz-button
(
click
)="
tabsChange
(
2
)"
nzType=
"primary"
>
下一步
</button>
</div>
</nz-tab>
<nz-tab
nzTitle=
"宏"
>
<div
nz-row
[
nzGutter
]="
24
"
>
<div
nz-col
[
nzSpan
]="
12
"
>
<nz-form-item
nzFlex
>
<nz-form-control
[
nzOffset
]="
4
"
[
nzSpan
]="
14
"
>
<nz-radio-group
[(
ngModel
)]="
macroTYpe
"
>
<label
nz-radio-button
nzValue=
"macro"
><span>
主机宏
</span></label>
<!--<label nz-radio-button nzValue="macroExpand"><span>继承以及主机宏</span></label>-->
</nz-radio-group>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div
*
ngIf=
"macroTYpe == 'macro'"
>
<div
nz-row
[
nzGutter
]="
24
"
>
<div
nz-col
[
nzOffset
]="
2
"
[
nzSpan
]="
6
"
>
宏
</div>
<div
nz-col
[
nzSpan
]="
6
"
>
值
</div>
</div>
<div
nz-row
*
ngFor=
"let item of macroList1;let i = index;"
[
nzGutter
]="
24
"
>
<nz-form-control
[
nzOffset
]="
2
"
nz-col
[
nzSpan
]="
6
"
>
<input
nz-input
[(
ngModel
)]="
item
.
macro
"
>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
1
"
>
=>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
6
"
>
<input
nz-input
[(
ngModel
)]="
item
.
value
"
>
</nz-form-control>
<nz-form-control
nz-col
[
nzSpan
]="
3
"
>
<span
(
click
)="
deleteMacro1
(
i
)"
>
移除
</span>
</nz-form-control>
</div>
<button
nz-button
(
click
)="
addMacro1
()"
nzType=
"default"
>
添加
</button>
</div>
<div
*
ngIf=
"macroTYpe == 'macroExpand'"
>
<div
nz-row
[
nzGutter
]="
24
"
>
<div
nz-col
[
nzOffset
]="
2
"
[
nzSpan
]="
6
"
>
宏
</div>
<div
nz-col
[
nzSpan
]="
1
"
>
</div>
<div
nz-col
[
nzSpan
]="
6
"
>
值
</div>
<div
nz-col
[
nzSpan
]="
3
"
>
模版值
</div>
<div
nz-col
[
nzSpan
]="
1
"
>
</div>
<div
nz-col
[
nzSpan
]="
3
"
>
全局值(配置)
</div>
</div>
<div
nz-row
[
nzGutter
]="
12
"
*
ngFor=
"let item of macroList2"
>
<nz-form-control
nz-col
[
nzOffset
]="
2
"
[
nzSpan
]="
6
"
>
<input
nz-input
placeholder=
"{$SNMP_COMMUNITY}"
value=
"{{item.macro}}"
>
</nz-form-control>
<div
nz-col
[
nzSpan
]="
1
"
>
=>
</div>
<nz-form-control
nz-col
[
nzSpan
]="
6
"
>
<input
nz-input
placeholder=
"public"
value=
"{{item.value}}"
>
</nz-form-control>
<div
nz-col
[
nzSpan
]="
3
"
>
<button
nz-button
nzType=
"default"
>
更改
</button>
</div>
<div
nz-col
[
nzSpan
]="
1
"
>
<span></span>
</div>
<div
nz-col
[
nzSpan
]="
3
"
>
<span>
"public"
</span>
</div>
<div
nz-col
[
nzSpan
]="
2
"
>
<span
class=
"cursor"
(
click
)="
deleteMacro2
(
i
)"
>
移除
</span>
</div>
</div>
<button
nz-button
(
click
)="
addMacro2
()"
nzType=
"default"
>
添加
</button>
</div>
<div
class=
"modal-footer-btn"
>
<button
nz-button
(
click
)="
tabsChange
(
1
)"
nzType=
"primary"
>
上一步
</button>
<button
nz-button
(
click
)="
handleOk
()"
nzType=
"primary"
>
确定
</button>
</div>
</nz-tab>
</nz-tabset>
</nz-modal>
src/main/webapp/app/modal/strategy/strategy.component.ts
View file @
f20ba31c
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
EventEmitter
,
OnInit
,
Output
}
from
'@angular/core'
;
import
{
FormBuilder
}
from
'@angular/forms'
;
import
{
Router
}
from
'@angular/router'
;
import
{
JhiMainComponent
}
from
'../../layouts'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
OverAllService
}
from
'../../overAll/overAll.service'
;
@
Component
({
selector
:
'smart-strategy'
,
templateUrl
:
'./strategy.component.html'
,
styles
:
[]
selector
:
'smart-strategy'
,
templateUrl
:
'./strategy.component.html'
,
styles
:
[]
})
export
class
StrategyComponent
implements
OnInit
{
constructor
()
{
}
@
Output
()
done
=
new
EventEmitter
<
any
>
();
isVisible
=
false
;
title
;
tabNum
=
0
;
nzSize
=
'large'
;
ngOnInit
()
{
}
validateForm
;
tempId
;
//模版Id
templateList
=
[];
//模版组
tempList
;
//模版
//宏
macroTYpe
=
'macro'
;
//宏tabs
mainHost
=
'hostType1'
;
//主机tabs
macroList1
:
any
[];
macroList2
:
any
[];
//配置宏数组
constructor
(
private
fb
:
FormBuilder
,
private
overAllSer
:
OverAllService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
message
:
NzMessageService
,
private
main
:
JhiMainComponent
)
{
}
ngOnInit
()
{
this
.
getTemplateGroup
();
this
.
getTemplate
();
this
.
initForm
();
}
initForm
()
{
this
.
validateForm
=
{
host
:
null
,
name
:
null
,
groups
:
[],
templates
:
[],
macros
:
[],
hosts
:
[],
};
}
//获取模版组
getTemplateGroup
()
{
this
.
templateList
=
[];
this
.
overAllSer
.
getTemplateGroups
().
subscribe
(
(
res
)
=>
{
const
list
=
res
.
data
;
list
.
forEach
(
e
=>
{
const
gObj
=
{
label
:
e
.
name
,
value
:
e
.
groupid
,
checked
:
false
};
this
.
templateList
.
push
(
gObj
);
});
}
);
}
//获取模版
getTemplate
()
{
this
.
tempList
=
[];
this
.
overAllSer
.
templates
().
subscribe
(
(
res
)
=>
{
this
.
tempList
=
res
.
data
;
}
);
}
tabsChange
(
e
){
this
.
tabNum
=
e
;
}
showAddModal
(
title
):
void
{
this
.
isVisible
=
true
;
this
.
title
=
title
;
}
showEditModal
(
title
,
id
){
this
.
isVisible
=
true
;
this
.
title
=
title
;
this
.
tempId
=
id
;
const
data
=
{
templateids
:[
this
.
tempId
]
}
this
.
overAllSer
.
findTemplates
(
data
).
subscribe
(
(
res
)
=>
{
const
data
=
res
.
data
[
0
];
this
.
validateForm
.
host
=
data
.
host
;
this
.
validateForm
.
name
=
data
.
name
;
if
(
data
.
groups
){
//所在组回显
this
.
templateList
.
forEach
(
e1
=>
{
data
.
groups
.
forEach
(
e2
=>
{
if
(
e1
.
value
==
e2
.
groupid
){
e1
.
checked
=
true
;
}
})
});
}
if
(
data
.
parentTemplates
){
//模版回显
this
.
validateForm
.
templates
=
data
.
parentTemplates
.
map
(
e
=>
{
return
e
.
templateid
;
})
}
}
)
}
check
(){
const
han
=
/.*
[\u
4e00-
\u
9fa5
]
+.*$/
;
if
(
han
.
test
(
this
.
validateForm
.
host
))
{
this
.
message
.
error
(
"模版真实名称不能输入中文"
);
return
false
;
};
return
true
;
}
handleOk
()
{
if
(
!
this
.
check
()){
return
false
;
}
const
arr
=
[];
this
.
templateList
.
forEach
(
e
=>
{
if
(
e
.
checked
){
const
d
=
{
groupid
:
e
.
value
}
arr
.
push
(
d
);
}
});
if
(
this
.
title
==
"添加模版"
){
this
.
create
(
arr
);
}
if
(
this
.
title
==
"编辑模版"
){
this
.
update
(
arr
);
}
}
create
(
arr
){
const
data
=
{
host
:
this
.
validateForm
.
host
,
name
:
this
.
validateForm
.
name
,
groups
:
arr
,
templates
:
this
.
validateForm
.
templates
.
map
(
e
=>
{
const
d
=
{
templateid
:
e
}
return
d
;
}),
macros
:
[],
hosts
:
[],
};
this
.
overAllSer
.
createTemplates
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
message
.
success
(
"添加模版成功"
);
this
.
initForm
();
this
.
done
.
emit
();
this
.
isVisible
=
false
;
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
)
}
update
(
arr
){
const
data
=
{
templateid
:
this
.
tempId
,
//模版id
host
:
this
.
validateForm
.
host
,
name
:
this
.
validateForm
.
name
,
groups
:
arr
,
templates
:
this
.
validateForm
.
templates
.
map
(
e
=>
{
const
d
=
{
templateid
:
e
}
return
d
;
}),
macros
:
[],
hosts
:
[],
}
this
.
overAllSer
.
updateTemplates
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
this
.
message
.
success
(
"修改模版成功"
);
this
.
initForm
();
this
.
done
.
emit
();
this
.
isVisible
=
false
;
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
)
}
handleCancel
():
void
{
this
.
isVisible
=
false
;
this
.
initForm
();
}
//新增宏
addMacro1
()
{
const
data
=
{
macro
:
'{$SNMP_COMMUNITY}'
,
value
:
'public'
,
};
this
.
macroList1
.
push
(
data
);
}
//移除宏
deleteMacro1
(
index
)
{
this
.
macroList1
.
splice
(
index
,
1
);
}
//新增主机宏
addMacro2
()
{
const
data
=
{
macro
:
'{$SNMP_COMMUNITY}'
,
value
:
'public'
,
};
this
.
macroList2
.
push
(
data
);
}
//移除主机宏
deleteMacro2
(
index
)
{
this
.
macroList2
.
splice
(
index
,
1
);
}
}
src/main/webapp/app/netTopology/ne-topology/ne-topology.component.ts
View file @
f20ba31c
...
...
@@ -306,16 +306,12 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
arr
.
forEach
(
e2
=>
{
if
(
e1
.
elementId
==
e2
.
hostId
){
if
(
e1
.
status
==
0
){
e2
.
alarm
=
"正常"
;
e2
.
alarmColor
=
"50,205,50"
;
}
if
(
e1
.
status
==
1
){
e2
.
alarm
=
"告警"
;
e2
.
alarmColor
=
"255,182,193"
;
}
if
(
e1
.
status
==
2
){
e2
.
alarm
=
"严重"
;
e2
.
alarmColor
=
"220,20,60"
;
// e2.alarm = "严重";
}
}
})
...
...
src/main/webapp/app/overAll/basic/basic-detail/basic-detail.component.html
View file @
f20ba31c
...
...
@@ -108,35 +108,35 @@
<div
echarts
[
options
]="
secondOptionLeft
"
class=
"demo-chart"
></div>
</div>
<div
nz-col
nzSpan=
"8"
>
<
div
echarts
[
options
]="
secondOptionRight
"
class=
"demo-chart"
></div
>
<
!--<div echarts [options]="secondOptionRight" class="demo-chart"></div>--
>
</div>
</nz-collapse-panel>
</nz-collapse>
</div>
<
div
nz-row
>
<
nz-table
#
basicTable
[
nzData
]="
dataSet
"
[
nzFrontPagination
]="
false
"
[
nzTotal
]="
totalNumInOut
"
[
nzPageIndex
]="
pageNum
"
[
nzPageSize
]="
pageCount
"
(
nzPageIndexChange
)="
changeInoutInfo
($
event
)"
[
nzLoading
]="
inOutLoading
"
>
<
thead
>
<
tr
>
<
th>
状态
</th
>
<
th>
接口
</th
>
<
th>
进流量
</th
>
<
th>
出流量
</th
>
<
th>
状态变更时间
</th
>
<!--
<th nzWidth="150px">图表</th>
-->
<
/tr
>
<
/thead
>
<
tbody
>
<
tr
*
ngFor=
"let data of basicTable.data"
>
<
td>
{{data.state}}
</td
>
<
td>
{{data.name}}
</td
>
<
td>
{{data.in}}
</td
>
<
td>
{{data.out}}
</td
>
<
td>
{{data.changeState}}
</td
>
<!--
<td>图表</td>
-->
<
/tr
>
<
/tbody
>
<
/nz-table
>
<
/div
>
<
!--<div nz-row>--
>
<
!--<nz-table #basicTable [nzData]="dataSet" [nzFrontPagination]="false" [nzTotal]="totalNumInOut" [nzPageIndex]="pageNum" [nzPageSize]="pageCount" (nzPageIndexChange)="changeInoutInfo($event)" [nzLoading]="inOutLoading">--
>
<
!--<thead>--
>
<
!--<tr>--
>
<
!--<th>状态</th>--
>
<
!--<th>接口</th>--
>
<
!--<th>进流量</th>--
>
<
!--<th>出流量</th>--
>
<
!--<th>状态变更时间</th>--
>
<!--
<!–<th nzWidth="150px">图表</th>–>
-->
<
!--</tr>--
>
<
!--</thead>--
>
<
!--<tbody>--
>
<
!--<tr *ngFor="let data of basicTable.data">--
>
<
!--<td>{{data.state}}</td>--
>
<
!--<td>{{data.name}}</td>--
>
<
!--<td>{{data.in}}</td>--
>
<
!--<td>{{data.out}}</td>--
>
<
!--<td>{{data.changeState}}</td>--
>
<!--
<!–<td>图表</td>–>
-->
<
!--</tr>--
>
<
!--</tbody>--
>
<
!--</nz-table>--
>
<
!--</div>--
>
</section>
</nz-tab>
<nz-tab
nzTitle=
"监测点列表"
>
...
...
src/main/webapp/app/overAll/basic/basic-detail/basic-detail.component.ts
View file @
f20ba31c
...
...
@@ -53,7 +53,6 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
hostName
;
realName
;
size
=
'default'
;
hostType
:
string
;
changeStates
;
chartOption1
;
responseTimeStr
;
...
...
@@ -129,7 +128,6 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
this
.
isSpinning
=
true
;
this
.
routerInfo
.
queryParams
.
subscribe
(
queryParams
=>
{
this
.
hostId
=
queryParams
.
hostId
;
this
.
hostType
=
queryParams
.
type
;
this
.
hostName
=
queryParams
.
name
;
this
.
realName
=
queryParams
.
hostName
;
});
...
...
@@ -138,7 +136,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
this
.
cpused
();
this
.
disks
();
this
.
used
();
this
.
inOutInfo
();
//
this.inOutInfo();
//监测点
this
.
getList
();
...
...
@@ -296,7 +294,6 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
cpused
()
{
const
data
=
{
hostId
:
this
.
hostId
,
hostType
:
this
.
hostType
,
};
this
.
overAllSer
.
cupUsed
(
data
).
subscribe
(
(
res
)
=>
{
...
...
@@ -370,7 +367,6 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
used
()
{
const
data
=
{
hostId
:
this
.
hostId
,
hostType
:
this
.
hostType
,
};
this
.
overAllSer
.
used
(
data
).
subscribe
(
(
res
)
=>
{
...
...
@@ -444,7 +440,6 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
disks
()
{
const
data
=
{
hostId
:
this
.
hostId
,
hostType
:
this
.
hostType
,
};
this
.
overAllSer
.
disks
(
data
).
subscribe
(
(
res
)
=>
{
...
...
@@ -626,7 +621,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//进出口流量 翻页
changeInoutInfo
(
e
){
this
.
pageNum
=
e
;
this
.
inOutInfo
();
//
this.inOutInfo();
}
//添加监测点
...
...
src/main/webapp/app/overAll/basic/basic.component.ts
View file @
f20ba31c
...
...
@@ -446,16 +446,9 @@ export class BasicComponent implements OnInit {
//查看详情
goDetail
(
item
)
{
let
type
=
0
;
if
(
item
.
hostExtend
)
{
if
(
item
.
hostExtend
.
equipmentType
==
'交换机'
)
{
type
=
1
;
}
}
this
.
router
.
navigate
([
'app/main/basic-detail'
],
{
queryParams
:
{
hostId
:
item
.
hostid
,
type
:
type
,
name
:
item
.
name
,
hostName
:
item
.
host
}
...
...
src/main/webapp/app/overAll/overAll.service.ts
View file @
f20ba31c
...
...
@@ -61,17 +61,17 @@ export class OverAllService {
//CPU使用率
cupUsed
(
data
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/cpuUsed/'
+
data
.
hostId
+
'/'
+
data
.
hostType
);
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/cpuUsed/'
+
data
.
hostId
);
}
//内存使用率
used
(
data
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/used/'
+
data
.
hostId
+
'/'
+
data
.
hostType
);
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/used/'
+
data
.
hostId
);
}
//磁盘使用率
disks
(
data
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/disks/'
+
data
.
hostId
+
'/'
+
data
.
hostType
);
return
this
.
http
.
get
(
SERVER_API_URL
+
'/host/disks/'
+
data
.
hostId
);
}
//进出口流量 --SNMP
...
...
@@ -319,6 +319,11 @@ export class OverAllService {
return
this
.
http
.
post
(
SERVER_API_URL
+
'/templates/create'
,
data
);
}
//修改模板
updateTemplates
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/templates/update'
,
data
);
}
//删除模板(支持批量删除)
deleteTemplates
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/templates/delete'
,
data
);
...
...
src/main/webapp/app/overAll/template/template.component.html
View file @
f20ba31c
...
...
@@ -15,12 +15,7 @@
</nz-breadcrumb-item>
</nz-breadcrumb>
</div>
<div
nz-col
nzSpan=
"10"
class=
"search-input text-right"
>
<input
(
keyup
.
enter
)="
search
('')"
type=
"text"
nz-input
[(
ngModel
)]="
searchName
"
placeholder=
"输入资源名称"
>
<button
(
click
)="
search
('')"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
style=
"color: #6097b7"
></i>
搜索
</button>
</div>
<div
nz-col
nzSpan=
"10"
class=
"search-input text-right"
></div>
<div
nz-col
nzSpan=
"2"
class=
"text-right"
>
<button
(
click
)="
ngOnInit
()"
nz-button
nzType=
"primary"
><i
class=
"anticon anticon-sync"
></i></button>
<smart-full-screen></smart-full-screen>
...
...
@@ -29,15 +24,12 @@
<div
nz-row
class=
"search-form tag-form"
>
<div
nz-col
nzSpan=
"12"
>
<input
style=
"width: 250px"
(
keyup
.
enter
)="
search
('')"
type=
"text"
nz-input
[(
ngModel
)]="
searchName
"
placeholder=
"输入资源名称"
>
<button
(
click
)="
search
('')"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-search"
style=
"color: #6097b7"
></i>
搜索
</button>
</div>
<div
nz-col
nzSpan=
"12"
class=
"text-right"
>
<button
nz-button
nzType=
"default"
(
click
)="
showGroupModal
()"
>
<i
class=
"anticon anticon-plus-circle-o"
></i>
添加分组
</button>
<button
(
click
)="
openBatchHost
(
1
,'停止')"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-pause-circle-o"
></i>
停止监控
</button>
<button
(
click
)="
openBatchHost
(
0
,'开启')"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-play-circle-o"
></i>
开启监控
<i
class=
"anticon anticon-plus-circle-o"
></i>
添加模版组
</button>
<button
(
click
)="
batchDeleteConfirm
()"
nz-button
nzType=
"default"
><i
class=
"anticon anticon-close-circle-o"
></i>
删除模版
</button>
...
...
@@ -48,10 +40,7 @@
<tr>
<th
[
nzChecked
]="
allChecked
"
></th>
<th>
名称
</th>
<th>
告警状态
</th>
<th>
关联资产
</th>
<!--<th nzWidth="20%">主机启用状态</th>-->
<th>
可用性
</th>
<th>
描述
</th>
<th>
操作
</th>
</tr>
</thead>
...
...
@@ -69,84 +58,26 @@
(
nzExpandChange
)="
getChildren
(
item
)"
>
<span>
{{item.name}}
</span>
</td>
<td>
{{item.groupDescribe}}
</td>
</ng-container>
<!--子集-->
<ng-container
*
ngIf=
"item.level"
>
<td
nzShowCheckbox
[
nzIndeterminate
]="
indeterminate
"
(
nzCheckedChange
)="
selectChecked
($
event
,
item
)"
[(
nzChecked
)]="
item
.
checked
"
></td>
<td
class=
"cursor"
[
nzIndentSize
]="
item
.
level
*
20
"
>
<span
(
click
)="
goDetail
(
item
)"
>
{{item.name}}
</span>
<span>
{{item.name}}
</span>
</td>
<td></td>
</ng-container>
<td
class=
"round-tag tag-form"
>
<ng-container
*
ngIf=
"item.status == 1"
>
<nz-tag
[
nzColor
]="
color
.
gray
"
></nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.status == 0"
>
<nz-tag
*
ngIf=
"item.maxLevel == 4 || item.maxLevel == 5"
[
nzColor
]="
color
.
red
"
></nz-tag>
<nz-tag
*
ngIf=
"item.maxLevel == 2 || item.maxLevel == 3"
[
nzColor
]="
color
.
yellow
"
></nz-tag>
<nz-tag
*
ngIf=
"item.maxLevel < 2 "
[
nzColor
]="
color
.
green
"
></nz-tag>
</ng-container>
</td>
<td
class=
"cursor"
>
<span
(
click
)="
goTOInventory
(
item
?.
inventory
?.
id
)"
>
{{item?.inventory?.name}}
</span>
</td>
<!--<nz-tag *ngIf="item.status == 0" [nzColor]="color.green"></nz-tag>-->
<!--<nz-tag *ngIf="item.status == 1" [nzColor]="color.gray"></nz-tag>-->
<td
class=
"default"
>
<ng-container
*
ngIf=
"item.level"
>
<ng-container
*
ngIf=
"item.available == 0"
>
<nz-tag>
AGENT
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
AGENT
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
AGENT
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.snmp_available == 0"
>
<nz-tag>
SNMP
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.snmp_available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
SNMP
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.snmp_available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
SNMP
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.jmx_available == 0"
>
<nz-tag>
JMX
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.jmx_available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
JMX
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.jmx_available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
JMX
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.ipmi_available == 0"
>
<nz-tag>
IPMI
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.ipmi_available == 1"
>
<nz-tag
[
nzColor
]="'#
3bae6a
'"
>
IPMI
</nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.ipmi_available == 2"
>
<nz-tag
[
nzColor
]="'#
d44f51
'"
>
IPMI
</nz-tag>
</ng-container>
</ng-container>
</td>
<td
class=
"handle main-color"
>
<ng-container
*
ngIf=
"!item.level"
>
<span
(
click
)="
show
BasicEditModal
(
item
)"
>
添加资源
</span>
<span
(
click
)="
show
TempAddModal
(
item
)"
>
添加模版
</span>
<span
(
click
)="
updateGroup
(
item
)"
>
编辑
</span>
<span
(
click
)="
showDeleteGroupConfirm
(
item
)"
>
删除
</span>
</ng-container>
<ng-container
*
ngIf=
"item.level"
>
<span
(
click
)="
showBasicCheckModal
(
item
.
hostid
,
item
.
host
)"
>
添加监测点
</span>
<span
(
click
)="
editBasic
Modal
(
item
)"
>
编辑
</span>
<span
(
click
)="
showTempEdit
Modal
(
item
)"
>
编辑
</span>
<span
(
click
)="
showDeleteConfirm
(
item
)"
>
删除
</span>
<nz-dropdown
[
nzTrigger
]="'
click
'"
class=
"table-dropdown"
>
<a
nz-dropdown
>
更多
<i
class=
"anticon anticon-down"
></i>
...
...
src/main/webapp/app/overAll/template/template.component.ts
View file @
f20ba31c
...
...
@@ -60,6 +60,9 @@ export class TemplateComponent implements OnInit {
searchName
;
searchData
;
//模版
templateList
=
[];
constructor
(
private
fb
:
FormBuilder
,
private
overAllSer
:
OverAllService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
message
:
NzMessageService
,
private
main
:
JhiMainComponent
)
{
}
...
...
@@ -116,7 +119,22 @@ export class TemplateComponent implements OnInit {
}
ngOnInit
():
void
{
this
.
select
();
// this.select();
this
.
getTemplateGroup
();
}
//获取模版组
getTemplateGroup
(){
this
.
overAllSer
.
getTemplateGroups
().
subscribe
(
(
res
)
=>
{
this
.
dataSet
=
res
.
data
;
for
(
let
i
=
0
;
i
<
this
.
dataSet
.
length
;
i
++
)
{
this
.
dataSet
[
i
].
host
=
i
;
this
.
dataSet
[
i
].
checked
=
false
;
}
this
.
toTree
(
null
);
}
)
}
//搜索
...
...
@@ -146,14 +164,14 @@ export class TemplateComponent implements OnInit {
this
.
frontPagination
=
true
;
}
//添加
资源
show
BasicEdit
Modal
()
{
this
.
basicEdit
.
showModal
(
);
//添加
模版
show
TempAdd
Modal
()
{
this
.
smartStrategy
.
showAddModal
(
"添加模版"
);
}
//编辑
资源 name--分组名称,gId-当前分组的id
editBasic
Modal
(
item
)
{
this
.
basicEdit
.
editModal
(
item
.
hostid
,
item
.
name
,
item
.
gI
d
);
//编辑
模版
showTempEdit
Modal
(
item
)
{
this
.
smartStrategy
.
showEditModal
(
"编辑模版"
,
item
.
templatei
d
);
}
//添加监测点
...
...
@@ -161,21 +179,6 @@ export class TemplateComponent implements OnInit {
this
.
smartCheck
.
showAddModal
(
hostid
,
host
);
}
//列表
findList
()
{
const
data
=
{};
this
.
overAllSer
.
find
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
)
{
this
.
dataSet
=
res
.
data
;
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
}
);
}
//选择分组
select
()
{
this
.
loading
=
true
;
...
...
@@ -216,7 +219,6 @@ export class TemplateComponent implements OnInit {
}
);
}
else
if
(
this
.
selectedValue
==
'all'
)
{
this
.
findList
();
}
}
...
...
@@ -288,7 +290,7 @@ export class TemplateComponent implements OnInit {
//添加分组
showGroupModal
()
{
this
.
smartCreateGroup
.
showModal
(
'添加
分
组'
);
this
.
smartCreateGroup
.
showModal
(
'添加
模版
组'
);
}
//编辑分组
...
...
@@ -329,6 +331,7 @@ export class TemplateComponent implements OnInit {
handleOk
(
e
)
{
this
.
select
();
this
.
smartStrategy
.
getTemplateGroup
();
}
//获取下级list
...
...
@@ -344,11 +347,8 @@ export class TemplateComponent implements OnInit {
this
.
loading
=
true
;
const
data
=
{
'groupids'
:
[
item
.
groupid
],
'hostExtend'
:
{
'superiorHostid'
:
null
}
};
this
.
overAllSer
.
find
Detail
(
data
).
subscribe
(
this
.
overAllSer
.
find
Templates
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
)
{
this
.
dataSet
[
item
.
host
].
list
=
res
.
data
;
...
...
@@ -388,24 +388,6 @@ export class TemplateComponent implements OnInit {
);
}
//查看详情
goDetail
(
item
)
{
let
type
=
0
;
if
(
item
.
hostExtend
)
{
if
(
item
.
hostExtend
.
equipmentType
==
'交换机'
)
{
type
=
1
;
}
}
this
.
router
.
navigate
([
'app/main/basic-detail'
],
{
queryParams
:
{
hostId
:
item
.
hostid
,
type
:
type
,
name
:
item
.
name
,
hostName
:
item
.
host
}
});
}
//临时暂停
showTempStop
(
item
)
{
this
.
smartPause
.
showModal
(
item
.
hostid
,
'基础资源'
);
...
...
@@ -453,37 +435,6 @@ export class TemplateComponent implements OnInit {
});
}
//批量开启or停止监控
openBatchHost
(
status
,
operation
)
{
if
(
this
.
batchDelList
.
length
==
0
)
{
this
.
message
.
info
(
'请选择需要'
+
operation
+
'的设备'
);
return
false
;
}
this
.
modalService
.
confirm
({
nzTitle
:
'监控'
,
nzContent
:
'确定批量'
+
operation
+
'监控设备?'
,
nzOkText
:
'确定'
,
nzCancelText
:
'取消'
,
nzOnOk
:
()
=>
{
const
data
=
{
status
:
status
,
hostids
:
this
.
batchDelList
};
this
.
overAllSer
.
batchStopOrOpen
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'修改成功'
);
this
.
batchDelList
=
[];
this
.
select
();
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
}
);
},
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
)
});
}
//资产页面
goTOInventory
(
id
)
{
...
...
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