[Ovirt-devel] [PATCH] Updated tree nav layout to move smart pools above the main pools.
Jason Guiditta
jguiditt at redhat.com
Tue Jan 20 22:49:49 UTC 2009
ACK but for the issue I hit if you have no smart pools, problem
described inline and, one css fix inline.
-j
On Mon, 2009-01-19 at 20:09 +0000, Scott Seago wrote:
> Dashboard and networks have their own links in the nav.
> Also updating reworked nav icons.
>
> Signed-off-by: Scott Seago <sseago at redhat.com>
> ---
> src/app/controllers/network_controller.rb | 13 +++++-
> src/app/controllers/tree_controller.rb | 53 ++++++++++++++++---------
> src/app/models/pool.rb | 12 +++++-
> src/app/views/layouts/_navigation_tabs.rhtml | 9 ++++
> src/app/views/layouts/_tree.rhtml | 23 +++++++++--
> src/public/images/icon_add_hardwarepool.png | Bin 1223 -> 1133 bytes
> src/public/images/icon_add_smartpool.png | Bin 1341 -> 948 bytes
> src/public/images/icon_add_vmpool.png | Bin 838 -> 741 bytes
> src/public/images/icon_dashboard.gif | Bin 14152 -> 0 bytes
> src/public/images/icon_dashboard.png | Bin 0 -> 4457 bytes
> src/public/images/icon_hdwarepool.png | Bin 1179 -> 4509 bytes
> src/public/images/icon_networks.png | Bin 0 -> 4223 bytes
> src/public/images/icon_smartpool.png | Bin 641 -> 4233 bytes
> src/public/images/icon_smartpools.png | Bin 0 -> 4117 bytes
> src/public/images/icon_smartpools_dir.png | Bin 0 -> 4228 bytes
> src/public/javascripts/ovirt.tree.js | 43 ++++++--------------
> src/public/stylesheets/ovirt-tree/tree.css | 27 +++++++++++--
> 17 files changed, 119 insertions(+), 61 deletions(-)
> delete mode 100644 src/public/images/icon_dashboard.gif
> create mode 100644 src/public/images/icon_dashboard.png
> create mode 100644 src/public/images/icon_networks.png
> create mode 100644 src/public/images/icon_smartpools.png
> create mode 100644 src/public/images/icon_smartpools_dir.png
>
<snip>
> diff --git a/src/app/controllers/tree_controller.rb b/src/app/controllers/tree_controller.rb
> index 07d46f7..e2065ca 100644
> --- a/src/app/controllers/tree_controller.rb
> +++ b/src/app/controllers/tree_controller.rb
> @@ -29,12 +29,19 @@ class TreeController < ApplicationController
> @clientHash[tempItem[0]] = itemHash
> }
> end
> - @serverHash = {:pools => build_json(HardwarePool.get_default_pool.full_set_nested(:method => :json_hash_element,
> - :privilege => Permission::PRIV_VIEW, :user => get_login_user))
> - }
> - @serverHash[:smart_pools] = adjust_smart_pool_list(build_json(DirectoryPool.get_smart_root.full_set_nested(:method => :json_hash_element,
> - :privilege => Permission::PRIV_VIEW, :user => get_login_user,
> - :smart_pool_set => true)))
> + pools = build_json(
> + HardwarePool.get_default_pool.full_set_nested(
> + :method => :json_hash_element,
> + :privilege => Permission::PRIV_VIEW,
> + :user => get_login_user))
> + smart_pools = adjust_smart_pool_list(
> + build_json(
> + DirectoryPool.get_smart_root.full_set_nested(
> + :method => :json_hash_element,
> + :privilege => Permission::PRIV_VIEW,
> + :user => get_login_user,
> + :smart_pool_set => true)))
> + @serverHash = {:pools => smart_pools + pools }
> @ids.each { |item|
> if @clientHash.has_key?(item.to_s)
> @clientHash.delete(item.to_s)
> @@ -69,19 +76,27 @@ class TreeController < ApplicationController
> end
>
> def adjust_smart_pool_list(list)
> - mySmartPools = Array.new
> - otherSmartPools = Array.new
> - list.each {|listItem|
> - if (listItem[:name] == get_login_user)
> - if listItem.has_key?(:children)
> - listItem[:children].each {|item|
> - mySmartPools.push(item)
> - }
> + # list should have a single element. If it doesn't, don't transform anything here
> + if list.size == 1
> + smart_root = list[0]
> + smart_root[:name] = "Smart Pools"
> + smart_root[:type] = "SmartPoolRoot"
> + mySmartPools = Array.new
> + otherSmartPools = Array.new
The following line throws an error of you have no smart pools:
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each)
> + smart_root[:children].each {|listItem|
> + if (listItem[:name] == get_login_user)
> + if listItem.has_key?(:children)
> + listItem[:children].each {|item|
> + item[:parent_id] = smart_root[:id]
> + mySmartPools.push(item)
> + }
> + end
> + else
> + otherSmartPools.push(listItem)
> end
> - else
> - otherSmartPools.push(listItem)
> - end
> - }
> - mySmartPools + otherSmartPools
> + }
> + smart_root[:children] = mySmartPools + otherSmartPools
> + end
> + list
> end
> end
<snip>
> diff --git a/src/public/stylesheets/ovirt-tree/tree.css
> b/src/public/stylesheets/ovirt-tree/tree.css
> index 7d5411f..de019f4 100644
> --- a/src/public/stylesheets/ovirt-tree/tree.css
> +++ b/src/public/stylesheets/ovirt-tree/tree.css
> @@ -1,12 +1,12 @@
> #nav_tree {
> - padding: 20px;
> + padding: 0px 20px;
> }
>
> .nav-tree {
> width: 222px;
> position: absolute;
> overflow: auto;
> - top: 25px;
> + top: 50px;
if you get rid of the following line, the blank space that used to hold
smart pools list will go away. Actually, I know jeremy had some style
stuff for you to add that is not in this patch, so after this is in, I
will fix a couple other things once I see what he has added. We can
probably do away with most, if not all, of the absolute positioning.
For now though, this next line needs to go.
> bottom: 140px;
> }
>
> @@ -44,6 +44,15 @@
> background-image: url('../../images/icon_smartpool.png');
> }
>
> +.SmartPoolRoot {
> + padding: 4px 0 4px 28px !important;
> + background-image: url('../../images/icon_smartpools.png');
> +}
> +.DirectoryPool {
> + padding: 4px 0 4px 28px !important;
> + background-image: url('../../images/icon_smartpools_dir.png');
> +}
> +
> .hitarea {
> width: 16px;
> margin-left: -16px;
> @@ -81,11 +90,21 @@
> }
>
> .nav-dashboard {
> - background-image: url('../../images/icon_dashboard.gif');
> + background-image: url('../../images/icon_dashboard.png');
> background-repeat: no-repeat;
> background-position: left;
> padding: 0px 0 0px 28px;
> position: absolute;
> height: 25px;
> top: 0;
> -}
> \ No newline at end of file
> +}
> +
> +.nav-networks {
> + background-image: url('../../images/icon_networks.png');
> + background-repeat: no-repeat;
> + background-position: left;
> + padding: 0px 0 0px 28px;
> + position: absolute;
> + height: 25px;
> + top: 25px;
> +}
More information about the ovirt-devel
mailing list