You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by we...@apache.org on 2014/07/01 11:39:59 UTC
[2/4] git commit: updated refs/heads/4.3 to ba9ae0c
[UI] filter out already connected networks when add network to vm
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6fd419ad
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6fd419ad
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6fd419ad
Branch: refs/heads/4.3
Commit: 6fd419ad9d589da7930b9c593eb8ad81c989ebe7
Parents: 11f5f92
Author: Wei Zhou <w....@leaseweb.com>
Authored: Tue Jul 1 10:54:57 2014 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Tue Jul 1 11:39:25 2014 +0200
----------------------------------------------------------------------
ui/scripts/instances.js | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6fd419ad/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index d45b6cb..8a13ef2 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1906,13 +1906,30 @@
domainid: args.context.instances[0].domainid
},
success: function(json) {
+ var networkObjs = json.listnetworksresponse.network;
+ var nicObjs = args.context.instances[0].nic;
+ var items = [];
+
+ for (var i = 0; i < networkObjs.length; i++) {
+ var networkObj = networkObjs[i];
+ var isNetworkExists = false;
+
+ for (var j = 0; j < nicObjs.length; j++) {
+ if (nicObjs[j].networkid == networkObj.id) {
+ isNetworkExists = true;
+ break;
+ }
+ }
+
+ if (!isNetworkExists) {
+ items.push({
+ id: networkObj.id,
+ description: networkObj.name
+ });
+ }
+ }
args.response.success({
- data: $.map(json.listnetworksresponse.network, function(network) {
- return {
- id: network.id,
- description: network.name
- };
- })
+ data: items
});
}
});