Commit 96ff4459 authored by wangqinghua's avatar wangqinghua

告警模块

parent ac4ade89
......@@ -24,4 +24,21 @@
<span>当前告警数:120</span>
</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>
\ 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-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-col [nzSpan]="12">
<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-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>
......@@ -26,7 +29,8 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="os">操作系统</nz-form-label>
<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-item>
</div>
......@@ -34,31 +38,34 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="secondLevelType">二级类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<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>
<nz-option nzValue="虚拟化" nzLabel="虚拟化"></nz-option>
<nz-option nzValue="应用服务" nzLabel="应用服务"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<nz-form-item nzFlex>
<nz-form-label [nzOffset]="4" [nzSpan]="6" nzRequired nzFor="secondLevelType">二级类型
</nz-form-label>
<nz-form-control [nzSpan]="14">
<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>
<nz-option nzValue="虚拟化" nzLabel="虚拟化"></nz-option>
<nz-option nzValue="应用服务" nzLabel="应用服务"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="name">厂商</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="inventory_name" nz-input placeholder="厂商" name="inventory_name" [(ngModel)]="validateForm.inventory.name">
</nz-form-control>
</nz-form-item>
</div>
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="name">厂商</nz-form-label>
<nz-form-control [nzSpan]="14">
<input id="inventory_name" nz-input placeholder="厂商" name="inventory_name"
[(ngModel)]="validateForm.inventory.name">
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row [nzGutter]="24">
......@@ -75,7 +82,8 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="serialno_a">产品序列号</nz-form-label>
<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-item>
</div>
......@@ -96,21 +104,23 @@
</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-select name="serviceid" [(ngModel)]="validateForm.hostExtend.serviceid" nzPlaceHolder="无关联业务">
<nz-select name="serviceid" [(ngModel)]="validateForm.hostExtend.serviceid"
nzPlaceHolder="无关联业务">
<nz-option nzValue="" nzLabel="无"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-item>
<nz-form-label [nzSpan]="4">添加接口</nz-form-label>
<nz-form-control [nzSpan]="20">
<div nz-row [nzGutter]="12">
<ng-container *ngFor="let item of interfaceslist;let i = index;">
<nz-form-control nz-col [nzSpan]="2">
<nz-select name="main" nzPlaceHolder="选择接口类型" [(ngModel)]="item.main">
<ng-container *ngFor="let item of interfaceslist;let i = index;">
<div nz-row [nzGutter]="12">
<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="0" nzLabel="不默认"></nz-option>
</nz-select>
......@@ -121,8 +131,9 @@
<nz-form-control nz-col [nzSpan]="4">
<input type="text" placeholder="DNS名称" nz-input name="dns" [(ngModel)]="item.dns">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="6">
<nz-select name="type" nzPlaceHolder="连接类型" [(ngModel)]="item.type" (ngModelChange)="changePort(i)">
<nz-form-control nz-col [nzSpan]="5">
<nz-select name="type" nzPlaceHolder="连接类型" [(ngModel)]="item.type"
(ngModelChange)="changePort(i)">
<nz-option nzValue="1" nzLabel="agent代理程序接口"></nz-option>
<nz-option nzValue="2" nzLabel="SNMP接口"></nz-option>
<nz-option nzValue="3" nzLabel="JMX接口"></nz-option>
......@@ -130,34 +141,36 @@
</nz-select>
</nz-form-control>
<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-col [nzSpan]="3">
<label nz-checkbox [(ngModel)]="checked">使用大量请求</label>
<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="cursor" (click)="deleteInterfaces(i)">X</span>
</nz-form-control>
</ng-container>
</div>
</div>
</ng-container>
<button nz-button (click)="addInterfaces()" nzType="default">添加</button>
</nz-form-control>
</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>
<nz-option nzValue="" nzLabel="无agen代理程序"></nz-option>
</nz-select>
</nz-form-control>
</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-select name="templates" style="width: 100%" [(ngModel)]="validateForm.templates" [nzSize]="nzSize" nzMode="tags" nzPlaceHolder="选择监控策略">
<nz-option *ngFor="let option of tempList" [nzLabel]="option.name" [nzValue]="option.templateid"></nz-option>
<nz-select name="templates" style="width: 100%" [(ngModel)]="validateForm.templates"
[nzSize]="nzSize" nzMode="tags" nzPlaceHolder="选择监控策略">
<nz-option *ngFor="let option of tempList" [nzLabel]="option.name"
[nzValue]="option.templateid"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
......@@ -171,14 +184,16 @@
<nz-tab nzTitle="配置信息">
<nz-collapse>
<nz-collapse-panel [nzHeader]="panel1.name" [nzActive]="panel1.active">
<form nz-form class="ant-advanced-search-form">
<nz-collapse-panel [nzHeader]="panel1.name" [nzActive]="panel1.active">
<form nz-form class="ant-advanced-search-form">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<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-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="0" nzLabel="无"></nz-option>
<nz-option nzValue="1" nzLabel="MD2"></nz-option>
......@@ -195,7 +210,8 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="ipmi_username">用户名称</nz-form-label>
<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-item>
</div>
......@@ -204,9 +220,11 @@
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<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-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="2" nzLabel="用户"></nz-option>
<nz-option nzValue="3" nzLabel="操作者"></nz-option>
......@@ -221,7 +239,8 @@
<nz-form-item nzFlex>
<nz-form-label [nzSpan]="6" nzFor="ipmi_password">密码</nz-form-label>
<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-item>
</div>
......@@ -230,8 +249,8 @@
</nz-collapse-panel>
</nz-collapse>
<nz-collapse>
<nz-collapse-panel [nzHeader]="panel2.name" [nzActive]="panel2.active">
<div nz-row [nzGutter]="24" >
<nz-collapse-panel [nzHeader]="panel2.name" [nzActive]="panel2.active">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="12">
<nz-form-item nzFlex>
<nz-form-control [nzOffset]="4" [nzSpan]="14">
......@@ -243,7 +262,7 @@
</nz-form-item>
</div>
</div>
<div *ngIf="macroTYpe == 'macro'">
<div *ngIf="macroTYpe == 'macro'">
<div nz-row [nzGutter]="24">
<div nz-col [nzOffset]="2" [nzSpan]="6">
......@@ -255,13 +274,13 @@
<div nz-row *ngFor="let item of macroList;let i = index;" [nzGutter]="24">
<nz-form-control [nzOffset]="2" nz-col [nzSpan]="6">
<input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}">
<input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="1">
=>
</nz-form-control>
<nz-form-control nz-col [nzSpan]="6">
<input nz-input placeholder="public" value="{{item.value}}">
<input nz-input placeholder="public" value="{{item.value}}">
</nz-form-control>
<nz-form-control nz-col [nzSpan]="3">
<span (click)="deleteMacro(i)">移除</span>
......@@ -269,8 +288,8 @@
</div>
<button nz-button (click)="addMacro()" nzType="default">添加</button>
</div>
<div *ngIf="macroTYpe == 'macroExpand'">
<div nz-row [nzGutter]="24" >
<div *ngIf="macroTYpe == 'macroExpand'">
<div nz-row [nzGutter]="24">
<div nz-col [nzOffset]="2" [nzSpan]="6">
</div>
......@@ -290,13 +309,13 @@
</div>
<div nz-row [nzGutter]="12" *ngFor="let item of macroList">
<nz-form-control nz-col [nzOffset]="2" [nzSpan]="6">
<input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}">
<input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}">
</nz-form-control>
<div nz-col [nzSpan]="1">
=>
</div>
<nz-form-control nz-col [nzSpan]="6">
<input nz-input placeholder="public" value="{{item.value}}">
<input nz-input placeholder="public" value="{{item.value}}">
</nz-form-control>
<div nz-col [nzSpan]="3">
<button nz-button nzType="default">更改</button>
......@@ -325,65 +344,65 @@
</nz-tab>
<!--<nz-tab nzTitle="加密">-->
<!--<form nz-form class="ant-advanced-search-form">-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="host">连接主机</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-radio-group [(ngModel)] ="mainHost" name="mainHost">-->
<!--<label nz-radio-button nzValue="hostType1"><span>非加密</span></label>-->
<!--<label nz-radio-button nzValue="hostType2"><span>共享密钥(PSK)</span></label>-->
<!--<label nz-radio-button nzValue="hostType3"><span>证书</span></label>-->
<!--</nz-radio-group>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<form nz-form class="ant-advanced-search-form">-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="host">连接主机</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-radio-group [(ngModel)] ="mainHost" name="mainHost">-->
<!--<label nz-radio-button nzValue="hostType1"><span>非加密</span></label>-->
<!--<label nz-radio-button nzValue="hostType2"><span>共享密钥(PSK)</span></label>-->
<!--<label nz-radio-button nzValue="hostType3"><span>证书</span></label>-->
<!--</nz-radio-group>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="host">从主机连接</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-radio-group [(ngModel)]="otherHost" name="otherHost">-->
<!--<label nz-radio [ngStyle]="style" nzValue="A">非加密</label>-->
<!--<label nz-radio [ngStyle]="style" nzValue="B">共享密钥(PSK)</label>-->
<!--<label nz-radio [ngStyle]="style" nzValue="C">证书</label>-->
<!--</nz-radio-group>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="host">从主机连接</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<nz-radio-group [(ngModel)]="otherHost" name="otherHost">-->
<!--<label nz-radio [ngStyle]="style" nzValue="A">非加密</label>-->
<!--<label nz-radio [ngStyle]="style" nzValue="B">共享密钥(PSK)</label>-->
<!--<label nz-radio [ngStyle]="style" nzValue="C">证书</label>-->
<!--</nz-radio-group>-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<ng-container *ngIf="mainHost == 'hostType2'">-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_psk_identity">共享密钥一致性</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" name="tls_psk_identity" nz-input [(ngModel)]="tls_psk_identity">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_psk">共享密钥(PSK)</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" nz-input name="tls_psk" [(ngModel)]="tls_psk">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--</ng-container>-->
<!--<ng-container *ngIf="mainHost == 'hostType2'">-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_psk_identity">共享密钥一致性</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" name="tls_psk_identity" nz-input [(ngModel)]="tls_psk_identity">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_psk">共享密钥(PSK)</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" nz-input name="tls_psk" [(ngModel)]="tls_psk">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--</ng-container>-->
<!--<ng-container *ngIf="mainHost == 'hostType3'">-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_issuer">发行者</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" name="tls_issuer" nz-input [(ngModel)]="tls_issuer">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_subject">主体</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" name="tls_subject" nz-input [(ngModel)]="tls_subject">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--</ng-container>-->
<!--<ng-container *ngIf="mainHost == 'hostType3'">-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_issuer">发行者</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" name="tls_issuer" nz-input [(ngModel)]="tls_issuer">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--<nz-form-item>-->
<!--<nz-form-label [nzSpan]="6" nzFor="tls_subject">主体</nz-form-label>-->
<!--<nz-form-control [nzSpan]="14">-->
<!--<input type="text" name="tls_subject" nz-input [(ngModel)]="tls_subject">-->
<!--</nz-form-control>-->
<!--</nz-form-item>-->
<!--</ng-container>-->
<!--</form>-->
<!--<div class="modal-footer-btn">-->
<!--<button nz-button (click)="handleEditCancel()" nzType="primary">取消</button>-->
<!--<button nz-button (click)="tabsChange(1)" nzType="primary">上一步</button>-->
<!--<button nz-button (click)="handEditleOk()" nzType="primary">完成</button>-->
<!--</div>-->
<!--</form>-->
<!--<div class="modal-footer-btn">-->
<!--<button nz-button (click)="handleEditCancel()" nzType="primary">取消</button>-->
<!--<button nz-button (click)="tabsChange(1)" nzType="primary">上一步</button>-->
<!--<button nz-button (click)="handEditleOk()" nzType="primary">完成</button>-->
<!--</div>-->
<!--</nz-tab>-->
</nz-tabset>
</nz-modal>
......@@ -4,13 +4,13 @@ import {
FormGroup,
Validators
} from '@angular/forms';
import { OverAllService } from "../../overAll/overAll.service";
import { NzMessageService } from "ng-zorro-antd";
import {OverAllService} from '../../overAll/overAll.service';
import {NzMessageService} from 'ng-zorro-antd';
@Component({
selector: 'smart-basic-edit',
templateUrl: './basic-edit.component.html',
styles: []
selector: 'smart-basic-edit',
templateUrl: './basic-edit.component.html',
styles: []
})
export class BasicEditComponent implements OnInit {
@Output() done = new EventEmitter<string>();
......@@ -18,8 +18,8 @@ export class BasicEditComponent implements OnInit {
nzSize = 'large';
hostId; //主机ID
style = {
display : 'block',
height : '30px',
display: 'block',
height: '30px',
lineHeight: '30px'
};
radioValue;
......@@ -30,139 +30,141 @@ export class BasicEditComponent implements OnInit {
groupList = [];
//折叠面板
panel1 = { name:'配置IPMI',active:true };
panel2 = { name:'配置宏',active:true };
panel1 = {name: '配置IPMI', active: true};
panel2 = {name: '配置宏', active: true};
//加密
otherHost;
isBasicEdit = false;
tabNum:number; //tabs面板的序列号
tabNum: number; //tabs面板的序列号
macroList = [ //配置宏数组
{
macro:'{$SNMP_COMMUNITY}',
value:'public',
macro: '{$SNMP_COMMUNITY}',
value: 'public',
}
];
interfaceslist = [
{
main:'1',
ip:'',
dns:'',
type:'1',
port:'10050',
useip:1,
main: '1',
ip: '',
dns: '',
type: '1',
port: '10050',
useip: 1,
bulk: 0,
}
]; //接口数组
macroTYpe = 'macro'; //宏tabs
mainHost = 'hostType1'; //主机tabs
constructor(private fb: FormBuilder,private overAllSer: OverAllService,
private message: NzMessageService) { }
constructor(private fb: FormBuilder, private overAllSer: OverAllService,
private message: NzMessageService) {
}
ngOnInit() {
this.tabNum = 0;
// this.isBasicEdit = true;
this.validateForm ={
groups: [],
hostExtend:{
equipmentType: null,
secondLevelType: null,
serviceid:""
},
macros:this.macroList,
interfaces:this.interfaceslist, //接口
inventory:{
os:null,
name:null,
serialno_a:null
},
templates:[],
name: null,
host: null,
ipmi_authtype:null,
ipmi_username:null,
ipmi_privilege:null,
ipmi_password:null,
tls_psk_identity:null,
tls_issuer:null,
tls_subject:null,
tls_psk:null,
}
}
ngOnInit() {
this.tabNum = 0;
// this.isBasicEdit = true;
this.validateForm = {
groups: [],
hostExtend: {
equipmentType: null,
secondLevelType: null,
serviceid: ''
},
macros: this.macroList,
interfaces: this.interfaceslist, //接口
inventory: {
os: null,
name: null,
serialno_a: null
},
templates: [],
name: null,
host: null,
ipmi_authtype: null,
ipmi_username: null,
ipmi_privilege: null,
ipmi_password: null,
tls_psk_identity: null,
tls_issuer: null,
tls_subject: null,
tls_psk: null,
};
}
//新增
showModal(hostId,name,gId): void {
//新增
showModal(hostId, name, gId): void {
this.groupList = [];
if( gId ){
const gObj = {
label: name,value:gId,checked:true
};
this.groupList.push(gObj);
}else{
this.overAllSer.getgroups({}).subscribe(
(res)=>{
for(let i = 0;i<res.data.length;i++){
const gObj = {
label: res.data[i].name,value:res.data[i].groupid,checked:false
};
this.groupList.push(gObj);
}
}
)
}
if (gId) {
const gObj = {
label: name, value: gId, checked: true
};
this.groupList.push(gObj);
} else {
this.overAllSer.getgroups({}).subscribe(
(res) => {
for (let i = 0; i < res.data.length; i++) {
const gObj = {
label: res.data[i].name, value: res.data[i].groupid, checked: false
};
this.groupList.push(gObj);
}
}
);
}
this.modalTitle = '添加资源';
this.hostId = hostId;
this.tabNum = 0;
this.isBasicEdit = true;
this.getTemplate();
this.validateForm ={
this.validateForm = {
groups: [],
hostExtend:{
hostExtend: {
equipmentType: null,
secondLevelType: null,
serviceid:""
serviceid: ''
},
macros:this.macroList,
interfaces:this.interfaceslist, //接口
inventory:{
os:null,
name:null,
serialno_a:null
macros: this.macroList,
interfaces: this.interfaceslist, //接口
inventory: {
os: null,
name: null,
serialno_a: null
},
templates:[],
templates: [],
name: null,
host: null,
ipmi_authtype:null,
ipmi_username:null,
ipmi_privilege:null,
ipmi_password:null,
tls_psk_identity:null,
tls_issuer:null,
tls_subject:null,
tls_psk:null,
}
ipmi_authtype: null,
ipmi_username: null,
ipmi_privilege: null,
ipmi_password: null,
tls_psk_identity: null,
tls_issuer: null,
tls_subject: null,
tls_psk: null,
};
}
//编辑
editModal(hostId,name,gId): void{
editModal(hostId, name, gId): void {
this.groupList = [];
if( gId ){
if (gId) {
const gObj = {
label: name,value:gId,checked:true
label: name, value: gId, checked: true
};
this.groupList.push(gObj);
}else{
} else {
this.overAllSer.getgroups({}).subscribe(
(res)=>{
for(let i = 0;i<res.data.length;i++){
(res) => {
for (let i = 0; i < res.data.length; i++) {
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.hostId = hostId;
......@@ -171,39 +173,39 @@ export class BasicEditComponent implements OnInit {
this.isBasicEdit = true;
this.getTemplate();
this.overAllSer.findDetailed(this.hostId).subscribe(
(res)=>{
(res) => {
this.validateForm = res.data[0];
this.validateForm.ipmi_authtype = res.data[0].ipmi_authtype +"";
this.validateForm.ipmi_privilege = res.data[0].ipmi_privilege +"";
this.validateForm.ipmi_authtype = res.data[0].ipmi_authtype + '';
this.validateForm.ipmi_privilege = res.data[0].ipmi_privilege + '';
this.interfaceslist = res.data[0].interfaces;
// console.log(this.validateForm);
// this.message.info(res.errMsg);
}
)
}
);
}
handEditleOk(): void {
//获取分组id
let groupArr = [];
for( let i = 0; i< this.groupList.length; i++ ){
if(this.groupList[i].checked == true){
const groupid = {"groupid":this.groupList[i].value}
const groupArr = [];
for (let i = 0; i < this.groupList.length; i++) {
if (this.groupList[i].checked == true) {
const groupid = {'groupid': this.groupList[i].value};
groupArr.push(groupid);
}
}
this.validateForm.groups = groupArr;
this.overAllSer.createHost(this.validateForm).subscribe(
(res)=>{
if(res.errCode == 10000){
(res) => {
if (res.errCode == 10000) {
this.isBasicEdit = false;
}
this.done.emit();
this.message.info(res.errMsg);
},
(err)=>{
this.message.info("系统错误");
(err) => {
this.message.info('系统错误');
}
)
);
}
handleEditCancel(): void {
......@@ -211,61 +213,70 @@ export class BasicEditComponent implements OnInit {
}
//tabs切换
tabsChange(num){
console.log('tabs:' +num);
this.tabNum = num;
tabsChange(num) {
console.log('tabs:' + num);
this.tabNum = num;
}
//获取模版
getTemplate(){
this.overAllSer.templates().subscribe(
(res)=>{
this.tempList = res.apiResponse.data;
}
)
getTemplate() {
this.overAllSer.templates().subscribe(
(res) => {
this.tempList = res.apiResponse.data;
}
);
}
//接口add
addInterfaces(){
const demo = {
main:'1',
ip:'',
dns:'',
type:'1',
port:'10050',
useip:1,
addInterfaces() {
const demo = {
main: '0',
ip: '',
dns: '',
type: '1',
port: '10050',
useip: 1,
bulk: 0,
};
this.interfaceslist.push(demo);
this.interfaceslist.push(demo);
}
deleteInterfaces(index){
this.interfaceslist.splice(index,1);
deleteInterfaces(index) {
this.interfaceslist.splice(index, 1);
}
// agent:10050 SNMP:161 JMX:12345 IPMI:623
changePort(index) {
switch (this.interfaceslist[index].type) {
case '1': {
this.interfaceslist[index].port = '10050';
break;
}
case '2': {
this.interfaceslist[index].port = '161';
this.interfaceslist[index].bulk = 1;
break;
}
case '3': {
this.interfaceslist[index].port = '12345';
break;
}
case '4': {
this.interfaceslist[index].port = '623';
break;
}
}
console.log(this.interfaceslist);
}
// agent:10050
// SNMP:161
// JMX:12345
// IPMI:623
changePort(index){
console.log(this.interfaceslist);
switch (this.interfaceslist[index].type){
case '1':{
this.interfaceslist[index].port = '10050';
break;
}
case '2':{
this.interfaceslist[index].port = '161';
break;
}
case '3':{
this.interfaceslist[index].port = '12345';
break;
}
case '4':{
this.interfaceslist[index].port = '623';
break;
}
}
//只能一个默认
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