Remove IPA.current_entity usage

https://fedorahosted.org/freeipa/ticket/3236
This commit is contained in:
Petr Vobornik committed 2013-05-06 16:22:18 +02:00
1 parent a3e0e671a1
commit 99fc3d597a
9 files changed
+24 -33

No files matched your search

+2 -4
View File
@@ -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);
},
+6 -10
View File
@@ -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;
+2 -1
View File
@@ -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({
+5
View File
@@ -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();
+3 -10
View File
@@ -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) {
+1
View File
@@ -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;
+1
View File
@@ -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);
};
+2 -2
View File
@@ -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()
});
+2 -6
View File
@@ -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;