Commit f1f6d9b7 authored by wangqinghua's avatar wangqinghua

update

parent 58553072
...@@ -20,6 +20,9 @@ import {FlowTrendComponent} from './netTopology/flow-trend/flow-trend.component' ...@@ -20,6 +20,9 @@ import {FlowTrendComponent} from './netTopology/flow-trend/flow-trend.component'
import {NetworkCheckComponent} from './overAll/network-check/network-check.component'; import {NetworkCheckComponent} from './overAll/network-check/network-check.component';
import {NetworkDetailComponent} from './overAll/network-check/network-detail/network-detail.component'; import {NetworkDetailComponent} from './overAll/network-check/network-detail/network-detail.component';
import {TopologyImgComponent} from './netTopology/topology-img/topology-img.component'; import {TopologyImgComponent} from './netTopology/topology-img/topology-img.component';
import {WorkHandleComponent} from './work/work-handle/work-handle.component';
import {InspectPlanComponent} from './work/inspect-plan/inspect-plan.component';
import {AssetPartComponent} from './work/asset-part/asset-part.component';
export const route: Routes = [ export const route: Routes = [
{path: '', component: JhiMainComponent,canActivate:[LoginGuard]}, {path: '', component: JhiMainComponent,canActivate:[LoginGuard]},
...@@ -47,6 +50,9 @@ export const route: Routes = [ ...@@ -47,6 +50,9 @@ export const route: Routes = [
{path: 'neTopology', component: NeTopologyComponent}, {path: 'neTopology', component: NeTopologyComponent},
{path: 'flowTrend', component: FlowTrendComponent}, {path: 'flowTrend', component: FlowTrendComponent},
{path: 'topoImg', component: TopologyImgComponent}, {path: 'topoImg', component: TopologyImgComponent},
{path: 'workHandle', component: WorkHandleComponent},
{path: 'inspectPlan', component: InspectPlanComponent},
{path: 'assetPart', component: AssetPartComponent},
] ]
}, },
] ]
......
import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core'; import {Component, EventEmitter, OnInit, Output, ViewChild} from '@angular/core';
import {OverAllService} from '../../overAll/overAll.service'; import {OverAllService} from '../../overAll/overAll.service';
import { import {
FormBuilder, FormBuilder, FormControl,
FormGroup, FormGroup,
Validators Validators
} from '@angular/forms'; } from '@angular/forms';
...@@ -20,7 +20,11 @@ import {NewTypeComponent} from '../new-type/new-type.component'; ...@@ -20,7 +20,11 @@ import {NewTypeComponent} from '../new-type/new-type.component';
color: rgba(0, 0, 0, 0.65); color: rgba(0, 0, 0, 0.65);
background-color: #fff; background-color: #fff;
border-color: #d9d9d9; border-color: #d9d9d9;
}` }
:host ::ng-deep .ant-tabs-nav .ant-tabs-tab-disabled{
color: rgba(0,0,0,.65);
}
`
] ]
}) })
export class BasiCheckComponent implements OnInit { export class BasiCheckComponent implements OnInit {
...@@ -33,7 +37,7 @@ export class BasiCheckComponent implements OnInit { ...@@ -33,7 +37,7 @@ export class BasiCheckComponent implements OnInit {
hostId; //主机ID hostId; //主机ID
itemId; //监控项id itemId; //监控项id
interfaceList: any[]; interfaceList: any[];
validateForm; validateForm:FormGroup;
checkList; //监测点分类 checkList; //监测点分类
interval; //间隔时长 interval; //间隔时长
conditionType = 'commonly'; conditionType = 'commonly';
...@@ -51,38 +55,41 @@ export class BasiCheckComponent implements OnInit { ...@@ -51,38 +55,41 @@ export class BasiCheckComponent implements OnInit {
value: '', value: '',
} }
]; //故障list ]; //故障list
tabNum:number;
triggerObj = {
condition:'',
faultCondition:'',
itemName:''
};
constructor(private overAllSer: OverAllService, private fb: FormBuilder, constructor(private overAllSer: OverAllService, private fb: FormBuilder,
private message: NzMessageService) { private message: NzMessageService) {
} }
ngOnInit() { ngOnInit() {
this.tabNum = 0;
this.initForm(); this.initForm();
} }
initForm(){ initForm(){
this.validateForm = { this.validateForm = this.fb.group({
hostid: this.hostId, hostid:[null],
name: null, name:[null,[Validators.required]],
interfaceid: null, interfaceid:[null,[Validators.required]],
key_: null, key_:[null,[Validators.required]],
value_type: null, value_type:[null,[Validators.required]],
type: null, type:[null,[Validators.required]],
data_type: null, data_type:[null,[Validators.required]],
units: null, units:[null],
history: '100', formula:[null,[Validators.required]],
trends: null, history:[null],
valuemapid: null, trends:[null],
delay: null, valuemapid:[null],
snmp_oid:null, delay:[null,[Validators.required]],
snmp_community:null, snmp_oid:[null],
condition_commonly: null, //故障 snmp_community:[null],
condition_high: null, //故障 delta:[null],
faultCondition_commonly: null, //危险 applicationids:[null],
faultCondition_high: null, //危险 })
delta: null,
formula: null,
applicationids: null
};
} }
//新增 //新增
...@@ -109,11 +116,12 @@ export class BasiCheckComponent implements OnInit { ...@@ -109,11 +116,12 @@ export class BasiCheckComponent implements OnInit {
this.overAllSer.findItemDetail(id).subscribe( this.overAllSer.findItemDetail(id).subscribe(
(res) => { (res) => {
this.validateForm = res.data[0]; this.validateForm = res.data[0];
this.validateForm.type = this.validateForm.type +''; this.validateForm.patchValue(res.date[0]);
this.validateForm.interfaceid = this.validateForm.interfaceid +""; // this.validateForm.type = this.validateForm.type +'';
this.validateForm.value_type = this.validateForm.value_type +""; // this.validateForm.interfaceid = this.validateForm.interfaceid +"";
this.validateForm.data_type = this.validateForm.data_type +""; // this.validateForm.value_type = this.validateForm.value_type +"";
this.validateForm.applicationids = this.validateForm.applications[0].applicationid +""; // this.validateForm.data_type = this.validateForm.data_type +"";
// this.validateForm.applicationids = this.validateForm.applications[0].applicationid +"";
} }
); );
...@@ -140,55 +148,31 @@ export class BasiCheckComponent implements OnInit { ...@@ -140,55 +148,31 @@ export class BasiCheckComponent implements OnInit {
} }
//添加 //添加
handleCheckOk(): void { handleCheckOk() {
const data = { for(let i in this.validateForm.controls) {
hostid: this.hostId, this.validateForm.controls[ i ].markAsDirty();
name: this.validateForm.name, this.validateForm.controls[ i ].updateValueAndValidity();
interfaceid: this.validateForm.interfaceid,
key_: this.validateForm.key_,
value_type: Number(this.validateForm.value_type),
type: Number(this.validateForm.type),
data_type: Number(this.validateForm.data_type),
units: this.validateForm.units,
history: this.validateForm.history,
trends: this.validateForm.trends,
valuemapid: this.validateForm.valuemapid,
delay: this.validateForm.delay,
snmp_oid:this.validateForm.snmp_oid,
snmp_community:this.validateForm.snmp_community,
condition: '', //故障
faultCondition: '', //危险
delta: Number(this.validateForm.delta),
formula: this.validateForm.formula,
applicationids: [this.validateForm.applicationids]
};
if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => {
data.condition += '{' + this.validateForm.name + ':' + this.validateForm.key_ + '.last()}' + res.equal + '' + res.value ;
});
this.faultConditionList.forEach(res => {
data.faultCondition += '{' + this.validateForm.name + ':' + this.validateForm.key_ + '.last()}' + res.equal + '' + res.value;
});
} else { //高级
data.condition = this.validateForm.condition_high;
data.faultCondition = this.validateForm.faultCondition_high;
} }
if(this.validateForm.invalid){
return false;
}
this.validateForm.value.applicationids = [this.validateForm.value.applicationids];
if(this.title == "添加监测点"){ if(this.title == "添加监测点"){
this.create(data); this.create();
} }
if(this.title == "编辑监测点"){ if(this.title == "编辑监测点"){
this.update(data); this.update();
} }
} }
create(data){ create(){
this.overAllSer.create(data).subscribe( this.overAllSer.create(this.validateForm.value).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.isCheck = false; // this.isCheck = false;
this.initForm(); // this.initForm();
this.done.emit(); // this.done.emit();
this.tabNum = 1;
} }
this.message.info(res.errMsg); this.message.info(res.errMsg);
}, },
...@@ -198,9 +182,11 @@ export class BasiCheckComponent implements OnInit { ...@@ -198,9 +182,11 @@ export class BasiCheckComponent implements OnInit {
); );
} }
update(data){ //修改监控项
data.itemid = this.itemId; update(){
this.overAllSer.itemUpdata(data).subscribe( this.validateForm.addControl('itemid',new FormControl(this.itemId));
// data.itemid = this.itemId;
this.overAllSer.itemUpdata(this.validateForm).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.isCheck = false; this.isCheck = false;
...@@ -281,6 +267,57 @@ export class BasiCheckComponent implements OnInit { ...@@ -281,6 +267,57 @@ export class BasiCheckComponent implements OnInit {
} }
getKey(keyValue): void { getKey(keyValue): void {
this.validateForm.key_ = keyValue; this.validateForm.value.key_ = keyValue;
} }
//阈值--start
save(){
const data = {
condition:'',
faultCondition:''
};
if (this.conditionType == 'commonly') { //常规
this.conditionList.forEach(res => {
data.condition += '{' + this.validateForm.value.name + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value ;
});
this.faultConditionList.forEach(res => {
data.faultCondition += '{' + this.validateForm.value.name + ':' + this.validateForm.value.key_ + '.last()}' + res.equal + '' + res.value;
});
} else { //高级
data.condition = this.validateForm.value.condition_high;
data.faultCondition = this.validateForm.value.faultCondition_high;
}
if(this.title == "添加监测点"){
this.createTrigger(data);
}
if(this.title == "编辑监测点"){
this.updateTrigger(data);
}
}
//1.创建阈值
createTrigger(data){
const res = {
itemName:this.validateForm.value.name,
faultCondition:data.faultCondition,
condition:data.condition
};
this.overAllSer.createTrigger(res).subscribe(res=>{
})
}
//2.修改阈值
updateTrigger(data){
const res = {
triggerid:'',
itemName:this.validateForm.value.name,
faultCondition:data.faultCondition,
condition:data.condition
};
this.overAllSer.updateTrigger(data).subscribe(res=>{
})
}
//阈值--end
} }
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<th [nzChecked]="allChecked"></th> <th [nzChecked]="allChecked"></th>
<th>名称</th> <th>名称</th>
<th>告警状态</th> <th>告警状态</th>
<th>关联资产</th>
<th nzWidth="20%">状态</th> <th nzWidth="20%">状态</th>
<th>可用性</th> <th>可用性</th>
<th>操作</th> <th>操作</th>
...@@ -105,10 +106,11 @@ ...@@ -105,10 +106,11 @@
</ng-container> </ng-container>
<td class="round-tag"> <td class="round-tag">
<nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="color.red"></nz-tag>
<nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="'#fd9827'"></nz-tag> <nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="col.yellow"></nz-tag>
<span *ngIf="item.maxLevel < 2">正常</span> <nz-tag *ngIf="item.maxLevel < 2" [nzColor]="col.green"></nz-tag>
</td> </td>
<td>关联资产</td>
<td> <td>
<span *ngIf="item.status == 0">已监控</span> <span *ngIf="item.status == 0">已监控</span>
<span *ngIf="item.status == 1">未监控</span> <span *ngIf="item.status == 1">未监控</span>
...@@ -172,6 +174,7 @@ ...@@ -172,6 +174,7 @@
<li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li> <li (click)="showTempStop(item)" nz-menu-item><a>临时暂停</a></li>
<li (click)="goDetail(item)" nz-menu-item><a>查看监测点</a></li> <li (click)="goDetail(item)" nz-menu-item><a>查看监测点</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li> <li (click)="showAlarm(item)" nz-menu-item><a>添加告警</a></li>
<li (click)="showAlarm(item)" nz-menu-item><a>关联资产</a></li>
</ul> </ul>
</nz-dropdown> </nz-dropdown>
</ng-container> </ng-container>
...@@ -204,10 +207,11 @@ ...@@ -204,10 +207,11 @@
</ng-container> </ng-container>
<td class="round-tag tag-form"> <td class="round-tag tag-form">
<nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="color.red"></nz-tag>
<nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="'#fd9827'"></nz-tag> <nz-tag *ngIf="item.maxLevel == 2 || item.maxLevel == 3" [nzColor]="color.yellow"></nz-tag>
<span *ngIf="item.maxLevel < 2">正常</span> <nz-tag *ngIf="item.maxLevel < 2" [nzColor]="color.green"></nz-tag>
</td> </td>
<td>关联资产</td>
<td> <td>
<span *ngIf="item.status == 0">已监控</span> <span *ngIf="item.status == 0">已监控</span>
<span *ngIf="item.status == 1">未监控</span> <span *ngIf="item.status == 1">未监控</span>
...@@ -243,7 +247,6 @@ ...@@ -243,7 +247,6 @@
<ng-container *ngIf="item.jmx_available == 2"> <ng-container *ngIf="item.jmx_available == 2">
<nz-tag [nzColor]="'#d44f51'">JMX</nz-tag> <nz-tag [nzColor]="'#d44f51'">JMX</nz-tag>
</ng-container> </ng-container>
<ng-container *ngIf="item.ipmi_available == 0"> <ng-container *ngIf="item.ipmi_available == 0">
<nz-tag>IPMI</nz-tag> <nz-tag>IPMI</nz-tag>
</ng-container> </ng-container>
...@@ -298,12 +301,14 @@ ...@@ -298,12 +301,14 @@
<td class="round-tag tag-form"> <td class="round-tag tag-form">
<nz-tag *ngIf="item.maxLevel == 4 || item.maxLevel == 5" [nzColor]="color.red"></nz-tag> <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 || item.maxLevel == 3" [nzColor]="color.yellow"></nz-tag>
<span *ngIf="item.maxLevel < 2">正常</span> <nz-tag *ngIf="item.maxLevel < 2" [nzColor]="color.green"></nz-tag>
</td> </td>
<td>关联资产</td>
<td> <td>
<span *ngIf="item.status == 0">已监控</span> <span *ngIf="item.status == 0">已监控</span>
<span *ngIf="item.status == 1">未监控</span> <span *ngIf="item.status == 1">未监控</span>
</td> </td>
<td> <td>
<ng-container *ngIf="item.level"> <ng-container *ngIf="item.level">
<ng-container *ngIf="item.available == 0"> <ng-container *ngIf="item.available == 0">
......
...@@ -298,4 +298,15 @@ export class OverAllService { ...@@ -298,4 +298,15 @@ export class OverAllService {
findTree(): Observable<any>{ findTree(): Observable<any>{
return this.http.get(SERVER_API_URL + '/hostType/findTree'); return this.http.get(SERVER_API_URL + '/hostType/findTree');
} }
}
\ No newline at end of file //创建触发器
createTrigger(data){
return this.http.post(SERVER_API_URL + '/item/createItemTrigger',data);
}
//修改触发器
updateTrigger(data){
return this.http.post(SERVER_API_URL + '/item/updateItemTrigger',data);
}
}
<p> <div nz-row class="breadcrumbs" >
work-handle works! <div nz-col nzSpan="16">
</p> <nz-breadcrumb class="padding-8-0">
<nz-breadcrumb-item>
首页
</nz-breadcrumb-item>
<nz-breadcrumb-item>
<a>运维工作</a>
</nz-breadcrumb-item>
<nz-breadcrumb-item>
运维事件
</nz-breadcrumb-item>
</nz-breadcrumb>
</div>
<div nz-col nzSpan="8" class="text-right">
<button nz-button nzType="primary"><i class="anticon anticon-search"></i></button>
<button nz-button nzType="primary"><i class="anticon anticon-sync"></i></button>
<button nz-button nzType="primary"><i class="anticon anticon-arrows-alt"></i></button>
</div>
</div>
<div nz-row [nzGutter]="4" class="search-form">
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="事件分类">
<nz-option nzLabel="告警" nzValue="告警"></nz-option>
<nz-option nzLabel="严重" nzValue="严重"></nz-option>
</nz-select>
</div>
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="事件状态">
<nz-option nzLabel="" nzValue=""></nz-option>
</nz-select>
</div>
<div nz-col nzSpan="3">
<nz-select style="width: 100%;" nzShowSearch nzAllowClear nzPlaceHolder="事件来源">
<nz-option nzLabel="" nzValue=""></nz-option>
</nz-select>
</div>
<div nz-col nzSpan="8">
<nz-date-picker
nzShowTime
[nzFormat]="timeFormat"
[(ngModel)]="timeBegin"
nzPlaceHolder="开始时间"></nz-date-picker>
<nz-date-picker
nzShowTime
[nzFormat]="timeFormat"
[(ngModel)]="timeEnd"
nzPlaceHolder="结束时间"></nz-date-picker>
</div>
<div nz-col nzSpan="3">
<button nz-button nzType="default"><i class="anticon anticon-plus"></i>新增事件</button>
</div>
</div>
<nz-table #nzTable [nzData]="eventList">
<thead>
<tr>
<th>事件编号</th>
<th>标题</th>
<th>时间</th>
<th>时间来源</th>
<th>事件分类</th>
<th>处理人</th>
<th>状态</th>
<th style="text-align: center">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of eventList">
<td class="round-tag tag-form">
{{data.description}}
</td>
<td>
<span *ngIf="data.type == 0">邮件</span>
<span *ngIf="data.type == 1">脚本</span>
<span *ngIf="data.type == 2">SMS</span>
<span *ngIf="data.type == 3">Jabber</span>
<span *ngIf="data.type == 100">EZ texting</span>
</td>
<td>用于告警中</td>
<td>用于告警中</td>
<td>用于告警中</td>
<td>
<span *ngIf="data.status == 0">启用</span>
<span *ngIf="data.status == 1">暂停</span>
</td>
<td>细节</td>
<td class="handle text-center">
<span (click)="showEditModal(data)">编辑</span>
<span (click)="deleteSend(data)">删除</span>
<span (click)="operationSend('启用',0,data)" *ngIf="data.status == 1">启用</span>
<span (click)="operationSend('暂停',1,data)" *ngIf="data.status == 0">暂停</span>
</td>
</tr>
</tbody>
</nz-table>
\ No newline at end of file
...@@ -7,6 +7,10 @@ import { Component, OnInit } from '@angular/core'; ...@@ -7,6 +7,10 @@ import { Component, OnInit } from '@angular/core';
}) })
export class WorkHandleComponent implements OnInit { export class WorkHandleComponent implements OnInit {
timeFormatL = 'yyyy-MM-dd';
eventList;
timeBegin;
timeEnd;
constructor() { } constructor() { }
ngOnInit() { ngOnInit() {
......
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {Observable} from 'rxjs/Rx';
import {SERVER_API_URL} from '../app.constants';
import {HttpClient} from '@angular/common/http';
@Injectable() @Injectable()
export class WorkService { export class WorkService {
constructor() { } constructor(private http: HttpClient) {
}
//事件转派
transfer(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/transfer' ,data);
}
//修改事件
update(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/update' ,data);
}
//删除事件
delete(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/delete' ,data);
}
//查找事件列表
find(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/find' ,data);
}
//根据事件编号查询
findByNo(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/sysevent/find/' +params);
}
//添加事件
create(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/create' ,data);
}
//事件信息流转记录查询接口
transferInfo(params): Observable<any>{
return this.http.get(SERVER_API_URL + '/sysevent/transferInfo/' +params);
}
//处理事件
deal(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/sysevent/deal' ,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