From 9bc3cc9897741ac720747ecd4a3b4d4f31de7232 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Tue, 23 Nov 2010 22:24:50 -0500
Subject: [PATCH] action panel formatting

Cleans up the indentation of the action panel
Puts the sudo and HBAC entries in a consistent order
---
 install/static/details.js      |    4 +---
 install/static/entity.js       |   25 +++++++++++++++++++------
 install/static/hbacsvc.js      |    5 ++++-
 install/static/hbacsvcgroup.js |   15 +++++++++------
 install/static/ipa.css         |   10 +++++++++-
 install/static/search.js       |    3 +--
 install/static/sudocmd.js      |    2 +-
 install/static/sudocmdgroup.js |   15 +++++++++------
 8 files changed, 53 insertions(+), 26 deletions(-)

diff --git a/install/static/details.js b/install/static/details.js
index 3b4edda6c5ac751cbaa4c897bf2ba34b2458a051..a989d9d4e3c163a4c9a136a7b6e082a3d5294bb5 100644
--- a/install/static/details.js
+++ b/install/static/details.js
@@ -457,9 +457,7 @@ function ipa_details_create(container)
     var action_panel = that.get_action_panel();
 
     var ul = $('ul', action_panel);
-    var buttons = $('<li/>', {
-        'class': 'details-buttons'
-    }).prependTo(ul);
+    var buttons = $('.action-controls',action_panel);
 
     $('<input/>', {
         'type': 'text',
diff --git a/install/static/entity.js b/install/static/entity.js
index 25a9fd3106c29d28679f6fc365f803d8d2e9e9d0..713dbf31d528970e7895cc2929fc4b3ae66824b2 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -1,6 +1,7 @@
 /*  Authors:
  *    Pavel Zuna <pz...@redhat.com>
  *    Endi S. Dewata <edew...@redhat.com>
+ *    Adam Young <ayo...@redhat.com>
  *
  * Copyright (C) 2010 Red Hat
  * see file 'COPYING' for use and warranty information
@@ -340,8 +341,6 @@ function ipa_entity_setup(container) {
     facet.refresh();
 }
 
-
-
 function ipa_facet_create_action_panel(container) {
 
     var that = this;
@@ -349,7 +348,9 @@ function ipa_facet_create_action_panel(container) {
 
     var action_panel = $('<div/>', {
         "class": "action-panel",
-        html: $('<h3>Actions</h3>')
+        html: $('<h3>',{
+            text: IPA.metadata[entity_name].label
+        })
     }).appendTo(container);
 
     function build_link(other_facet,label,other_entity){
@@ -387,9 +388,21 @@ function ipa_facet_create_action_panel(container) {
     var entity = IPA.get_entity(entity_name);
     var facet_name =  ipa_current_facet(entity);
 
-    for (var i=0; i<entity.facets.length; i++) {
-        var other_facet = entity.facets[i];
-        var other_facet_name = other_facet.name;
+    var other_facet = entity.facets[0];
+    var other_facet_name = other_facet.name;
+    var main_facet = build_link(other_facet,other_facet.label)
+
+    /*assumeing for now that entities with only a single facet 
+      do not have search*/
+    if (entity.facets.length > 0 ){
+        main_facet.text( 'List ' +  IPA.metadata[entity_name].label);
+    }
+    main_facet.appendTo(ul);
+
+    ul.append($('<li><span class="action-controls"/></li>'));
+    for (var i=1; i<entity.facets.length; i++) {
+        other_facet = entity.facets[i];
+        other_facet_name = other_facet.name;
 
         if (other_facet.label) {
             ul.append(build_link(other_facet,other_facet.label));
diff --git a/install/static/hbacsvc.js b/install/static/hbacsvc.js
index 26a2e8a0a3be71ff23edb0c5c0dd5a6e31b77d29..7dca90ecf90a81f1aac06866386006afcf068f47 100755
--- a/install/static/hbacsvc.js
+++ b/install/static/hbacsvc.js
@@ -98,10 +98,13 @@ function ipa_hbacsvc_search_facet(spec) {
 
         var ul = $('ul', action_panel);
 
+        /*Note that we add the rules at the top of the action panel
+          so that the HBAC entities always show in the same order.*/
+
         $('<li/>', {
             title: 'hbac',
             text: 'HBAC Rules'
-        }).appendTo(ul);
+        }).prependTo(ul);
 
         $('<li/>', {
             title: 'hbacsvcgroup',
diff --git a/install/static/hbacsvcgroup.js b/install/static/hbacsvcgroup.js
index 056c8fab1ef0d2503db45e4ca083321815847de7..121fad676b6130a3b34c15aa3a52da1f72701a2a 100755
--- a/install/static/hbacsvcgroup.js
+++ b/install/static/hbacsvcgroup.js
@@ -109,15 +109,18 @@ function ipa_hbacsvcgroup_search_facet(spec) {
 
         var ul = $('ul', action_panel);
 
-        $('<li/>', {
-            title: 'hbac',
-            text: 'HBAC Rules'
-        }).appendTo(ul);
-
+        /*Note that we add these at the top of the action panel
+          so that the HBAC entities always show in the same order.*/
         $('<li/>', {
             title: 'hbacsvc',
             text: 'HBAC Services'
-        }).appendTo(ul);
+        }).prependTo(ul);
+
+        $('<li/>', {
+            title: 'hbac',
+            text: 'HBAC Rules'
+        }).prependTo(ul);
+
 
         that.search_facet_create(container);
 
diff --git a/install/static/ipa.css b/install/static/ipa.css
index b7654be00ea7f84549eda78d9569b75c2bf53bbf..3b283610b931db56cb9e463de670783f541eb313 100644
--- a/install/static/ipa.css
+++ b/install/static/ipa.css
@@ -322,17 +322,24 @@ span.main-separator{
     float: left;
     margin-top: 5em;
     margin-left: 2.5em;
+    padding-left: 0.5em;
     padding-bottom: 1em;
     width: 17.5em;
 }
 
+
+.action-panel ul {
+    list-style-type:none;
+    padding: 0;
+}
+
 .action-panel h3{
     margin: 0;
     background: #e8e8e8;
 }
 
 .action-panel li {
-    height: 2em;
+    height: auto;
     padding: 0.2em;
 }
 
@@ -346,6 +353,7 @@ span.main-separator{
     color: black;
     text-decoration: underline;
     cursor: pointer;
+    margin-left:2em;
 }
 
 .action-panel li.entity-facet-disabled {
diff --git a/install/static/search.js b/install/static/search.js
index 03d4cac5a61c510943c79c545b95b93d24e9a1c1..5b42cf11a0411f1a479755f31d315086baa13ae9 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -54,8 +54,7 @@ function ipa_search_widget(spec) {
 
         var action_panel = that.facet.get_action_panel();
 
-        var ul = $('ul', action_panel);
-        var li = $('<li/>').prependTo(ul);
+        var li = $('.action-controls',action_panel);
 
         var search_buttons = $('<span/>', {
             'class': 'search-buttons'
diff --git a/install/static/sudocmd.js b/install/static/sudocmd.js
index 2ac947fcfc2b46821f16bc4d0ca7c27996a6f9e0..4255a31e3b415811b32c0bb88b26029d1b7194b8 100755
--- a/install/static/sudocmd.js
+++ b/install/static/sudocmd.js
@@ -101,7 +101,7 @@ function ipa_sudocmd_search_facet(spec) {
         $('<li/>', {
             title: 'sudorule',
             text: 'SUDO Rules'
-        }).appendTo(ul);
+        }).prependTo(ul);
 
         $('<li/>', {
             title: 'sudocmdgroup',
diff --git a/install/static/sudocmdgroup.js b/install/static/sudocmdgroup.js
index 0a193afabd41ea0ad8cc925ec31fe9486c4afc25..6fddafb155e144d1f1f167262832679189239ab5 100755
--- a/install/static/sudocmdgroup.js
+++ b/install/static/sudocmdgroup.js
@@ -109,15 +109,18 @@ function ipa_sudocmdgroup_search_facet(spec) {
 
         var ul = $('ul', action_panel);
 
-        $('<li/>', {
-            title: 'sudorule',
-            text: 'SUDO Rules'
-        }).appendTo(ul);
-
+        /*Make sure that these go at the top of the action panel
+          and in the same order as on the other SUDO entity pages */
         $('<li/>', {
             title: 'sudocmd',
             text: 'SUDO Command'
-        }).appendTo(ul);
+        }).prependTo(ul);
+
+        $('<li/>', {
+            title: 'sudorule',
+            text: 'SUDO Rules'
+        }).prependTo(ul);
+
 
         that.search_facet_create(container);
 
-- 
1.7.2.3

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

Reply via email to