Commit bd08a093 authored by wangqinghua's avatar wangqinghua

兼容性测试

parent 9e8886d0
......@@ -40,7 +40,7 @@ Module ng g module my-module
版本更新:
v2.0.1 修复选择节点之后 流量查询不出来
****上传文件到服务器******
scp -r 22 build/www root@10.10.38.99:/home/nginx
scp -r 22 build/wx root@10.10.38.99:/home/nginx/www
......@@ -27,8 +27,7 @@
</nz-select>
</div>
<div nz-col nzSpan="7">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()"
[nzButtonStyle]="'solid'">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()">
<label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label>
<label nz-radio-button nzValue="3">三天</label>
......
......@@ -31,6 +31,7 @@ export class ResourceUsabilComponent implements OnInit {
lastList;
obj = {
timeType:this.timeType,
type: '',
groupid: '',
startTime: '',
......
......@@ -72,7 +72,7 @@
</div>
</div>
</div>
<nz-tabset class="tabs-smart">
<nz-tabset class="tabs-smart" [nzType]="'card'">
<nz-tab nzTitle="网站监测">
<div style="min-height: 500px">
<ng-container *ngIf="noData">
......@@ -183,4 +183,4 @@
</nz-tab>
</nz-tabset>
</div>
</div>
\ No newline at end of file
</div>
......@@ -17,262 +17,104 @@ import {Router} from '@angular/router';
]
})
export class HomeComponent implements OnInit,AfterViewInit {
@ViewChild('smartSelectGroup') smartSelectGroup:SelectGroupComponent;
@ViewChild("leftDiv") leftDiv:ElementRef;
@ViewChild("rightDiv") rightDiv:ElementRef;
export class HomeComponent implements OnInit {
@ViewChild('smartTopologyView') smartTopologyView: TopologyViewComponent;
color = color;
obj = {
leftGroupId: '',
};
noData = false;
groupList; //分组数组
timeList = [
{'label': '最近一小时', value: '1'},
{'label': '最近一天', value: '2'},
{'label': '最近三天', value: '3'},
{'label': '最近一周', value: '4'},
];
timeTypeTrend = "0";
leftOneChart;
leftTwoChart;
rightOneChart;
rightTwoChart;
warnList= [];
totalNum;
groupList;
pageNum = 1;
pageCount = 10;
loading = false;
obj = {
leftGroupId:null,
alarmGroupId:null
};
charTrendOption; //告警综述趋势
leftOneData = {
high:0,
warning:0,
normal:0,
disabled:0,
high: 0,
warning: 0,
normal: 0,
disabled: 0,
};
leftOneDataPre = {
highPer:0,
warningPer:0,
normalPer:0,
disabledPer:0,
highPer: 0,
warningPer: 0,
normalPer: 0,
disabledPer: 0,
};
leftOneTotal = 0;
leftTwoData ={
high:0,
warning:0,
normal:0,
disabled:0,
leftTwoData = {
high: 0,
warning: 0,
normal: 0,
disabled: 0,
};
leftTwoDataPre = {
highPer:0,
warningPer:0,
normalPer:0,
disabledPer:0,
highPer: 0,
warningPer: 0,
normalPer: 0,
disabledPer: 0,
};
leftTwoTotal = 0;
rightTotal = 0;
//我的关注
followList;
flowListNum; //接口流量排行 数值
flowListPre; //发送利用率排名 百分比
countOrderList; //cpu内存使用率排名列表
//资源设备数量
deviceNo;
isTrendLoading = false;
trendObj = {
startTime: '',
endTime: ''
};
dataSet; //拓扑图
topoId;
constructor(
private overAllSer:OverAllService,private message:NzMessageService,
private alarmSer:AlarmService,private renderer:Renderer2,
private layoutSer:LayoutService,
private principal: Principal,
private eventManager: JhiEventManager,
private router:Router
private overAllSer: OverAllService, private message: NzMessageService,
private alarmSer: AlarmService, private renderer: Renderer2,
private layoutSer: LayoutService,private datePipe:DatePipe,
private principal: Principal, private topologySer: TopologyService,
private eventManager: JhiEventManager, private analysisSer: AnalysisService,
private router: Router, private commonSer: CommonService,
) {
}
ngOnInit() {
this.getAlarmList();
this.findGroupCount();
this.findHostCount();
this.getGroup();
this.getMyFollow();
this.findSize();
}
ngAfterViewInit(){
let rightHeight = this.rightDiv.nativeElement.clientHeight;
this.renderer.setStyle(this.leftDiv.nativeElement,"height",rightHeight +"px");
}
//查看详情
goToDetail(item) {
this.router.navigate(['app/main/basic-detail'], {
queryParams: {
hostId: item.hostid,
name: item.hostname,
hostName: item.hostname
}
});
}
this.flowRankNum();
this.flowRankPre();
this.countOrde();
//我的关注
getMyFollow(){
this.layoutSer.myFollow().subscribe(
(res)=>{
this.followList = res.data;
if(this.followList.length > 0 ){
let dataStyle = {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 40,
borderWidth: 10,
shadowColor: 'rgba(0, 0, 0, 0)' //边框阴影
}
};
let placeHolderStyle = {
normal: {
color: '#eee',
label: {
show: false
},
labelLine: {
show: false
}
},
emphasis: {
color: '#393d50'
}
};
this.followList.forEach(e=>{
e.option = {
backgroundColor: '#fff',
title: {
text: '',
x: 'center',
y: 'center',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "red",
}
},
tooltip: {
trigger: 'item',
show: true,
formatter: "{b} : <br/>{d}%",
backgroundColor: 'rgba(0,0,0,0.7)', // 背景
padding: [8, 10], //内边距
extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
},
series: [{
name: 'CPU使用率',
type: 'pie',
clockWise: false,
radius: [50, 58],
center:['30%','50%'],
itemStyle: dataStyle,
hoverAnimation: false,
startAngle: 90,
label:{
borderRadius:'10',
},
data: [{
value: e.cpu,
name: 'CPU使用率',
itemStyle: {
normal: {
color: "#f09363"
}
}
},
{
value: 100 - e.cpu,
name: '',
tooltip: {
show: false
},
itemStyle: placeHolderStyle
},
]
},
{
name: '内存使用率',
type: 'pie',
clockWise: false,
radius: [35, 43],
center:['30%','50%'],
itemStyle: dataStyle,
hoverAnimation: false,
startAngle: 90,
data: [{
value: e.memory,
name: '内存使用率',
itemStyle: {
normal: {
color: "#80ba78"
}
}
},
{
value: 100 - e.memory,
name: '',
tooltip: {
show: false
},
itemStyle: placeHolderStyle
},
]
},
// {
// name: '带宽使用率',
// type: 'pie',
// clockWise: false,
// radius: [20, 28],
// center:['30%','50%'],
// itemStyle: dataStyle,
// hoverAnimation: false,
// startAngle: 90,
// data: [{
// value: e.lose,
// name: '带宽使用率',
// itemStyle: {
// normal: {
// color: "#73b6e4"
// }
// }
// },
// {
// value: 100 - e.lose,
// name: '',
// tooltip: {
// show: false
// },
// itemStyle: placeHolderStyle
// },
// ]
// }
]
};
})
}
}
)
this.getList();
}
//获取分组
getGroup() {
this.overAllSer.findGroup().subscribe(
(res) => {
if(res.data){
if (res.errCode == 10000 && res.data) {
this.groupList = res.data;
this.obj.leftGroupId = this.groupList[0].groupid;
this.countGroupItem();
......
<!--告警推送-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isShow" [nzTitle]="title" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [(nzSelectedIndex)]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tabset [nzType]="'card'" [(nzSelectedIndex)]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="选定告警目标">
<div nz-form class="ant-advanced-search-form form-select">
<nz-form-item>
......
<!--添加资源-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isBasicEdit" [nzTitle]="modalTitle" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [(nzSelectedIndex)]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tabset [(nzSelectedIndex)]="tabNum" [nzType]="'card'" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="资源信息">
<div nz-form class="ant-advanced-search-form form-select">
<nz-form-item>
......@@ -232,7 +232,7 @@
全局值(配置)
</div>
</div>
<div nz-row [nzGutter]="12" *ngFor="let item of macroList2">
<div nz-row [nzGutter]="12" *ngFor="let item of macroList2;let i = index;">
<nz-form-control nz-col [nzOffset]="2" [nzSpan]="6">
<input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}">
</nz-form-control>
......
<nz-modal [nzWidth]="880" [nzFooter]="null" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()">
<nz-tabset [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)"
<nz-tabset [nzType]="'card'" [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)"
style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="模版">
<div nz-form>
......
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tabset [nzType]="'card'" [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="1.场景">
<div nz-form class="ant-advanced-search-form form-select">
<form nz-form class="ant-advanced-search-form">
......@@ -318,4 +318,4 @@
</form>
</nz-tab>
</nz-tabset>
</nz-modal>
\ No newline at end of file
</nz-modal>
<!--进出口流量-->
<nz-modal [nzWidth]="780" [(nzVisible)]="isLine" nzTitle="流量配置" (nzOnCancel)="handleLineCancel()" (nzOnOk)="handleLineOk()">
<form nz-form>
<nz-tabset>
<nz-tabset [nzType]="'card'">
<nz-tab nzTitle="进流量">
<div class="padding-10">
<input (keyup.enter)="getInList()" name="inSearchName" style="width: 200px;" type="text" nz-input [(ngModel)]="inSearchName" placeholder="输入名称">
......@@ -58,4 +58,4 @@
</nz-tab>
</nz-tabset>
</form>
</nz-modal>
\ No newline at end of file
</nz-modal>
......@@ -50,7 +50,7 @@
{{checkStatus.disabled}}
</span>
</div>
<nz-tabset [nzSelectedIndex]="tabNum" class="tabs-smart">
<nz-tabset [nzType]="'card'" [nzSelectedIndex]="tabNum" class="tabs-smart">
<nz-tab nzTitle="资源详情">
<section>
<p class="padding-8-0">{{hostName}}</p>
......
......@@ -81,7 +81,7 @@ export class BasicComponent implements OnInit {
totalNum;
constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router,
private commonSer:CommonService,
private commonSer: CommonService,
private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) {
}
......@@ -176,10 +176,10 @@ export class BasicComponent implements OnInit {
this.findOpStatus();
}
changeStatus(status){
if(this.status == status){
changeStatus(status) {
if (this.status == status) {
this.status = null;
}else{
} else {
this.status = status;
}
this.pageNum = 1;
......@@ -189,7 +189,7 @@ export class BasicComponent implements OnInit {
/*
//waringName:(值为:正常,禁用,告警,严重)
*/
search(){
search() {
this.pageNum = 1;
this.searchRe();
}
......@@ -198,28 +198,28 @@ export class BasicComponent implements OnInit {
this.loading = true;
this.searchStatus = true;
const data = {
pageNum:this.pageNum,
pageCount:this.pageCount,
obj:{
name:this.searchName,
waringName:this.status,
groupids:[]
pageNum: this.pageNum,
pageCount: this.pageCount,
obj: {
name: this.searchName,
waringName: this.status,
groupids: []
}
}
};
this.overAllSer.findHostPageNew(data).subscribe(
(res)=>{
(res) => {
if (res.errCode == 10000) {
this.dataSet = res.data.data;
this.totalNum = res.data.totalNum;
}
this.loading = false;
}
)
);
}
//翻页
change(event){
if(event > 0){
change(event) {
if (event > 0) {
this.pageNum = event;
this.searchRe();
}
......@@ -235,7 +235,7 @@ export class BasicComponent implements OnInit {
//查询设备状态
findOpStatus() {
this.overAllSer.findHostCountByStatusByHost().subscribe(
(res)=>{
(res) => {
if (res.errCode == 10000) {
this.green = res.data.normal;
this.gray = res.data.disable;
......@@ -246,7 +246,7 @@ export class BasicComponent implements OnInit {
this.message.info(res.Msg);
}
}
)
);
}
//添加资源
......@@ -261,7 +261,7 @@ export class BasicComponent implements OnInit {
//添加监测点
showBasicCheckModal(hostid, host) {
this.smartCheck.showAddModal(hostid, host,'添加监测点');
this.smartCheck.showAddModal(hostid, host, '添加监测点');
}
//列表
......@@ -325,7 +325,7 @@ export class BasicComponent implements OnInit {
//删除单个资源
showDeleteConfirm(item) {
this.commonSer.confirmThing("删除","确认删除该资源吗?",()=>{
this.commonSer.confirmThing('删除', '确认删除该资源吗?', () => {
const data = {
hostids: []
};
......@@ -340,7 +340,7 @@ export class BasicComponent implements OnInit {
}
}
);
})
});
}
//批量删除资源
......@@ -350,7 +350,7 @@ export class BasicComponent implements OnInit {
return false;
}
this.commonSer.confirmThing("删除","确认要删除所选设备吗?",()=>{
this.commonSer.confirmThing('删除', '确认要删除所选设备吗?', () => {
const data = {
hostids: this.batchDelList
};
......@@ -406,7 +406,7 @@ export class BasicComponent implements OnInit {
//添加告警
showAlarm() {
this.smartAlarmModal.showAddModal('添加告警',null);
this.smartAlarmModal.showAddModal('添加告警', null);
}
handleOk(e) {
......
......@@ -27,7 +27,7 @@
<button (click)="showDeleteConfirm()" nz-button nzType="default">删除</button>
</div>
<div class="releative">
<nz-tabset class="tabs-smart ">
<nz-tabset class="tabs-smart" [nzType]="'card'">
<nz-tab nzTitle="监测信息">
<section>
<div nz-row nzGutter="24">
......
import {Injectable, OnInit} from "@angular/core";
import {Injectable, OnInit} from '@angular/core';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {SERVER_API_URL, SERVER_API_URL_COMS} from '../../app.constants';
import {DatePipe} from '@angular/common';
declare var ActiveXObject: ActiveXObject;
interface ActiveXObject {
new (type: string): ActiveXObject;
SendKeys(key: string): void;
}
@Injectable()
export class CommonService implements OnInit {
constructor(private modalSer:NzModalService,private datePipe:DatePipe,
private message:NzMessageService) {
constructor(private modalSer: NzModalService, private datePipe: DatePipe,
private message: NzMessageService) {
// 定义发射事件
}
......@@ -14,9 +20,9 @@ export class CommonService implements OnInit {
}
exists(list, parentId,myId){
for(let i=0; i<list.length; i++){
if(list[i][myId] == parentId){
exists(list, parentId, myId) {
for (let i = 0; i < list.length; i++) {
if (list[i][myId] == parentId) {
return true;
}
}
......@@ -30,26 +36,26 @@ export class CommonService implements OnInit {
* @param list
* @returns {any[]}
*/
listToTree(myId,pId,list){
const nodes = [];
for(let i=0; i<list.length; i++){
listToTree(myId, pId, list) {
const nodes = [];
for (let i = 0; i < list.length; i++) {
list[i].checked = false;
const row = list[i];
if ( !this.exists(list, row[pId],myId) ){
if (!this.exists(list, row[pId], myId)) {
nodes.push(row);
}
}
const toDo = [];
for(let i=0; i<nodes.length; i++){
for (let i = 0; i < nodes.length; i++) {
toDo.push(nodes[i]);
}
while(toDo.length){
while (toDo.length) {
const node = toDo.shift(); // the parent node
for(let i=0; i<list.length; i++){
for (let i = 0; i < list.length; i++) {
const row = list[i];
if (row[pId] == node[myId]){
if (node.children){
if (row[pId] == node[myId]) {
if (node.children) {
node.children.push(row);
} else {
node.children = [row];
......@@ -66,7 +72,7 @@ export class CommonService implements OnInit {
* @param data json格式的数据
* @returns {string}
*/
toQuery(data){
toQuery(data) {
let str = '';
for (let key in data) {
if (data.hasOwnProperty(key)) {
......@@ -83,16 +89,16 @@ export class CommonService implements OnInit {
* @param title 提示语
* @param callback 回调函数
*/
confirmThing(title,content,callback){
confirmThing(title, content, callback) {
this.modalSer.confirm({
nzTitle: title,
nzContent: '<b style="color: red;">'+content+'</b>',
nzContent: '<b style="color: red;">' + content + '</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: callback,
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel'),
})
});
}
/**
......@@ -131,11 +137,24 @@ export class CommonService implements OnInit {
* @param method 全屏方法
* @returns {any}
*/
showInFullScreen(element, method){
showInFullScreen(element, method) {
let usablePrefixMethod;
['webkit', 'moz', 'ms', 'o', ''].forEach( (prefix)=> {
const ie = navigator.userAgent.match(/MSIE\s([\d.]+)/),
ie11 = navigator.userAgent.match(/Trident\/7.0/) && navigator.userAgent.match(/rv:11/),
ieEDGE = navigator.userAgent.match(/Edge/g),
ieVer = (ie ? ie[1] : (ie11 ? 11 : (ieEDGE ? 12 : -1)));
if (ieVer > -1) {
if(typeof (<any>window).ActiveXObject !== "undefined") {
//这的方法 模拟f11键,使浏览器全屏
const wscript = new ActiveXObject("WScript.Shell");
if(wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
['webkit', 'moz', 'ms', 'o', ''].forEach((prefix) => {
if (usablePrefixMethod) {
return
return;
}
if (prefix === '') {
// 无前缀,方法首字母小写
......@@ -144,13 +163,13 @@ export class CommonService implements OnInit {
let typePrefixMethod = typeof element[prefix + method];
if (typePrefixMethod + '' !== 'undefined') {
if (typePrefixMethod === 'function') {
usablePrefixMethod = element[prefix + method]()
usablePrefixMethod = element[prefix + method]();
} else {
usablePrefixMethod = element[prefix + method]
usablePrefixMethod = element[prefix + method];
}
}
}
)
);
return usablePrefixMethod;
}
......@@ -158,12 +177,12 @@ export class CommonService implements OnInit {
* 根据type 查询时间段
* @param timeType 0:最近一小时 1:今天 2:昨天(最近一天) 3:最近三天 4:最近一周 5:最近一个月
*/
getTimeByType(timeType){
getTimeByType(timeType) {
const nowDate = new Date().getTime();
let day1, day2; //当作变量使用
let obj = {startTime:'',endTime:''};
let obj = {startTime: '', endTime: ''};
switch (timeType) {
case'0':{ //最近一小时
case'0': { //最近一小时
day1 = nowDate - 1 * 60 * 60 * 1000;
obj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd HH:mm:ss');
obj.endTime = this.datePipe.transform(nowDate, 'yyyy-MM-dd HH:mm:ss');
......
......@@ -29,7 +29,7 @@
<button (click)="showEditModal()" nz-button nzType="default">编辑</button>
<button (click)="deleteModal()" nz-button nzType="default">删除</button>
</div>
<nz-tabset class="tabs-smart ">
<nz-tabset [nzType]="'card'" class="tabs-smart ">
<nz-tab #thirdTabs nzTitle="资产信息">
<div nz-form class="ant-advanced-search-form form-select">
......@@ -255,4 +255,4 @@
<!--选择资源-->
<smart-select-group #smartSelectGroup (done)="setLink($event)"></smart-select-group>
<!--资产-->
<smart-assets #smartAssets (done)="getDetail()"></smart-assets>
\ No newline at end of file
<smart-assets #smartAssets (done)="getDetail()"></smart-assets>
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