<p dir="ltr">Sounds great. Just wanted to know if I was going to be reinventing my own wheel again. </p>
<p dir="ltr">Thanks again. </p>
<p dir="ltr">Corey</p>
<div class="gmail_quote">On Mar 6, 2015 6:58 AM, "Petr Vobornik" <<a href="mailto:pvoborni@redhat.com">pvoborni@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/06/2015 02:31 PM, Corey Kovacs wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I almost forgot to ask. Since you don't point it out, I am assuming (yeah I<br>
know) the plugin code methods have not changed from 3.3 to 4.1? That is to<br>
day I should be able to use the same techniques?<br>
</blockquote>
<br>
Same techniques should be applicable, there were no major improvements in plugin support in 4.1. But Web UI doesn't have any stable API so little things could be different.<br>
<br>
Basically plugins interact with Web UI's core code which is not perfect(easy to break things) but it's powerful and better than nothing.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks again!<br>
<br>
Corey<br>
<br>
On Fri, Mar 6, 2015 at 3:51 AM, Petr Vobornik <<a href="mailto:pvoborni@redhat.com" target="_blank">pvoborni@redhat.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 03/06/2015 03:54 AM, Corey Kovacs wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
After reading the extending freeipa training document I was able<br>
successfully add  us to meet attributes and add/modify them using the cli<br>
which was pretty cool. Now that I got the cli out of the way I want to add<br>
the fields to the ui. Because of the similarities between what I want to<br>
do<br>
and the example given in the docs I just followed along and changed<br>
variables where it made sense to do so. I cannot however get the new field<br>
to show up.  The Apache logs don't show any errors but they do show the<br>
plugin being read as the page (user details) is loaded. After searching<br>
around I found a document which attempts to explain the process but it<br>
assumes some knowledge held by the reader which I don't possess.<br>
<br>
It looks like I  supposed to create some sort of index loader which loads<br>
all of the modules which are part of the plugin. I can't seem to find any<br>
good documents telling the whole process or least non that I can make<br>
sense<br>
of.<br>
<br>
<br>
</blockquote>
Plugin could be just one file, if the plugin name is "myplugin" it has to<br>
be:<br>
<br>
  /usr/share/ipa/ui/js/plugins/<u></u>myplugin/myplugin.js<br>
<br>
IPA Web UI uses AMD module format:<br>
- <a href="https://dojotoolkit.org/documentation/tutorials/1.10/modules/" target="_blank">https://dojotoolkit.org/<u></u>documentation/tutorials/1.10/<u></u>modules/</a><br>
- <a href="http://requirejs.org/docs/whyamd.html#amd" target="_blank">http://requirejs.org/docs/<u></u>whyamd.html#amd</a><br>
<br>
I have some example plugins here:<br>
- <a href="https://pvoborni.fedorapeople.org/plugins/" target="_blank">https://pvoborni.fedorapeople.<u></u>org/plugins/</a><br>
<br>
For your case I would look at:<br>
- <a href="https://pvoborni.fedorapeople.org/plugins/employeenumber/" target="_blank">https://pvoborni.fedorapeople.<u></u>org/plugins/employeenumber/</a><br>
employeenumber.js<br>
<br>
Web UI basics and introspection:<br>
(this section is little redundant to your question, but it might help<br>
others)<br>
<br>
FreeIPA Web UI is semi declarative. That means that part of the pages<br>
could be thrown away, modified or extended by plugins before the page is<br>
constructed. To do that, one has to modify specification object of<br>
particular module.<br>
<br>
Here, I would assume that you don't have UI sources(before minification),<br>
so all introspection will be done in running web ui. Otherwise it's easier<br>
to inspect sources in install/ui/src/freeipa, i.e. checkout ipa-3-3 branch<br>
from upstream git.<br>
<br>
List of modules could be find(after authentication) in browse developer<br>
tools console in object:<br>
<br>
   window.require.cache<br>
or (depends on IPA version)<br>
   window.dojo.config.cache<br>
<br>
One can then obtain the module by:<br>
<br>
   var user_module = require('freeipa/user')<br>
<br>
specification object is usually in 'entity_spec' or '$enity_name_spec'<br>
property.<br>
<br>
   user_module.entity_spec<br>
<br>
UI is internally organized into entities. Entity corresponds to ipalib<br>
object. Entity, e.g. user, usually have multiple pages called facets. To<br>
get a list of facets:<br>
   user_module.entity_spec.facets<br>
<br>
The one with fields has usually a name "details". For users it's the<br>
second facet:<br>
   var details_facet = user_module.entity_spec.<u></u>facets[1]<br>
<br>
IF i simplify it a bit, we can say that fields on a page are organized in<br>
sections:<br>
   details_facet.sections<br>
<br>
Section has fields. A field usually represents an editable element on<br>
page, e.g. a textbox with label, validators and other stuff.<br>
<br>
Example of inspection:<br>
<br>
<a href="https://pvoborni.fedorapeople.org/images/inspect_ui.png" target="_blank">https://pvoborni.fedorapeople.<u></u>org/images/inspect_ui.png</a><br>
<br>
Your goal is to pick a section, or create a new one an add a field there.<br>
To know what to define, just examine a definition of already existing field<br>
and just amend name, label, ...<br>
<br>
<br>
  It would help also to understand how to debug such a thing.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
</blockquote>
In browser developer tools. There is javascript console (use in the text<br>
above), javascript debugger, network tab for inspecting loaded files.<br>
<br>
For developing RHEL 7 plugin, I would suggest you to install test instance<br>
of FreeIPA 3.3 and use "Debugging with source codes" method described in:<br>
<br>
- <a href="https://pvoborni.fedorapeople.org/doc/#!/guide/Debugging" target="_blank">https://pvoborni.fedorapeople.<u></u>org/doc/#!/guide/Debugging</a><br>
<br>
Some tips:<br>
- if you get a weird dojo loader messegate, you probably have a syntax<br>
error in the plugin or you don't return a plugin object or the plugin could<br>
not be loaded (bad name)<br>
- it's good to use some JavaScript liner - jsl or jshint to catch syntax<br>
errors early.<br>
<br>
<br>
  I  running version 3.3 on rhel 7. Any help or pointers to more<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
documentation would be greatly appreciated.<br>
<br>
<br>
</blockquote>
--<br>
Petr Vobornik<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
<br>
-- <br>
Petr Vobornik<br>
</blockquote></div>