#45: Refine XML markup to embed dashboard layouts and widgets
-------------------------+-------------------------------------------------
Reporter: olemis | Owner: olemis
Type: | Status: accepted
enhancement | Milestone: Release 2
Priority: minor | Version:
Component: dashboard | Keywords: markup widget layout genshi
Resolution: | template
-------------------------+-------------------------------------------------
Old description:
> Right now a combination of XML + JSON has to be inserted in Genshi
> templates so as to embed widgets and layouts implemented by dashboard
> plugin .
>
> For some reasons it's better to implement this feature using ''XML''
> instead. My initial attempt trying to get this done was not as successful
> as I expected but eventually a solution will come up handy .
>
> For instance , widget markup in the early days (prior to r1351312 )
> looked like the snippet shown below
>
> {{{
> #!xml
>
> <bh:widget id="simple_widget" urn="WidgetName" altlinks="false">
> <bh:args>
> {"args" : {"arg1" : "value1",
> "arg2" : "value2"
> }
> }
> </bh:args>
> </bh:widget>
>
> }}}
>
> ... whereas in current implementation ''only XML'' is needed (which is
> more suitable to use together with ''Genshi'' statements e.g. `py:for` ,
> `py:if` ... )
>
> {{{
> #!xml
>
> <bh:widget id="simple_widget" urn="WidgetName" altlinks="false">
> <bh:args>
> <bh:arg name="arg1">value1</bh:arg>
> <bh:arg name="arg2">value2</bh:arg>
> </bh:args>
> </bh:widget>
>
> }}}
>
> Further details may be found in comments in Genshi templates included in
> dashboard plugin
New description:
Right now a combination of XML + JSON has to be inserted in Genshi
templates so as to embed widgets and layouts implemented by dashboard
plugin .
For some reasons it's better to implement this feature using ''XML''
instead. My initial attempt trying to get this done was not as successful
as I expected but eventually a solution will come up handy .
For instance , widget markup in the early days (prior to r1351312 ) looked
like the snippet shown below
{{{
#!xml
<bh:widget id="simple_widget" urn="WidgetName" altlinks="false">
<bh:args>
{"args" : {"arg1" : "value1",
"arg2" : "value2"
}
}
</bh:args>
</bh:widget>
}}}
... whereas in current implementation ''only XML'' is needed (which is
more suitable to use together with ''Genshi'' statements e.g. `py:for` ,
`py:if` ... )
{{{
#!xml
<bh:widget id="simple_widget" urn="WidgetName" altlinks="false">
<bh:args>
<bh:arg name="arg1">value1</bh:arg>
<bh:arg name="arg2">value2</bh:arg>
</bh:args>
</bh:widget>
}}}
[attachment:bh_milestone_view.html Sample file] illustrates the use of
markup to embed (nested) layouts in ''Genshi'' templates.
Further details may be found in comments in Genshi templates included in
dashboard plugin
--
Comment (by olemis):
Attached two patches implementing markup to embed layouts in ''Genshi''
templates . [attachment:t45_r1357341_layout_xml.diff First one] implements
necessary logic needed for this to happen . Some
[attachment:t45_r1357341_widget_markup_doctests.diff doctests] available
as well . Apply patches against r1357341 in the following order :
{{{
#!sh
$ hg qapplied
t45/t45_r1357341_layout_xml.diff
t45/t45_r1357341_widget_markup_doctests.diff
}}}
Everything was tested using [attachment:bh_milestone_view.html sample
Genshi template] to obtain a modified version of milestone view. It all
looks like shown below . Please take a look at the usage of nested layouts
[[Image(bh_theme_x_47_layout_markup_1.png, width=600)]]
[[Image(bh_theme_x_48_layout_markup_2.png, width=600)]]
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/45#comment:8>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound (incubating) issue tracker