Re: [Freeipa-devel] [PATCH] UI for host managedby

2010-12-02 Thread Adam Young

On 12/01/2010 09:39 PM, Endi Sukma Dewata wrote:

Hi,

Please review the attached patch. Thanks!

A custom facet has been added to manage the host's managedby attribute.
The facet defines the add and remove methods, the columns for the
association table and enrollment dialog, and the link for the primary
key column.


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

ACK and pushed to master
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

[Freeipa-devel] [PATCH] UI for host managedby

2010-12-01 Thread Endi Sukma Dewata

Hi,

Please review the attached patch. Thanks!

A custom facet has been added to manage the host's managedby attribute.
The facet defines the add and remove methods, the columns for the
association table and enrollment dialog, and the link for the primary
key column.

--
Endi S. Dewata
From 0cd0435af1678a693e405d22b3b5ccd814c526a8 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata edew...@redhat.com
Date: Wed, 1 Dec 2010 20:25:44 -0600
Subject: [PATCH] UI for host managedby

A custom facet has been added to manage the host's managedby attribute.
The facet defines the add and remove methods, the columns for the
association table and enrollment dialog, and the link for the primary
key column.
---
 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 5cfceba5cc8fbbee8922a05a6f220141bac357bb..4f3a636ebe3169cea87dd59536d822015191b041 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
-- 
1.6.6.1

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel