diff options
author | Pavel Vomacka <pvomacka@redhat.com> | 2017-01-16 14:13:42 +0100 |
---|---|---|
committer | Tomas Krizek <tkrizek@redhat.com> | 2017-03-08 10:14:21 +0100 |
commit | fba318b83337b71ccb3421690071a130171fbdfe (patch) | |
tree | 37af6b5aefff7192c5796e742922e91bc44cd7cc | |
parent | 27027bbc9cf7faa29c3c94686635559cbcbde98a (diff) | |
download | freeipa-fba318b83337b71ccb3421690071a130171fbdfe.tar.gz freeipa-fba318b83337b71ccb3421690071a130171fbdfe.tar.xz freeipa-fba318b83337b71ccb3421690071a130171fbdfe.zip |
WebUI: Create non editable row widget for mutlivalued widget
Old krb-principal widget is changed to general one. And used also for
ipacertmapdata in user.
This widget make every line non-editable.
Part of: https://fedorahosted.org/freeipa/ticket/6601
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
-rw-r--r-- | install/ui/src/freeipa/host.js | 3 | ||||
-rw-r--r-- | install/ui/src/freeipa/service.js | 3 | ||||
-rw-r--r-- | install/ui/src/freeipa/user.js | 3 | ||||
-rw-r--r-- | install/ui/src/freeipa/widget.js | 29 |
4 files changed, 25 insertions, 13 deletions
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 1dfe05eb7..a09535cd1 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -93,7 +93,8 @@ return { name: 'krbprincipalname', item_name: 'principal', child_spec: { - $type: 'krb_principal' + $type: 'non_editable_row', + data_name: 'krb-principal' } }, { diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js index 2533ad0d9..10f86cec2 100644 --- a/install/ui/src/freeipa/service.js +++ b/install/ui/src/freeipa/service.js @@ -81,7 +81,8 @@ return { name: 'krbprincipalname', item_name: 'principal', child_spec: { - $type: 'krb_principal' + $type: 'non_editable_row', + data_name: 'krb-principal' } }, { diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 628cf8ecb..8f78f2b79 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -192,7 +192,8 @@ return { name: 'krbprincipalname', item_name: 'principal', child_spec: { - $type: 'krb_principal' + $type: 'non_editable_row', + data_name: 'krb-principal' } }, { diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index b7028a9bf..17b137628 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1792,6 +1792,8 @@ IPA.custom_command_multivalued_widget = function(spec) { IPA.krb_principal_multivalued_widget = function (spec) { spec = spec || {}; + spec.child_spec = spec.child_spec || {}; + spec.child_spec.data_name = spec.child_spec.data_name || 'krb-principal'; spec.adder_dialog_spec = spec.adder_dialog_spec || { title: '@i18n:krbaliases.adder_title', @@ -1812,7 +1814,7 @@ IPA.krb_principal_multivalued_widget = function (spec) { that.create_remove_dialog_message = function(row) { var message = text.get('@i18n:krbaliases.remove_message'); - message = message.replace('${alias}', row.widget.principal_name); + message = message.replace('${alias}', row.widget.new_value); return message; }; @@ -1820,7 +1822,7 @@ IPA.krb_principal_multivalued_widget = function (spec) { that.create_remove_args = function(row) { var pkey = that.facet.get_pkey(); - var krbprincipalname = row.widget.principal_name; + var krbprincipalname = row.widget.new_value; krbprincipalname = [ krbprincipalname ]; var args = [ @@ -1847,22 +1849,27 @@ IPA.krb_principal_multivalued_widget = function (spec) { }; /** - * Widget which is used as row in kerberos aliases multivalued widget. - * It contains only string where is the principal alias name and delete button. + * Widget which is used as row in multivalued widget. Each row is just + * non-editable text field. * * @class * @extends IPA.input_widget */ -IPA.krb_principal_widget = function(spec) { +IPA.non_editable_row_widget = function(spec) { spec = spec || {}; var that = IPA.input_widget(); + /** + * Prefix of CSS class of each row. + */ + that.data_name = spec.data_name || 'non-editable'; + that.create = function(container) { that.widget_create(container); - that.principal_text = $('<span />', { - 'class': 'krb-principal-name', + that.data_text = $('<span />', { + 'class': that.data_name + '-data', text: '' }).appendTo(container); @@ -1875,19 +1882,20 @@ IPA.krb_principal_widget = function(spec) { that.update = function(value) { - var principal_name = value[0] || ''; + var single_value = value[0] || ''; - that.principal_name = principal_name; + that.new_value = single_value; that.update_text(); }; that.update_text = function() { - that.principal_text.text(that.principal_name); + that.data_text.text(that.new_value); }; return that; }; + /** * Option widget base * @@ -7161,6 +7169,7 @@ exp.register = function() { w.register('html', IPA.html_widget); w.register('link', IPA.link_widget); w.register('multivalued', IPA.multivalued_widget); + w.register('non_editable_row', IPA.non_editable_row_widget); w.register('custom_command_multivalued', IPA.custom_command_multivalued_widget); w.register('krb_principal_multivalued', |