Commit c7d456a5 authored by wangqinghua's avatar wangqinghua

update

parent 68020c1a
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<th>状态</th> <th>状态</th>
<th>发送方式</th> <th>发送方式</th>
<th>发送对象</th> <th>发送对象</th>
<th>操作</th> <!--<th>操作</th>-->
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -100,9 +100,9 @@ ...@@ -100,9 +100,9 @@
<td> <td>
{{data.sendto}} {{data.sendto}}
</td> </td>
<td class="handle main-color"> <!--<td class="handle main-color">-->
<span (click)="deleteLog(data)">删除</span> <!--<span (click)="deleteLog(data)">删除</span>-->
</td> <!--</td>-->
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<tr> <tr>
<th></th> <th></th>
<th>名称</th> <th>名称</th>
<th>主机名</th>
<th>键值</th> <th>键值</th>
</tr> </tr>
</thead> </thead>
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
<tr *ngFor="let data of basicTable1.data"> <tr *ngFor="let data of basicTable1.data">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="inselectItem(data,$event)"></td> <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="inselectItem(data,$event)"></td>
<td>{{data.name}}</td> <td>{{data.name}}</td>
<td>{{data.hostName}}</td>
<td>{{data.key}}</td> <td>{{data.key}}</td>
</tr> </tr>
</tbody> </tbody>
...@@ -40,6 +42,7 @@ ...@@ -40,6 +42,7 @@
<tr> <tr>
<th></th> <th></th>
<th>名称</th> <th>名称</th>
<th>主机名</th>
<th>键值</th> <th>键值</th>
</tr> </tr>
</thead> </thead>
...@@ -47,6 +50,7 @@ ...@@ -47,6 +50,7 @@
<tr *ngFor="let data of basicTable2.data"> <tr *ngFor="let data of basicTable2.data">
<td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="outselectItem(data,$event)"></td> <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="outselectItem(data,$event)"></td>
<td>{{data.name}}</td> <td>{{data.name}}</td>
<td>{{data.hostName}}</td>
<td>{{data.key}}</td> <td>{{data.key}}</td>
</tr> </tr>
</tbody> </tbody>
......
...@@ -100,7 +100,7 @@ export class LineComponent implements OnInit { ...@@ -100,7 +100,7 @@ export class LineComponent implements OnInit {
showModal(linkObj) { showModal(linkObj) {
this.hostIds = linkObj.hostIds; //线条上的主机id; this.hostIds = linkObj.hostIds; //线条上的主机id;
if(linkObj.itemId.length > 0){ if(linkObj.itemId && linkObj.itemId.length > 0){
this.itemId = linkObj.itemId.split(','); //线条上的监测点id; this.itemId = linkObj.itemId.split(','); //线条上的监测点id;
} }
this.isLine = true; this.isLine = true;
...@@ -124,6 +124,7 @@ export class LineComponent implements OnInit { ...@@ -124,6 +124,7 @@ export class LineComponent implements OnInit {
this.inList.forEach(e=>{ //进口流量回显 this.inList.forEach(e=>{ //进口流量回显
if(e.itemId == this.itemId[0]){ if(e.itemId == this.itemId[0]){
e.checked = true; e.checked = true;
this.inSelect = e;
} }
}) })
} }
...@@ -147,6 +148,7 @@ export class LineComponent implements OnInit { ...@@ -147,6 +148,7 @@ export class LineComponent implements OnInit {
this.outList.forEach(e=>{ this.outList.forEach(e=>{
if(e.itemId == this.itemId[1]){ //出口流量回显 if(e.itemId == this.itemId[1]){ //出口流量回显
e.checked = true; e.checked = true;
this.outSelect = e;
} }
}) })
} }
...@@ -156,22 +158,23 @@ export class LineComponent implements OnInit { ...@@ -156,22 +158,23 @@ export class LineComponent implements OnInit {
//进出口流量 //进出口流量
handleLineCancel() { handleLineCancel() {
this.inList = []; this.initForm();
this.outList = [];
this.inSearchName = null;
this.outSearchName = null;
this.isLine = false;
localStorage.setItem("line",'false'); localStorage.setItem("line",'false');
} }
handleLineOk() { handleLineOk() {
this.initForm();
editor.utils.setLink(this.inSelect,this.outSelect);
localStorage.setItem("line",'false');
}
initForm(){
this.inList = []; this.inList = [];
this.outList = []; this.outList = [];
this.itemId = [];
this.inSearchName = null; this.inSearchName = null;
this.outSearchName = null; this.outSearchName = null;
this.isLine = false; this.isLine = false;
editor.utils.setLink(this.inSelect,this.outSelect);
localStorage.setItem("line",'false');
} }
} }
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<div nz-row class="layui-layout layui-layout-admin header-bar"> <div nz-row class="layui-layout layui-layout-admin header-bar">
<div nz-col nzSpan="12" class="layui-header "> <div nz-col nzSpan="12" class="layui-header ">
<span (click)="addDevice()">添加设备</span> <span (click)="addDevice()">添加设备</span>
<span (click)="addCheck()">添加监测点</span> <!--<span (click)="addCheck()">添加监测点</span>-->
<span (click)="showAddImg()">添加图片</span> <span (click)="showAddImg()">添加图片</span>
<span onClick="editor.utils.deleteSelectedNodes()">移除</span> <span onClick="editor.utils.deleteSelectedNodes()">移除</span>
<nz-select style="width: 200px;" nzPlaceHolder="选择线条" [(ngModel)]="lineType" <nz-select style="width: 200px;" nzPlaceHolder="选择线条" [(ngModel)]="lineType"
......
...@@ -64,8 +64,8 @@ declare var layui: any; ...@@ -64,8 +64,8 @@ declare var layui: any;
.lineList{ .lineList{
position: absolute; position: absolute;
top: 5px; top: 5px;
left: 20px; right: 20px;
color: #6097b7; color: red;
cursor: pointer; cursor: pointer;
} }
...@@ -89,6 +89,7 @@ declare var layui: any; ...@@ -89,6 +89,7 @@ declare var layui: any;
}) })
export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDestroy { export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDestroy {
@ViewChild('topologyCanvas') topologyCanvas: ElementRef; @ViewChild('topologyCanvas') topologyCanvas: ElementRef;
@ViewChild('topologyBody') topologyBody: ElementRef;
@ViewChild('smartTopology') smartTopology: TopologyComponent; @ViewChild('smartTopology') smartTopology: TopologyComponent;
@ViewChild('smartCheck') smartCheck: CheckComponent; @ViewChild('smartCheck') smartCheck: CheckComponent;
@ViewChild('smartSelectGroup') smartSelectGroup: SelectGroupComponent; @ViewChild('smartSelectGroup') smartSelectGroup: SelectGroupComponent;
...@@ -135,7 +136,9 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -135,7 +136,9 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
} }
ngAfterViewInit() { ngAfterViewInit() {
this.loadCanvas(); const canvasWidth = this.topologyBody.nativeElement.clientWidth;
const canvasHeight = this.topologyBody.nativeElement.clientHeight;
editor.loadTopology('','', 'img/backimg.png',canvasWidth,canvasHeight);
} }
ngDoCheck(){ ngDoCheck(){
...@@ -251,7 +254,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -251,7 +254,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
} }
this.topologySer.findByHostIdOrWeb(data).subscribe( this.topologySer.findByHostIdOrWeb(data).subscribe(
(res)=>{ (res)=>{
editor.utils.addNode(res.data[0].url, '',e[0]); editor.utils.addNode(res.data[0].url, res.data[0].name,e[0]);
} }
) )
} }
...@@ -286,6 +289,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -286,6 +289,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.message.success('编辑成功'); this.message.success('编辑成功');
this.getList(); this.getList();
this.getDetail();
} else { } else {
this.message.error(res.errMsg); this.message.error(res.errMsg);
} }
...@@ -293,28 +297,11 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -293,28 +297,11 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
); );
} }
//load
loadCanvas() {
editor.loadTopology('','', 'img/backimg.png');
}
interval(arr,str){
arr.forEach(e2=>{
setInterval(function(){
if(e2.alarm == str){
e2.alarm = null;
}else{
e2.alarm = str
}
}, 600);
})
}
//查询单个 //查询单个
getDetail(id) { getDetail() {
this.isLoading = true; this.isLoading = true;
this.topologySer.findItem(id).subscribe( this.topologySer.findItem( this.topoId).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
if (res.data.json.length > 0) { if (res.data.json.length > 0) {
...@@ -348,6 +335,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -348,6 +335,7 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
const hostIds = []; const hostIds = [];
arr.forEach(e=>{ arr.forEach(e=>{
if(e.elementType == 'link' && e.itemId && e.itemId.length > 0){ if(e.elementType == 'link' && e.itemId && e.itemId.length > 0){
console.log(e);
const data = { const data = {
itemIdIn:e.itemId.split(',')[0], itemIdIn:e.itemId.split(',')[0],
itemIdOut:e.itemId.split(',')[1], itemIdOut:e.itemId.split(',')[1],
...@@ -379,20 +367,20 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe ...@@ -379,20 +367,20 @@ export class NeTopologyComponent implements OnInit, DoCheck, AfterViewInit, OnDe
if(e1.elementId == e2.hostId){ if(e1.elementId == e2.hostId){
if(e1.status == -2){ if(e1.status == -2){
e2.alarm = "主机被删除,请及时清理"; e2.alarm = "主机被删除,请及时清理";
e2.fontColor='255,255,255'; e2.fontColor='0,0,0';
e2.alarmAlpha=0.9; e2.alarmAlpha=0.9;
// dlist.push(e2) // dlist.push(e2)
} }
if(e1.status == 1){ if(e1.status == 1){
e2.alarm = "危险"; e2.alarm = "危险";
e2.fontColor='255,255,255'; e2.fontColor='0,0,0';
e2.alarmColor='255,153,18'; e2.alarmColor='255,153,18';
e2.alarmAlpha=0.9; e2.alarmAlpha=0.9;
// wlist.push(e2); // wlist.push(e2);
} }
if(e1.status == 2){ if(e1.status == 2){
e2.alarm = "故障"; e2.alarm = "故障";
e2.fontColor='255,255,255'; e2.fontColor='0,0,0';
e2.alarmAlpha=0.9; e2.alarmAlpha=0.9;
// glist.push(e2); // glist.push(e2);
} }
......
...@@ -67,7 +67,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -67,7 +67,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
dataSet: any[]; dataSet: any[];
panel1 = {active: true, name: '响应时间与丢包率', disabled: false}; 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}; panel3 = {active: true, name: '磁盘使用情况', disabled: false};
//监控点 //监控点
isBasicEdit; isBasicEdit;
...@@ -122,19 +122,18 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -122,19 +122,18 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
constructor(private routerInfo: ActivatedRoute, private message: NzMessageService, constructor(private routerInfo: ActivatedRoute, private message: NzMessageService,
private overAllSer: OverAllService, private renderer: Renderer,private router:Router, private overAllSer: OverAllService, private renderer: Renderer,private router:Router,
private fb: FormBuilder, private modalService: NzModalService,private datePipe:DatePipe) { private fb: FormBuilder, private modalService: NzModalService,private datePipe:DatePipe) {
}
ngOnInit() {
this.isSpinning = true;
this.routerInfo.queryParams.subscribe(queryParams => { this.routerInfo.queryParams.subscribe(queryParams => {
this.hostId = queryParams.hostId; this.hostId = queryParams.hostId;
this.hostName = queryParams.name; this.hostName = queryParams.name;
this.realName = queryParams.hostName; this.realName = queryParams.hostName;
}); });
}
ngOnInit() {
this.isSpinning = true;
this.responseTime(); this.responseTime();
this.losed(); this.losed();
this.cpused(); this.cpused();
this.disks();
this.used(); this.used();
// this.inOutInfo(); // this.inOutInfo();
...@@ -144,6 +143,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -144,6 +143,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
//历史告警 //历史告警
const obj = {}; const obj = {};
this.warnList.getList(obj); this.warnList.getList(obj);
this.disks();
} }
ngAfterViewInit() { ngAfterViewInit() {
...@@ -459,14 +459,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -459,14 +459,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
show: false, show: false,
}, },
yAxis: { yAxis: {
axisLabel:{ triggerEvent: true,
interval:0,
margin:95,
textStyle: {
align:'left',
baseline:'middle'
}
},
type: 'category', type: 'category',
axisTick: { axisTick: {
show: false show: false
...@@ -481,6 +474,13 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -481,6 +474,13 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
data: res.data.disks.map((item) => { data: res.data.disks.map((item) => {
return item.name; return item.name;
}), }),
axisLabel:res.data.disks.map((item) => {
let data = item.name;
if(data.length > 5) {
data = data.substring(0, 4) + "..";
}
return data;
}),
}, },
color: ['#ed7a7b', '#f2f2f2'], color: ['#ed7a7b', '#f2f2f2'],
series: [ series: [
...@@ -592,6 +592,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -592,6 +592,7 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
} }
] ]
}; };
} else { } else {
this.message.info(res.errMsg); this.message.info(res.errMsg);
} }
...@@ -600,6 +601,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit { ...@@ -600,6 +601,10 @@ export class BasicDetailComponent implements OnInit, AfterViewInit {
); );
} }
extension(){
}
add(arr) { add(arr) {
let total = 0; let total = 0;
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
<th>说明</th> <th>说明</th>
<!--<th>权限模块</th>--> <!--<th>权限模块</th>-->
<!--<th>资源权限</th>--> <!--<th>资源权限</th>-->
<th>有效</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
...@@ -46,11 +45,11 @@ ...@@ -46,11 +45,11 @@
<td>{{data.comment}}</td> <td>{{data.comment}}</td>
<!--<td>{{data.key3}}</td>--> <!--<td>{{data.key3}}</td>-->
<!--<td>{{data.key4}}</td>--> <!--<td>{{data.key4}}</td>-->
<td> <!--<td>-->
<ng-container *ngIf="data.status == 0"> <!--<ng-container *ngIf="data.status == 0">-->
<i class="anticon anticon-check"></i> <!--<i class="anticon anticon-check"></i>-->
</ng-container> <!--</ng-container>-->
</td> <!--</td>-->
<td class="handle main-color"> <td class="handle main-color">
<span (click)="grantUser(data)">授予用户</span> <span (click)="grantUser(data)">授予用户</span>
<!--<span (click)="lookRole(data)">查看</span>--> <!--<span (click)="lookRole(data)">查看</span>-->
......
...@@ -46,7 +46,7 @@ TopologyPanel.prototype.resetTopology = function (url) { ...@@ -46,7 +46,7 @@ TopologyPanel.prototype.resetTopology = function (url) {
* @param topologyGuid 拓扑 表记录ID * @param topologyGuid 拓扑 表记录ID
* @param backImg 拓扑图的背景图片 * @param backImg 拓扑图的背景图片
*/ */
TopologyPanel.prototype.loadTopology = function (response, topologyGuid, backImg) { TopologyPanel.prototype.loadTopology = function (response, topologyGuid, backImg,canvasWidth,canvasHeight) {
// 错误处理 // 错误处理
if (!response) { if (!response) {
// 拓扑不存在,创建一个空白的拓扑图 // 拓扑不存在,创建一个空白的拓扑图
...@@ -68,10 +68,10 @@ TopologyPanel.prototype.loadTopology = function (response, topologyGuid, backImg ...@@ -68,10 +68,10 @@ TopologyPanel.prototype.loadTopology = function (response, topologyGuid, backImg
} }
] ]
} }
editor.init(topologyGuid, backImg, initTopologyJson, '') editor.init(topologyGuid, backImg, initTopologyJson,canvasWidth,canvasHeight)
} else { } else {
// 拓扑存在,渲染拓扑图 // 拓扑存在,渲染拓扑图
editor.init(topologyGuid, backImg, response, '') editor.init(topologyGuid, backImg, response,canvasWidth,canvasHeight)
} }
} }
...@@ -507,7 +507,7 @@ TopologyEditor.prototype.replaceStage = function (url) { ...@@ -507,7 +507,7 @@ TopologyEditor.prototype.replaceStage = function (url) {
* @param backImg 背景图片 * @param backImg 背景图片
* @param topologyJson 拓扑JSON结构 * @param topologyJson 拓扑JSON结构
*/ */
TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) { TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson,canvasWidth,canvasHeight) {
if (!topologyJson) { if (!topologyJson) {
// alert('加载拓扑编辑器失败!') // alert('加载拓扑编辑器失败!')
return return
...@@ -515,8 +515,8 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) { ...@@ -515,8 +515,8 @@ TopologyEditor.prototype.init = function (topologyGuid, backImg, topologyJson) {
this.topologyGuid = topologyGuid this.topologyGuid = topologyGuid
// 创建jTopo舞台屏幕对象 // 创建jTopo舞台屏幕对象
var canvas = document.getElementById('topology-canvas') var canvas = document.getElementById('topology-canvas')
canvas.width = $('#topology-body').width() canvas.width = canvasWidth;
canvas.height = $('#topology-body').height() canvas.height = canvasHeight;
// 加载空白的编辑器 // 加载空白的编辑器
if (topologyJson === '-1') { if (topologyJson === '-1') {
this.stage = new JTopo.Stage(canvas) // 定义舞台对象 this.stage = new JTopo.Stage(canvas) // 定义舞台对象
...@@ -1181,6 +1181,8 @@ editor.utils = { ...@@ -1181,6 +1181,8 @@ editor.utils = {
}; };
var self = this; var self = this;
var link = editor.scene.selectedElements; var link = editor.scene.selectedElements;
link[0].itemId = "";
link[0].text = "";
if(inItem){ if(inItem){
link[0].text = "进口流量:"+inItem.name; link[0].text = "进口流量:"+inItem.name;
link[0].itemId = (inItem.itemId) link[0].itemId = (inItem.itemId)
...@@ -1197,6 +1199,7 @@ editor.utils = { ...@@ -1197,6 +1199,7 @@ editor.utils = {
}; };
var self = this; var self = this;
var node = editor.scene.selectedElements; var node = editor.scene.selectedElements;
node[0].text = "";
node[0].text = item.name; node[0].text = item.name;
// node[0].setImage(topoImgPath + item.img); // node[0].setImage(topoImgPath + item.img);
// node[0].nodeImage = item.img; // node[0].nodeImage = item.img;
......
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