mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
committed by
Tomas Krizek
parent
27027bbc9c
commit
fba318b833
@@ -93,7 +93,8 @@ return {
|
||||
name: 'krbprincipalname',
|
||||
item_name: 'principal',
|
||||
child_spec: {
|
||||
$type: 'krb_principal'
|
||||
$type: 'non_editable_row',
|
||||
data_name: 'krb-principal'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -81,7 +81,8 @@ return {
|
||||
name: 'krbprincipalname',
|
||||
item_name: 'principal',
|
||||
child_spec: {
|
||||
$type: 'krb_principal'
|
||||
$type: 'non_editable_row',
|
||||
data_name: 'krb-principal'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -192,7 +192,8 @@ return {
|
||||
name: 'krbprincipalname',
|
||||
item_name: 'principal',
|
||||
child_spec: {
|
||||
$type: 'krb_principal'
|
||||
$type: 'non_editable_row',
|
||||
data_name: 'krb-principal'
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user