summaryrefslogtreecommitdiffstats
path: root/install/ui/entitle.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/entitle.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/entitle.js')
-rw-r--r--install/ui/entitle.js36
1 files changed, 17 insertions, 19 deletions
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index ea838e2c..ccf82173 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -85,8 +85,8 @@ IPA.entitle.entity = function(spec) {
}
]
}).
- search_facet({
- factory: IPA.entitle.search_facet,
+ facet({
+ factory: IPA.entitle.certificates_facet,
name: 'certificates',
label: IPA.messages.objects.entitle.certificates,
facet_group: 'certificates',
@@ -365,7 +365,7 @@ IPA.entitle.details_facet = function(spec) {
// that.register_offline_button.css('display', 'none');
}
- that.load(data.result.result);
+ that.load(data);
summary.empty();
}
@@ -375,13 +375,15 @@ IPA.entitle.details_facet = function(spec) {
that.register_online_button.css('display', 'inline');
// that.register_offline_button.css('display', 'inline');
- var result = {
+ var data = {};
+ data.result = {};
+ data.result.result = {
uuid: '',
product: '',
quantity: 0,
consumed: 0
};
- that.load(result);
+ that.load(data);
summary.empty();
summary.append(error_thrown.name+': '+error_thrown.message);
@@ -395,13 +397,17 @@ IPA.entitle.details_facet = function(spec) {
return that;
};
-IPA.entitle.search_facet = function(spec) {
+IPA.entitle.certificates_facet = function(spec) {
spec = spec || {};
spec.disable_facet_tabs = false;
spec.selectable = false;
- var that = IPA.search_facet(spec);
+ var that = IPA.table_facet(spec);
+
+ var init = function() {
+ that.init_table(that.entity);
+ };
that.create_header = function(container) {
@@ -455,16 +461,7 @@ IPA.entitle.search_facet = function(spec) {
that.import_button.css('display', 'inline');
}
- that.load(data.result.result);
-
- var summary = $('span[name=summary]', that.table.tfoot).empty();
- if (data.result.truncated) {
- var message = IPA.messages.search.truncated;
- message = message.replace('${counter}', data.result.count);
- summary.text(message);
- } else {
- summary.text(data.result.summary);
- }
+ that.load(data);
}
function on_error(xhr, text_status, error_thrown) {
@@ -472,8 +469,7 @@ IPA.entitle.search_facet = function(spec) {
that.consume_button.css('display', 'none');
that.import_button.css('display', 'inline');
- var summary = $('span[name=summary]', that.table.tfoot).empty();
- summary.append(error_thrown.name+': '+error_thrown.message);
+ that.table.summary.text(error_thrown.name+': '+error_thrown.message);
}
that.entity.get_status(
@@ -485,6 +481,8 @@ IPA.entitle.search_facet = function(spec) {
on_error);
};
+ init();
+
return that;
};