mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
webui: fix regression: enabled gid field on group add
GID field should be enabled by default since the default group is posix. Was caused by option_widget_base not properly reporting value change while selecting the default value. It has to be notified with delay otherwise the event is consumed by FieldBinder. https://fedorahosted.org/freeipa/ticket/4325 Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
parent
255cbb4976
commit
e3840eef09
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
|
'dojo/on',
|
||||||
'./ipa',
|
'./ipa',
|
||||||
'./jquery',
|
'./jquery',
|
||||||
'./phases',
|
'./phases',
|
||||||
@ -29,7 +30,7 @@ define([
|
|||||||
'./search',
|
'./search',
|
||||||
'./association',
|
'./association',
|
||||||
'./entity'],
|
'./entity'],
|
||||||
function(IPA, $, phases, reg) {
|
function(on, IPA, $, phases, reg) {
|
||||||
|
|
||||||
var exp = IPA.group = {};
|
var exp = IPA.group = {};
|
||||||
|
|
||||||
@ -197,14 +198,14 @@ IPA.group_adder_dialog = function(spec) {
|
|||||||
var init = function() {
|
var init = function() {
|
||||||
|
|
||||||
var type_field = that.fields.get_field('type');
|
var type_field = that.fields.get_field('type');
|
||||||
type_field.widget.value_changed.attach(that.on_type_change);
|
on(type_field, 'value-change', that.on_type_change);
|
||||||
};
|
};
|
||||||
|
|
||||||
that.on_type_change = function() {
|
that.on_type_change = function() {
|
||||||
|
|
||||||
var type_field = that.fields.get_field('type');
|
var type_field = that.fields.get_field('type');
|
||||||
var gid_field = that.fields.get_field('gidnumber');
|
var gid_field = that.fields.get_field('gidnumber');
|
||||||
var posix = type_field.save()[0] === 'posix';
|
var posix = type_field.get_value()[0] === 'posix';
|
||||||
|
|
||||||
if (!posix) {
|
if (!posix) {
|
||||||
gid_field.reset();
|
gid_field.reset();
|
||||||
|
@ -1590,6 +1590,8 @@ IPA.option_widget_base = function(spec, that) {
|
|||||||
// select default if none specified
|
// select default if none specified
|
||||||
if (that.default_value !== null) {
|
if (that.default_value !== null) {
|
||||||
check(that._selector+'[value="'+that.default_value+'"]');
|
check(that._selector+'[value="'+that.default_value+'"]');
|
||||||
|
// default was selected instead of supplied value, hence notify
|
||||||
|
util.emit_delayed(that, 'value-change', { source: that });
|
||||||
} else {
|
} else {
|
||||||
// otherwise select empty
|
// otherwise select empty
|
||||||
check(that._selector+'[value=""]');
|
check(that._selector+'[value=""]');
|
||||||
|
@ -42,6 +42,37 @@ class test_group(UI_driver):
|
|||||||
self.basic_crud(group.ENTITY, group.DATA,
|
self.basic_crud(group.ENTITY, group.DATA,
|
||||||
default_facet=group.DEFAULT_FACET)
|
default_facet=group.DEFAULT_FACET)
|
||||||
|
|
||||||
|
@screenshot
|
||||||
|
def test_group_types(self):
|
||||||
|
"""
|
||||||
|
Test group types in adder dialog
|
||||||
|
"""
|
||||||
|
self.init_app()
|
||||||
|
|
||||||
|
pkey = 'itest-group'
|
||||||
|
data = {
|
||||||
|
'pkey': pkey,
|
||||||
|
'add': [
|
||||||
|
('callback', self.check_posix_enabled, True),
|
||||||
|
('textbox', 'cn', pkey),
|
||||||
|
('textarea', 'description', 'test-group desc'),
|
||||||
|
('radio', 'type', 'normal'),
|
||||||
|
('callback', self.check_posix_enabled, False),
|
||||||
|
('radio', 'type', 'posix'),
|
||||||
|
('callback', self.check_posix_enabled, True),
|
||||||
|
('radio', 'type', 'external'),
|
||||||
|
('callback', self.check_posix_enabled, False),
|
||||||
|
('radio', 'type', 'posix'),
|
||||||
|
('callback', self.check_posix_enabled, True),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
self.add_record(group.ENTITY, data)
|
||||||
|
self.delete(group.ENTITY, [data], navigate=False)
|
||||||
|
|
||||||
|
def check_posix_enabled(self, enabled):
|
||||||
|
self.assert_disabled("[name=gidnumber]", negative=enabled)
|
||||||
|
|
||||||
@screenshot
|
@screenshot
|
||||||
def test_actions(self):
|
def test_actions(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user