diff options
-rw-r--r-- | install/static/host.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/install/static/host.js b/install/static/host.js index 5cfceba5..4f3a636e 100644 --- a/install/static/host.js +++ b/install/static/host.js @@ -58,6 +58,13 @@ function ipa_host() { }); that.add_facet(facet); + facet = ipa_host_managedby_host_facet({ + 'name': 'managedby_host', + 'label': 'Managed by Hosts', + 'other_entity': 'host' + }); + that.add_facet(facet); + that.create_association_facets(); that.entity_init(); @@ -412,3 +419,62 @@ function host_certificate_status_widget(spec) { return that; } + +function ipa_host_managedby_host_facet(spec) { + + spec = spec || {}; + + var that = ipa_association_facet(spec); + + that.add_method = 'add_managedby'; + that.delete_method = 'remove_managedby'; + + that.init = function() { + + var column = that.create_column({ + name: 'fqdn', + label: 'Name', + primary_key: true + }); + + column.setup = function(container, record) { + container.empty(); + + var value = record[column.name]; + value = value ? value.toString() : ''; + + $('<a/>', { + 'href': '#'+value, + 'html': value, + 'click': function (value) { + return function() { + var state = IPA.tab_state(that.other_entity); + state[that.other_entity + '-facet'] = 'details'; + state[that.other_entity + '-pkey'] = value; + $.bbq.pushState(state); + return false; + } + }(value) + }).appendTo(container); + }; + + that.create_column({name: 'description', label: 'Description'}); + + that.create_adder_column({ + name: 'fqdn', + label: 'Name', + primary_key: true, + width: '100px' + }); + + that.create_adder_column({ + name: 'description', + label: 'Description', + width: '100px' + }); + + that.association_facet_init(); + }; + + return that; +}
\ No newline at end of file |