[ 
https://issues.apache.org/jira/browse/SOLR-3867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461158#comment-13461158
 ] 

Yonik Seeley edited comment on SOLR-3867 at 9/23/12 12:59 AM:
--------------------------------------------------------------

Or maybe it should be easy for someone familiar with js/ajax - but my attempt 
has failed so far.

{code}
Index: solr/webapp/web/js/scripts/cloud.js
===================================================================
--- solr/webapp/web/js/scripts/cloud.js (revision 1388800)
+++ solr/webapp/web/js/scripts/cloud.js (working copy)
@@ -1,4 +1,4 @@
-/*
+tate[c]*
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
@@ -372,11 +372,12 @@
                 for( var s in state[c] )
                 {
                   var nodes = [];
-                  for( var n in state[c][s] )
+                  for( var n in state[c][s].replicas )
                   {
                     leaf_count++;
+                    var replica = state[c][s].replicas[n]
 
-                    var uri = state[c][s][n].base_url;
+                    var uri = replica.base_url;
                     var parts = uri.match( 
/^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/ );
                     var uri_parts = {
                       protocol: parts[1],
@@ -392,9 +393,9 @@
                     helper_data.port.push( uri_parts.port );
                     helper_data.pathname.push( uri_parts.pathname );
 
-                    var status = state[c][s][n].state;
+                    var status = replica.state;
 
-                    if( !live_nodes[state[c][s][n].node_name] )
+                    if( !live_nodes[replica.node_name] )
                     {
                       status = 'gone';
                     }
@@ -404,7 +405,7 @@
                       data: {
                         type : 'node',
                         state : status,
-                        leader : 'true' === state[c][s][n].leader,
+                        leader : 'true' === replica.leader,
                         uri : uri_parts
                       }
                     };
@@ -715,4 +716,4 @@
       }
     );
   }
-);
\ No newline at end of file
+);
{code}

I just get a blank view though, so not sure how one goes about debugging these 
things...

edit: Heh - I saw the errant paste in the first line of the file after I pasted 
the diff in here.  Looks like this approach does work.
                
      was (Author: ysee...@gmail.com):
    Or maybe it should be easy for someone familiar with js/ajax - but my 
attempt has failed so far.

{code}
Index: solr/webapp/web/js/scripts/cloud.js
===================================================================
--- solr/webapp/web/js/scripts/cloud.js (revision 1388800)
+++ solr/webapp/web/js/scripts/cloud.js (working copy)
@@ -1,4 +1,4 @@
-/*
+tate[c]*
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
@@ -372,11 +372,12 @@
                 for( var s in state[c] )
                 {
                   var nodes = [];
-                  for( var n in state[c][s] )
+                  for( var n in state[c][s].replicas )
                   {
                     leaf_count++;
+                    var replica = state[c][s].replicas[n]
 
-                    var uri = state[c][s][n].base_url;
+                    var uri = replica.base_url;
                     var parts = uri.match( 
/^(\w+:)\/\/(([\w\d\.-]+)(:(\d+))?)(.+)$/ );
                     var uri_parts = {
                       protocol: parts[1],
@@ -392,9 +393,9 @@
                     helper_data.port.push( uri_parts.port );
                     helper_data.pathname.push( uri_parts.pathname );
 
-                    var status = state[c][s][n].state;
+                    var status = replica.state;
 
-                    if( !live_nodes[state[c][s][n].node_name] )
+                    if( !live_nodes[replica.node_name] )
                     {
                       status = 'gone';
                     }
@@ -404,7 +405,7 @@
                       data: {
                         type : 'node',
                         state : status,
-                        leader : 'true' === state[c][s][n].leader,
+                        leader : 'true' === replica.leader,
                         uri : uri_parts
                       }
                     };
@@ -715,4 +716,4 @@
       }
     );
   }
-);
\ No newline at end of file
+);
{code}

I just get a blank view though, so not sure how one goes about debugging these 
things...
                  
> admin gui cloud views broken
> ----------------------------
>
>                 Key: SOLR-3867
>                 URL: https://issues.apache.org/jira/browse/SOLR-3867
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrCloud
>            Reporter: Yonik Seeley
>            Priority: Blocker
>             Fix For: 4.0, 5.0
>
>
> The cloud tree view works (the one that shows the raw contents of ZK), but 
> the other views (like graph) don't work.  This is probably due to the recent 
> custerstate.json changes.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to