[PATCH V2 1/2] Plugins: Fix plugins framework in kimchi

If the plugin tab name string is not found in kimchi i18n file, the tab name is set as 'unknown'. This patch also add more messages to kimchis log, and fixes a problem with the plugins extra tabs file location Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- src/kimchi/server.py | 13 ++++++++++--- ui/js/src/kimchi.main.js | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/kimchi/server.py b/src/kimchi/server.py index b820263..4fcb0df 100644 --- a/src/kimchi/server.py +++ b/src/kimchi/server.py @@ -28,6 +28,7 @@ import logging.handlers import os import sslcert + from kimchi import auth from kimchi import config from kimchi import model @@ -208,14 +209,19 @@ class Server(object): script_name = plugin_config['kimchi']['uri'] del plugin_config['kimchi'] + tabs_extra_file = config.get_plugin_tab_xml(plugin_name) plugin_config['/ui/config/tab-ext.xml'] = { 'tools.staticfile.on': True, - 'tools.staticfile.filename': - config.get_plugin_tab_xml(plugin_name), + 'tools.staticfile.filename': tabs_extra_file, 'tools.nocache.on': True} except KeyError: continue - + except IOError as e: + msg = "Failed to load plugin tabs file %s" %tabs_extra_file + cherrypy.log.error_log.error(msg) + cherrypy.log.error_log.error('Ignoring plugin "%s"', + plugin_name) + continue try: plugin_app = import_class(plugin_class)() except ImportError: @@ -223,6 +229,7 @@ class Server(object): plugin_class) continue cherrypy.tree.mount(plugin_app, script_name, plugin_config) + cherrypy.log('Plugin loaded: %s' %plugin_class) def _init_ssl(self, options): ssl_server = cherrypy._cpserver.Server() diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index cc8afee..8b84a34 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -211,7 +211,7 @@ kimchi.getTabHtml = function(url) { $(xmlData).find('tab').each(function() { var $tab = $(this); var titleKey = $tab.find('title').text(); - var title = i18n[titleKey]; + var title = i18n[titleKey] || titleKey; var path = $tab.find('path').text(); tabsHtml += "<li><a class='item' href=" + path + ">" + title + "</a></li>"; }); -- 1.8.4.2

The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample" [/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin -- 1.8.4.2

On 01/18/2014 02:41 AM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html Sorry, I don't understand why you add a test tab in sample/ui, seems it does't needed. @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

On 01/19/2014 11:43 PM, zhoumeina wrote:
On 01/18/2014 02:41 AM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html Sorry, I don't understand why you add a test tab in sample/ui, seems it does't needed.
Hi, I think this plugin should only work as an example (since plugin development for Kimchi is not well documented), so I thought that would be good to add an example of UI. Then, anyone that wants to create a plugin, will have a better idea how to proceed.
@@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html'
I was expecting have a plugins/sample/sample.conf.in with: tools.staticfile.on: True tools.staticfile.filename: '*@pluginddir@*/sample/ui/tab.html' Then we add it to Makefile.am to do the replacement during build process. So when we get kimchi installed the plugins/sample/sample.conf file will have the correct full path Does that make sense for you?
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

On 01/20/2014 02:24 PM, Aline Manera wrote:
On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo<rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html'
I was expecting have a plugins/sample/sample.conf.in with:
tools.staticfile.on: True tools.staticfile.filename: '*@pluginddir@*/sample/ui/tab.html'
Then we add it to Makefile.am to do the replacement during build process.
So when we get kimchi installed the plugins/sample/sample.conf file will have the correct full path
Does that make sense for you?
Hi Aline, I considered and thought about your approach, but I did not implemented it because it will only work for this plugin, which is built together with whole Kimchi code. I my opinion, the sample plugin should be a guide for how to develop new plugins (for now, at least, as we don't a documentation and the plugin framework is still being refined). What do you think ?
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

On 01/21/2014 02:34 PM, Rodrigo Trujillo wrote:
On 01/20/2014 02:24 PM, Aline Manera wrote:
On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo<rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html'
I was expecting have a plugins/sample/sample.conf.in with:
tools.staticfile.on: True tools.staticfile.filename: '*@pluginddir@*/sample/ui/tab.html'
Then we add it to Makefile.am to do the replacement during build process.
So when we get kimchi installed the plugins/sample/sample.conf file will have the correct full path
Does that make sense for you?
Hi Aline, I considered and thought about your approach, but I did not implemented it because it will only work for this plugin, which is built together with whole Kimchi code. I my opinion, the sample plugin should be a guide for how to develop new plugins (for now, at least, as we don't a documentation and the plugin framework is still being refined). What do you think ?
First of all, sorry for the late message. As it will be a guide to new plugins development we need to address it in the best way to disseminateit. For that, I sill think the best way is using autoconf/automake to generate the correct entry in the config file.
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

On 01/30/2014 03:23 PM, Aline Manera wrote:
On 01/21/2014 02:34 PM, Rodrigo Trujillo wrote:
On 01/20/2014 02:24 PM, Aline Manera wrote:
On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo<rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html'
I was expecting have a plugins/sample/sample.conf.in with:
tools.staticfile.on: True tools.staticfile.filename: '*@pluginddir@*/sample/ui/tab.html'
Then we add it to Makefile.am to do the replacement during build process.
So when we get kimchi installed the plugins/sample/sample.conf file will have the correct full path
Does that make sense for you?
Hi Aline, I considered and thought about your approach, but I did not implemented it because it will only work for this plugin, which is built together with whole Kimchi code. I my opinion, the sample plugin should be a guide for how to develop new plugins (for now, at least, as we don't a documentation and the plugin framework is still being refined). What do you think ?
First of all, sorry for the late message.
As it will be a guide to new plugins development we need to address it in the best way to disseminateit. For that, I sill think the best way is using autoconf/automake to generate the correct entry in the config file.
How could an external plugin rpm being compiled/built in a different machine know the value of what is in kimchis autoconf/automake ?? But, nevermind, you can ignore this patch ... Mark have worked in something else related to paths.
diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False
I've just noticed we can't disable this plugin otherwise the tests will fail.
plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

On 01/30/2014 03:25 PM, Aline Manera wrote:
On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
The xml file had wrong entries, then kimchi UI did not recognize the tabs. This patch fixes this problem and also disables the sample plugin by default.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- plugins/sample/sample.conf | 7 ++++++- plugins/sample/ui/config/tab-ext.xml | 8 ++++---- plugins/sample/ui/tab.html | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 plugins/sample/ui/tab.html
diff --git a/plugins/sample/sample.conf b/plugins/sample/sample.conf index c4e80f7..1a8d6b4 100644 --- a/plugins/sample/sample.conf +++ b/plugins/sample/sample.conf @@ -1,7 +1,12 @@ [kimchi] -enable = True +enable = False
I've just noticed we can't disable this plugin otherwise the tests will fail.
Ok, please ignore this patch
plugin_class = "Drawings" uri = "/plugins/sample"
[/] tools.trailing_slash.on = False + + +[/ui/tab.html] +tools.staticfile.on: True +tools.staticfile.filename: kimchi.config.get_plugins_dir() + '/sample/ui/tab.html' diff --git a/plugins/sample/ui/config/tab-ext.xml b/plugins/sample/ui/config/tab-ext.xml index 948fa07..d1f8456 100644 --- a/plugins/sample/ui/config/tab-ext.xml +++ b/plugins/sample/ui/config/tab-ext.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!--<tabs-ext> +<tabs-ext> <tab> - <title>Test</title> - <filePath>plugins/sample/ui/tab.html</filePath> + <title>Sample</title> + <path>plugins/sample/ui/tab.html</path> </tab> -</tabs-ext>--> \ No newline at end of file +</tabs-ext> diff --git a/plugins/sample/ui/tab.html b/plugins/sample/ui/tab.html new file mode 100644 index 0000000..1562713 --- /dev/null +++ b/plugins/sample/ui/tab.html @@ -0,0 +1 @@ +This is a test TAB for SAMPLE plugin

Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 01/17/2014 04:41 PM, Rodrigo Trujillo wrote:
If the plugin tab name string is not found in kimchi i18n file, the tab name is set as 'unknown'. This patch also add more messages to kimchis log, and fixes a problem with the plugins extra tabs file location
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- src/kimchi/server.py | 13 ++++++++++--- ui/js/src/kimchi.main.js | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/kimchi/server.py b/src/kimchi/server.py index b820263..4fcb0df 100644 --- a/src/kimchi/server.py +++ b/src/kimchi/server.py @@ -28,6 +28,7 @@ import logging.handlers import os import sslcert
+ from kimchi import auth from kimchi import config from kimchi import model @@ -208,14 +209,19 @@ class Server(object): script_name = plugin_config['kimchi']['uri'] del plugin_config['kimchi']
+ tabs_extra_file = config.get_plugin_tab_xml(plugin_name) plugin_config['/ui/config/tab-ext.xml'] = { 'tools.staticfile.on': True, - 'tools.staticfile.filename': - config.get_plugin_tab_xml(plugin_name), + 'tools.staticfile.filename': tabs_extra_file, 'tools.nocache.on': True} except KeyError: continue - + except IOError as e: + msg = "Failed to load plugin tabs file %s" %tabs_extra_file + cherrypy.log.error_log.error(msg) + cherrypy.log.error_log.error('Ignoring plugin "%s"', + plugin_name) + continue try: plugin_app = import_class(plugin_class)() except ImportError: @@ -223,6 +229,7 @@ class Server(object): plugin_class) continue cherrypy.tree.mount(plugin_app, script_name, plugin_config) + cherrypy.log('Plugin loaded: %s' %plugin_class)
def _init_ssl(self, options): ssl_server = cherrypy._cpserver.Server() diff --git a/ui/js/src/kimchi.main.js b/ui/js/src/kimchi.main.js index cc8afee..8b84a34 100644 --- a/ui/js/src/kimchi.main.js +++ b/ui/js/src/kimchi.main.js @@ -211,7 +211,7 @@ kimchi.getTabHtml = function(url) { $(xmlData).find('tab').each(function() { var $tab = $(this); var titleKey = $tab.find('title').text(); - var title = i18n[titleKey]; + var title = i18n[titleKey] || titleKey; var path = $tab.find('path').text(); tabsHtml += "<li><a class='item' href=" + path + ">" + title + "</a></li>"; });
participants (3)
-
Aline Manera
-
Rodrigo Trujillo
-
zhoumeina