Commit 2db7ef83 authored by wangqinghua's avatar wangqinghua

interface update

parent eca8de8b
...@@ -235,6 +235,17 @@ export class BasicEditComponent implements OnInit { ...@@ -235,6 +235,17 @@ export class BasicEditComponent implements OnInit {
groupArr.push(groupid); groupArr.push(groupid);
} }
} }
this.validateForm.groups = groupArr;
this.isOkLoading = true;
if (this.modalTitle == '编辑资源') {
this.update();
} else {
this.create();
}
}
//创建
create() {
const interfaceArr = []; const interfaceArr = [];
this.interfaceslist.forEach(res => { this.interfaceslist.forEach(res => {
const a = { const a = {
...@@ -244,8 +255,8 @@ export class BasicEditComponent implements OnInit { ...@@ -244,8 +255,8 @@ export class BasicEditComponent implements OnInit {
type: res.type, type: res.type,
port: res.port, port: res.port,
useip: res.useip, useip: res.useip,
bulk:'' bulk: ''
} };
if (res.type == '2') { if (res.type == '2') {
if (res.bulk == true || res.bulk == '1') { if (res.bulk == true || res.bulk == '1') {
a.bulk = '1'; a.bulk = '1';
...@@ -258,17 +269,6 @@ export class BasicEditComponent implements OnInit { ...@@ -258,17 +269,6 @@ export class BasicEditComponent implements OnInit {
interfaceArr.push(a); interfaceArr.push(a);
}); });
this.validateForm.interfaces = interfaceArr; this.validateForm.interfaces = interfaceArr;
this.validateForm.groups = groupArr;
this.isOkLoading = true;
if (this.modalTitle == '编辑资源') {
this.update();
} else {
this.create();
}
}
//创建
create() {
if (this.macroTYpe == 'macroExpand') { if (this.macroTYpe == 'macroExpand') {
this.validateForm.macros = this.macroList2; this.validateForm.macros = this.macroList2;
} }
...@@ -296,6 +296,31 @@ export class BasicEditComponent implements OnInit { ...@@ -296,6 +296,31 @@ export class BasicEditComponent implements OnInit {
//更新 //更新
update() { update() {
const interfaceArr = [];
this.interfaceslist.forEach(res => {
const a = {
main: res.main,
ip: res.ip,
dns: res.dns,
type: res.type,
port: res.port,
useip: res.useip,
bulk: '',
hostid: this.hostId,
interfaceid: res.interfaceid
};
if (res.type == '2') {
if (res.bulk == true || res.bulk == '1') {
a.bulk = '1';
} else {
a.bulk = '0';
}
} else {
delete a.bulk;
}
interfaceArr.push(a);
});
this.validateForm.interfaces = interfaceArr;
//比较监控模版是否发生变化 //比较监控模版是否发生变化
const clearArr = []; const clearArr = [];
if (!this.isInVentory) { if (!this.isInVentory) {
...@@ -311,9 +336,6 @@ export class BasicEditComponent implements OnInit { ...@@ -311,9 +336,6 @@ export class BasicEditComponent implements OnInit {
if (this.macroTYpe == 'macroExpand') { if (this.macroTYpe == 'macroExpand') {
this.validateForm.macros = this.macroList2; this.validateForm.macros = this.macroList2;
} }
this.validateForm.interfaces.forEach(e=>{
e.hostid = this.hostId
});
this.validateForm.hostid = this.hostId; this.validateForm.hostid = this.hostId;
this.validateForm.macros = this.macroList1; this.validateForm.macros = this.macroList1;
this.overAllSer.updateHost(this.validateForm).subscribe( this.overAllSer.updateHost(this.validateForm).subscribe(
......
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