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
9c0a7f77
Commit
9c0a7f77
authored
Jun 05, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
服务器
parent
ebc74086
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
548 additions
and
123 deletions
+548
-123
app.constants.ts
src/main/webapp/app/app.constants.ts
+3
-3
app.module.ts
src/main/webapp/app/app.module.ts
+30
-28
basic-detail.component.ts
.../app/overAll/basic/basic-detail/basic-detail.component.ts
+0
-0
basic.component.ts
src/main/webapp/app/overAll/basic/basic.component.ts
+2
-1
host.component.ts
src/main/webapp/app/overAll/host.component.ts
+17
-0
database.component.ts
...n/webapp/app/overAll/modal/database/database.component.ts
+1
-1
server.component.html
...ain/webapp/app/overAll/modal/server/server.component.html
+87
-43
server.component.ts
src/main/webapp/app/overAll/modal/server/server.component.ts
+196
-2
switch.component.html
...ain/webapp/app/overAll/modal/switch/switch.component.html
+53
-15
switch.component.ts
src/main/webapp/app/overAll/modal/switch/switch.component.ts
+145
-30
common.service.ts
src/main/webapp/app/shared/common/common.service.ts
+1
-0
darkBlue.scss
src/main/webapp/content/scss/darkBlue.scss
+13
-0
No files found.
src/main/webapp/app/app.constants.ts
View file @
9c0a7f77
...
...
@@ -23,9 +23,9 @@ export const ThemeList = [
//流量单位
export
const
UnitList
=
[
{
'label'
:
'bps'
,
value
:
'bps'
},
{
'label'
:
'Kbps'
,
value
:
'
k
bps'
},
{
'label'
:
'Mbps'
,
value
:
'
m
bps'
},
{
'label'
:
'Gbps'
,
value
:
'
g
bps'
},
{
'label'
:
'Kbps'
,
value
:
'
K
bps'
},
{
'label'
:
'Mbps'
,
value
:
'
M
bps'
},
{
'label'
:
'Gbps'
,
value
:
'
G
bps'
},
];
//主机指标
...
...
src/main/webapp/app/app.module.ts
View file @
9c0a7f77
import
'./vendor.ts'
;
import
{
NgModule
,
Injector
,
CUSTOM_ELEMENTS_SCHEMA
,
NO_ERRORS_SCHEMA
}
from
'@angular/core'
;
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
BrowserAnimationsModule
}
from
"@angular/platform-browser/animations"
;
import
{
HTTP_INTERCEPTORS
}
from
'@angular/common/http'
;
import
{
Ng2Webstorage
,
LocalStorageService
,
SessionStorageService
}
from
'ngx-webstorage'
;
import
{
JhiEventManager
}
from
'ng-jhipster'
;
import
{
FormsModule
,
ReactiveFormsModule
}
from
'@angular/forms'
;
import
{
HttpModule
}
from
"@angular/http"
;
import
{
AuthInterceptor
}
from
'./blocks/interceptor/auth.interceptor'
;
import
{
AuthExpiredInterceptor
}
from
'./blocks/interceptor/auth-expired.interceptor'
;
import
{
ErrorHandlerInterceptor
}
from
'./blocks/interceptor/errorhandler.interceptor'
;
import
{
NotificationInterceptor
}
from
'./blocks/interceptor/notification.interceptor'
;
import
{
BootappSharedModule
,
UserRouteAccessService
}
from
'./shared'
;
import
{
PaginationConfig
}
from
'./blocks/config/uib-pagination.config'
;
import
{
FileUploadModule
}
from
'ng2-file-upload'
;
import
{
BrowserModule
}
from
'@angular/platform-browser'
;
import
{
BrowserAnimationsModule
}
from
'@angular/platform-browser/animations'
;
import
{
HTTP_INTERCEPTORS
}
from
'@angular/common/http'
;
import
{
Ng2Webstorage
,
LocalStorageService
,
SessionStorageService
}
from
'ngx-webstorage'
;
import
{
JhiEventManager
}
from
'ng-jhipster'
;
import
{
FormsModule
,
ReactiveFormsModule
}
from
'@angular/forms'
;
import
{
HttpModule
}
from
'@angular/http'
;
import
{
AuthInterceptor
}
from
'./blocks/interceptor/auth.interceptor'
;
import
{
AuthExpiredInterceptor
}
from
'./blocks/interceptor/auth-expired.interceptor'
;
import
{
ErrorHandlerInterceptor
}
from
'./blocks/interceptor/errorhandler.interceptor'
;
import
{
NotificationInterceptor
}
from
'./blocks/interceptor/notification.interceptor'
;
import
{
BootappSharedModule
,
UserRouteAccessService
}
from
'./shared'
;
import
{
PaginationConfig
}
from
'./blocks/config/uib-pagination.config'
;
import
{
FileUploadModule
}
from
'ng2-file-upload'
;
import
{
CommonModule
,
LocationStrategy
,
PathLocationStrategy
}
from
'@angular/common'
;
import
{
LayoutService
}
from
"./layouts/layout.service"
;
import
{
NgxEchartsModule
}
from
"ngx-echarts"
;
import
{
LayoutService
}
from
'./layouts/layout.service'
;
import
{
NgxEchartsModule
}
from
'ngx-echarts'
;
import
{
FooterComponent
,
...
...
@@ -24,13 +24,14 @@ import {
PageRibbonComponent
,
ErrorComponent
}
from
'./layouts'
;
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
{
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
{
AppMainModule
}
from
'./app.main.module'
;
import
{
AppService
}
from
'./app.service'
;
import
{
HostComponent
}
from
'./overAll/host.component'
;
@
NgModule
({
imports
:
[
...
...
@@ -40,13 +41,13 @@ import {AppService} from './app.service';
HttpModule
,
BrowserAnimationsModule
,
RouterModule
,
Ng2Webstorage
.
forRoot
({
prefix
:
'smart'
,
separator
:
'-'
}),
Ng2Webstorage
.
forRoot
({
prefix
:
'smart'
,
separator
:
'-'
}),
BootappSharedModule
,
FileUploadModule
,
CommonModule
,
FormsModule
,
ReactiveFormsModule
,
RouterModule
.
forRoot
(
route
,{
useHash
:
true
})
RouterModule
.
forRoot
(
route
,
{
useHash
:
true
})
],
declarations
:
[
ErrorComponent
,
...
...
@@ -60,6 +61,7 @@ import {AppService} from './app.service';
PaginationConfig
,
LoginGuard
,
AppService
,
HostComponent
,
UserRouteAccessService
,
{
provide
:
HTTP_INTERCEPTORS
,
...
...
@@ -95,9 +97,9 @@ import {AppService} from './app.service';
]
},
],
bootstrap
:
[
AppComponent
],
schemas
:
[
CUSTOM_ELEMENTS_SCHEMA
,
NO_ERRORS_SCHEMA
],
exports
:[
]
bootstrap
:
[
AppComponent
],
schemas
:
[
CUSTOM_ELEMENTS_SCHEMA
,
NO_ERRORS_SCHEMA
],
exports
:
[]
})
export
class
BootappAppModule
{}
export
class
BootappAppModule
{
}
src/main/webapp/app/overAll/basic/basic-detail/basic-detail.component.ts
View file @
9c0a7f77
This diff is collapsed.
Click to expand it.
src/main/webapp/app/overAll/basic/basic.component.ts
View file @
9c0a7f77
...
...
@@ -550,7 +550,8 @@ export class BasicComponent implements OnInit {
}
this
.
router
.
navigate
([
'app/main/'
+
type
],
{
queryParams
:
{
hostId
:
item
.
hostid
hostId
:
item
.
hostid
,
equipmentType
:
item
.
equipmentType
}
});
}
...
...
src/main/webapp/app/overAll/host.component.ts
0 → 100644
View file @
9c0a7f77
import
{
OverAllService
}
from
'./overAll.service'
;
import
{
Injectable
}
from
'@angular/core'
;
@
Injectable
()
export
class
HostComponent
{
constructor
(
private
overAllSer
:
OverAllService
)
{
}
public
findHostDetail
(
hostId
){
return
this
.
overAllSer
.
findDetailed
(
hostId
).
subscribe
(
(
res
)
=>
{
let
data
=
res
.
data
[
0
];
}
);
}
}
src/main/webapp/app/overAll/modal/database/database.component.ts
View file @
9c0a7f77
...
...
@@ -240,7 +240,7 @@ export class DatabaseComponent implements OnInit {
};
this
.
overAllSer
.
findChartData
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
.
list
&&
res
.
data
.
list
.
length
>
0
)
{
if
(
res
.
data
.
list
)
{
this
.
setDatabaseChart
(
res
.
data
);
}
this
.
isDatabaseLoading
=
false
;
...
...
src/main/webapp/app/overAll/modal/server/server.component.html
View file @
9c0a7f77
...
...
@@ -3,6 +3,22 @@
<nz-col
nzSpan=
"12"
>
<div
class=
"padding-10"
style=
"height: 20%;"
>
<p
class=
"host-item-title"
>
关键指标
</p>
<div
class=
"host-item-content"
style=
"height:100%"
>
<nz-row>
<nz-col
nzSpan=
"12"
>
<p
style=
"text-align: center"
>
cpu利用率
</p>
<div
class=
"width-host"
>
<div
class=
"space"
[
style
.
width
]="
this
.
hostObj
.
cpu
+
'%'"
></div>
</div>
</nz-col>
<nz-col
nzSpan=
"12"
>
<p
style=
"text-align: center;color: #b7d1f1;"
>
内存使用率
</p>
<div
class=
"width-host"
>
<div
class=
"space"
[
style
.
width
]="
this
.
hostObj
.
used
+
'%'"
></div>
</div>
</nz-col>
</nz-row>
</div>
</div>
<div
class=
"padding-10"
style=
"height: 40%;"
>
<p
class=
"host-item-title"
>
分区
</p>
...
...
@@ -13,26 +29,28 @@
<p
class=
"host-item-title"
>
基本信息
</p>
<div
class=
"host-item-content"
>
<nz-row>
<nz-col
nzSpan=
"8"
><span
>
资源状态:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
><span
>
名称:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
><span
>
IP地址:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
><span
>
设备类型:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
><span
>
资产编号:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
><span
>
资源位置:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
><span
>
负责人:
</span></nz-col>
<nz-col
nzSpan=
"16"
><span
>
100
</span></nz-col>
<nz-col
nzSpan=
"8"
>
资源状态:
</nz-col>
<nz-col
nzSpan=
"16"
>
{{server?.waringName}}
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"8"
>
名称:
</nz-col>
<nz-col
nzSpan=
"16"
>
{{server?.name}}
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"8"
>
IP地址:
</nz-col>
<nz-col
nzSpan=
"16"
>
{{server?.ip}}
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"8"
>
设备类型:
</nz-col>
<nz-col
nzSpan=
"16"
>
{{equipmentType}}
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"8"
>
资产编号:
</nz-col>
<nz-col
nzSpan=
"16"
>
{{server?.inventory?.no}}
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"8"
>
负责人:
</nz-col>
<nz-col
nzSpan=
"16"
>
{{server?.inventory?.person}}
</nz-col>
</nz-row>
</div>
</nz-col>
...
...
@@ -40,44 +58,70 @@
<p
class=
"host-item-title"
>
指标列表
</p>
<div
class=
"host-item-content"
>
<nz-row>
<nz-col
nzSpan=
"16"
>
CPU利用率(%):
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
Ping延时(ms):
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
内存利用率(%):
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
CPU个数:
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
接口数:
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
物理内存容量(GB):
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
CPU利用率(%):
</nz-col>
<nz-col
nzSpan=
"8"
>
{{hostObj.cpu}}
</nz-col>
</nz-row>
<nz-col
nzSpan=
"16"
>
MAC地址:
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
<nz-row>
<nz-col
nzSpan=
"16"
>
Ping延时(ms):
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"16"
>
内存利用率(%):
</nz-col>
<nz-col
nzSpan=
"8"
>
{{hostObj.used}}
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"16"
>
CPU个数:
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
</nz-row>
<nz-row>
<nz-col
nzSpan=
"16"
>
接口数:
</nz-col>
<nz-col
nzSpan=
"8"
>
100
</nz-col>
</nz-row>
</div>
</nz-col>
</nz-row>
</div>
</nz-col>
<nz-col
nzSpan=
"12"
>
<div
class=
"padding-10"
style=
"height: 50%;"
>
<div
class=
"padding-10"
style=
"height: 50%;position: relative"
>
<div
class=
"time-group"
style=
"top: 18px;"
>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择指标"
(
ngModelChange
)="
changeTrend
(
null
)"
[(
ngModel
)]="
trendObj
.
type
"
>
<ng-container
*
ngFor=
"let flow of targetFlow"
>
<nz-option
[
nzLabel
]="
flow
.
label
"
[
nzValue
]="
flow
.
value
"
></nz-option>
</ng-container>
</nz-select>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择时间"
[(
ngModel
)]="
timeTypeTrend
"
(
ngModelChange
)="
changeTrend
($
event
)"
>
<ng-container
*
ngFor=
"let time of timeList"
>
<nz-option
[
nzLabel
]="
time
.
label
"
[
nzValue
]="
time
.
value
"
></nz-option>
</ng-container>
</nz-select>
</div>
<div
class=
"host-item-title"
>
指标趋势
</div>
<div
class=
"host-item-content"
>
图表
</div>
<nz-spin
[
nzSpinning
]="
isTrendLoading
"
>
<div
echarts
[
options
]="
chartTrendOption
"
style=
"height: 360px;width: 100%"
></div>
</nz-spin>
</div>
<div
class=
"padding-10"
style=
"height: 50%;"
>
<div
class=
"padding-10"
style=
"height: 50%;
position: relative
"
>
<div
class=
"host-item-title"
>
可用性历史趋势
</div>
<div
class=
"host-item-content"
>
图表
</div>
<div
class=
"time-group"
style=
"top: 18px;"
>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择时间"
[(
ngModel
)]="
timeTypeHistory
"
(
ngModelChange
)="
changeHistory
($
event
)"
>
<ng-container
*
ngFor=
"let time of timeList"
>
<nz-option
[
nzLabel
]="
time
.
label
"
[
nzValue
]="
time
.
value
"
></nz-option>
</ng-container>
</nz-select>
</div>
<nz-spin
[
nzSpinning
]="
isHistoryLoading
"
>
<div
echarts
[
options
]="
chartHistoryOption
"
style=
"height: 360px;width: 100%"
></div>
</nz-spin>
</div>
</nz-col>
</nz-row>
...
...
src/main/webapp/app/overAll/modal/server/server.component.ts
View file @
9c0a7f77
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
CommonService
}
from
'../../../shared/common/common.service'
;
import
{
ActivatedRoute
}
from
'@angular/router'
;
import
{
NzMessageService
}
from
'ng-zorro-antd'
;
import
{
OverAllService
}
from
'../../overAll.service'
;
import
{
HostComponent
}
from
'../../host.component'
;
import
{
HostFlow
}
from
'../../../app.constants'
;
@
Component
({
selector
:
'smart-server'
,
...
...
@@ -7,9 +13,197 @@ import { Component, OnInit } from '@angular/core';
})
export
class
ServerComponent
implements
OnInit
{
constructor
()
{
}
hostId
;
//主机ID
equipmentType
;
//主机类型
server
;
targetFlow
=
HostFlow
;
//主机指标
timeList
=
[
{
'label'
:
'最近一小时'
,
value
:
'0'
},
{
'label'
:
'最近一天'
,
value
:
'2'
},
{
'label'
:
'最近三天'
,
value
:
'3'
},
{
'label'
:
'最近一周'
,
value
:
'4'
},
];
timeTypeTrend
;
timeTypeHistory
;
isTrendLoading
=
false
;
chartTrendOption
;
isHistoryLoading
=
false
;
chartHistoryOption
;
trendObj
=
{
//指标趋势
type
:
'total_flow'
,
startTime
:
''
,
endTime
:
''
};
historyObj
=
{
startTime
:
''
,
endTime
:
''
};
hostObj
=
{
disk
:
null
,
used
:
null
,
cpu
:
null
,
losed
:
null
,
};
constructor
(
private
commonSer
:
CommonService
,
private
routerInfo
:
ActivatedRoute
,
private
message
:
NzMessageService
,
private
overAllSer
:
OverAllService
,
private
hostCom
:
HostComponent
)
{
this
.
routerInfo
.
queryParams
.
subscribe
(
queryParams
=>
{
this
.
hostId
=
queryParams
.
hostId
;
this
.
equipmentType
=
queryParams
.
equipmentType
;
});
}
ngOnInit
()
{
this
.
getDetail
();
this
.
getTrend
();
}
getDetail
()
{
const
data
=
{
hostId
:
this
.
hostId
,
};
this
.
overAllSer
.
findDetailed
(
this
.
hostId
).
subscribe
(
(
res
)
=>
{
this
.
server
=
res
.
data
[
0
];
}
);
//磁盘使用率
this
.
overAllSer
.
disks
(
data
).
subscribe
(
(
res
)
=>
{
this
.
hostObj
.
disk
=
res
.
data
;
}
);
//内存使用率
this
.
overAllSer
.
used
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
)
{
this
.
hostObj
.
used
=
res
.
data
;
}
else
{
this
.
hostObj
.
used
=
0
;
}
}
);
//cpu使用率
this
.
overAllSer
.
cupUsed
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
)
{
this
.
hostObj
.
cpu
=
res
.
data
;
}
else
{
this
.
hostObj
.
cpu
=
0
;
}
}
);
//丢包率
this
.
overAllSer
.
losed
(
this
.
hostId
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
)
{
this
.
hostObj
.
losed
=
res
.
data
.
losed
;
}
else
{
this
.
hostObj
.
losed
=
0
;
}
}
);
}
//获取趋势数据
getTrend
()
{
const
data
=
{
type
:
this
.
trendObj
.
type
,
hostid
:
this
.
hostId
,
startTime
:
this
.
trendObj
.
startTime
,
endTime
:
this
.
trendObj
.
endTime
};
this
.
overAllSer
.
findChartByKey
(
data
).
subscribe
(
(
res
)
=>
{
this
.
setTrendChart
(
res
.
data
);
}
);
}
//设置指标趋势
setTrendChart
(
data
)
{
this
.
chartTrendOption
=
{
xAxis
:
{
type
:
'category'
,
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
data
:
data
.
map
(
e
=>
{
return
e
.
time
;
})
},
yAxis
:
{
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
type
:
'value'
},
series
:
data
.
map
(
e
=>
{
return
e
.
value
;
})
};
this
.
isTrendLoading
=
false
;
}
//获取历史趋势
getHistory
()
{
}
//设置指标趋势
setHistoryChart
(
data
)
{
this
.
chartHistoryOption
=
{
xAxis
:
{
type
:
'category'
,
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
data
:
data
.
map
(
e
=>
{
return
e
.
time
;
})
},
yAxis
:
{
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
type
:
'value'
},
series
:
data
.
map
(
e
=>
{
return
e
.
value
;
})
};
this
.
isHistoryLoading
=
false
;
}
changeTrend
(
e
){
this
.
isTrendLoading
=
true
;
const
timeObj
=
this
.
commonSer
.
getTimeByType
(
e
);
this
.
trendObj
.
startTime
=
timeObj
.
startTime
;
this
.
trendObj
.
endTime
=
timeObj
.
endTime
;
this
.
getTrend
();
}
changeHistory
(
e
){
this
.
isHistoryLoading
=
true
;
const
timeObj
=
this
.
commonSer
.
getTimeByType
(
e
);
this
.
historyObj
.
startTime
=
timeObj
.
startTime
;
this
.
historyObj
.
endTime
=
timeObj
.
endTime
;
this
.
getHistory
();
}
}
src/main/webapp/app/overAll/modal/switch/switch.component.html
View file @
9c0a7f77
...
...
@@ -2,38 +2,38 @@
<nz-col
nzSpan=
"8"
>
<div
class=
"padding-10"
style=
"height: 30%;"
>
<p
class=
"host-item-title"
>
关键指标
</p>
<div
class=
"host-item-content"
>
<div
class=
"host-item-content"
style=
"height: 100%;"
>
</div>
</div>
<div
class=
"padding-10"
style=
"height: 35%;"
>
<p
class=
"host-item-title"
>
基本信息
</p>
<div
class=
"host-item-content"
>
<div
class=
"host-item-content"
style=
"height: 100%;"
>
<nz-row>
<nz-col
nzSpan=
"8"
>
资源状态:
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
{{switch?.waringName}}
</nz-col>
<nz-col
nzSpan=
"8"
>
名称:
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
{{switch?.name}}
</nz-col>
<nz-col
nzSpan=
"8"
>
IP地址:
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
{{switch?.ip}}
</nz-col>
<nz-col
nzSpan=
"8"
>
设备类型:
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
交换机
</nz-col>
<nz-col
nzSpan=
"8"
>
资产编号:
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
{{switch?.inventory?.no}}
</nz-col>
<nz-col
nzSpan=
"8"
>
负责人:
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
<nz-col
nzSpan=
"16"
>
{{switch?.inventory?.person}}
</nz-col>
</nz-row>
</div>
</div>
<div
class=
"padding-10"
style=
"height: 35%;"
>
<p
class=
"host-item-title"
>
指标列表
</p>
<div
class=
"host-item-content"
>
<nz-row
>
<div
class=
"host-item-content"
style=
"height: 100%;"
>
<nz-row>
<nz-col
nzSpan=
"8"
>
CPU利用率(%):
</nz-col>
<nz-col
nzSpan=
"16"
>
100
</nz-col>
...
...
@@ -50,17 +50,55 @@
<nz-col
nzSpan=
"16"
>
100
</nz-col>
</nz-row>
</div>
</div>
</nz-col>
<nz-col
nzSpan=
"16"
>
<div
class=
"padding-10"
style=
"height: 50%;"
>
<div
class=
"padding-10"
style=
"height: 50%;
position: relative
"
>
<div
class=
"host-item-title"
>
指标趋势
</div>
<div
class=
"host-item-content"
>
图表
</div>
<div
class=
"time-group"
style=
"top: 18px;"
>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择指标"
(
ngModelChange
)="
changeTimeTarget
(
null
)"
[(
ngModel
)]="
trendObj
.
type
"
>
<ng-container
*
ngFor=
"let flow of targetFlow"
>
<nz-option
[
nzLabel
]="
flow
.
label
"
[
nzValue
]="
flow
.
value
"
></nz-option>
</ng-container>
</nz-select>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择时间"
(
ngModelChange
)="
changeTimeTarget
($
event
)"
[(
ngModel
)]="
timeTypeTrend
"
>
<ng-container
*
ngFor=
"let time of timeList"
>
<nz-option
[
nzLabel
]="
time
.
label
"
[
nzValue
]="
time
.
value
"
></nz-option>
</ng-container>
</nz-select>
</div>
<nz-spin
[
nzSpinning
]="
isTrendLoading
"
>
<div
echarts
[
options
]="
chartTrendOption
"
style=
"height: 360px;width: 100%"
></div>
</nz-spin>
</div>
<div
class=
"padding-10"
style=
"height: 50%;"
>
<div
class=
"padding-10"
style=
"height: 50%;
position: relative
"
>
<div
class=
"host-item-title"
>
网卡流量
</div>
<div
class=
"host-item-content"
>
图表
</div>
<div
class=
"time-group"
style=
"top: 18px;"
>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择接口"
(
ngModelChange
)="
changeTimeFlow
(
null
)"
[(
ngModel
)]="
netWorkdObj
.
itemName
"
>
<ng-container
*
ngFor=
"let interface of interfaceList"
>
<nz-option
[
nzLabel
]="
interface
"
[
nzValue
]="
interface
"
></nz-option>
</ng-container>
</nz-select>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择单位"
(
ngModelChange
)="
changeTimeFlow
(
null
)"
[(
ngModel
)]="
netWorkdObj
.
unit
"
>
<ng-container
*
ngFor=
"let unit of unitList"
>
<nz-option
[
nzLabel
]="
unit
.
label
"
[
nzValue
]="
unit
.
value
"
></nz-option>
</ng-container>
</nz-select>
<nz-select
style=
"width: 150px;"
nzPlaceHolder=
"选择时间"
(
ngModelChange
)="
changeTimeFlow
(
null
)"
[(
ngModel
)]="
timeTypeFLow
"
>
<ng-container
*
ngFor=
"let time of timeList"
>
<nz-option
[
nzLabel
]="
time
.
label
"
[
nzValue
]="
time
.
value
"
></nz-option>
</ng-container>
</nz-select>
</div>
<nz-spin
[
nzSpinning
]="
isNetworkLoading
"
>
<div
echarts
[
options
]="
chartNetworkOption
"
style=
"height: 360px;width: 100%"
></div>
</nz-spin>
</div>
</nz-col>
</nz-row>
...
...
src/main/webapp/app/overAll/modal/switch/switch.component.ts
View file @
9c0a7f77
...
...
@@ -13,31 +13,48 @@ import {OverAllService} from '../../overAll.service';
export
class
SwitchComponent
implements
OnInit
{
hostId
;
//主机ID
switch
;
targetFlow
=
HostFlow
;
//主机指标
timeList
=
[
{
'label'
:
'最近一小时'
,
value
:
'0'
},
{
'label'
:
'最近一天'
,
value
:
'
1
'
},
{
'label'
:
'最近一天'
,
value
:
'
2
'
},
{
'label'
:
'最近三天'
,
value
:
'3'
},
{
'label'
:
'最近一周'
,
value
:
'4'
},
];
timeT
arget
;
time
Flow
;
timeT
ypeTrend
=
'0'
;
time
TypeFLow
=
'0'
;
interfaceList
=
[];
//接口数组
interface
;
unit
;
unitList
=
UnitList
;
// 单位
isNetworkLoading
=
false
;
chartNetworkOption
;
isTrendLoading
=
false
;
chartTrendOption
;
netWorkdObj
=
{
//网卡图表参数
itemName
:
''
,
unit
:
'Mbps'
,
startTime
:
''
,
endTime
:
''
,
};
trendObj
=
{
type
:
'total_flow'
,
startTime
:
''
,
endTime
:
''
};
constructor
(
private
commonSer
:
CommonService
,
private
routerInfo
:
ActivatedRoute
,
private
message
:
NzMessageService
,
private
overAllSer
:
OverAllService
)
{
this
.
routerInfo
.
queryParams
.
subscribe
(
queryParams
=>
{
this
.
hostId
=
queryParams
.
hostId
;
this
.
overAllSer
.
findDetailed
(
this
.
hostId
).
subscribe
(
(
res
)
=>
{
let
data
=
res
.
data
[
0
];
this
.
switch
=
res
.
data
[
0
];
}
);
});
...
...
@@ -45,54 +62,152 @@ export class SwitchComponent implements OnInit {
ngOnInit
()
{
this
.
overAllSer
.
findNetworkCard
(
this
.
hostId
).
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
this
.
interfaceList
=
res
.
data
;
this
.
netWorkdObj
.
itemName
=
this
.
interfaceList
[
0
];
this
.
changeTimeFlow
(
'0'
);
}
)
);
this
.
changeTimeTarget
(
'0'
);
}
//网卡流量
findNetwork
()
{
const
data
=
{
itemName
:
''
,
hostid
:
this
.
hostId
,
startTime
:
''
,
endTime
:
''
,
unit
:
this
.
unit
}
itemName
:
this
.
netWorkdObj
.
itemName
,
hostid
:
this
.
hostId
,
startTime
:
this
.
netWorkdObj
.
startTime
,
endTime
:
this
.
netWorkdObj
.
endTime
,
unit
:
this
.
netWorkdObj
.
unit
}
;
this
.
overAllSer
.
findNetworkFlow
(
data
).
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
this
.
setNetWorkChart
(
res
.
data
);
}
);
}
//设置网卡流量
setNetWorkChart
(
data
)
{
let
arr
=
[];
const
objSend
=
{
name
:
'发送速率'
,
stack
:
'网卡流量'
,
type
:
'line'
,
itemStyle
:
{
normal
:
{
lineStyle
:
{
color
:
'#2cfef7'
}
}
)
},
data
:
[],
};
const
objReceived
=
{
name
:
'接受速率'
,
stack
:
'网卡流量'
,
type
:
'line'
,
itemStyle
:
{
normal
:
{
lineStyle
:
{
color
:
'#b6d0f0'
}
}
},
data
:
[],
};
data
.
forEach
(
e
=>
{
objSend
.
data
.
push
(
e
.
sentValue
);
objReceived
.
data
.
push
(
e
.
sentValue
);
});
arr
.
push
(
objSend
,
objReceived
);
this
.
chartNetworkOption
=
{
xAxis
:
{
type
:
'category'
,
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
data
:
data
.
map
(
e
=>
{
return
e
.
time
;
})
},
yAxis
:
{
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
type
:
'value'
},
series
:
arr
,
};
this
.
isNetworkLoading
=
false
;
}
//指标趋势
findChart
(){
findChart
()
{
const
data
=
{
type
:
''
,
hostid
:
this
.
hostId
,
startTime
:
''
,
endTime
:
''
}
type
:
this
.
trendObj
.
type
,
hostid
:
this
.
hostId
,
startTime
:
this
.
trendObj
.
startTime
,
endTime
:
this
.
trendObj
.
endTime
}
;
this
.
overAllSer
.
findChartByKey
(
data
).
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
this
.
setTrendChart
(
res
.
data
);
}
);
}
//设置指标趋势
setTrendChart
(
data
)
{
this
.
chartTrendOption
=
{
xAxis
:
{
type
:
'category'
,
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
},
data
:
data
.
map
(
e
=>
{
return
e
.
time
;
})
},
yAxis
:
{
axisLine
:
{
lineStyle
:
{
color
:
'#b6d0f0'
,
}
)
},
type
:
'value'
},
series
:
data
.
map
(
e
=>
{
return
e
.
value
;
})
};
this
.
isTrendLoading
=
false
;
}
/**********指标趋势**************/
changeTimeTarget
()
{
const
timeObj
=
this
.
commonSer
.
getTimeByType
(
this
.
timeFlow
);
changeTimeTarget
(
e
)
{
this
.
isTrendLoading
=
true
;
const
timeObj
=
this
.
commonSer
.
getTimeByType
(
e
);
this
.
trendObj
.
startTime
=
timeObj
.
startTime
;
this
.
trendObj
.
endTime
=
timeObj
.
endTime
;
this
.
findChart
();
}
/**********指标趋势**************/
/**********网卡流量**************/
changeTimeFlow
()
{
const
timeObj
=
this
.
commonSer
.
getTimeByType
(
this
.
timeFlow
);
changeTimeFlow
(
e
)
{
this
.
isNetworkLoading
=
true
;
const
timeObj
=
this
.
commonSer
.
getTimeByType
(
e
);
this
.
netWorkdObj
.
startTime
=
timeObj
.
startTime
;
this
.
netWorkdObj
.
endTime
=
timeObj
.
endTime
;
this
.
findNetwork
();
}
/**********网卡流量**************/
}
src/main/webapp/app/shared/common/common.service.ts
View file @
9c0a7f77
...
...
@@ -143,6 +143,7 @@ export class CommonService implements OnInit {
* @param timeType 0:最近一小时 1:今天 2:昨天(最近一天) 3:最近三天 4:最近一周 5:最近一个月
*/
getTimeByType
(
timeType
){
console
.
log
(
timeType
);
const
nowDate
=
new
Date
().
getTime
();
let
day1
,
day2
;
//当作变量使用
let
obj
=
{
startTime
:
''
,
endTime
:
''
};
...
...
src/main/webapp/content/scss/darkBlue.scss
View file @
9c0a7f77
...
...
@@ -169,4 +169,17 @@ $fontColor: #b7d1f1;
top
:
10px
;
z-index
:
9
;
}
.width-host
{
position
:
relative
;
width
:
80%
;
margin
:
0
auto
;
background-color
:
#5489b2
;
height
:
23px
;
.space
{
height
:
23px
;
background-color
:
#4ccf46
;
transition
:
all
500ms
;
}
}
}
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