Commit 4f6f6ce6 authored by wangqinghua's avatar wangqinghua

网站监测

parent 5650d831
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of logList"> <tr *ngFor="let data of logList">
<td class="round-tag"> <td class="round-tag tag-form">
<nz-tag [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag [nzColor]="'#fc0d1b'"></nz-tag>
{{data.subject}} {{data.subject}}
</td> </td>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of setList"> <tr *ngFor="let data of setList">
<td class="round-tag"> <td class="round-tag tag-form">
<nz-tag [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag [nzColor]="'#fc0d1b'"></nz-tag>
{{data.name}} {{data.name}}
</td> </td>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<span>当前告警数:120</span> <span>当前告警数:120</span>
</div> </div>
</div> </div>
<div class="tag-warn"> <div class="tag-warn tag-form">
<span *ngFor="let item of warnCountList"> <span *ngFor="let item of warnCountList">
<nz-tag *ngIf="item.level == 4 || item.level == 5" [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag *ngIf="item.level == 4 || item.level == 5" [nzColor]="'#fc0d1b'"></nz-tag>
<nz-tag *ngIf="item.level == 2 || item.level == 3" [nzColor]="'#fd9827'"></nz-tag> <nz-tag *ngIf="item.level == 2 || item.level == 3" [nzColor]="'#fd9827'"></nz-tag>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of sendList"> <tr *ngFor="let data of sendList">
<td class="round-tag"> <td class="round-tag tag-form">
<nz-tag [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag [nzColor]="'#fc0d1b'"></nz-tag>
{{data.description}} {{data.description}}
</td> </td>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<td class="table-timeline"> <td class="table-timeline">
<nz-timeline-item>{{data.clock | date:'yyyy-MM-dd HH:MM:ss'}}</nz-timeline-item> <nz-timeline-item>{{data.clock | date:'yyyy-MM-dd HH:MM:ss'}}</nz-timeline-item>
</td> </td>
<td class="round-tag"> <td class="round-tag tag-form">
<nz-tag *ngIf="data.priority == 4 || data.priority == 5" [nzColor]="'#fc0d1b'"></nz-tag> <nz-tag *ngIf="data.priority == 4 || data.priority == 5" [nzColor]="'#fc0d1b'"></nz-tag>
<nz-tag *ngIf="data.priority == 2 || data.priority == 3" [nzColor]="'#fd9827'"></nz-tag> <nz-tag *ngIf="data.priority == 2 || data.priority == 3" [nzColor]="'#fd9827'"></nz-tag>
</td> </td>
......
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({ @Component({
selector: 'smart-website', selector: 'smart-website',
...@@ -14,28 +16,28 @@ export class WebsiteComponent implements OnInit { ...@@ -14,28 +16,28 @@ export class WebsiteComponent implements OnInit {
validateForm; validateForm;
steps = []; steps = [];
constructor() { constructor(private overAllSer:OverAllService,private message:NzMessageService) {
} }
ngOnInit() { ngOnInit() {
this.initForm(); this.initForm();
} }
initForm(){ initForm() {
this.steps = []; this.steps = [];
this.validateForm = { this.validateForm = {
name:'', name: '',
hostid:null, hostid: null,
applicationid:null, applicationid: null,
delay:'', delay: '',
retries:null, retries: null,
variables:'', variables: '',
http_proxy:'', http_proxy: '',
ssl_cert_file:'', ssl_cert_file: '',
ssl_key_file:'', ssl_key_file: '',
ssl_key_password:'', ssl_key_password: '',
steps:this.steps, steps: this.steps,
} };
} }
showAddModal() { showAddModal() {
...@@ -48,14 +50,39 @@ export class WebsiteComponent implements OnInit { ...@@ -48,14 +50,39 @@ export class WebsiteComponent implements OnInit {
} }
handleOk() { handleOk() {
this.isVisible = false; // this.isVisible = false;
if(this.title == '添加网站监测'){
this.create();
}else{
this.update();
}
}
//创建
create(){
const data = {};
this.overAllSer.createWebscenario(this.validateForm).subscribe(
(res)=>{
if(res.errCode == 10000){
this.message.info('添加成功');
this.initForm();
}else{
this.message.info(res.errMsg);
}
}
)
}
//更新
update(){
} }
handleCancel() { handleCancel() {
this.isVisible = false; this.isVisible = false;
} }
tabsChange(index){ tabsChange(index) {
this.tabNum = index; this.tabNum = index;
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<a>综合监控</a> <a>综合监控</a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
基础资源监控 <a routerLink="../basic">基础资源监控</a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
资源名称 资源名称
......
...@@ -348,7 +348,7 @@ export class BasicComponent implements OnInit { ...@@ -348,7 +348,7 @@ export class BasicComponent implements OnInit {
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: () => { nzOnOk: () => {
const data = {params: []}; const data = {params: []};
data.params.push(item.id); data.params.push(item.groupid);
this.overAllSer.deleteGroup(data).subscribe( this.overAllSer.deleteGroup(data).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
......
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
<div nz-col nzSpan="12" class="text-right"> <div nz-col nzSpan="12" class="text-right">
<button nz-button nzType="default" (click)="showAddmodal()"><i class="anticon anticon-plus"></i>添加网站 <button nz-button nzType="default" (click)="showAddmodal()"><i class="anticon anticon-plus"></i>添加网站
</button> </button>
<button (click)="openBatchHost(1,'关闭')" nz-button nzType="default"><i <button (click)="openBatchHost(1,'禁用')" nz-button nzType="default"><i
class="anticon anticon-pause-circle-o"></i>停止监控 class="anticon anticon-pause-circle-o"></i>停止监控
</button> </button>
<button (click)="openBatchHost(0,'开启')" nz-button nzType="default"><i class="anticon anticon-play-circle-o"></i>开启监控 <button (click)="openBatchHost(0,'启用')" nz-button nzType="default"><i class="anticon anticon-play-circle-o"></i>开启监控
</button> </button>
<button (click)="batchDeleteConfirm()" nz-button nzType="default"><i class="anticon anticon-close-circle"></i>删除网站 <button (click)="batchDeleteConfirm()" nz-button nzType="default"><i class="anticon anticon-close-circle"></i>删除网站
</button> </button>
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
<!--资源分组--> <!--资源分组-->
<ng-container *ngFor="let item of dataSet"> <ng-container *ngFor="let item of dataSet">
<tr> <tr>
<!--子集-->
<td nzShowCheckbox (nzCheckedChange)="selectChecked($event,item)"></td> <td nzShowCheckbox (nzCheckedChange)="selectChecked($event,item)"></td>
<td class="cursor"> <td class="cursor">
<span (click)="goDetail(item)">{{item.name}}</span> <span (click)="goDetail(item)">{{item.name}}</span>
......
...@@ -3,6 +3,7 @@ import {OverAllService} from '../overAll.service'; ...@@ -3,6 +3,7 @@ import {OverAllService} from '../overAll.service';
import {pageSize} from '../../app.constants'; import {pageSize} from '../../app.constants';
import {WebsiteComponent} from '../../modal/website/website.component'; import {WebsiteComponent} from '../../modal/website/website.component';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
@Component({ @Component({
selector: 'smart-network-check', selector: 'smart-network-check',
...@@ -29,7 +30,10 @@ export class NetworkCheckComponent implements OnInit { ...@@ -29,7 +30,10 @@ export class NetworkCheckComponent implements OnInit {
gray: '' gray: ''
}; };
constructor(private overAllSer: OverAllService,private router:Router) { batchSelectList = [];
constructor(private overAllSer: OverAllService,private router:Router,
private modalService:NzModalService,private message:NzMessageService) {
} }
ngOnInit() { ngOnInit() {
...@@ -70,18 +74,82 @@ export class NetworkCheckComponent implements OnInit { ...@@ -70,18 +74,82 @@ export class NetworkCheckComponent implements OnInit {
} }
//选中
selectChecked(event,item){
if(event){
this.batchSelectList.push(item.httptestid);
}else{
const index = this.batchSelectList.indexOf(item.hostid);
this.batchSelectList.splice(index,1);
}
}
//添加网站 //添加网站
showAddmodal(){ showAddmodal(){
this.smartWebsite.showAddModal(); this.smartWebsite.showAddModal();
} }
//批量开启or关闭 //批量开启or关闭
openBatchHost(status,opreation){ openBatchHost(status,operation){
if(this.batchSelectList.length == 0){
this.message.info('请选择需要'+ operation +'的网站监测');
return false;
}
this.modalService.confirm({
nzTitle: '监控',
nzContent: '确定批量'+operation+'网站监测?',
nzOkText: '确定',
nzCancelText: '取消',
nzOnOk: () => {
const data = {
status:status,
ids:this.batchSelectList
}
this.overAllSer.statusBatch(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('修改成功');
this.batchSelectList = [];
this.getwebList();
} else {
this.message.info(res.errMsg);
}
}
);
},
nzOnCancel: () => console.log('Cancel')
});
} }
//批量删除 //批量删除
batchDeleteConfirm(){ batchDeleteConfirm(){
if(this.batchSelectList.length == 0){
this.message.info('请选择需要删除的网站监测');
return false;
}
this.modalService.confirm({
nzTitle: '删除',
nzContent: '<b style="color: red;">确认要删除所选网站监测吗?</b>',
nzOkText: '确定',
nzOkType: 'danger',
nzOnOk: () => {
const data = {
ids:this.batchSelectList
}
this.overAllSer.deleteBatch(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.message.info('删除成功');
this.batchSelectList = [];
this.getwebList();
} else {
this.message.info(res.errMsg);
}
}
);
},
nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel')
});
} }
} }
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<nz-breadcrumb-item> <nz-breadcrumb-item>
<a>综合监控</a> <a>综合监控</a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item >
网站监测 <a routerLink="../networkCheck">网站监测</a>
</nz-breadcrumb-item> </nz-breadcrumb-item>
<nz-breadcrumb-item> <nz-breadcrumb-item>
网站名称 网站名称
...@@ -32,56 +32,72 @@ ...@@ -32,56 +32,72 @@
<section> <section>
<div nz-row nzGutter="24"> <div nz-row nzGutter="24">
<div nz-col nzSpan="12"> <div nz-col nzSpan="12">
<div> <nz-card nzTitle="当前状态" [nzExtra]="extraTemplate">
<div> <nz-table #basicTable [nzData]="nowStatus" [nzShowPagination]="false">
<span>当前状态</span><span>最近一次检查时间</span><span>2013123</span> <thead>
</div> <tr>
<div nz-row nzGutter="24"> <th>状态</th>
<div nz-col nzSpan="4">状态</div> <th>No.</th>
<div nz-col nzSpan="4">No.</div> <th>步骤</th>
<div nz-col nzSpan="4">步骤</div> <th>速度</th>
<div nz-col nzSpan="4">速度</div> <th>响应时间</th>
<div nz-col nzSpan="4">响应时间</div> <th>响应代码</th>
<div nz-col nzSpan="4">响应代码</div> </tr>
</div> </thead>
<ng-container *ngFor="let item of nowStatus"> <tbody>
<div nz-row nzGutter="24"> <tr *ngFor="let data of basicTable.data">
<div nz-col nzSpan="4">{{item.status}}</div> <td>{{data.name}}</td>
<div nz-col nzSpan="4">{{item.no}}</div> <td>{{data.age}}</td>
<div nz-col nzSpan="4">{{item.name}}</div> <td>{{data.address}}</td>
<div nz-col nzSpan="4">{{item.download}}</div> <td>{{data.address}}</td>
<div nz-col nzSpan="4">{{item.response}}</div> <td>{{data.address}}</td>
<div nz-col nzSpan="4">{{item.response_code}}</div> <td></td>
</div> </tr>
</ng-container> <tr>
<div nz-row nzGutter="24"> <td></td>
<div nz-col nzSpan="8">总计</div> <td>总计</td>
<div nz-col nzSpan="16">No.</div> <td></td>
</div> <td>68.4ms</td>
</div> <td></td>
<td></td>
</tr>
</tbody>
</nz-table>
</nz-card>
<ng-template #extraTemplate>
<span>最近一次检查时间</span><span>2013123</span>
</ng-template>
</div> </div>
<div nz-col nzSpan="12"> <div nz-col nzSpan="12">
<div>阈值设定</div> <nz-card nzTitle="阈值设定">
<div nz-row nzGutter="24"> <nz-table #basicTable [nzData]="triggerList" [nzShowPagination]="false">
<div nz-col nzSpan="4">级别</div> <thead>
<div nz-col nzSpan="4">步骤</div> <tr>
<div nz-col nzSpan="4">阈值信息</div> <th>级别</th>
</div> <th>步骤</th>
<ng-container> <th>阈值信息</th>
<div nz-row nzGutter="24" *ngFor="let item of triggerList"> </tr>
<div nz-col nzSpan="4"> </thead>
<span *ngIf="item.priority ==2 ">故障</span> <tbody>
<span *ngIf="item.priority ==4 ">危险</span> <tr *ngFor="let data of basicTable.data">
</div> <td>
<div nz-col nzSpan="4">{{item.name}}</div> <span *ngIf="data.priority ==2 ">故障</span>
<div nz-col nzSpan="4">{{item.expression}}</div> <span *ngIf="data.priority ==4 ">危险</span>
</div> </td>
</ng-container> <td>{{data.name}}</td>
<td>{{data.expression}}</td>
</tr>
</tbody>
</nz-table>
</nz-card>
</div> </div>
</div> </div>
<div nz-row style="margin: 30px 0;"> <div style="margin: 30px 0;">
<div> <div nz-row>
<div nz-col [nzSpan]="3">
<span>监测数据图表</span> <span>监测数据图表</span>
</div>
<div nz-col [nzSpan]="8">
<nz-radio-group style="width: 100%;" [nzButtonStyle]="'solid'"> <nz-radio-group style="width: 100%;" [nzButtonStyle]="'solid'">
<label nz-radio-button nzValue="1">今天</label> <label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label> <label nz-radio-button nzValue="2">昨天</label>
...@@ -90,8 +106,23 @@ ...@@ -90,8 +106,23 @@
<label nz-radio-button nzValue="5">自定义</label> <label nz-radio-button nzValue="5">自定义</label>
</nz-radio-group> </nz-radio-group>
</div> </div>
<div>速度</div> </div>
<div>响应时间</div> <div nz-row>
<div nz-col [nzSpan]="6">
</div>
<div nz-col [nzSpan]="18">
</div>
</div>
<div nz-row>
<div nz-col [nzSpan]="6">
</div>
<div nz-col [nzSpan]="18">
</div>
</div>
</div> </div>
</section> </section>
</nz-tab> </nz-tab>
......
...@@ -237,7 +237,7 @@ export class OverAllService { ...@@ -237,7 +237,7 @@ export class OverAllService {
//启用禁用网站监测 //启用禁用网站监测
statusBatch(data): Observable<any>{ statusBatch(data): Observable<any>{
return this.http.post(SERVER_API_URL + '/statusBatch' ,data); return this.http.post(SERVER_API_URL + '/webscenario/statusBatch' ,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