diff options
Diffstat (limited to 'install/ui/src')
-rw-r--r-- | install/ui/src/freeipa/add.js | 6 | ||||
-rw-r--r-- | install/ui/src/freeipa/automember.js | 16 | ||||
-rw-r--r-- | install/ui/src/freeipa/details.js | 3 | ||||
-rw-r--r-- | install/ui/src/freeipa/dialog.js | 5 | ||||
-rw-r--r-- | install/ui/src/freeipa/dns.js | 13 | ||||
-rw-r--r-- | install/ui/src/freeipa/field.js | 1 | ||||
-rw-r--r-- | install/ui/src/freeipa/search.js | 1 | ||||
-rw-r--r-- | install/ui/src/freeipa/user.js | 4 | ||||
-rw-r--r-- | install/ui/src/freeipa/widget.js | 8 |
9 files changed, 24 insertions, 33 deletions
diff --git a/install/ui/src/freeipa/add.js b/install/ui/src/freeipa/add.js index 388b4e497..a2b60435e 100644 --- a/install/ui/src/freeipa/add.js +++ b/install/ui/src/freeipa/add.js @@ -59,8 +59,7 @@ IPA.entity_adder_dialog = function(spec) { function(data, text_status, xhr) { that.added.notify(); that.show_message(that.get_success_message(data)); - var facet = IPA.current_entity.get_facet(); - facet.refresh(); + that.facet.refresh(); that.reset(); that.focus_first_element(); }, @@ -101,8 +100,7 @@ IPA.entity_adder_dialog = function(spec) { that.add( function(data, text_status, xhr) { that.added.notify(); - var facet = IPA.current_entity.get_facet(); - facet.refresh(); + that.facet.refresh(); that.close(); that.notify_success(data); }, diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index 0e05b8c59..0f188bd19 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -331,8 +331,8 @@ IPA.automember.rule_adder_dialog = function(spec) { if (pkey instanceof Array) { pkey = pkey[0]; } - var facet = IPA.current_entity.get_facet(); - var facetname = facet.group_type === 'group' ? 'usergrouprule' : + + var facetname = that.facet.group_type === 'group' ? 'usergrouprule' : 'hostgrouprule'; navigation.show_entity(that.entity.name, facetname, [pkey]); @@ -341,19 +341,17 @@ IPA.automember.rule_adder_dialog = function(spec) { that.reset = function() { var field = that.fields.get_field('cn'); - var facet = IPA.current_entity.get_facet(); - field.widget.other_entity = IPA.get_entity(facet.group_type); + field.widget.other_entity = IPA.get_entity(that.facet.group_type); that.dialog_reset(); }; that.create_add_command = function(record) { - var facet = IPA.current_entity.get_facet(); var command = that.entity_adder_dialog_create_add_command(record); - command.name = that.entity.name+facet.group_type+'_show'; - command.set_option('type', facet.group_type); + command.name = that.entity.name+that.facet.group_type+'_show'; + command.set_option('type', that.facet.group_type); return command; }; @@ -370,13 +368,11 @@ IPA.automember.rule_deleter_dialog = function(spec) { that.create_command = function() { - var facet = IPA.current_entity.get_facet(); - var batch = that.search_deleter_dialog_create_command(); for (var i=0; i<batch.commands.length; i++) { var command = batch.commands[i]; - command.set_option('type', facet.group_type); + command.set_option('type', that.facet.group_type); } return batch; diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js index 929c3a7d4..aa36b5fbc 100644 --- a/install/ui/src/freeipa/details.js +++ b/install/ui/src/freeipa/details.js @@ -689,7 +689,8 @@ IPA.details_facet = function(spec, no_init) { }); var field_builder = IPA.field_builder({ field_options: { - entity: that.entity + entity: that.entity, + facet: that } }); var section_builder = IPA.section_builder({ diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index f2326b321..a553814f4 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -97,6 +97,11 @@ IPA.dialog = function(spec) { that.close_on_escape = spec.close_on_escape !== undefined ? spec.close_on_escape : true; + // FIXME: remove facet reference + // Purpose of facet reference is to obtain pkeys or ability to reload + // facet. Such usage makes the code more spaghetti. It should be replaced. + that.facet = spec.facet; + that.widgets = IPA.widget_container(); that.fields = IPA.field_container({ container: that }); that.buttons = $.ordered_map(); diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js index 525debb5b..8d6f96fa3 100644 --- a/install/ui/src/freeipa/dns.js +++ b/install/ui/src/freeipa/dns.js @@ -2032,22 +2032,15 @@ IPA.dns.record_type_table_widget = function(spec) { }; that.reload_facet = function(data) { - - //FIXME: seems as bad approach - var facet = IPA.current_entity.get_facet(); - facet.load(data); + that.facet.load(data); }; that.refresh_facet = function() { - - //FIXME: seems as bad approach - var facet = IPA.current_entity.get_facet(); - facet.refresh(); + that.facet.refresh(); }; that.notify_facet_update = function() { - var facet = IPA.current_entity.get_facet(); - facet.on_update.notify(); + that.facet.on_update.notify(); }; that.update = function(values) { diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index 8a0e3fbdf..14aae65ec 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -31,6 +31,7 @@ IPA.field = function(spec) { var that = {}; that.entity = IPA.get_entity(spec.entity); + that.facet = spec.facet; that.container = null; that.name = spec.name; that.param = spec.param || spec.name; diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js index 9b7e4faec..8a993f04a 100644 --- a/install/ui/src/freeipa/search.js +++ b/install/ui/src/freeipa/search.js @@ -123,6 +123,7 @@ IPA.search_facet = function(spec, no_init) { that.show_add_dialog = function() { var dialog = that.managed_entity.get_dialog('add'); + dialog.facet = that; dialog.open(that.container); }; diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 8b5ed3b03..52abc40a0 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -595,8 +595,7 @@ IPA.user_password_dialog = function(spec) { that.close(); // refresh password expiration field - var facet = IPA.current_entity.get_facet(); - facet.refresh(); + that.facet.refresh(); if (that.is_self_service()) { var command = IPA.get_whoami_command(); @@ -632,6 +631,7 @@ IPA.user.reset_password_action = function(spec) { var dialog = IPA.user_password_dialog({ entity: facet.entity, + facet: facet, pkey: facet.get_pkey() }); diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 61bb03c23..d66f82097 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2288,16 +2288,12 @@ IPA.attribute_table_widget = function(spec) { that.reload_facet = function(data) { - //FIXME: bad approach - widget is directly manipulating with facet - var facet = IPA.current_entity.get_facet(); - facet.load(data); + that.facet.load(data); }; that.refresh_facet = function() { - //FIXME: bad approach - var facet = IPA.current_entity.get_facet(); - facet.refresh(); + that.facet.refresh(); }; that.attribute_table_adder_dialog_create_command = that.adder_dialog_create_command; |