Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    
    <title>Splout SQL Panel</title>
    
    <script src="js/jquery.js"></script>
    <script src="js/jquery-jtemplates.js"></script>
    <script src="js/panel.js"></script>
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/bootstrap.min.js"></script>
    <style>
      body {
        padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
      }
    </style>
    
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    
    <!-- <link rel=stylesheet href="style.css" type="text/css" media=screen> -->
     
    <script>
    	$.getJSON('/api/overview',
  			function(data) {
    		 
  				var dnodeCount = Object.keys(data.dNodes).length;  				
  				var tablespaceCount = Object.keys(data.tablespaceMap).length;

  				$('#dnodes-count').html(dnodeCount);
  				$('#tablespaces-count').html(tablespaceCount);
  				$('#qnodes-count').html(data.clusterSize-dnodeCount);
				
					$('#dnodes').setTemplateElement("dnodesTemplate");
					$('#dnodes').processTemplate(data.dNodes);
				
					$('#tablespaces').setTemplateElement("tablespacesTemplate");					
					$('#tablespaces').processTemplate(data.tablespaceMap);	  			
  			}
  		);
    </script>
  </head>
  <body>
  
	  <!-- DNodes Accordion TEMPLATE -->
		<textarea id="dnodesTemplate" style="display:none">		
			<div class="accordion" id="dnodes">
			{#foreach $T as dnode}
			<div class="accordion-group">
			<div class="accordion-heading">
			<a class="accordion-toggle collapsed" data-toggle="collapse"
							data-parent="#dnodes" href="#dnodesCollapse{$T.dnode$index}">
							{$T.dnode$key}</a>
					</div>
					<div id="dnodesCollapse{$T.dnode$index}" class="accordion-body collapse"
						style="height: 0px;">
						<div class="accordion-inner">
							<table class="table table-striped table-condensed table-bordered">
								<tbody>
									{#foreach $T.dnode as property}
									{#if $T.property$key == 'files'}{#continue}{#/if}								
									
									<tr>
										<td>{$T.property$key}</td>
										<td>
											{#if $T.property$key == 'upSince'}
												{new Date($T.property)}
											{#else}
												{$T.property}
											{#/if}
										</td>
									</tr>
									{#/for}
								</tbody>
							</table>
							<form action="dnode.html">
								<div class="form-actions">
									<input type="hidden" value="{$T.dnode$key}" name="dnode" />
									<button class="btn btn-primary btn-block">See more details</button>						
								</div>
							</form>
						</div>
					</div>
				</div>
				{#/for}
			</div>				
		</textarea>
  
	  <!-- Tablespaces Accordion TEMPLATE -->
		<textarea id="tablespacesTemplate" style="display:none">		
			<div class="accordion" id="tablespaces">
			{#foreach $T as tablespace}
			<div class="accordion-group">
			<div class="accordion-heading">
			<a class="accordion-toggle collapsed" data-toggle="collapse"
							data-parent="#tablespaces" href="#tablespacesCollapse{$T.tablespace$index}">
							{$T.tablespace$key}</a>
					</div>
					<div id="tablespacesCollapse{$T.tablespace$index}" class="accordion-body collapse"
						style="height: 0px;">
						<div class="accordion-inner">
							<dl class="dl-horizontal well">
								<dt>Version:<dt>
								<dd>{$T.tablespace.version}</dd>
								<dt>Created:<dt>
								<dd>{new Date($T.tablespace.creationDate)}</dd>												
							</dl>
							
							<h4>Partitions</h4>						
							<table class="table table-striped table-condensed table-bordered">
								<theader>
									<tr>
										<td style="text-align: center;"><strong>Shard</strong></td>
										<td style="text-align: center;"><strong>Min key</strong></td>
										<td style="text-align: center;"><strong>Max key</strong></td>
										<td style="text-align: center;"><strong></strong></td>
									</tr>
								</theader>
								<tbody>
									{#foreach $T.tablespace.partitionMap.partitionEntries as partition}								
									<tr>
										<td style="text-align: center;">{$T.partition.shard}</td>
										<td style="text-align: center;">{$T.partition.min}</td>
										<td style="text-align: center;">{$T.partition.max}</td>
										<td>
											<div class="btn-group">
												<a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
		    									{$T.tablespace.replicationMap.replicationEntries[$T.partition.shard].nodes.length} Replicas
		    									<span class="caret"></span>
		  									</a>
		  									<ul class="dropdown-menu pull-right">
		  										{#foreach $T.tablespace.replicationMap.replicationEntries[$T.partition.shard].nodes as replica}
	    											<li><a href="dnode.html?dnode={$T.replica}">{$T.replica}</a></li>
	    										{#/for}
	  										</ul>
  										</div>
										</td>
									</tr>
									{#/for}
								</tbody>
							</table>
														
							<form action="tablespace.html">
								<input type="hidden" value="{$T.tablespace$key}" name="tablespace" />
								<div class="form-actions">			            
										<button class="btn btn-primary btn-block">See more details</button>															
								</div>
							</form>
						</div>
					</div>
				</div>
				{#/for}
			</div>				
		</textarea>


  
    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <div class="brand">Splout SQL Panel</div>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li class="active"><a href="#">Status & Stats</a></li>
              <li><a href="console.html">Query Console</a></li>
		  	  <li><a href="deployments.html">Deployments</a></li>
              <li><a href="tables.html">Tablespace tables</a></li>
            </ul>
          	<p class="navbar-text pull-right"><a href="javascript:history.go(0)" rel="tooltip" title="Refresh page"><i class="icon-refresh"></i></a></p>  
          </div><!--/.nav-collapse -->
          
        </div>
      </div>
    </div>
  
  	<div class="container">
  	  <div class="page-header"><h2>Status</h2></div>
  	  
			<div id="status" class="row">
				<div class="span6">
					<dl class="dl-horizontal well">
						<dt>QNodes:<dt>
						<dd id="qnodes-count"></dd>					
						
						<dt>DNodes:<dt>
						<dd id="dnodes-count"></dd>										
					</dl>
				</div>
				<div class="span6">
					<dl class="dl-horizontal well">
						<dt>Tablespaces:<dt><dd id="tablespaces-count"></dd>
					</dl>
				</div>			
			</div>
			
			<hr/>
			
			<div class="row">
			
				<!--  DNodes accordion -->
				<div class="span6">
				  <h3>DNodes</h3>
					<div class="accordion" id="dnodes">					
					</div>
				</div>
				
				<!--  Tablespaces accordion -->
				<div class="span6">
					<h3>Tablespaces</h3>
					<div class="accordion" id="tablespaces">					
					</div>
				</div>
				
			</div>

      <hr/>

      <a href="/metrics/">Metrics</a>

      <div id="footer"><hr />Splout SQL 0.2</div>
			
		</div>

  </body>
</html>
New to GrepCode? Check out our FAQ X