Index: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java =================================================================== --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java (revision 1539753) +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java (working copy) @@ -193,10 +193,105 @@ "table.info tr th {width: 50%}")._(). // to center info table script("/static/jt/jquery.jstree.js"). script().$type("text/javascript"). - _("$(function() {", + _( + "function addRemoveQueueToQuery(e,data){", + " var OPEN_QUEUES = 'openQueues';", + " var ACTION_OPEN = 'open';", + " var ACTION_CLOSED = 'closed';", + " var $li = $(data.args[0]);", + " //var $li = $(this).closest('li');", + " var action = ACTION_CLOSED; //closed or open", + " var queueName = ''", + " if($li.hasClass('jstree-open')){", + " action=ACTION_OPEN;}", + " queueName = $li.find('.q').html();", + " var currentParam = window.location.href.split('?'); // http://localhost:8088/cluster/scheduler?openQueues=q1#q2¶m1=value1¶m2=value2", + " var tmpCurrentParam = currentParam; // [http://localhost:8088/cluster/scheduler , openQueues=q1#q2¶m1=value1¶m2=value2]", + " var queryString = '';", + " if(tmpCurrentParam.length>1){", + " tmpCurrentParam=tmpCurrentParam[1]; // openQueues=q1#q2¶m1=value1¶m2=value2", + " currentParam = tmpCurrentParam;", + " tmpCurrentParam = tmpCurrentParam.split('&');", + " var len = tmpCurrentParam.length;", + " var paramExist = false;", + " if(len>1){ //Currently no query param are present but in future if any are added for that handling it now", + " queryString = '';", + " for(var i=0 ; i1){", + " tmpCurrentParam=tmpCurrentParam[1]; // openQueues=q1#q2¶m1=value1¶m2=value2", + " if(tmpCurrentParam.indexOf('openQueues=')!=-1){", + " tmpCurrentParam = tmpCurrentParam.split('openQueues=')[1].split('&')[0];", + " queryQueuesString = tmpCurrentParam; }", + " }", + " if(queryQueuesString!=''){", + " $('#cs .q').each(function(){", + " var name = $(this).html();", + " if(name!='root' && queryQueuesString.indexOf(name)!=-1){", + " $(this).parents('li').removeClass('jstree-closed').addClass('jstree-open'); }", + " });", + " }", + "}", + "", + "$(function() {", " $('#cs a span').addClass('ui-corner-all').css('position', 'absolute');", " $('#cs').bind('loaded.jstree', function (e, data) {", - " data.inst.open_node('#pq', true);", + " var callback = {call:reopenQueryNodes}", + " data.inst.open_node('#pq', callback);", " }).", " jstree({", " core: { animation: 188, html_titles: true },", @@ -212,6 +307,10 @@ " $('#apps').dataTable().fnFilter(q, 3, true);", " });", " $('#cs').show();", + " $('#cs').bind({", + " 'open_node.jstree':function(e,data){ addRemoveQueueToQuery(e,data); },", + " 'close_node.jstree':function(e,data){ addRemoveQueueToQuery(e,data); }", + " });", "});")._(); } Index: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java =================================================================== --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java (revision 1539753) +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/CapacitySchedulerPage.java (working copy) @@ -246,10 +246,105 @@ "table.info tr th {width: 50%}")._(). // to center info table script("/static/jt/jquery.jstree.js"). script().$type("text/javascript"). - _("$(function() {", + _( + "function addRemoveQueueToQuery(e,data){", + " var OPEN_QUEUES = 'openQueues';", + " var ACTION_OPEN = 'open';", + " var ACTION_CLOSED = 'closed';", + " var $li = $(data.args[0]);", + " //var $li = $(this).closest('li');", + " var action = ACTION_CLOSED; //closed or open", + " var queueName = ''", + " if($li.hasClass('jstree-open')){", + " action=ACTION_OPEN;}", + " queueName = $li.find('.q').html();", + " var currentParam = window.location.href.split('?'); // http://localhost:8088/cluster/scheduler?openQueues=q1#q2¶m1=value1¶m2=value2", + " var tmpCurrentParam = currentParam; // [http://localhost:8088/cluster/scheduler , openQueues=q1#q2¶m1=value1¶m2=value2]", + " var queryString = '';", + " if(tmpCurrentParam.length>1){", + " tmpCurrentParam=tmpCurrentParam[1]; // openQueues=q1#q2¶m1=value1¶m2=value2", + " currentParam = tmpCurrentParam;", + " tmpCurrentParam = tmpCurrentParam.split('&');", + " var len = tmpCurrentParam.length;", + " var paramExist = false;", + " if(len>1){ //Currently no query param are present but in future if any are added for that handling it now", + " queryString = '';", + " for(var i=0 ; i1){", + " tmpCurrentParam=tmpCurrentParam[1]; // openQueues=q1#q2¶m1=value1¶m2=value2", + " if(tmpCurrentParam.indexOf('openQueues=')!=-1){", + " tmpCurrentParam = tmpCurrentParam.split('openQueues=')[1].split('&')[0];", + " queryQueuesString = tmpCurrentParam; }", + " }", + " if(queryQueuesString!=''){", + " $('#cs .q').each(function(){", + " var name = $(this).html();", + " if(name!='root' && queryQueuesString.indexOf(name)!=-1){", + " $(this).parents('li').removeClass('jstree-closed').addClass('jstree-open'); }", + " });", + " }", + "}", + "", + "$(function() {", " $('#cs a span').addClass('ui-corner-all').css('position', 'absolute');", " $('#cs').bind('loaded.jstree', function (e, data) {", - " data.inst.open_node('#pq', true);", + " var callback = {call:reopenQueryNodes}", + " data.inst.open_node('#pq', callback);", " }).", " jstree({", " core: { animation: 188, html_titles: true },", @@ -265,6 +360,10 @@ " $('#apps').dataTable().fnFilter(q, 3, true);", " });", " $('#cs').show();", + " $('#cs').bind({", + " 'open_node.jstree':function(e,data){ addRemoveQueueToQuery(e,data); },", + " 'close_node.jstree':function(e,data){ addRemoveQueueToQuery(e,data); }", + " });", "});")._(); }