Commit 96ff4459 authored by wangqinghua's avatar wangqinghua

告警模块

parent ac4ade89
...@@ -24,4 +24,21 @@ ...@@ -24,4 +24,21 @@
<span>当前告警数:120</span> <span>当前告警数:120</span>
</div> </div>
</div> </div>
<div>
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择级别" [(ngModel)]="selectedValue" (ngModelChange)="select()" >
<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>
<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>
</nz-select>
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择分组" [(ngModel)]="selectedValue" (ngModelChange)="select()" >
<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>
<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>
</nz-select>
<nz-select style="width: 200px;" nzShowSearch nzAllowClear nzPlaceHolder="选择资源类型" [(ngModel)]="selectedValue" (ngModelChange)="select()" >
<nz-option nzLabel="按设备类型展开" nzValue="type"></nz-option>
<nz-option nzLabel="按资源分组展开" nzValue="group"></nz-option>
</nz-select>
<nz-radio-group [(ngModel)]="itemTypeValue" [nzButtonStyle]="'solid'">
<label *ngFor="let item of itemTypeList" (click)="changeType(item.applicationid)" nz-radio-button nzValue="{{item.applicationid}}">{{item.name}}</label>
</nz-radio-group>
</div>
<smart-warn-list #warnList></smart-warn-list> <smart-warn-list #warnList></smart-warn-list>
\ No newline at end of file
<!--添加资源--> <!--添加资源-->
<nz-modal [nzWidth]="980" [nzFooter]="null" [(nzVisible)]="isBasicEdit" nzTitle="{{modalTitle}}" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()"> <nz-modal [nzWidth]="1080" [nzFooter]="null" [(nzVisible)]="isBasicEdit" nzTitle="{{modalTitle}}"
(nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()">
<nz-tabset [nzSelectedIndex]="tabNum" style="padding-bottom: 25px;min-height: 500px"> <nz-tabset [nzSelectedIndex]="tabNum" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="资源信息"> <nz-tab nzTitle="资源信息">
<div nz-form class="ant-advanced-search-form form-select"> <div nz-form class="ant-advanced-search-form form-select">
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="equipmentType">设备类型</nz-form-label> <nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="equipmentType">设备类型
</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select name="equipmentType" nzShowSearch nzAllowClear nzPlaceHolder="选择设备类型" [(ngModel)]="validateForm.hostExtend.equipmentType"> <nz-select name="equipmentType" nzShowSearch nzAllowClear nzPlaceHolder="选择设备类型"
[(ngModel)]="validateForm.hostExtend.equipmentType">
<nz-option nzValue="存储" nzLabel="存储"></nz-option> <nz-option nzValue="存储" nzLabel="存储"></nz-option>
<nz-option nzValue="交换机" nzLabel="交换机"></nz-option> <nz-option nzValue="交换机" nzLabel="交换机"></nz-option>
<nz-option nzValue="服务器" nzLabel="服务器"></nz-option> <nz-option nzValue="服务器" nzLabel="服务器"></nz-option>
...@@ -26,7 +29,8 @@ ...@@ -26,7 +29,8 @@
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="os">操作系统</nz-form-label> <nz-form-label [nzSpan]="6" nzFor="os">操作系统</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="os" nz-input placeholder="操作系统" name="inventory_os" [(ngModel)]="validateForm.inventory.os"> <input id="os" nz-input placeholder="操作系统" name="inventory_os"
[(ngModel)]="validateForm.inventory.os">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
...@@ -35,9 +39,11 @@ ...@@ -35,9 +39,11 @@
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="secondLevelType">二级类型</nz-form-label> <nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="secondLevelType">二级类型
</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select name="secondLevelType" nzShowSearch nzAllowClear nzPlaceHolder="选择二级类型" [(ngModel)]="validateForm.hostExtend.secondLevelType"> <nz-select name="secondLevelType" nzShowSearch nzAllowClear nzPlaceHolder="选择二级类型"
[(ngModel)]="validateForm.hostExtend.secondLevelType">
<nz-option nzValue="存储" nzLabel="存储"></nz-option> <nz-option nzValue="存储" nzLabel="存储"></nz-option>
<nz-option nzValue="交换机" nzLabel="交换机"></nz-option> <nz-option nzValue="交换机" nzLabel="交换机"></nz-option>
<nz-option nzValue="服务器" nzLabel="服务器"></nz-option> <nz-option nzValue="服务器" nzLabel="服务器"></nz-option>
...@@ -55,7 +61,8 @@ ...@@ -55,7 +61,8 @@
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="name">厂商</nz-form-label> <nz-form-label [nzSpan]="6" nzFor="name">厂商</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="inventory_name" nz-input placeholder="厂商" name="inventory_name" [(ngModel)]="validateForm.inventory.name"> <input id="inventory_name" nz-input placeholder="厂商" name="inventory_name"
[(ngModel)]="validateForm.inventory.name">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
...@@ -75,7 +82,8 @@ ...@@ -75,7 +82,8 @@
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="serialno_a">产品序列号</nz-form-label> <nz-form-label [nzSpan]="6" nzFor="serialno_a">产品序列号</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="serialno_a" nz-input placeholder="产品序列号" name="inventory_serialno_a" [(ngModel)]="validateForm.inventory.serialno_a"> <input id="serialno_a" nz-input placeholder="产品序列号" name="inventory_serialno_a"
[(ngModel)]="validateForm.inventory.serialno_a">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
...@@ -98,19 +106,21 @@ ...@@ -98,19 +106,21 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="serviceid">关联业务</nz-form-label> <nz-form-label [nzSpan]="4" nzFor="serviceid">关联业务</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select name="serviceid" [(ngModel)]="validateForm.hostExtend.serviceid" nzPlaceHolder="无关联业务"> <nz-select name="serviceid" [(ngModel)]="validateForm.hostExtend.serviceid"
nzPlaceHolder="无关联业务">
<nz-option nzValue="" nzLabel="无"></nz-option> <nz-option nzValue="" nzLabel="无"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item > <nz-form-item>
<nz-form-label [nzSpan]="4">添加接口</nz-form-label> <nz-form-label [nzSpan]="4">添加接口</nz-form-label>
<nz-form-control [nzSpan]="20"> <nz-form-control [nzSpan]="20">
<div nz-row [nzGutter]="12">
<ng-container *ngFor="let item of interfaceslist;let i = index;"> <ng-container *ngFor="let item of interfaceslist;let i = index;">
<nz-form-control nz-col [nzSpan]="2"> <div nz-row [nzGutter]="12">
<nz-select name="main" nzPlaceHolder="选择接口类型" [(ngModel)]="item.main"> <nz-form-control nz-col [nzSpan]="3">
<nz-select name="main" nzPlaceHolder="选择接口类型" [(ngModel)]="item.main"
(ngModelChange)="changeMain(i)">
<nz-option nzValue="1" nzLabel="默认"></nz-option> <nz-option nzValue="1" nzLabel="默认"></nz-option>
<nz-option nzValue="0" nzLabel="不默认"></nz-option> <nz-option nzValue="0" nzLabel="不默认"></nz-option>
</nz-select> </nz-select>
...@@ -121,8 +131,9 @@ ...@@ -121,8 +131,9 @@
<nz-form-control nz-col [nzSpan]="4"> <nz-form-control nz-col [nzSpan]="4">
<input type="text" placeholder="DNS名称" nz-input name="dns" [(ngModel)]="item.dns"> <input type="text" placeholder="DNS名称" nz-input name="dns" [(ngModel)]="item.dns">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="6"> <nz-form-control nz-col [nzSpan]="5">
<nz-select name="type" nzPlaceHolder="连接类型" [(ngModel)]="item.type" (ngModelChange)="changePort(i)"> <nz-select name="type" nzPlaceHolder="连接类型" [(ngModel)]="item.type"
(ngModelChange)="changePort(i)">
<nz-option nzValue="1" nzLabel="agent代理程序接口"></nz-option> <nz-option nzValue="1" nzLabel="agent代理程序接口"></nz-option>
<nz-option nzValue="2" nzLabel="SNMP接口"></nz-option> <nz-option nzValue="2" nzLabel="SNMP接口"></nz-option>
<nz-option nzValue="3" nzLabel="JMX接口"></nz-option> <nz-option nzValue="3" nzLabel="JMX接口"></nz-option>
...@@ -132,14 +143,14 @@ ...@@ -132,14 +143,14 @@
<nz-form-control nz-col [nzSpan]="2"> <nz-form-control nz-col [nzSpan]="2">
<input type="text" placeholder="端口" nz-input name="port" [(ngModel)]="item.port"> <input type="text" placeholder="端口" nz-input name="port" [(ngModel)]="item.port">
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="3"> <nz-form-control nz-col [nzSpan]="4" *ngIf="item.type == 2">
<label nz-checkbox [(ngModel)]="checked">使用大量请求</label> <label nz-checkbox [(ngModel)]="item.bulk">使用大量请求</label>
</nz-form-control> </nz-form-control>
<nz-form-control nz-col [nzSpan]="2"> <nz-form-control nz-col [nzSpan]="2">
<span class="cursor" (click)="deleteInterfaces(i)">X</span> <span class="cursor" (click)="deleteInterfaces(i)">X</span>
</nz-form-control> </nz-form-control>
</ng-container>
</div> </div>
</ng-container>
<button nz-button (click)="addInterfaces()" nzType="default">添加</button> <button nz-button (click)="addInterfaces()" nzType="default">添加</button>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
...@@ -156,8 +167,10 @@ ...@@ -156,8 +167,10 @@
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="4" nzFor="templates">监控策略</nz-form-label> <nz-form-label [nzSpan]="4" nzFor="templates">监控策略</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select name="templates" style="width: 100%" [(ngModel)]="validateForm.templates" [nzSize]="nzSize" nzMode="tags" nzPlaceHolder="选择监控策略"> <nz-select name="templates" style="width: 100%" [(ngModel)]="validateForm.templates"
<nz-option *ngFor="let option of tempList" [nzLabel]="option.name" [nzValue]="option.templateid"></nz-option> [nzSize]="nzSize" nzMode="tags" nzPlaceHolder="选择监控策略">
<nz-option *ngFor="let option of tempList" [nzLabel]="option.name"
[nzValue]="option.templateid"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
...@@ -176,9 +189,11 @@ ...@@ -176,9 +189,11 @@
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="ipmi_authtype">认证算法</nz-form-label> <nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="ipmi_authtype">认证算法
</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select style="width: 200px;" name="ipmi_authtype" nzShowSearch nzAllowClear nzPlaceHolder="选择设备类型" [(ngModel)]="validateForm.ipmi_authtype"> <nz-select style="width: 200px;" name="ipmi_authtype" nzShowSearch nzAllowClear
nzPlaceHolder="选择设备类型" [(ngModel)]="validateForm.ipmi_authtype">
<nz-option nzValue="-1" nzLabel="默认"></nz-option> <nz-option nzValue="-1" nzLabel="默认"></nz-option>
<nz-option nzValue="0" nzLabel="无"></nz-option> <nz-option nzValue="0" nzLabel="无"></nz-option>
<nz-option nzValue="1" nzLabel="MD2"></nz-option> <nz-option nzValue="1" nzLabel="MD2"></nz-option>
...@@ -195,7 +210,8 @@ ...@@ -195,7 +210,8 @@
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="ipmi_username">用户名称</nz-form-label> <nz-form-label [nzSpan]="6" nzFor="ipmi_username">用户名称</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="ipmi_username" name="ipmi_username" nz-input placeholder="用户名称" [(ngModel)]="validateForm.ipmi_username"> <input id="ipmi_username" name="ipmi_username" nz-input placeholder="用户名称"
[(ngModel)]="validateForm.ipmi_username">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
...@@ -204,9 +220,11 @@ ...@@ -204,9 +220,11 @@
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="ipmi_privilege">优先权层级</nz-form-label> <nz-form-label [nzOffset]="4" [nzSpan]="6" nzFor="ipmi_privilege">优先权层级
</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-select name="ipmi_privilege" nzShowSearch nzAllowClear nzPlaceHolder="选择设备类型" [(ngModel)]="validateForm.ipmi_privilege"> <nz-select name="ipmi_privilege" nzShowSearch nzAllowClear
nzPlaceHolder="选择设备类型" [(ngModel)]="validateForm.ipmi_privilege">
<nz-option nzValue="1" nzLabel="回调"></nz-option> <nz-option nzValue="1" nzLabel="回调"></nz-option>
<nz-option nzValue="2" nzLabel="用户"></nz-option> <nz-option nzValue="2" nzLabel="用户"></nz-option>
<nz-option nzValue="3" nzLabel="操作者"></nz-option> <nz-option nzValue="3" nzLabel="操作者"></nz-option>
...@@ -221,7 +239,8 @@ ...@@ -221,7 +239,8 @@
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="ipmi_password">密码</nz-form-label> <nz-form-label [nzSpan]="6" nzFor="ipmi_password">密码</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<input id="ipmi_password" name="ipmi_password" nz-input placeholder="密码" [(ngModel)]="validateForm.ipmi_password"> <input id="ipmi_password" name="ipmi_password" nz-input placeholder="密码"
[(ngModel)]="validateForm.ipmi_password">
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
...@@ -231,7 +250,7 @@ ...@@ -231,7 +250,7 @@
</nz-collapse> </nz-collapse>
<nz-collapse> <nz-collapse>
<nz-collapse-panel [nzHeader]="panel2.name" [nzActive]="panel2.active"> <nz-collapse-panel [nzHeader]="panel2.name" [nzActive]="panel2.active">
<div nz-row [nzGutter]="24" > <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12"> <div nz-col [nzSpan]="12">
<nz-form-item nzFlex> <nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14"> <nz-form-control [nzOffset]="4" [nzSpan]="14">
...@@ -270,7 +289,7 @@ ...@@ -270,7 +289,7 @@
<button nz-button (click)="addMacro()" nzType="default">添加</button> <button nz-button (click)="addMacro()" nzType="default">添加</button>
</div> </div>
<div *ngIf="macroTYpe == 'macroExpand'"> <div *ngIf="macroTYpe == 'macroExpand'">
<div nz-row [nzGutter]="24" > <div nz-row [nzGutter]="24">
<div nz-col [nzOffset]="2" [nzSpan]="6"> <div nz-col [nzOffset]="2" [nzSpan]="6">
</div> </div>
......
...@@ -4,8 +4,8 @@ import { ...@@ -4,8 +4,8 @@ import {
FormGroup, FormGroup,
Validators Validators
} from '@angular/forms'; } from '@angular/forms';
import { OverAllService } from "../../overAll/overAll.service"; import {OverAllService} from '../../overAll/overAll.service';
import { NzMessageService } from "ng-zorro-antd"; import {NzMessageService} from 'ng-zorro-antd';
@Component({ @Component({
selector: 'smart-basic-edit', selector: 'smart-basic-edit',
...@@ -18,8 +18,8 @@ export class BasicEditComponent implements OnInit { ...@@ -18,8 +18,8 @@ export class BasicEditComponent implements OnInit {
nzSize = 'large'; nzSize = 'large';
hostId; //主机ID hostId; //主机ID
style = { style = {
display : 'block', display: 'block',
height : '30px', height: '30px',
lineHeight: '30px' lineHeight: '30px'
}; };
radioValue; radioValue;
...@@ -30,85 +30,87 @@ export class BasicEditComponent implements OnInit { ...@@ -30,85 +30,87 @@ export class BasicEditComponent implements OnInit {
groupList = []; groupList = [];
//折叠面板 //折叠面板
panel1 = { name:'配置IPMI',active:true }; panel1 = {name: '配置IPMI', active: true};
panel2 = { name:'配置宏',active:true }; panel2 = {name: '配置宏', active: true};
//加密 //加密
otherHost; otherHost;
isBasicEdit = false; isBasicEdit = false;
tabNum:number; //tabs面板的序列号 tabNum: number; //tabs面板的序列号
macroList = [ //配置宏数组 macroList = [ //配置宏数组
{ {
macro:'{$SNMP_COMMUNITY}', macro: '{$SNMP_COMMUNITY}',
value:'public', value: 'public',
} }
]; ];
interfaceslist = [ interfaceslist = [
{ {
main:'1', main: '1',
ip:'', ip: '',
dns:'', dns: '',
type:'1', type: '1',
port:'10050', port: '10050',
useip:1, useip: 1,
bulk: 0,
} }
]; //接口数组 ]; //接口数组
macroTYpe = 'macro'; //宏tabs macroTYpe = 'macro'; //宏tabs
mainHost = 'hostType1'; //主机tabs mainHost = 'hostType1'; //主机tabs
constructor(private fb: FormBuilder,private overAllSer: OverAllService, constructor(private fb: FormBuilder, private overAllSer: OverAllService,
private message: NzMessageService) { } private message: NzMessageService) {
}
ngOnInit() { ngOnInit() {
this.tabNum = 0; this.tabNum = 0;
// this.isBasicEdit = true; // this.isBasicEdit = true;
this.validateForm ={ this.validateForm = {
groups: [], groups: [],
hostExtend:{ hostExtend: {
equipmentType: null, equipmentType: null,
secondLevelType: null, secondLevelType: null,
serviceid:"" serviceid: ''
}, },
macros:this.macroList, macros: this.macroList,
interfaces:this.interfaceslist, //接口 interfaces: this.interfaceslist, //接口
inventory:{ inventory: {
os:null, os: null,
name:null, name: null,
serialno_a:null serialno_a: null
}, },
templates:[], templates: [],
name: null, name: null,
host: null, host: null,
ipmi_authtype:null, ipmi_authtype: null,
ipmi_username:null, ipmi_username: null,
ipmi_privilege:null, ipmi_privilege: null,
ipmi_password:null, ipmi_password: null,
tls_psk_identity:null, tls_psk_identity: null,
tls_issuer:null, tls_issuer: null,
tls_subject:null, tls_subject: null,
tls_psk:null, tls_psk: null,
} };
} }
//新增 //新增
showModal(hostId,name,gId): void { showModal(hostId, name, gId): void {
this.groupList = []; this.groupList = [];
if( gId ){ if (gId) {
const gObj = { const gObj = {
label: name,value:gId,checked:true label: name, value: gId, checked: true
}; };
this.groupList.push(gObj); this.groupList.push(gObj);
}else{ } else {
this.overAllSer.getgroups({}).subscribe( this.overAllSer.getgroups({}).subscribe(
(res)=>{ (res) => {
for(let i = 0;i<res.data.length;i++){ for (let i = 0; i < res.data.length; i++) {
const gObj = { const gObj = {
label: res.data[i].name,value:res.data[i].groupid,checked:false label: res.data[i].name, value: res.data[i].groupid, checked: false
}; };
this.groupList.push(gObj); this.groupList.push(gObj);
} }
} }
) );
} }
this.modalTitle = '添加资源'; this.modalTitle = '添加资源';
...@@ -116,53 +118,53 @@ export class BasicEditComponent implements OnInit { ...@@ -116,53 +118,53 @@ export class BasicEditComponent implements OnInit {
this.tabNum = 0; this.tabNum = 0;
this.isBasicEdit = true; this.isBasicEdit = true;
this.getTemplate(); this.getTemplate();
this.validateForm ={ this.validateForm = {
groups: [], groups: [],
hostExtend:{ hostExtend: {
equipmentType: null, equipmentType: null,
secondLevelType: null, secondLevelType: null,
serviceid:"" serviceid: ''
}, },
macros:this.macroList, macros: this.macroList,
interfaces:this.interfaceslist, //接口 interfaces: this.interfaceslist, //接口
inventory:{ inventory: {
os:null, os: null,
name:null, name: null,
serialno_a:null serialno_a: null
}, },
templates:[], templates: [],
name: null, name: null,
host: null, host: null,
ipmi_authtype:null, ipmi_authtype: null,
ipmi_username:null, ipmi_username: null,
ipmi_privilege:null, ipmi_privilege: null,
ipmi_password:null, ipmi_password: null,
tls_psk_identity:null, tls_psk_identity: null,
tls_issuer:null, tls_issuer: null,
tls_subject:null, tls_subject: null,
tls_psk:null, tls_psk: null,
} };
} }
//编辑 //编辑
editModal(hostId,name,gId): void{ editModal(hostId, name, gId): void {
this.groupList = []; this.groupList = [];
if( gId ){ if (gId) {
const gObj = { const gObj = {
label: name,value:gId,checked:true label: name, value: gId, checked: true
}; };
this.groupList.push(gObj); this.groupList.push(gObj);
}else{ } else {
this.overAllSer.getgroups({}).subscribe( this.overAllSer.getgroups({}).subscribe(
(res)=>{ (res) => {
for(let i = 0;i<res.data.length;i++){ for (let i = 0; i < res.data.length; i++) {
const gObj = { const gObj = {
label: res.data[i].name,value:res.data[i].groupid,checked:false label: res.data[i].name, value: res.data[i].groupid, checked: false
}; };
this.groupList.push(gObj); this.groupList.push(gObj);
} }
} }
) );
} }
this.hostId = hostId; this.hostId = hostId;
...@@ -171,39 +173,39 @@ export class BasicEditComponent implements OnInit { ...@@ -171,39 +173,39 @@ export class BasicEditComponent implements OnInit {
this.isBasicEdit = true; this.isBasicEdit = true;
this.getTemplate(); this.getTemplate();
this.overAllSer.findDetailed(this.hostId).subscribe( this.overAllSer.findDetailed(this.hostId).subscribe(
(res)=>{ (res) => {
this.validateForm = res.data[0]; this.validateForm = res.data[0];
this.validateForm.ipmi_authtype = res.data[0].ipmi_authtype +""; this.validateForm.ipmi_authtype = res.data[0].ipmi_authtype + '';
this.validateForm.ipmi_privilege = res.data[0].ipmi_privilege +""; this.validateForm.ipmi_privilege = res.data[0].ipmi_privilege + '';
this.interfaceslist = res.data[0].interfaces; this.interfaceslist = res.data[0].interfaces;
// console.log(this.validateForm); // console.log(this.validateForm);
// this.message.info(res.errMsg); // this.message.info(res.errMsg);
} }
) );
} }
handEditleOk(): void { handEditleOk(): void {
//获取分组id //获取分组id
let groupArr = []; const groupArr = [];
for( let i = 0; i< this.groupList.length; i++ ){ for (let i = 0; i < this.groupList.length; i++) {
if(this.groupList[i].checked == true){ if (this.groupList[i].checked == true) {
const groupid = {"groupid":this.groupList[i].value} const groupid = {'groupid': this.groupList[i].value};
groupArr.push(groupid); groupArr.push(groupid);
} }
} }
this.validateForm.groups = groupArr; this.validateForm.groups = groupArr;
this.overAllSer.createHost(this.validateForm).subscribe( this.overAllSer.createHost(this.validateForm).subscribe(
(res)=>{ (res) => {
if(res.errCode == 10000){ if (res.errCode == 10000) {
this.isBasicEdit = false; this.isBasicEdit = false;
} }
this.done.emit(); this.done.emit();
this.message.info(res.errMsg); this.message.info(res.errMsg);
}, },
(err)=>{ (err) => {
this.message.info("系统错误"); this.message.info('系统错误');
} }
) );
} }
handleEditCancel(): void { handleEditCancel(): void {
...@@ -211,61 +213,70 @@ export class BasicEditComponent implements OnInit { ...@@ -211,61 +213,70 @@ export class BasicEditComponent implements OnInit {
} }
//tabs切换 //tabs切换
tabsChange(num){ tabsChange(num) {
console.log('tabs:' +num); console.log('tabs:' + num);
this.tabNum = num; this.tabNum = num;
} }
//获取模版 //获取模版
getTemplate(){ getTemplate() {
this.overAllSer.templates().subscribe( this.overAllSer.templates().subscribe(
(res)=>{ (res) => {
this.tempList = res.apiResponse.data; this.tempList = res.apiResponse.data;
} }
) );
} }
//接口add //接口add
addInterfaces(){ addInterfaces() {
const demo = { const demo = {
main:'1', main: '0',
ip:'', ip: '',
dns:'', dns: '',
type:'1', type: '1',
port:'10050', port: '10050',
useip:1, useip: 1,
bulk: 0,
}; };
this.interfaceslist.push(demo); this.interfaceslist.push(demo);
} }
deleteInterfaces(index){ deleteInterfaces(index) {
this.interfaceslist.splice(index,1); this.interfaceslist.splice(index, 1);
} }
// agent:10050 // agent:10050 SNMP:161 JMX:12345 IPMI:623
// SNMP:161 changePort(index) {
// JMX:12345 switch (this.interfaceslist[index].type) {
// IPMI:623 case '1': {
changePort(index){
console.log(this.interfaceslist);
switch (this.interfaceslist[index].type){
case '1':{
this.interfaceslist[index].port = '10050'; this.interfaceslist[index].port = '10050';
break; break;
} }
case '2':{ case '2': {
this.interfaceslist[index].port = '161'; this.interfaceslist[index].port = '161';
this.interfaceslist[index].bulk = 1;
break; break;
} }
case '3':{ case '3': {
this.interfaceslist[index].port = '12345'; this.interfaceslist[index].port = '12345';
break; break;
} }
case '4':{ case '4': {
this.interfaceslist[index].port = '623'; this.interfaceslist[index].port = '623';
break; break;
} }
}
console.log(this.interfaceslist);
} }
//只能一个默认
changeMain(index){
this.interfaceslist.forEach(res=>{
res.main = '0';
});
this.interfaceslist[index].main = '1';
console.log(this.interfaceslist);
} }
} }
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