mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
UI: Update IP address server calls to support per-NIC IPs
Update the following actions on IP address section to support per-NIC IP addresses: - List IPs -> listNics - Add IP -> addIpToNic - Remove IP -> removeIpFromNic These API calls will be conditionally invoked in place of the existing calls if a NIC is selected -- i.e., args.context.nics is present
This commit is contained in:
parent
b652d2e4ba
commit
6c8182b6f4
@ -1585,30 +1585,47 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$.ajax({
|
|
||||||
url: createURL('associateIpAddress'),
|
|
||||||
data: dataObj,
|
|
||||||
success: function(data) {
|
|
||||||
args.response.success({
|
|
||||||
_custom: {
|
|
||||||
jobId: data.associateipaddressresponse.jobid,
|
|
||||||
getUpdatedItem: function(data) {
|
|
||||||
var newIP = data.queryasyncjobresultresponse.jobresult.ipaddress;
|
|
||||||
return $.extend(newIP, {
|
|
||||||
state: 'Allocated'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getActionFilter: function() {
|
|
||||||
return actionFilters.ipAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
error: function(json) {
|
if (args.context.nics) {
|
||||||
args.response.error(parseXMLHttpResponse(json));
|
$.ajax({
|
||||||
}
|
url: createURL('addIpToNic'),
|
||||||
});
|
data: {
|
||||||
|
nicId: args.context.nics[0].id
|
||||||
|
},
|
||||||
|
success: function(json) {
|
||||||
|
args.response.success({
|
||||||
|
_custom: {
|
||||||
|
jobId: json.addiptonicresponse.jobid
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('associateIpAddress'),
|
||||||
|
data: dataObj,
|
||||||
|
success: function(data) {
|
||||||
|
args.response.success({
|
||||||
|
_custom: {
|
||||||
|
jobId: data.associateipaddressresponse.jobid,
|
||||||
|
getUpdatedItem: function(data) {
|
||||||
|
var newIP = data.queryasyncjobresultresponse.jobresult.ipaddress;
|
||||||
|
return $.extend(newIP, {
|
||||||
|
state: 'Allocated'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getActionFilter: function() {
|
||||||
|
return actionFilters.ipAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
error: function(json) {
|
||||||
|
args.response.error(parseXMLHttpResponse(json));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
notification: {
|
notification: {
|
||||||
@ -1643,27 +1660,42 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
if (args.context.nics) {
|
||||||
url: createURL('listPublicIpAddresses'),
|
$.ajax({
|
||||||
data: data,
|
url: createURL('listNics'),
|
||||||
dataType: "json",
|
data: {
|
||||||
async: true,
|
nicId: args.context.nics[0].id,
|
||||||
success: function(json) {
|
vmId: args.context.instances[0].id
|
||||||
var items = json.listpublicipaddressesresponse.publicipaddress;
|
},
|
||||||
|
success: function(json) {
|
||||||
$(items).each(function() {
|
args.response.success({
|
||||||
getExtaPropertiesForIpObj(this, args);
|
data: json.listnicsresponse.nic[0].ipAddresses
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('listPublicIpAddresses'),
|
||||||
|
data: data,
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var items = json.listpublicipaddressesresponse.publicipaddress;
|
||||||
|
|
||||||
|
$(items).each(function() {
|
||||||
|
getExtaPropertiesForIpObj(this, args);
|
||||||
|
});
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
actionFilter: actionFilters.ipAddress,
|
actionFilter: actionFilters.ipAddress,
|
||||||
data: items
|
data: items
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
args.response.error(parseXMLHttpResponse(data));
|
args.response.error(parseXMLHttpResponse(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Detail view
|
// Detail view
|
||||||
@ -2017,39 +2049,53 @@
|
|||||||
remove: {
|
remove: {
|
||||||
label: 'label.action.release.ip',
|
label: 'label.action.release.ip',
|
||||||
action: function(args) {
|
action: function(args) {
|
||||||
$.ajax({
|
if (args.context.nics) {
|
||||||
url: createURL('disassociateIpAddress'),
|
$.ajax({
|
||||||
data: {
|
url: createURL('removeIpFromNic'),
|
||||||
id: args.context.ipAddresses[0].id
|
data: {
|
||||||
},
|
id: args.context.ipAddresses[0].id
|
||||||
dataType: 'json',
|
},
|
||||||
async: true,
|
success: function(json) {
|
||||||
success: function(data) {
|
args.response.success({
|
||||||
args.response.success({
|
_custom: { jobId: json.removeipfromnicresponse.jobid }
|
||||||
_custom: {
|
});
|
||||||
jobId: data.disassociateipaddressresponse.jobid,
|
}
|
||||||
getActionFilter: function() {
|
});
|
||||||
return function(args) {
|
} else {
|
||||||
var allowedActions = ['enableStaticNAT'];
|
$.ajax({
|
||||||
|
url: createURL('disassociateIpAddress'),
|
||||||
|
data: {
|
||||||
|
id: args.context.ipAddresses[0].id
|
||||||
|
},
|
||||||
|
dataType: 'json',
|
||||||
|
async: true,
|
||||||
|
success: function(data) {
|
||||||
|
args.response.success({
|
||||||
|
_custom: {
|
||||||
|
jobId: data.disassociateipaddressresponse.jobid,
|
||||||
|
getActionFilter: function() {
|
||||||
|
return function(args) {
|
||||||
|
var allowedActions = ['enableStaticNAT'];
|
||||||
|
|
||||||
return allowedActions;
|
return allowedActions;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getUpdatedItem: function(args) {
|
getUpdatedItem: function(args) {
|
||||||
return {
|
return {
|
||||||
state: 'Released'
|
state: 'Released'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onComplete: function() {
|
onComplete: function() {
|
||||||
$(window).trigger('cloudStack.fullRefresh');
|
$(window).trigger('cloudStack.fullRefresh');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
},
|
||||||
},
|
error: function(data) {
|
||||||
error: function(data) {
|
args.response.error(parseXMLHttpResponse(data));
|
||||||
args.response.error(parseXMLHttpResponse(data));
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
confirm: function(args) {
|
confirm: function(args) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user