diff options
author | Pavel Vomacka <pvomacka@redhat.com> | 2016-06-30 14:34:33 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2016-07-01 09:39:49 +0200 |
commit | 4bc2e3164fbc4fdbbd4ecd1d26001a5d4671dd94 (patch) | |
tree | 87f528bf0d5aa5c29403d74d8070da64921948f8 /install/ui/src | |
parent | 2232a5bb09b3e99d10598ab64d0bf5d8ef006df4 (diff) | |
download | freeipa-4bc2e3164fbc4fdbbd4ecd1d26001a5d4671dd94.tar.gz freeipa-4bc2e3164fbc4fdbbd4ecd1d26001a5d4671dd94.tar.xz freeipa-4bc2e3164fbc4fdbbd4ecd1d26001a5d4671dd94.zip |
Add widgets for kerberos aliases
Create own custom_command_multivalued_widget for kerberos aliases.
https://fedorahosted.org/freeipa/ticket/5927
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
Diffstat (limited to 'install/ui/src')
-rw-r--r-- | install/ui/src/freeipa/widget.js | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 49d8f141d..9151ebac9 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1798,6 +1798,110 @@ IPA.custom_command_multivalued_widget = function(spec) { return that; }; +/** + * Multivalued widget which is used for working with kerberos principal aliases. + * + * @class + * @extends IPA.custom_command_multivalued_widget + */ +IPA.krb_principal_multivalued_widget = function (spec) { + + spec = spec || {}; + + spec.adder_dialog_spec = spec.adder_dialog_spec || { + title: '@i18n:krbaliases.adder_title', + fields: [ + { + $type: 'text', + name: 'krbprincalname', + label: '@i18n:krbaliases.add_krbal_label' + } + ] + }; + + var that = IPA.custom_command_multivalued_widget(spec); + + that.create_remove_dialog_title = function(row) { + return text.get('@i18n:krbaliases.remove_title'); + }; + + that.create_remove_dialog_message = function(row) { + var message = text.get('@i18n:krbaliases.remove_message'); + message = message.replace('${alias}', row.widget.principal_name); + + return message; + }; + + + that.create_remove_args = function(row) { + var pkey = that.facet.get_pkey(); + var krbprincipalname = row.widget.principal_name; + krbprincipalname = [ krbprincipalname ]; + + var args = [ + pkey, + krbprincipalname + ]; + + return args; + }; + + that.create_add_args = function(row) { + var pkey = that.facet.get_pkey(); + var krbprincipalname = that.adder_dialog.get_field('krbprincalname').value; + + var args = [ + pkey, + krbprincipalname + ]; + + return args; + }; + + return that; +}; + +/** + * Widget which is used as row in kerberos aliases multivalued widget. + * It contains only string where is the principal alias name and delete button. + * + * @class + * @extends IPA.input_widget + */ +IPA.krb_principal_widget = function(spec) { + spec = spec || {}; + + var that = IPA.input_widget(); + + that.create = function(container) { + that.widget_create(container); + + that.principal_text = $('<span />', { + 'class': 'krb-principal-name', + text: '' + }).appendTo(container); + + if (that.undo) { + that.create_undo(container); + } + + that.create_error_link(container); + }; + + that.update = function(value) { + + var principal_name = value[0] || ''; + + that.principal_name = principal_name; + that.update_text(); + }; + + that.update_text = function() { + that.principal_text.text(that.principal_name); + }; + + return that; +}; /** * Option widget base @@ -7053,6 +7157,10 @@ exp.register = function() { w.register('multivalued', IPA.multivalued_widget); w.register('custom_command_multivalued', IPA.custom_command_multivalued_widget); + w.register('krb_principal_multivalued', + IPA.krb_principal_multivalued_widget); + w.register('krb_principal', + IPA.krb_principal_widget); w.register('password', IPA.password_widget); w.register('radio', IPA.radio_widget); w.register('select', IPA.select_widget); |