[Kimchi-devel] [PATCH v2] [Kimchi 2/2] Filter VEPA interfaces: JS changes
dhbarboza82 at gmail.com
dhbarboza82 at gmail.com
Thu May 12 11:49:16 UTC 2016
From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
This patch adds a new call in kimchi.api.js to fetch only
the interfaces that has VEPA support and changes
kimchi.network_add_main.js to call this new function
when network type is VEPA.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
ui/js/src/kimchi.api.js | 14 ++++++++++++++
ui/js/src/kimchi.network_add_main.js | 12 ++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
index 3a94631..83d1cc7 100644
--- a/ui/js/src/kimchi.api.js
+++ b/ui/js/src/kimchi.api.js
@@ -634,6 +634,20 @@ var kimchi = {
});
},
+ getVEPAInterfaces : function(suc, err) {
+ wok.requestJSON({
+ url : 'plugins/kimchi/interfaces?module=^(?!mlx5_core|mlx5-core).*$',
+ type : 'GET',
+ contentType : 'application/json',
+ dataType : 'json',
+ resend : true,
+ success : suc,
+ error : err ? err : function(data) {
+ wok.message.error(data.responseJSON.reason);
+ }
+ });
+ },
+
deleteNetwork : function(name, suc, err) {
wok.requestJSON({
url : 'plugins/kimchi/networks/' + encodeURIComponent(name),
diff --git a/ui/js/src/kimchi.network_add_main.js b/ui/js/src/kimchi.network_add_main.js
index 4eb5c5b..e12f1df 100644
--- a/ui/js/src/kimchi.network_add_main.js
+++ b/ui/js/src/kimchi.network_add_main.js
@@ -169,7 +169,8 @@ kimchi.enableBridgeOptions = function(enable, networkType, networkDestinationTyp
};
kimchi.loadInterfaces = function(interfaceFilterArray) {
- kimchi.getInterfaces(function(result) {
+
+ var loadInterfacesHTML = function(result) {
var options = [];
$selectDestination = $('#networkDestinationID');
var nics = {};
@@ -194,5 +195,12 @@ kimchi.loadInterfaces = function(interfaceFilterArray) {
$('#networkDestinationID').selectpicker('refresh');
kimchi.setDefaultNetworkType(result.length!==0);
kimchi.changeNetworkDestination();
- });
+ };
+
+ var networkType = $("#networkType").val();
+ if (networkType === kimchi.NETWORK_TYPE_VEPA) {
+ kimchi.getVEPAInterfaces(loadInterfacesHTML);
+ } else {
+ kimchi.getInterfaces(loadInterfacesHTML);
+ }
};
--
2.5.5
More information about the Kimchi-devel
mailing list