[Kimchi-devel] [PATCH] [WoK 2/2] /config/plugins: changing existing UI calls
dhbarboza82 at gmail.com
dhbarboza82 at gmail.com
Wed Feb 1 12:03:27 UTC 2017
From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
This patch changes ui/js/src/wok.api.js 'listPlugins' method
to use the URL /config/plugins instead of /plugins.
With this change, ui/js/src/wok.logos.js and ui/js/src/wok.main.js
were also changed to handle the different return value from the
/config/plugins API.
Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
ui/js/src/wok.api.js | 4 ++--
ui/js/src/wok.logos.js | 11 +++++++----
ui/js/src/wok.main.js | 10 +++++++---
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ui/js/src/wok.api.js b/ui/js/src/wok.api.js
index e2829ab..c465dfb 100644
--- a/ui/js/src/wok.api.js
+++ b/ui/js/src/wok.api.js
@@ -1,7 +1,7 @@
/*
* Project Wok
*
- * Copyright IBM Corp, 2015-2016
+ * Copyright IBM Corp, 2015-2017
*
* Code derived from Project Kimchi
*
@@ -111,7 +111,7 @@ var wok = {
listPlugins : function(suc, err, sync) {
wok.requestJSON({
- url : 'plugins',
+ url : '/config/plugins',
type : 'GET',
contentType : 'application/json',
dataType : 'json',
diff --git a/ui/js/src/wok.logos.js b/ui/js/src/wok.logos.js
index a825108..b4e2d75 100644
--- a/ui/js/src/wok.logos.js
+++ b/ui/js/src/wok.logos.js
@@ -1,7 +1,7 @@
/*
* Project Wok
*
- * Copyright IBM Corp, 2016
+ * Copyright IBM Corp, 2016-2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -78,18 +78,21 @@ wok.logos = function(element, powered) {
wok.listPlugins(function(plugins) {
if(plugins && plugins.length > 0) {
$(plugins).each(function(i, p) {
+ if (p.enabled === false) {
+ return true;
+ }
var url = wok.substitute(pluginUrl, {
- plugin: p
+ plugin: p.name
});
obj[i] = {
- name : p
+ name : p.name
}
var pluginVersions;
pluginVersions = retrieveVersion(url);
if(pluginVersions && pluginVersions.length > 0){
obj[i].version = pluginVersions;
}
- var imagepath = url+'/images/'+p;
+ var imagepath = url+'/images/'+p.name;
if(checkImage(imagepath+'.svg') == 200) {
obj[i].image = imagepath+'.svg';
}
diff --git a/ui/js/src/wok.main.js b/ui/js/src/wok.main.js
index c67e97c..6de8ea0 100644
--- a/ui/js/src/wok.main.js
+++ b/ui/js/src/wok.main.js
@@ -142,16 +142,20 @@ wok.main = function() {
var tabs = retrieveTabs('wok', wokConfigUrl);
wok.listPlugins(function(plugins) {
$(plugins).each(function(i, p) {
+ if (p.enabled === false) {
+ return true;
+ }
+
var url = wok.substitute(pluginConfigUrl, {
- plugin: p
+ plugin: p.name
});
var i18nUrl = wok.substitute(pluginI18nUrl, {
- plugin: p
+ plugin: p.name
});
wok.getI18n(function(i18nObj){ $.extend(i18n, i18nObj)},
function(i18nObj){ //i18n is not define by plugin
}, i18nUrl, true);
- var pluginTabs = retrieveTabs(p, url);
+ var pluginTabs = retrieveTabs(p.name, url);
if(pluginTabs.length > 0){
tabs.push.apply(tabs, pluginTabs);
}
--
2.9.3
More information about the Kimchi-devel
mailing list