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 id="title">Splout SQL Panel - Tablespace</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>
    	var tablespaceEnc = $.urlParam("tablespace");
    	var tablespace = decodeURIComponent(tablespaceEnc);
    	    	
    	$("#title").html("Splout SQL Panel - Tablespace "+ tablespace);
    	
    	
    	$.getJSON('/api/tablespace/' + tablespaceEnc + '/versions' ,
  			function(data) {
    			$("#versionTitle").html("<h2>Tablespace " + tablespace + "</h2>");
					$('#tablespaces').setTemplateElement("tablespacesTemplate");
					$('#tablespaces').setParam("id", "all");
					$('#tablespaces').processTemplate(data);
  			}
  		);
    	
    	$.getJSON('/api/tablespace/' + tablespaceEnc ,
      			function(data) {
   			    	var current = {};
   			    	current[data.version] = data;
   			    	$('#currentTablespace').setTemplateElement("tablespacesTemplate");
							$('#currentTablespace').setParam("id", "current");
   			    	$('#currentTablespace').processTemplate(current);
      			}
      		);    	  	
    </script>
  </head>
  <body> 
  
	  <!-- Tablespaces Accordion TEMPLATE -->
		<textarea id="tablespacesTemplate" style="display:none">		
			<div class="accordion" id="tablespaces{$P.id}">
			{#foreach $T as tablespace}
			<div class="accordion-group">
			<div class="accordion-heading">
			<a class="accordion-toggle collapsed" data-toggle="collapse"
							data-parent="#tablespaces{$P.id}" href="#tablespacesCollapse{$T.tablespace$index}{$P.id}">
							Version {$T.tablespace$key}</a>
					</div>
					<div id="tablespacesCollapse{$T.tablespace$index}{$P.id}" 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">
		  										{#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>														
						</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><a href="/">Status & Stats</a></li>
              <li><a href="console.html">Query Console</a></li>
              <li><a href="deployments.html">Deployments</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"><div id="versionTitle"></div></div>  	   	   	 
			
			<div class="row">					
				<!--  Tablespaces accordion -->
				<div class="span12">
					<h3>Version being served</h3>
					<div id="currentTablespace">
					</div>
				
					<h3>Available versions</h3>
					<div id="tablespaces">
					</div>
					
				</div>
				
			</div>
			
			<div id="footer"><hr />Splout SQL 0.2</div>
			
		</div>
  </body>
</html>
New to GrepCode? Check out our FAQ X