summaryrefslogtreecommitdiffstats
path: root/install/ui/association.js
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2011-11-18 19:47:39 -0600
committerEndi S. Dewata <edewata@redhat.com>2011-12-06 22:08:07 +0000
commitcaa9d52666e5beb7321dc6c80820eeacca356077 (patch)
tree01b91c26442e559632afbf652968c0dbd9c0291b /install/ui/association.js
parenta8ea42bda841c8773d68886614faf9efd38e33bd (diff)
downloadfreeipa.git-caa9d52666e5beb7321dc6c80820eeacca356077.tar.gz
freeipa.git-caa9d52666e5beb7321dc6c80820eeacca356077.tar.xz
freeipa.git-caa9d52666e5beb7321dc6c80820eeacca356077.zip
Refactored facet.load().
The load() in IPA.facet has been modified to accept the complete data returned by the server instead of just the result. This is needed by HBAC Test to access other attributes returned in the test result. Ticket #388
Diffstat (limited to 'install/ui/association.js')
-rw-r--r--install/ui/association.js43
1 files changed, 23 insertions, 20 deletions
diff --git a/install/ui/association.js b/install/ui/association.js
index 7db91ef9..9d7950dc 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -753,11 +753,6 @@ IPA.association_facet = function (spec) {
var column;
var i;
- var adder_columns = spec.adder_columns || [];
- for (i=0; i<adder_columns.length; i++) {
- that.create_adder_column(adder_columns[i]);
- }
-
var pkey_name;
if (that.other_entity) {
pkey_name = IPA.metadata.objects[that.other_entity].primary_key;
@@ -765,12 +760,24 @@ IPA.association_facet = function (spec) {
if (!that.columns.length){
that.create_column({
- name: pkey_name,
- primary_key: true,
- link: spec.link
+ name: pkey_name
});
}
+ var columns = that.columns.values;
+ for (i=0; i<columns.length; i++) {
+ column = columns[i];
+ column.link = spec.link;
+ }
+
+ var other_entity = IPA.get_entity(that.other_entity);
+ that.init_table(other_entity);
+
+ var adder_columns = spec.adder_columns || [];
+ for (i=0; i<adder_columns.length; i++) {
+ that.create_adder_column(adder_columns[i]);
+ }
+
if (!that.adder_columns.length) {
that.create_adder_column({
name: pkey_name,
@@ -783,9 +790,6 @@ IPA.association_facet = function (spec) {
column = adder_columns[i];
column.entity_name = that.other_entity;
}
-
- var other_entity = IPA.get_entity(that.other_entity);
- that.init_table(other_entity);
};
that.get_records_command_name = function() {
@@ -882,10 +886,6 @@ IPA.association_facet = function (spec) {
}
};
- that.create_content = function(container) {
- that.table.create(container);
- };
-
that.show = function() {
that.facet_show();
@@ -903,7 +903,7 @@ IPA.association_facet = function (spec) {
title = title.replace('${primary_key}', pkey);
title = title.replace('${other_entity}', label);
- var pkeys = that.data[that.get_attribute_name()];
+ var pkeys = that.data.result.result[that.get_attribute_name()];
var dialog = IPA.association_adder_dialog({
title: title,
@@ -995,8 +995,8 @@ IPA.association_facet = function (spec) {
dialog.open(that.container);
};
- that.load_pkeys = function(result) {
- that.pkeys = that.data[that.get_attribute_name()] || [];
+ that.get_pkeys = function(data) {
+ return data.result.result[that.get_attribute_name()] || [];
};
that.refresh = function() {
@@ -1020,10 +1020,13 @@ IPA.association_facet = function (spec) {
});
command.on_success = function(data, text_status, xhr) {
- that.load(data.result.result);
+ that.load(data);
};
- command.on_error = that.on_error;
+ command.on_error = function(xhr, text_status, error_thrown) {
+ that.redirect_error(error_thrown);
+ that.report_error(error_thrown);
+ };
command.execute();
};