<div dir="ltr">So, an update:<div><br></div><div>I implemented support of json and yaml schemas to generate views dynamically. A schema looks like this:</div><div><br></div><div><div>{</div><div>        &quot;summary&quot;: [</div><div>                {&quot;name&quot;: &quot;id&quot;},</div><div>                {&quot;name&quot;: &quot;active&quot;, &quot;alias&quot;: &quot;is_active&quot;},</div><div>                {&quot;name&quot;: &quot;full_name&quot;, &quot;alias&quot;: &quot;name&quot;}</div><div>        ],</div><div>        &quot;foo&quot;: {&quot;name&quot;: &quot;foo&quot;}</div><div>}</div></div><div><br></div><div>Which is functionally equivalent (it actually generates a view dynamically with the same ruby code) to this:</div><div><br></div><div>pane :summary do</div><div>  field :id</div><div>  field :active, :is_active</div><div>  field :full_name, :mario</div><div>end</div><div><br></div><div>field :foo</div><div><br></div><div>And this is how it could be used to generate the views from data:</div><div><br></div><div>render json: View.from_json(unparsed_json).new(entity)</div><div>render json: View.from_yaml(unparsed_yaml).new(entity)</div><div>render json: View.from_hash(data_as_hash).new(entity)</div><div><br></div><div>Since those methods generate classes, they can be used to inherit new views, or even doing something like this:</div><div><br></div><div>class EAPServerView &lt; View.from_json(:code_to_get_from_hawkular)</div><div>end</div><div><br></div><div>Also, another important thing is that methods defined inside a view are used for the rendering, so attribute transformation can done in the view, instead of the entity if necessary, like this:</div><div><br></div><div>entity = OpenStruct.new(foo: :bar)</div><div>class MyView &lt; View</div><div>  field :foo</div><div><br></div><div>  def foo</div><div>    :baz</div><div>  end</div><div>end</div><div><br></div><div>Then rendering it would return something like { &quot;foo&quot;: &quot;baz&quot; }.</div><div><br></div><div>The changes are available on the same repo as always: <a href="http://github.com/cfcosta/dynamic-entity-poc">github.com/cfcosta/dynamic-entity-poc</a> , and you can find examples on how this work on view_spec.rb, and examples of schemas on spec/fixtures/view_import.*</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 9:42 AM, Heiko Rupp <span dir="ltr">&lt;<a href="mailto:hrupp@redhat.com" target="_blank">hrupp@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 17 Jul 2017, at 15:59, Caina Costa wrote:<br>
<br>
&gt; If we have a WildflyDomainControllerServer to render, first it will<br>
&gt; try to find WildFlyDomainControllerServerV<wbr>iew, then<br>
<br>
</span><span class="">I (still) consider that a problem, even if better than what we have now.<br>
</span>I can&#39;t tell e.g. the Infinispan folks &quot;Listen you know your stuff<br>
<span class="">better than we do, so please start writing Ruby code and create a<br>
pull-request against the hawkular-provider gem&quot;<br>
<br>
My goal really is to externalise that as much as possible (in to the<br>
hawkular-server or agent side), so that it is<br>
possible for other groups to write the description in e.g. JSON for<br>
their UI and the relation between Entities.<br>
<br>
Having that in Hawkular/Agent also allows us to introduce new supported<br>
</span>stuff outside the release cycles of ManageIQ and their downstream<br>
CloudForms.<br>
I am not even sure if e.g. introducing support for Infinispan could be<br>
part of a z-Stream release, which is supposed to be bugfixes only.<br>
<span class="">So if we&#39;d miss CF 4.6 GA, we can only support Fuse in the CF release<br>
after 4.6 GA, while if the UI is driven from (meta)-data on the Hawkular<br>
side, we can update the Middleware Manager / agent and the support would<br>
show automagically.<br>
Of course we may at some point in time create more specific UIs for some<br>
task, but the 80% case should work without modification of MiQ code.<br>
<br>
</span>We need to generate the views dynamically, by fetching the (meta) data<br>
<span class="">and the schema and generating the view from that. That means we don&#39;t<br>
need to change anything on ui-classic to add new entity types.<br>
</span><span class="">Those *EntityView Ruby objects need to be created from data retrieved<br>
from the Hawkular side and not by checking in new code into the<br>
hawkular-provider gem when supporting new Entities.<br>
<br>
</span>The metadata should probably stored inside MiQ for faster access, but<br>
that is a 2ndary concern.<br>
<br>
______________________________<wbr>_________________<br>
hawkular-dev mailing list<br>
<a href="mailto:hawkular-dev@lists.jboss.org">hawkular-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/hawkular-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/hawkular-dev</a><br>
</blockquote></div><br></div>