<div dir="ltr"><div><div>I almost forgot to ask. Since you don't point it out, I am assuming (yeah I know) the plugin code methods have not changed from 3.3 to 4.1? That is to day I should be able to use the same techniques?<br><br></div>Thanks again!<br><br><br></div>Corey<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 6, 2015 at 3:51 AM, Petr Vobornik <span dir="ltr"><<a href="mailto:pvoborni@redhat.com" target="_blank">pvoborni@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 03/06/2015 03:54 AM, Corey Kovacs wrote:<br>
</span><span class=""><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 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 sense<br>
of.<br>
<br>
</blockquote>
<br></span>
Plugin could be just one file, if the plugin name is "myplugin" it has to 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/employeenumber.js" target="_blank">https://pvoborni.fedorapeople.<u></u>org/plugins/employeenumber/<u></u>employeenumber.js</a><br>
<br>
Web UI basics and introspection:<br>
(this section is little redundant to your question, but it might help others)<br>
<br>
FreeIPA Web UI is semi declarative. That means that part of the pages could be thrown away, modified or extended by plugins before the page is constructed. To do that, one has to modify specification object of particular module.<br>
<br>
Here, I would assume that you don't have UI sources(before minification), so all introspection will be done in running web ui. Otherwise it's easier to inspect sources in install/ui/src/freeipa, i.e. checkout ipa-3-3 branch from upstream git.<br>
<br>
List of modules could be find(after authentication) in browse developer 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' property.<br>
<br>
user_module.entity_spec<br>
<br>
UI is internally organized into entities. Entity corresponds to ipalib object. Entity, e.g. user, usually have multiple pages called facets. To 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 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 sections:<br>
details_facet.sections<br>
<br>
Section has fields. A field usually represents an editable element on 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. To know what to define, just examine a definition of already existing field and just amend name, label, ...<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
It would help also to understand how to debug such a thing.<br>
<br>
</blockquote>
<br></span>
In browser developer tools. There is javascript console (use in the text above), javascript debugger, network tab for inspecting loaded files.<br>
<br>
For developing RHEL 7 plugin, I would suggest you to install test instance 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 error in the plugin or you don't return a plugin object or the plugin could not be loaded (bad name)<br>
- it's good to use some JavaScript liner - jsl or jshint to catch syntax errors early.<div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I running version 3.3 on rhel 7. Any help or pointers to more<br>
documentation would be greatly appreciated.<br>
<br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Petr Vobornik<br>
</font></span></blockquote></div><br></div>