Commit 3dc04b43 authored by wangqinghua's avatar wangqinghua

告警模块

parent ee8d16c3
...@@ -90,6 +90,16 @@ export class BasicEditComponent implements OnInit { ...@@ -90,6 +90,16 @@ export class BasicEditComponent implements OnInit {
tls_subject: null, tls_subject: null,
tls_psk: null, tls_psk: null,
}; };
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);
}
}
);
} }
//新增 //新增
...@@ -148,6 +158,7 @@ export class BasicEditComponent implements OnInit { ...@@ -148,6 +158,7 @@ export class BasicEditComponent implements OnInit {
//编辑 //编辑
editModal(hostId, name, gId): void { editModal(hostId, name, gId): void {
console.log(this.validateForm);
this.groupList = []; this.groupList = [];
if (gId) { if (gId) {
const gObj = { const gObj = {
...@@ -177,8 +188,14 @@ export class BasicEditComponent implements OnInit { ...@@ -177,8 +188,14 @@ export class BasicEditComponent implements OnInit {
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.validateForm.groups = [{groupid:1},{groupid:2}];
this.interfaceslist = res.data[0].interfaces; this.interfaceslist = res.data[0].interfaces;
// console.log(this.validateForm); this.interfaceslist.forEach(res=>{
res.main = res.main +'';
res.type = res.type +'';
});
console.log(this.validateForm);
// this.message.info(res.errMsg); // this.message.info(res.errMsg);
} }
); );
...@@ -194,6 +211,16 @@ export class BasicEditComponent implements OnInit { ...@@ -194,6 +211,16 @@ export class BasicEditComponent implements OnInit {
} }
} }
this.validateForm.groups = groupArr; this.validateForm.groups = groupArr;
if(this.modalTitle == '编辑资源'){
this.update();
}else{
this.create();
}
}
//创建
create(){
this.overAllSer.createHost(this.validateForm).subscribe( this.overAllSer.createHost(this.validateForm).subscribe(
(res) => { (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
...@@ -208,6 +235,22 @@ export class BasicEditComponent implements OnInit { ...@@ -208,6 +235,22 @@ export class BasicEditComponent implements OnInit {
); );
} }
//更新
update(){
this.overAllSer.updateHost(this.validateForm).subscribe(
(res) => {
if (res.errCode == 10000) {
this.isBasicEdit = false;
}
this.done.emit();
this.message.info(res.errMsg);
},
(err) => {
this.message.info('系统错误');
}
);
}
handleEditCancel(): void { handleEditCancel(): void {
this.isBasicEdit = false; this.isBasicEdit = false;
} }
......
...@@ -188,4 +188,9 @@ export class OverAllService { ...@@ -188,4 +188,9 @@ export class OverAllService {
findWarnAll(): Observable<any>{ findWarnAll(): Observable<any>{
return this.http.get(SERVER_API_URL + '/alertGroup/findAll'); return this.http.get(SERVER_API_URL + '/alertGroup/findAll');
} }
//修改资源
updateHost(data): Observable<any>{
return this.http.put(SERVER_API_URL + '/host/updataHost',data);
}
} }
\ No newline at end of file
...@@ -279,13 +279,14 @@ ui bootstrap tweaks ...@@ -279,13 +279,14 @@ ui bootstrap tweaks
width: 300px; width: 300px;
} }
.login-form{ .login-form{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 600px; width: 600px;
height: 350px; height: 350px;
padding-top: 110px; padding-top: 110px;
position: absolute;
margin: 0px auto; margin: 0px auto;
left: 29%;
top: 25%;
background-image: url("../images/input-bg.png"); background-image: url("../images/input-bg.png");
background-size: 100%, 100%; background-size: 100%, 100%;
} }
......
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