On ke, 01 kesä 2022, Leo O via FreeIPA-users wrote:
I absolutely don't how the file "postfixbook/postfixbook.js" has to be
structured. It's not clear to me, even when reading the README.md you
proposed.
Maybe something like:
"
{
name: '$plugin_name',
path: 'plugins/$plugin_name'
}
"
But how to continue? I mean, do I have to put this inside an array or
an JSON object etc. How would that look like for multiple plugins like
I have?
You have one plugin in terms of IPA UI -- it is loaded via
postfixbook/postfixbook.js. The rest can be loaded similar to how we
load internal plugins.
define([
'./mailalias',
'./mailenabled',
'./mailforwardingaddress',
'./mailgidnumber',
'./mailgroupmember',
'./mailhomedirectory',
'./mailquota',
'./mailsieverulesource',
'./mailstoragedirectory',
'./mailuidnumber'],function(){
});
'define()' function will load each of those and run them and after that
is done, the function will be called.
I did a small experiment with a plugin 'foo':
# cat foo/foo.js
define([
'./bar'],
function(){
})
# cat foo/bar.js
define([
'freeipa/text',
'freeipa/widgets/LoginScreen'
],function(text, LoginScreen){
LoginScreen.field_specs[0].label = text.get('@i18n:login.username1',
"Username 1");
});
This 'bar' subplugin replaces 'Username' label on the login page by
'Username 1'. Obviously, login.username1 translation is not provided by
anything -- for that one needs Python code that extends
ipaserver.internal.i18n_messages.messages['login'] dict with
'username1' element:
---------------------------------------------------------
from ipalib.text import _
from .internal import i18n_messages
i18n_messages.messages['login']['username1'] = _("My other username")
----------------------------------------------------------
If you'd provide one, then it would be 'My other username' rather than
'Username 1'.
The paths in 'define' are relative to /ipa/ui/js, so all FreeIPA
components are in 'freeipa/', all Dojo components are in 'dojo/' and so
on. Your own plugin code would be at './' inside 'foo' or at
'plugins/foo/', if you want the full path to reference it from other
plugin.
Hopefully, this helps.
--
/ Alexander Bokovoy
Sr. Principal Software Engineer
Security / Identity Management Engineering
Red Hat Limited, Finland
_______________________________________________
FreeIPA-users mailing list -- freeipa-users@lists.fedorahosted.org
To unsubscribe send an email to freeipa-users-le...@lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/freeipa-users@lists.fedorahosted.org
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure