Commit 2053b0af authored by Leigh Stoller's avatar Leigh Stoller

We love usage stats!

parent 04d2a732
......@@ -30,6 +30,14 @@ else {
$DEFAULT_AGGREGATE = "Utah APT";
}
$urn_mapping =
array("urn:publicid:IDN+utah.cloudlab.us+authority+cm" => "Utah",
"urn:publicid:IDN+wisc.cloudlab.us+authority+cm" => "Wisc",
"urn:publicid:IDN+clemson.cloudlab.us+authority+cm" => "Clem",
"urn:publicid:IDN+apt.emulab.net+authority+cm" => "APT",
"urn:publicid:IDN+emulab.net+authority+cm" => "MS",
"urn:publicid:IDN+utahddc.geniracks.net+authority+cm" => "DDC");
class Instance
{
var $instance;
......
......@@ -13,7 +13,7 @@ function (sup, moment)
var date = $.trim($(this).html());
if (date != "") {
$(this).html(moment($(this).html())
.format("MMM Do, h:mm a"));
.format("ll"));
}
});
InitTable("table1");
......
......@@ -1250,6 +1250,12 @@ function (_, sup, moment, marked, UriTemplate, ShowImagingModal,
//
function DoSnapshotNode(node_id)
{
// Do not allow snapshot if the experiment is not in the ready state.
if (lastStatus != "ready") {
alert("Experiment is not ready yet, snapshot not allowed");
return;
}
// Default to update unless checkbox says otherwise.
var update_profile = 1;
var update_prepare = 0;
......
require(window.APT_OPTIONS.configObject,
['js/quickvm_sup', 'moment'],
function (sup, moment)
{
'use strict';
function initialize()
{
window.APT_OPTIONS.initialize(sup);
// Format dates with moment before display.
$('.format-date').each(function() {
var date = $.trim($(this).html());
if (date != "") {
$(this).html(moment($(this).html())
.format("MMM Do, h:mm a"));
}
});
InitTable("uid");
InitTable("pid");
}
function InitTable(name)
{
var tablename = "#tablesorter_" + name;
var searchname = "#search_" + name;
var table = $(tablename)
.tablesorter({
theme : 'green',
//cssChildRow: "tablesorter-childRow",
// initialize zebra and filter widgets
widgets: ["zebra", "filter", "resizable", "math"],
widgetOptions: {
// include child row content while filtering, if true
filter_childRows : true,
// include all columns in the search.
filter_anyMatch : true,
// class name applied to filter row and each input
filter_cssFilter : 'form-control',
// search from beginning
filter_startsWith : false,
// Set this option to false for case sensitive search
filter_ignoreCase : true,
// Only one search box.
filter_columnFilters : false,
// data-math attribute
math_data : 'math',
// ignore first column
math_ignore : [0],
// integers
math_mask : '',
}
});
// Target the $('.search') input using built in functioning
// this binds to the search using "search" and "keyup"
// Allows using filter_liveSearch or delayed search &
// pressing escape to cancel the search
$.tablesorter.filter.bindSearch(table, $(searchname));
}
$(document).ready(initialize);
});
......@@ -106,6 +106,8 @@ else {
function SPITROWS($all, $name, $result)
{
global $TBBASE, $urn_mapping;
echo "<input class='form-control search' type='search' data-column='all'
id='experiment_search_${name}' placeholder='Search'>\n";
......@@ -122,7 +124,12 @@ function SPITROWS($all, $name, $result)
}
echo " <th>Project</th>
<th>Status</th>
<th>Created</th>
<th>Cluster</th>\n";
if (ISADMIN()) {
echo " <th>P</th>\n";
echo " <th>V</th>\n";
}
echo " <th>Created</th>
<th>Expires</th>
</tr>
</thead>
......@@ -139,16 +146,23 @@ function SPITROWS($all, $name, $result)
$profile_name = $profile_id;
$creator_uid = $row["creator"];
$pid = $row["pid"];
$urn = $row["aggregate_urn"];
$cluster = $urn_mapping[$urn];
$pcount = $row["physnode_count"];
$vcount = $row["virtnode_count"];
list($foo,$hrn) = preg_split("/\./", $row["hrn"]);
$email = $row["email"];
# If a guest user, use email instead.
if (isset($email)) {
$creator = $email;
}
else {
elseif (ISADMIN()) {
$creator = "<a href='$TBBASE/showuser.php3?user=$creator_idx'>".
"$creator_uid</a>";
}
else {
$creator = $creator_uid;
}
if ($row["expired"]) {
$status = "expired";
}
......@@ -168,9 +182,20 @@ function SPITROWS($all, $name, $result)
if ($all) {
echo "<td>$creator</td>";
}
echo " <td><a href='$TBBASE/showproject.php3?pid=$pid'>$pid</a></td>";
echo " <td>$status</td>
<td class='format-date'>$created</td>
if (ISADMIN()) {
echo " <td><a href='$TBBASE/showproject.php3?pid=$pid'>".
"$pid</a></td>";
}
else {
echo " <td>$pid</td>\n";
}
echo " <td>$status</td>\n";
echo " <td>$cluster</td>\n";
if (ISADMIN()) {
echo "<td>$pcount</td>";
echo "<td>$vcount</td>";
}
echo" <td class='format-date'>$created</td>
<td class='format-date'>$expires</td>
</tr>\n";
}
......@@ -190,7 +215,7 @@ if (mysql_num_rows($query_result1) == 0) {
if (ISADMIN()) {
$message .= "<img src='images/redball.gif'>".
"<a href='myexperiments.php?all=1'>";
$message .= "Show all user Experiments</a>";
$message .= "Show all user Experiments</a><br>";
}
echo $message;
}
......
......@@ -283,7 +283,8 @@ $PAGEHEADER_FUNCTION = function($thinheader = 0, $ignore1 = NULL,
<li><a href='create-dataset.php'>Create Dataset</a></li>";
if (ISADMIN()) {
echo " <li class='divider'></li>
<li><a href='activity.php'>Activity</a></li>";
<li><a href='activity.php'>Activity</a></li>
<li><a href='sumstats.php'>Summary Stats</a></li>";
}
echo " </ul>
</li>\n";
......
This diff is collapsed.
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