diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2011-10-24 14:53:29 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-11-02 15:37:49 +0000 |
commit | 9afe4b98da13bbf1ce2fd68a660ee1d77fd84f2f (patch) | |
tree | 76ddd647312cda21d55d8da0189e0b6321013d96 /install/ui/entity.js | |
parent | 237a021848dd3a1e4716971ae907910e1cbfbc8e (diff) | |
download | freeipa-9afe4b98da13bbf1ce2fd68a660ee1d77fd84f2f.tar.gz freeipa-9afe4b98da13bbf1ce2fd68a660ee1d77fd84f2f.tar.xz freeipa-9afe4b98da13bbf1ce2fd68a660ee1d77fd84f2f.zip |
Page is cleared before it is visible
https://fedorahosted.org/freeipa/ticket/1459
Changes:
* added clear method to widgets, section, search, details, association facets
* clear and refresh method in facet are called only if key/filter was changed
* added id generator for widgets
Diffstat (limited to 'install/ui/entity.js')
-rw-r--r-- | install/ui/entity.js | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/install/ui/entity.js b/install/ui/entity.js index 704b5c43b..ace44c3c1 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -109,6 +109,9 @@ IPA.facet = function (spec) { that.header.load(data); }; + that.clear = function() { + }; + that.needs_update = function() { return true; }; @@ -336,6 +339,11 @@ IPA.facet_header = function(spec) { that.load = function(data) { if (!that.facet.disable_facet_tabs) { + var pkey = that.facet.pkey; + if(!pkey || !data) { + pkey = ''; + } + var facet_groups = that.facet.entity.facet_groups.values; for (var i=0; i<facet_groups.length; i++) { var facet_group = facet_groups[i]; @@ -345,7 +353,7 @@ IPA.facet_header = function(spec) { var label = facet_group.label; if (label) { - label = label.replace('${primary_key}', that.facet.pkey); + label = label.replace('${primary_key}', pkey); var label_container = $('.facet-group-label', span); label_container.text(label); @@ -356,7 +364,7 @@ IPA.facet_header = function(spec) { var facet = facets[j]; var link = $('li[name='+facet.name+'] a', span); - var values = data[facet.name]; + var values = data ? data[facet.name] : null; if (values) { link.text(facet.label+' ('+values.length+')'); } else { @@ -367,6 +375,10 @@ IPA.facet_header = function(spec) { } }; + that.clear = function() { + that.load(); + }; + return that; }; @@ -589,9 +601,15 @@ IPA.entity = function (spec) { that.facet.create(facet_container); } - that.facet.show(); - that.facet.header.select_tab(); - that.facet.refresh(); + if (that.facet.needs_update()) { + that.facet.clear(); + that.facet.show(); + that.facet.header.select_tab(); + that.facet.refresh(); + } else { + that.facet.show(); + that.facet.header.select_tab(); + } }; that.get_primary_key_prefix = function() { |