[Kimchi-devel] [PATCH V5 1/7] Add Minimal UI Page for the Sample Plugin

Aline Manera alinefm at linux.vnet.ibm.com
Tue Jun 10 14:34:53 UTC 2014


On 06/10/2014 11:24 AM, Zhou Zheng Sheng wrote:
> on 2014/06/10 22:19, Zhou Zheng Sheng wrote:
>> on 2014/06/10 21:24, Aline Manera wrote:
>>> On 06/09/2014 11:20 PM, Zhou Zheng Sheng wrote:
>>>> on 2014/06/10 03:21, Aline Manera wrote:
>>>>> On 06/09/2014 07:08 AM, shaohef at linux.vnet.ibm.com wrote:
>>>>>> diff --git a/plugins/sample/ui/config/tab-ext.xml
>>>>>> b/plugins/sample/ui/config/tab-ext.xml
>>>>>> index 948fa07..8e0b3d3 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>SampleTab</title>
>>>>>> +        <path>plugins/sample/tab.html</path>
>>>>> The UI files should be in a dedicated dir, as we have for kimchi
>>>>> And we could remove tab.html (which does not have any meaning) to
>>>>> sampleplugin.html or something like that
>>>>>
>>>> Hi, this file is not handle by back-end. It's just served by back-end,
>>>> and the front-end parses this file to get the clue on where the html
>>>> file of the plugin is.
>>>> So "plugins/sample/ui/tab.html" here is a virtual
>>>> URI, which is mapped to pages/tab.html under the specific ui dir of this
>>>> plugin.
>>> 1. This patch set uses plugins/sample/tab/html instead of
>>> plugins/sample/ui/tab.html
>>>
>> Sorry! I wanted to say "plugins/sample/tab.html is virtual URI", and
>> "plugins/sample/ui/tab.htmls" is the real file. Sorry for the misleading.
>>
>>> 2. Where is the map to pages/tab.html?
>>>
>> It works like this:
>>
>> 1. plugins.sample.Drawings inherits Root, and it is mounted on URI
>> "/plugins/sample". It also sets "self.paths = PluginPaths('sample')"
>>
>> 2. GET plugins/sample/tab.html -> Drawings(Root).default("tab.html") ->
>> template.render("tab.html").
>>
>> 3. When the template needs to get the actual template file name, it calls
>>   paths = cherrypy.request.app.root.paths
>>   filename = paths.get_template_path(resource)
>>
>> So here paths is actually "PluginPaths('sample')", and calling
>>    paths.get_template_path()
>> returns the result of
>>    os.path.join(self.ui_dir, 'pages/%s.tmpl' % resource)
>>
>> So actually the filename is
>>    self.ui_dir + 'pages/tab.html'
> should be self.ui_dir + 'pages/tab.html.tmpl'
>
>> and PluginPaths.__init__ sets
>>   self.ui_dir = self.add_prefix(os.path.join(self.plugin_dir, 'ui'))
>>
>> so at last the filename is
>>    'plugins/sample/ui' + 'pages/tab.html'
> should be 'plugins/sample/ui' + 'pages/tab.html.tmpl'
>
>> Let me add Mark Wu to the cc list. He is the designer of the plugin
>> framework.


Thanks a lot for the explanation, Zhou Zheng! =)

Got the flow now!

Sorry about too many question. I was just trying to understand that
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140610/0a23b01c/attachment.html>


More information about the Kimchi-devel mailing list