Commit 60f5e480 authored by wangqinghua's avatar wangqinghua

style update

parent c1158be1
......@@ -16,16 +16,6 @@
<div nz-col nzSpan="16">
<div class="leftDiv">
<div #leftDiv class="leftDiv-container">
<div nz-row class="padding-10">
<div nz-col nzSpan="12"> <h2>运行情况统计</h2></div>
<div nz-col nzSpan="12">
<nz-select style="width: 200px;float: right" nzPlaceHolder="选择分组" [(ngModel)]="obj.leftGroupId" (ngModelChange)="countGroupItem()">
<ng-container *ngFor="let item of groupList;let i = index;">
<nz-option [nzLabel]="item.name" [nzValue]="item.groupid"></nz-option>
</ng-container>
</nz-select>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="12">
<div echarts [options]="leftOneChart" style="height: 250px;width: 100%"></div>
......@@ -33,7 +23,7 @@
<div class="flex-item round-tag tag-form">
<p>
<nz-tag class="tag-red" [nzColor]="color.red"></nz-tag>
<span class="margin-0-10">严重 {{leftOneData.high}}个,{{leftOneDataPre.highPer}}%</span>
<span class="margin-0-10">严重 {{leftOneData.serious}}个,{{leftOneDataPre.seriousPer}}%</span>
</p>
<p>
<nz-tag class="tag-yellow" [nzColor]="color.yellow"></nz-tag>
......@@ -45,7 +35,7 @@
</p>
<p>
<nz-tag class="tag-gray" [nzColor]="color.gray"></nz-tag>
<span class="margin-0-10">禁止 {{leftOneData.disabled}}个,{{leftOneDataPre.disabledPer}}%</span>
<span class="margin-0-10">禁止 {{leftOneData.disable}}个,{{leftOneDataPre.disablePer}}%</span>
</p>
</div>
</div>
......@@ -56,7 +46,7 @@
<div class="flex-item round-tag tag-form">
<p>
<nz-tag class="tag-red" [nzColor]="color.red"></nz-tag>
<span class="margin-0-10">严重 {{leftTwoData.high}}个,{{leftTwoDataPre.highPer}}% </span>
<span class="margin-0-10">严重 {{leftTwoData.serious}}个,{{leftTwoDataPre.seriousPer}}% </span>
</p>
<p>
<nz-tag class="tag-yellow" [nzColor]="color.yellow"></nz-tag>
......@@ -68,7 +58,7 @@
</p>
<p>
<nz-tag class="tag-gray" [nzColor]="color.gray"></nz-tag>
<span class="margin-0-10">禁止 {{leftTwoData.disabled}}个,{{leftTwoDataPre.disabledPer}}%</span>
<span class="margin-0-10">禁止 {{leftTwoData.disable}}个,{{leftTwoDataPre.disablePer}}%</span>
</p>
</div>
</div>
......
......@@ -42,30 +42,30 @@ export class HomeComponent implements OnInit,AfterViewInit {
};
leftOneData = {
high:0,
serious:0,
warning:0,
normal:0,
disabled:0,
disable:0,
};
leftOneDataPre = {
highPer:0,
seriousPer:0,
warningPer:0,
normalPer:0,
disabledPer:0,
disablePer:0,
};
leftOneTotal = 0;
leftTwoData ={
high:0,
serious:0,
warning:0,
normal:0,
disabled:0,
disable:0,
};
leftTwoDataPre = {
highPer:0,
seriousPer:0,
warningPer:0,
normalPer:0,
disabledPer:0,
disablePer:0,
};
leftTwoTotal = 0;
......@@ -87,8 +87,6 @@ export class HomeComponent implements OnInit,AfterViewInit {
ngOnInit() {
this.getAlarmList();
this.findGroupCount();
this.findHostCount();
this.getGroup();
......@@ -117,7 +115,7 @@ export class HomeComponent implements OnInit,AfterViewInit {
this.overAllSer.findGroup().subscribe(
(res) => {
if(res.data){
this.groupList = res.data;
this.groupList = res.data.data;
this.obj.leftGroupId = this.groupList[0].groupid;
this.countGroupItem();
}
......@@ -143,16 +141,16 @@ export class HomeComponent implements OnInit,AfterViewInit {
setLeftOne(data){
this.leftOneDataPre = {
highPer:0,
seriousPer:0,
warningPer:0,
normalPer:0,
disabledPer:0,
disablePer:0,
};
this.leftOneTotal = data.disabled + data.high + data.normal + data.warning;
this.leftOneTotal = data.total;
if(this.leftOneData.high > 0){
let a:any = (this.leftOneData.high / this.leftOneTotal)* 100;
this.leftOneDataPre.highPer = a.toFixed(2);
if(this.leftOneData.serious > 0){
let a:any = (this.leftOneData.serious / this.leftOneTotal)* 100;
this.leftOneDataPre.seriousPer = a.toFixed(2);
}
if(this.leftOneData.warning > 0){
......@@ -165,9 +163,9 @@ export class HomeComponent implements OnInit,AfterViewInit {
this.leftOneDataPre.normalPer = c .toFixed(2);
}
if(this.leftOneData.disabled > 0){
let d:any = ( (this.leftOneData.disabled / this.leftOneTotal)* 100 );
this.leftOneDataPre.disabledPer = d .toFixed(2);
if(this.leftOneData.disable > 0){
let d:any = ( (this.leftOneData.disable / this.leftOneTotal)* 100 );
this.leftOneDataPre.disablePer = d .toFixed(2);
}
this.leftOneChart =
......@@ -212,10 +210,10 @@ export class HomeComponent implements OnInit,AfterViewInit {
}
},
data: [
{value: data.high, name: '严重'},
{value: data.serious, name: '严重'},
{value: data.warning, name: '告警'},
{value: data.normal, name: '正常'},
{value: data.disabled, name: '禁止'},
{value: data.disable, name: '禁止'},
],
itemStyle: {
emphasis: {
......@@ -231,15 +229,15 @@ export class HomeComponent implements OnInit,AfterViewInit {
setLeftTwo(data){
this.leftTwoDataPre = {
highPer:0,
seriousPer:0,
warningPer:0,
normalPer:0,
disabledPer:0,
disablePer:0,
};
this.leftTwoTotal = data.disabled + data.high + data.normal + data.warning;
if(this.leftTwoData.high > 0){
let w:any = ( (this.leftTwoData.high / this.leftTwoTotal)*100 );
this.leftTwoDataPre.highPer = w.toFixed(2);
this.leftTwoTotal = data.total;
if(this.leftTwoData.serious > 0){
let w:any = ( (this.leftTwoData.serious / this.leftTwoTotal)*100 );
this.leftTwoDataPre.seriousPer = w.toFixed(2);
}
if(this.leftTwoData.warning > 0){
......@@ -252,9 +250,9 @@ export class HomeComponent implements OnInit,AfterViewInit {
this.leftTwoDataPre.normalPer = y.toFixed(2);
}
if(this.leftTwoData.disabled > 0){
let z:any = ( (this.leftTwoData.disabled / this.leftTwoTotal)*100);
this.leftTwoDataPre.disabledPer = z.toFixed(2);
if(this.leftTwoData.disable > 0){
let z:any = ( (this.leftTwoData.disable / this.leftTwoTotal)*100);
this.leftTwoDataPre.disablePer = z.toFixed(2);
}
this.leftTwoChart =
......@@ -299,10 +297,10 @@ export class HomeComponent implements OnInit,AfterViewInit {
}
},
data: [
{value: data.high, name: '严重'},
{value: data.serious, name: '严重'},
{value: data.warning, name: '告警'},
{value: data.normal, name: '正常'},
{value: data.disabled, name: '禁止'},
{value: data.disable, name: '禁止'},
],
itemStyle: {
emphasis: {
......@@ -316,45 +314,6 @@ export class HomeComponent implements OnInit,AfterViewInit {
};
}
findGroupCount(){
this.layoutSer.findGroupCount().subscribe(
(res)=>{
if(res.data.length > 0){
this.rightTotal = res.data.length;
this.rightOneChart = {
tooltip : {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
series : [
{
name: '',
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:res.data.map(e=>{
const arr = {
value:e.count,
name:e.name
};
return arr;
}),
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
}
}
)
}
findHostCount(){
this.layoutSer.findHostCount().subscribe(
(res)=>{
......
......@@ -37,12 +37,12 @@ export class LayoutService {
//主机状态统计(用于首页)
findHostCountByStatusByGroup(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/host/findHostCountByStatusByGroup/'+params);
return this.http.get(SERVER_API_URL + '/host/findHostCountByStatus');
}
//根据组id统计监控项状态数量
findItemStatisticsByGroupid(params): Observable<any> {
return this.http.get(SERVER_API_URL + '/item/findItemStatisticsByGroupid/'+params);
return this.http.get(SERVER_API_URL + '/item/findItemCountByStatus');
}
//取消关注
......
......@@ -52,7 +52,7 @@
<nz-form-control [nzSpan]="20">
<ng-container *ngFor="let item of interfaceslist;let i = index;">
<div nz-row [nzGutter]="12">
<nz-form-control nz-col [nzSpan]="3">
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="main" nzPlaceHolder="选择接口类型" [(ngModel)]="item.main"
(ngModelChange)="changeMain(i)">
<nz-option nzValue="1" nzLabel="默认"></nz-option>
......@@ -69,12 +69,9 @@
<nz-option nzValue="4" nzLabel="JMX接口"></nz-option>
</nz-select>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<nz-form-control nz-col [nzSpan]="4">
<input type="text" placeholder="端口" nz-input name="port" [(ngModel)]="item.port">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="4" *ngIf="item.type == 2">
<label nz-checkbox [(ngModel)]="item.bulk">使用大量请求</label>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="2">
<span class="main-color cursor" (click)="deleteInterfaces(i)">X</span>
</nz-form-control>
......@@ -85,7 +82,7 @@
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="test3">agent代理程序检测</nz-form-label>
<nz-form-label [nzSpan]="4" nzFor="test3">agent代理程序检测</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select name="test3" name="test3" nzPlaceHolder="无agen代理程序">
<nz-option nzValue="" nzLabel="无agen代理程序"></nz-option>
......
......@@ -123,7 +123,7 @@ export class BasicEditComponent implements OnInit {
}
//编辑
editModal(hostId, name, gId): void {
editModal(hostId): void {
this.isBasicEdit = true;
this.tabNum = 0;
this.hostId = hostId;
......@@ -236,6 +236,11 @@ export class BasicEditComponent implements OnInit {
}
}
this.validateForm.groups = groupArr;
let tempArr = [];
this.validateForm.templates.forEach(e=>{
tempArr.push({id:e})
});
this.validateForm.templates = tempArr;
this.isOkLoading = true;
if (this.modalTitle == '编辑资源') {
this.update();
......@@ -252,17 +257,7 @@ export class BasicEditComponent implements OnInit {
ip: res.ip,
type: res.type,
port: res.port,
bulk: ''
};
if (res.type == '2') {
if (res.bulk == true || res.bulk == '1') {
a.bulk = '1';
} else {
a.bulk = '0';
}
} else {
delete a.bulk;
}
interfaceArr.push(a);
});
this.validateForm.interfaces = interfaceArr;
......@@ -282,7 +277,6 @@ export class BasicEditComponent implements OnInit {
});
this.validateForm.templates = clearArr;
}
this.overAllSer.createHost(this.validateForm).subscribe(
(res) => {
if (res.errCode == 10000) {
......@@ -307,19 +301,9 @@ export class BasicEditComponent implements OnInit {
ip: res.ip,
type: res.type,
port: res.port,
bulk: '',
hostid: this.hostId,
interfaceid: res.interfaceid
};
if (res.type == '2') {
if (res.bulk == true || res.bulk == '1') {
a.bulk = '1';
} else {
a.bulk = '0';
}
} else {
delete a.bulk;
}
interfaceArr.push(a);
});
this.validateForm.interfaces = interfaceArr;
......@@ -337,13 +321,14 @@ export class BasicEditComponent implements OnInit {
}
});
this.validateForm.clearTemplateids = clearArr;
// this.validateForm.clearTemplateids = clearArr;
if (this.macroTYpe == 'macroExpand') {
this.validateForm.macros = this.macroList2;
}
this.validateForm.hostid = this.hostId;
this.validateForm.macros = this.macroList1;
this.validateForm.id = this.hostId;
this.overAllSer.updateHost(this.validateForm).subscribe(
(res) => {
if (res.errCode == 10000) {
......@@ -409,7 +394,6 @@ export class BasicEditComponent implements OnInit {
ip: '',
type: '2',
port: '10050',
bulk: true,
};
this.interfaceslist.push(demo);
}
......@@ -428,7 +412,6 @@ export class BasicEditComponent implements OnInit {
}
case '2': {
this.interfaceslist[index].port = '161';
this.interfaceslist[index].bulk = true;
break;
}
case '3': {
......@@ -528,11 +511,10 @@ export class BasicEditComponent implements OnInit {
ip: '',
type: '2',
port: '10050',
bulk: true,
}
];
this.tabNum = 0;
this.validateForm = {
this.validateForm = <any>{
groups: [],
hostExtend: {
equipmentTypeid: null,
......@@ -555,7 +537,7 @@ export class BasicEditComponent implements OnInit {
repaircount: null,
scrapcount: null,
},
templates: null,
templates: [],
name: null,
host: null,
};
......
......@@ -176,8 +176,7 @@
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="openHost(item)" nz-menu-item><a>
<ng-container *ngIf="item.status == 1">开启</ng-container>
<ng-container *ngIf="item.status == 0">停止</ng-container>
监控
<ng-container *ngIf="item.status == 0">停止</ng-container>监控
</a></li>
<!-- <li nz-menu-item (click)="goDetail(item)"><a>查看监测点</a></li>-->
</ul>
......@@ -197,5 +196,3 @@
<smart-create-group #smartCreateGroup (add)="handleOk($event)"></smart-create-group>
<!--临时暂停-->
<smart-pause #smartPause (done)="handleOk($event)"></smart-pause>
<!--添加告警-->
<!--<smart-alarm-modal #smartAlarmModal></smart-alarm-modal>-->
......@@ -43,12 +43,10 @@ export interface TreeNodeInterface {
})
export class BasicComponent implements OnInit {
//组件
@ViewChild('basicEdit') basicEdit: BasicEditComponent;
@ViewChild('smartCheck') smartCheck: BasiCheckComponent;
@ViewChild('smartCreateGroup') smartCreateGroup: CreateGroupComponent;
@ViewChild('smartPause') smartPause: PauseComponent;
// @ViewChild('smartAlarmModal') smartAlarmModal: AlarmModalComponent;
color = color;
......@@ -289,7 +287,7 @@ export class BasicComponent implements OnInit {
//编辑资源 name--分组名称,gId-当前分组的id
editBasicModal(item) {
this.basicEdit.editModal(item.hostid, item.name, item.gId);
this.basicEdit.editModal(item.hostid);
}
//添加监测点
......@@ -470,19 +468,17 @@ export class BasicComponent implements OnInit {
//开启or停止监控
openHost(item) {
this.modalService.confirm({
nzTitle: '监控',
nzContent: '确定开启监控设备' + item.name + '?',
nzOkText: '确定',
nzCancelText: '取消',
nzOnOk: () => {
this.commonSer.confirmThing('暂停',`确定开启监控设备${item.name}?`,()=>{
this.loading = true;
let params1 = 0;
if (item.status == 0) {
params1 = 1;
}
const params2 = item.hostid;
this.overAllSer.stopOrOpen(params1, params2).subscribe(
const data = {
hostid:item.hostid,
status:params1,
}
this.overAllSer.updateHostStatus(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('修改成功');
......@@ -490,9 +486,7 @@ export class BasicComponent implements OnInit {
}
}
);
},
nzOnCancel: () => console.log('Cancel')
});
})
}
//批量开启or停止监控
......
......@@ -2,11 +2,12 @@ import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs/Rx';
import {Injectable} from '@angular/core';
import {SERVER_API_URL} from '../app.constants';
import {CommonService} from '../shared/common/common.service';
@Injectable()
export class OverAllService {
constructor(private http: HttpClient) {
constructor(private http: HttpClient,private commonSer:CommonService) {
}
//获取分组信息 --列表
......@@ -35,8 +36,8 @@ export class OverAllService {
}
//停止-开启监控
stopOrOpen(params1, params2): Observable<any> {
return this.http.get(SERVER_API_URL + '/host/stopOrOpen/' + params1 + '/' + params2);
updateHostStatus(data): Observable<any> {
return this.http.get(SERVER_API_URL + '/host/updateHostStatus/' +this.commonSer.toQuery(data));
}
//批量停止开启监控接口
......
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