Commit 0961ab86 authored by Leigh Stoller's avatar Leigh Stoller

New front page for Emulab. Work in progress.

parent 7641f6db
<?php
#
# Copyright (c) 2016-2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
chdir("..");
include("defs.php3");
chdir("apt");
include("quickvm_sup.php");
# Must be after quickvm_sup.php since it changes the auth domain.
$page_title = "Emulab";
#
# Get current user.
#
RedirectSecure();
$check_status = 0;
$this_user = CheckLogin($check_status);
SPITHEADER(1, 1);
echo "<script type='text/javascript'>\n";
echo "</script>\n";
# Place to hang the toplevel template.
echo "<div id='main-body'></div>\n";
REQUIRE_UNDERSCORE();
REQUIRE_SUP();
REQUIRE_MOMENT();
SPITREQUIRE("js/frontpage.js");
AddTemplateList(array("frontpage", "frontpage-facility", "frontpage-status",
"oops-modal", "waitwait-modal"));
SPITFOOTER(1);
?>
$(function ()
{
'use strict';
var template_list = ["frontpage", "frontpage-facility",
"frontpage-status",
"oops-modal", "waitwait-modal"];
var templates = APT_OPTIONS.fetchTemplateList(template_list);
var mainTemplate = _.template(templates["frontpage"]);
var statusTemplate = _.template(templates["frontpage-status"]);
function initialize()
{
window.APT_OPTIONS.initialize(sup);
// Generate the main template.
var html = mainTemplate({
});
$('#main-body').html(html);
$('#frontpage-facility').html(templates["frontpage-facility"]);
$('.cluster-status').html(statusTemplate({"typeinfo" : {} }));
$('#oops_div').html(templates["oops-modal"]);
$('#waitwait_div').html(templates["waitwait-modal"]);
updateFacilStats();
}
function updateFacilStats()
{
$.getJSON("stats-ajax.php", function(data, status) {
if (status == "success") {
$('.cluster-status').html(statusTemplate({
"typeinfo" : data.typeinfo
}));
_.each(data.typeinfo, function(info, type) {
var statusid = "#facility-status-" + type;
var progressid = "#facility-full-" + type;
var total = parseInt(info.total);
var free = parseInt(info.free);
var pctfull = Math.round(100 * (total - free) / total);
$(statusid).html(free);
$(progressid).css("width", pctfull + "%");
$(progressid).text(pctfull + "% inuse");
});
$("#facility-experiments")
.text(Number(data["active_experiments"]).toLocaleString());
$("#facility-total-experiments")
.text(Number(data["total_experiments"]).toLocaleString());
$("#facility-total-users")
.text(Number(data["distinct_users"]).toLocaleString());
$("#facility-total-projects")
.text(Number(data["projects"]).toLocaleString());
$("#facility-profiles")
.text(Number(data["profiles"]).toLocaleString());
}
});
}
$(document).ready(initialize);
});
......@@ -172,6 +172,9 @@ $PAGEHEADER_FUNCTION = function($thinheader = 0, $ignore1 = NULL,
if ($embedded) {
goto embed;
}
if ($ignore1) {
return;
}
#
# This is the stuff to the right of the logo.
......@@ -584,8 +587,10 @@ function GET_ANNOUNCEMENTS($user, $update = true)
$PAGEFOOTER_FUNCTION = function($ignored = NULL) {
global $PORTAL_HELPFORUM, $PORTAL_NSFNUMBER, $embedded, $PORTAL_TEMPLATES;
echo "</div>
</div>\n";
echo "</div>";
if (!$ignored) {
echo "</div>\n";
}
if (!$embedded) {
if ($PORTAL_NSFNUMBER) {
SpitNSFModal();
......
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -88,4 +88,63 @@ if ($query_result) {
$blob["profiles"] = $row[0];
}
#
# For the Emulab Portal frontpage, we return inuse/free counts for
# the allocatable node types, mostly so we have something interesting
# to show.
#
$typeinfo = array();
$prunelist = Instance::NodeTypePruneList();
#
# Get total number of nodes.
#
$query_result =
DBQueryFatal("select n.type,count(*) as count from nodes as n ".
"left join node_types as nt on n.type=nt.type ".
"left join node_type_attributes as attr on ".
" attr.type=n.type and ".
" attr.attrkey='noshowfreenodes' ".
"where (role='testnode') and class='pc' and ".
" attr.attrvalue is null ".
"group BY n.type");
while ($row = mysql_fetch_array($query_result)) {
$type = $row["type"];
$count = $row["count"];
if (!array_key_exists($type, $prunelist)) {
$typeinfo[$type] = array("total" => $count, "free" => 0);
}
}
# Get free totals by type.
$query_result =
DBQueryFatal("select n.type,count(*) as count from nodes as n ".
"left join node_types as nt on n.type=nt.type ".
"left join reserved as r on r.node_id=n.node_id ".
"left join node_type_attributes as attr on ".
" attr.type=n.type and ".
" attr.attrkey='noshowfreenodes' ".
"where (role='testnode') and class='pc' and ".
" r.pid is null and ".
" attr.attrvalue is null and ".
" (n.reserved_pid is null) AND ".
" (n.eventstate='" . TBDB_NODESTATE_ISUP . "' or ".
" n.eventstate='" . TBDB_NODESTATE_POWEROFF . "' or ".
" n.eventstate='" . TBDB_NODESTATE_ALWAYSUP . "' or ".
" n.eventstate='" . TBDB_NODESTATE_PXEWAIT . "') ".
"group BY n.type");
while ($row = mysql_fetch_array($query_result)) {
$type = $row["type"];
$count = $row["count"];
if (!array_key_exists($type, $prunelist)) {
$typeinfo[$type]["free"] = $count;
}
}
$blob["typeinfo"] = $typeinfo;
echo json_encode($blob);
<div class="panel panel-primary">
<div class="panel-body">
<div class="col-sm-7 col-xs-12 cluster-status">
</div>
<div class="col-sm-5 col-xs-12">
<table class="table table-hover table-condensed" style="margin-bottom: 0px">
<thead>
<tr>
<th colspan="2">Activity</th>
</tr>
<tbody>
<tr>
<td>Projects</td>
<td class="text-right" id="facility-total-projects">-</td>
</tr>
<tr>
<td>Users</td>
<td class="text-right" id="facility-total-users">-</td>
</tr>
<tr>
<td>Profiles</td>
<td class="text-right" id="facility-profiles">-</td>
</tr>
<tr>
<td>Experiments</td>
<td class="text-right" id="facility-total-experiments">-</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<table class="table table-hover table-condensed"
style="margin-bottom: 0px">
<thead>
<tr><th colspan="3">Cluster Status</th></tr>
</thead>
<tbody>
<tr>
<td colspan="3">Active Experiments:
<span class="pull-right badge badge-info"
style="min-width: 4em" id="facility-experiments">-</span>
</td>
</tr>
<% _.each(typeinfo, function(info, type) { %>
<tr>
<td><%- type %></td>
<td id="facility-status-<%- type %>"><small>
<span class="badge badge-light">---</span></small></td>
<td style="width: 8em">
<div class="progress" style="margin-bottom: 0px">
<div id="facility-full-<%- type %>"
class="progress-bar" role="progressbar">
</div>
</div>
</td>
</tr>
<% }) %>
</tbody>
</table>
<div class='navbar portal-navbar' role='navigation' style="margin-bottom: 0px">
<div class='navbar-header'>
<button type='button' class='navbar-toggle collapsed'
data-toggle='collapse' data-target='.navbar-collapse'
aria-expanded='false'>
<span class='sr-only'>Toggle navigation</span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
</button>
<a class='navbar-brand' href='landing.php'>
<img src='images/emulab-logo.svg'/></a>
</div>
<a class="btn btn-quickvm-home btn-success navbar-btn pull-right"
style="margin-right: 20px; margin-left: 10px; padding: 5px 5px;"
href="landing.php">Log In</a>
<div class="navbar-collapse collapse navbar-left">
<ul class="nav navbar-nav">
</ul>
</div>
<div class="navbar-collapse collapse navbar-right">
<ul class="nav navbar-nav">
<li><a href="http://docs.emulab.net/"
class="btn btn-quickvm-home navbar-btn">Docs</a></li>
</ul>
</div>
</div>
<div class="jumbotron" style="padding-top: 15px; padding-bottom: 10px">
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12">
<img class="header-logo img-responsive" src="images/emulab.png" alt="Emulab">
</div>
<div class="col-md-6 col-sm-12"> <a style="margin: 0px 0px 10px 10px" class="btn btn-success pull-right" href="signup.php">Request an Account</a>
<p id="jumbo-text">
A time- and space-shared platform
for research, education, and development in distributed systems and
networks. Emulab's primary goals are ease of use, control, and
realism, achieved through consistent use of virtualization
and abstraction.
</p>
</div>
</div> <!-- /row -->
</div> <!-- /container -->
</div>
<div class="container">
<div class="row">
<div class="col-md-6 col-sm-12">
<em>Emulab</em> is a network testbed, giving researchers a wide range of
environments in which to develop, debug, and evaluate their systems.
The name Emulab refers both to a <strong>facility</strong> and to a
<strong>software system</strong>.
The <a href="http://www.emulab.net">primary Emulab installation</a> is run
by the
<a href="http://www.flux.utah.edu">Flux Group</a>, part of the
<a href="http://www.cs.utah.edu">School of Computing</a> at the
<a href="http://www.utah.edu">University of Utah</a>.
There are also installations of the Emulab software at more than
<a href="http://users.emulab.net/trac/emulab/wiki/OtherEmulabs">two
dozen sites</a> around the world, ranging from testbeds with a handful
of nodes up to testbeds with hundreds of nodes.
Emulab is <a href="http://www.emulab.net/expubs.php">widely used</a>
by computer science researchers in the fields of networking and
distributed systems.
It is also designed to support
<a href="http://users.emulab.net/trac/emulab/wiki/Education">
education</a>, and has been used to
<a href="http://users.emulab.net/trac/emulab/wiki/Classes">teach
classes</a> in those fields.
</div>
<div class="col-md-6 col-sm-12" id="frontpage-facility">
</div>
</div>
<div class="row">
<div class="col-md-6 col-sm-12">
<ul>
<li><a href="https://gitlab.flux.utah.edu/emulab/emulab-devel/wikis/home">Emulab Wiki</a></li>
<li><a href="https://gitlab.flux.utah.edu/emulab/emulab-devel/wikis/How%20to%20Get%20Started">How to Get Started</a></li>
<li><a href="https://gitlab.flux.utah.edu/emulab/emulab-devel/wikis/Acceptable%20Use%20Policy">Acceptable Use Policy</a></li>
<li><a href="https://gitlab.flux.utah.edu/emulab/emulab-devel/wikis/Administrative%20Policies">Adiministrative Policies</a></li>
<li><a href="https://gitlab.flux.utah.edu/emulab/emulab-devel/wikis/Security%20Policies">Security Policies</a></li>
<li><a href="https://gitlab.flux.utah.edu/emulab/emulab-devel/wikis/Utah%20Cluster">Hardware Overview of the Utah cluster</a></li>
</ul>
</div>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment