[Ovirt-devel] [PATCH] add 'selected' state tracking to nav tree
Hugh O. Brock
hbrock at redhat.com
Fri Jun 6 16:58:20 UTC 2008
On Fri, Jun 06, 2008 at 11:51:40AM -0400, Jason Guiditta wrote:
> This patch keep track of which tree node has been selected (on the
> browser side) so when the tree refreshes, it redraws that node as still
> being the current one. Also decreased refresh time to every 10 seconds.
>
> -j
> >From 26227b552568e74ee40d7b0526564fdb7b2e7486 Mon Sep 17 00:00:00 2001
> >From: Jason Guiditta <jguiditt at redhat.com>
> Date: Fri, 6 Jun 2008 11:46:13 -0400
> Subject: [PATCH] adding tracking of what the currently selected node is (as opposed to open nodes) on the nav tree, and updated refresh to be every 10 seconds.
>
>
> Signed-off-by: Jason Guiditta <jguiditt at redhat.com>
> ---
> wui/src/app/views/layouts/redux.rhtml | 1 +
> .../public/javascripts/jquery.ovirt.treeview.js | 8 ++++++--
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/wui/src/app/views/layouts/redux.rhtml b/wui/src/app/views/layouts/redux.rhtml
> index 52a4363..f4c07d2 100644
> --- a/wui/src/app/views/layouts/redux.rhtml
> +++ b/wui/src/app/views/layouts/redux.rhtml
> @@ -47,6 +47,7 @@
> $('a[rel*=facebox]').livequery(function(){$(this).facebox();},function(){});
> $('#side a').livequery(function(){
> $(this).bind('click', function(){
> + currentNode = $(this).parent().parent()[0].id;
> $('#side span').each(function(){
> var nodeType = $(this).attr('class');
> if (nodeType.indexOf('_') != -1){
> diff --git a/wui/src/public/javascripts/jquery.ovirt.treeview.js b/wui/src/public/javascripts/jquery.ovirt.treeview.js
> index 2fe0f1b..8a12dc1 100644
> --- a/wui/src/public/javascripts/jquery.ovirt.treeview.js
> +++ b/wui/src/public/javascripts/jquery.ovirt.treeview.js
> @@ -4,7 +4,7 @@
> var container = this;
> settings.current_pool_id!=""?settings.params={current_id:settings.current_pool_id}:settings.params=null;
> load(settings, settings.params, this, container);
> - $(this).everyTime(20000,function(){
> + $(this).everyTime(10000,function(){
> load(settings, settings.params, this, container);
> })
>
> @@ -67,12 +67,16 @@
> for (var i = 0; i < selectedNodes.length; i++){
> $('#test-tree li#' + selectedNodes[i] +' > div').click();
> }
> -
> + if (currentNode != null) {
> + var nodeType = $('li#' + currentNode + ' > span').attr('class');
> + $('li#' + currentNode + ' > span').attr('class', 'current_' + nodeType);
> + }
> });
> }
> })(jQuery);
>
> var selectedNodes = [];
> +var currentNode;
> $('#test-tree li.collapsable').livequery(
> function(){
> if($.inArray(this.id,selectedNodes) == -1){
> --
> 1.5.4.1
>
ACK
I have applied this and, yes, actually pushed it this time...
--Hugh
More information about the ovirt-devel
mailing list