Commit 43458f66 authored by wangqinghua's avatar wangqinghua

bug 修正

parents b5d9bb59 065e2802
import {RouterModule} from "@angular/router";
import {RouterModule} from '@angular/router';
import {CUSTOM_ELEMENTS_SCHEMA, NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgxEchartsModule } from "ngx-echarts";
import {CommonModule} from '@angular/common';
import {NgxEchartsModule} from 'ngx-echarts';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {NgZorroAntdModule,NZ_I18N,zh_CN} from 'ng-zorro-antd';
import {NgZorroAntdModule, NZ_I18N, zh_CN} from 'ng-zorro-antd';
import {AlarmListComponent} from './alarm/alarm-list/alarm-list.component';
import {AlarmLogComponent} from './alarm/alarm-log/alarm-log.component';
import {AlarmSetComponent} from './alarm/alarm-set/alarm-set.component';
......@@ -111,14 +111,16 @@ import {DisableControlDirective} from './shared/common/disable-control.directive
import {SelectTriggerComponent} from './modal/select-trigger/select-trigger.component';
import {WebModalComponent} from './modal/web-modal/web-modal.component';
import {WorkReportComponent} from './business/modal/work-report/work-report.component';
import {SignalComponent} from './shared/signal/signal.component';
import {ServerComponent} from './overAll/modal/server/server.component';
import {DatabaseComponent} from './overAll/modal/database/database.component';
import {SwitchComponent} from './overAll/modal/switch/switch.component';
import {PipeModule} from './shared/pipe/pipe.module';
import {SignalComponent} from './shared/signal/signal.component';
import {MineComponent} from './mine/mine.component';
@NgModule({
imports: [
PipeModule,
RouterModule,
CommonModule,
NgxEchartsModule,
......@@ -229,13 +231,13 @@ import {MineComponent} from './mine/mine.component';
SelectTriggerComponent,
WebModalComponent,
WorkReportComponent,
SignalComponent,
ServerComponent,
DatabaseComponent,
SwitchComponent,
SignalComponent,
MineComponent,
],
providers:[
providers: [
OverAllService,
SystemService,
AlarmService,
......@@ -243,9 +245,9 @@ import {MineComponent} from './mine/mine.component';
AnalysisService,
WorkService,
BusinessService,
{ provide: NZ_I18N, useValue: zh_CN },
{provide: NZ_I18N, useValue: zh_CN},
],
exports:[
exports: [
BasiCheckComponent,
BasicEditComponent,
BasicKeyComponent,
......@@ -254,6 +256,7 @@ import {MineComponent} from './mine/mine.component';
WarnListComponent,
PauseComponent
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA,NO_ERRORS_SCHEMA ],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
})
export class AppMainModule { }
export class AppMainModule {
}
......@@ -4,7 +4,7 @@ import {BehaviorSubject, Subscription} from 'rxjs';
@Injectable()
export class AppService {
private themeSource:BehaviorSubject<string> = new BehaviorSubject('white');
private themeSource:BehaviorSubject<string> = new BehaviorSubject('dark');
public theme = this.themeSource.asObservable();
public setTheme(value: string){
......
......@@ -119,30 +119,6 @@
</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>-->
<!--&lt;!&ndash;<th nzWidth="150px">图表</th>&ndash;&gt;-->
<!--</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>-->
<!--&lt;!&ndash;<td>图表</td>&ndash;&gt;-->
<!--</tr>-->
<!--</tbody>-->
<!--</nz-table>-->
<!--</div>-->
</section>
</nz-tab>
<nz-tab nzTitle="监测点列表">
......@@ -151,7 +127,7 @@
<button (click)="getCheckList()" nz-button nzType="default"><i class="anticon anticon-search" style="color: #6097b7"></i>搜索</button>
</div>
<div class="padding-15-0">
<nz-radio-group [(ngModel)]="itemTypeValue" [nzButtonStyle]="'solid'">
<nz-radio-group [(ngModel)]="itemTypeValue">
<label *ngFor="let item of itemTypeList" (click)="changeType(item)" nz-radio-button [nzValue]="item.applicationid">{{item.name}}</label>
</nz-radio-group>
</div>
......
......@@ -21,26 +21,22 @@ import {ThresholdComponent} from '../../../modal/threshold/threshold.component';
left: 233px;
z-index: 989;
}
.time-select {
.time-select{
position: absolute;
top: 55px;
right: 15px;
z-index: 999;
}
.select-border {
.select-border{
border: 1px solid #6097b7;
border-radius: 5px;
padding: 2px;
margin-right: 5px;
}
:host ::ng-deep .tabs-smart .ant-tabs-nav-scroll div.ant-tabs-tab:nth-child(3) {
:host ::ng-deep .tabs-smart .ant-tabs-nav-scroll div.ant-tabs-tab:nth-child(3){
margin-right: 180px !important;
}
:host ::ng-deep .ant-radio-button-wrapper {
:host ::ng-deep .ant-radio-button-wrapper{
margin: 4px;
}
`
......@@ -51,8 +47,8 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
@ViewChild('smartThreshold') smartThreshold: ThresholdComponent;
@ViewChild('thirdTabs') thirdTabs: ElementRef;
@ViewChild('warnList') warnList: WarnListComponent;
@ViewChild('colorEle') colorEle: ElementRef;
@ViewChild('checkEle') checkEle: ElementRef;
@ViewChild('colorEle') colorEle:ElementRef;
@ViewChild('checkEle') checkEle:ElementRef;
color = color;
loading = false;
hostId: string;
......@@ -73,7 +69,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
secondOptionRight;
dataSet: any[];
panel1 = {active: true, name: '响应时间与丢包率', disabled: false};
panel2 = {active: true, name: 'CPU使用率及内存使用率', disabled: false};
panel2 = {active: true, name: 'CPU使用率及内存使用率',disabled: false};
panel3 = {active: true, name: '磁盘使用情况', disabled: false};
//监控点
......@@ -127,17 +123,17 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
units; //图表单位
constructor(private routerInfo: ActivatedRoute, private message: NzMessageService,
private overAllSer: OverAllService, private renderer: Renderer, private router: Router,
private fb: FormBuilder, private modalService: NzModalService, private datePipe: DatePipe) {
private overAllSer: OverAllService, private renderer: Renderer,private router:Router,
private fb: FormBuilder, private modalService: NzModalService,private datePipe:DatePipe) {
this.routerInfo.queryParams.subscribe(queryParams => {
this.hostId = queryParams.hostId;
this.overAllSer.findDetailed(this.hostId).subscribe(
(res) => {
let data = res.data[0];
(res)=>{
let data = res.data[0]
this.hostName = data.name; //显示名
this.realName = data.host; //主机名
}
);
)
});
}
......@@ -150,7 +146,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
// this.inOutInfo();
//监测点
this.getList();
this.getList();
//历史告警
const obj = {};
......@@ -159,7 +155,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
ngAfterViewInit() {
this.checkEle.nativeElement.children[1].children[0].children[0].children[2].children[0].children[0].children[2].style.marginRight = this.colorEle.nativeElement.offsetWidth + 'px';
this.checkEle.nativeElement.children[1].children[0].children[0].children[2].children[0].children[0].children[2].style.marginRight = this.colorEle.nativeElement.offsetWidth +'px';
}
//平均响应时间
......@@ -224,7 +220,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
]
};
} else {
this.message.info(res.errMsg);
}
}
);
}
......@@ -291,7 +290,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
]
};
} else {
this.message.info(res.errMsg);
}
}
);
}
......@@ -361,7 +363,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
]
};
} else {
this.message.info(res.errMsg);
}
}
);
}
......@@ -477,10 +482,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
data: res.data.disks.map((item) => {
return item.name;
}),
axisLabel: res.data.disks.map((item) => {
axisLabel:res.data.disks.map((item) => {
let data = item.name;
if (data.length > 5) {
data = data.substring(0, 4) + '..';
if(data.length > 5) {
data = data.substring(0, 4) + "..";
}
return data;
}),
......@@ -507,7 +512,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
},
},
data: res.data.disks.map((item) => {
const pre = ((item.used / item.total) * 100).toFixed(2); //已使用百分比
const pre = ( (item.used / item.total) * 100 ).toFixed(2); //已使用百分比
return pre;
})
},
......@@ -532,7 +537,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
},
},
data: res.data.disks.map((item) => {
const pre = ((item.total - item.used) / (item.total) * 100).toFixed(2); //剩余百分比
const pre = ( (item.total - item.used) / (item.total) * 100 ).toFixed(2); //剩余百分比
return pre;
})
},
......@@ -551,12 +556,12 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
const arr = [
{
name: '已使用',
value: used,
name:"已使用",
value:used,
},
{
name: '未使用',
value: total,
name:"未使用",
value:total,
}
];
......@@ -569,7 +574,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
color: ['#3194e0', '#bfbfbf'],
color: ['#3194e0','#bfbfbf'],
series: [
{
name: '',
......@@ -604,6 +609,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
);
}
extension(){
}
add(arr) {
let total = 0;
for (let i = 0; i < arr.length; i++) {
......@@ -616,19 +625,19 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
inOutInfo() {
this.inOutLoading = true;
const data = {
obj: {
hostid: Number(this.hostId)
obj:{
hostid:Number(this.hostId)
},
pageNum: this.pageNum,
pageCount: this.pageCount
};
pageNum:this.pageNum,
pageCount:this.pageCount
}
this.overAllSer.inOutInfoSnmp(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.dataSet = res.data.data;
this.inOutLoading = false;
this.totalNumInOut = res.data.totalNum;
} else {
}else{
this.message.info(res.errMsg);
}
}
......@@ -636,33 +645,33 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
//进出口流量 翻页
changeInoutInfo(e) {
changeInoutInfo(e){
this.pageNum = e;
// this.inOutInfo();
}
//添加监测点
showCheckModal() {
this.smartCheck.showAddModal(this.hostId, this.realName, '添加监测点');
this.smartCheck.showAddModal(this.hostId,this.realName,'添加监测点');
}
//编辑监测点
showEditModal(item) {
this.smartCheck.showEditModal(this.hostId, item.itemid, this.realName, item.templateid, '编辑监测点');
showEditModal(item){
this.smartCheck.showEditModal(this.hostId,item.itemid,this.realName,item.templateid,'编辑监测点');
}
//添加阈值
showAddThresholdModal(item) {
this.smartThreshold.showAddModal('添加阈值', item.itemid, this.realName);
showAddThresholdModal(item){
this.smartThreshold.showAddModal("添加阈值",item.itemid,this.realName);
}
//编辑阈值
showEditThresholdModal(item) {
this.smartThreshold.showEditModal('编辑阈值', item.itemid, this.hostId, this.realName);
showEditThresholdModal(item){
this.smartThreshold.showEditModal("编辑阈值",item.itemid,this.hostId,this.realName);
}
//添加or编辑监测点 之后
getList() {
getList(){
this.getCheckList();
this.findItemType();
}
......@@ -682,11 +691,11 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
const data = {
pageNum: this.pageIndex,
pageCount: pageSize,
obj: {
obj:{
applicationid: this.applicationId,
hostid: this.hostId,
priorityName: this.changeStates,
name: this.searchName
priorityName:this.changeStates,
name:this.searchName
}
};
this.overAllSer.findCheckByType(data).subscribe(
......@@ -698,7 +707,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
);
}
changeState(state) {
changeState(state){
this.tabNum = 1;
this.changeStates = state;
this.getCheckList();
......@@ -712,7 +721,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
changeType(item) {
this.pageIndex = 1;
if (item.name == '全部') {
if(item.name == "全部"){
this.changeStates = null;
}
this.applicationId = item.applicationid;
......@@ -723,7 +732,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
getCheckStatus() {
this.overAllSer.findItemCount(this.hostId).subscribe(
(res) => {
if (res.errCode == 10000) {
if(res.errCode == 10000){
this.checkStatus = res.data;
}
}
......@@ -739,8 +748,8 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
nzOkType: 'danger',
nzOnOk: () => {
const data = {
itemids: [item.itemid],
templateid: item.templateid
itemids:[item.itemid],
templateid:item.templateid
};
this.overAllSer.deleteItem(data).subscribe(
(res) => {
......@@ -767,9 +776,9 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
}
//获取图表数据
getGraphDate() {
getGraphDate(){
const data = {
date: this.datePipe.transform(this.imageSelectDate, 'yyyy-MM-dd'),
date: this.datePipe.transform(this.imageSelectDate,'yyyy-MM-dd'),
itemid: this.selectGraphadata.itemid
};
this.overAllSer.findGraphData(data).subscribe(
......@@ -792,9 +801,9 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
splitLine: {
show: false
},
axisLabel: { //Y轴数据
formatter: (value) => {
return value + ' ' + this.selectGraphadata.units; //负数取绝对值变正数
axisLabel:{ //Y轴数据
formatter:(value)=>{
return value+ " " +this.selectGraphadata.units; //负数取绝对值变正数
},
},
},
......@@ -806,7 +815,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
series: {
type: 'line',
data: result.map((item) => {
return item.value;
return item.value ;
}),
}
......@@ -831,10 +840,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
(res) => {
this.itemTypeList = res.data;
const data = {
applicationid: '',
name: '全部'
applicationid:'',
name:'全部'
};
if (null != res.data) {
if (null!=res.data){
this.itemTypeList.unshift(data);
}
this.itemTypeValue = '';
......@@ -878,7 +887,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
nzOkType: 'danger',
nzOnOk: () => {
const data = {
hostids: []
hostids:[]
};
data.hostids.push(this.hostId);
this.overAllSer.deleteHostPost(data).subscribe(
......@@ -897,4 +906,3 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
});
}
}
......@@ -23,12 +23,13 @@
<div class="padding-10" style="height: 40%;position: relative">
<p class="host-item-title">分区</p>
<div class="time-group" style="top: 18px;">
<nz-select style="width: 150px;" nzPlaceHolder="选择磁盘"
(ngModelChange)="setDiskChart($event)" [(ngModel)]="diskType">
<ng-container *ngFor="let disk of hostObj.disk;let i = index;">
<nz-option [nzLabel]="disk.name" [nzValue]="i"></nz-option>
</ng-container>
</nz-select>
<nz-select style="width: 150px;" nzPlaceHolder="选择磁盘" (ngModelChange)="setDiskChart($event)"
[(ngModel)]="diskType">
<ng-container *ngFor="let disk of hostObj.disk;let i = index;">
<nz-option [nzLabel]="disk.name" [nzValue]="i"></nz-option>
</ng-container>
</nz-select>
</div>
<div class="host-item-content" style="height: 300px;">
<ng-container *ngIf="noData">
......@@ -44,15 +45,15 @@
</div>
<nz-row>
<nz-col nzSpan="12">总大小:</nz-col>
<nz-col nzSpan="12">{{hostObj.disk[diskType].total || '-'}}</nz-col>
<nz-col nzSpan="12">{{hostObj.disk[diskType].total | unitConversion}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="12">已用大小:</nz-col>
<nz-col nzSpan="12">{{hostObj.disk[diskType].use || '-'}}</nz-col>
<nz-col nzSpan="12">{{hostObj.disk[diskType].used | unitConversion}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="12">剩余容量:</nz-col>
<nz-col nzSpan="12">{{(hostObj.disk[diskType].total - hostObj.disk[diskType].use) || '-'}}</nz-col>
<nz-col nzSpan="12">{{(hostObj.disk[diskType].total - hostObj.disk[diskType].used) | unitConversion }}</nz-col>
</nz-row>
</nz-spin>
</ng-container>
......@@ -62,7 +63,8 @@
<nz-row>
<nz-col class="padding-right-10" nzSpan="12">
<p class="host-item-title">基本信息</p>
<div class="host-item-content" style="height: 300px;">
<div class="host-item-content" style="height: 300px;">
<nz-row>
<nz-col nzSpan="8">资源状态:</nz-col>
<nz-col nzSpan="16">{{server?.waringName}}</nz-col>
......@@ -81,7 +83,8 @@
</nz-row>
<nz-row>
<nz-col nzSpan="8">资产编号:</nz-col>
<nz-col nzSpan="16">{{server?.inventory?.no || '-'}}</nz-col>
<nz-col nzSpan="16">{{server?.inventory?.inventoryNo || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">负责人:</nz-col>
......@@ -105,14 +108,6 @@
<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>
......
......@@ -32,7 +32,9 @@
</nz-row>
<nz-row>
<nz-col nzSpan="8">IP地址:</nz-col>
<nz-col nzSpan="16">{{switch?.ip || '-'}}</nz-col>
<nz-col nzSpan="16">{{switch?.host || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">设备类型:</nz-col>
......@@ -40,7 +42,8 @@
</nz-row>
<nz-row>
<nz-col nzSpan="8">资产编号:</nz-col>
<nz-col nzSpan="16">{{switch?.inventory?.no || '-'}}</nz-col>
<nz-col nzSpan="16">{{switch?.inventory?.inventoryNo || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">负责人:</nz-col>
......@@ -53,19 +56,21 @@
<div class="host-item-content" style="height: 100%;">
<nz-row>
<nz-col nzSpan="8">CPU利用率(%):</nz-col>
<nz-col nzSpan="16">{{hostObj.cpu}}</nz-col>
<nz-col nzSpan="16">{{hostObj.cpu || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">Ping延时(ms):</nz-col>
<nz-col nzSpan="16">{{hostObj.response}}</nz-col>
<nz-col nzSpan="16">{{hostObj.response || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">丢包数:</nz-col>
<nz-col nzSpan="16">{{hostObj.losed}}</nz-col>
<nz-col nzSpan="16">{{hostObj.losed || '-'}}</nz-col>
</nz-row>
<nz-row>
<nz-col nzSpan="8">内存利用率(%):</nz-col>
<nz-col nzSpan="16">{{hostObj.used}}</nz-col>
<nz-col nzSpan="16">{{hostObj.used || '-'}}</nz-col>
</nz-row>
</div>
</div>
......
......@@ -33,7 +33,6 @@ export class SwitchComponent implements OnInit {
isNetworkLoading = false;
chartNetworkOption;
isTrendLoading = false;
chartTrendOption;
......@@ -131,7 +130,7 @@ export class SwitchComponent implements OnInit {
this.overAllSer.responseTime(this.hostId).subscribe(
(res)=>{
if (res.data) {
this.hostObj.response = res.data.response;
this.hostObj.response = res.data.responseTime;
} else {
this.hostObj.response = 0;
}
......
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import {UnitConversionPipe} from './unit-conversion/unit-conversion.pipe';
@NgModule({
imports: [
],
declarations: [
UnitConversionPipe
],
providers: [
],
entryComponents: [],
exports: [
UnitConversionPipe
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class PipeModule {}
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({
name: 'unitConversion'
})
export class UnitConversionPipe implements PipeTransform {
transform(value: any, args?: any): any {
console.log(value);
let res = '';
let Gbps = 1000 * 1000 * 1000;
let Mbps = 1000 * 1000;
let kbps = 1000;
let size = Math.abs(value);
if (size / Gbps > 1) {
res += (size / Gbps).toFixed(2) + 'Gbps';
} else if (size / Mbps > 1) {
res += (size / Mbps).toFixed(2) + 'Mbps';
} else if (size / kbps > 1) {
res += (size / kbps).toFixed(2) + 'kbps';
} else {
res += (size) + 'bps';
}
return res;
}
}
......@@ -19,13 +19,15 @@ import {ReactiveFormsModule} from '@angular/forms';
import {CommonService} from './common/common.service';
import {UtilService} from './common/util.service';
import {DisableControlDirective} from './common/disable-control.directive';
import {PipeModule} from './pipe/pipe.module';
@NgModule({
imports: [
ReactiveFormsModule,
NgZorroAntdModule,
BootappSharedLibsModule,
BootappSharedCommonModule
BootappSharedCommonModule,
PipeModule,
],
declarations: [
JhiLoginModalComponent,
......
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