Commit 0737e7f2 authored by Leigh Stoller's avatar Leigh Stoller

First crack at a node type picker.

parent ccd40a5b
......@@ -386,6 +386,28 @@ class Aggregate
}
return $result;
}
#
# Array of type attributes for the specified type.
#
function TypeAttributes($type)
{
$result = array();
$urn = $this->urn();
$query_result =
DBQueryFatal("select attrkey,attrvalue from ".
" apt_aggregate_nodetype_attributes ".
"where type='$type' and urn='$urn'");
if (!mysql_num_rows($query_result)) {
return null;
}
while ($row = mysql_fetch_array($query_result)) {
$result[$row["attrkey"]] = $row["attrvalue"];
}
return $result;
}
}
#
......
......@@ -594,3 +594,53 @@ blockquote #selected_profile_description {
color: #fff;
background-color: #007bff;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu:hover>.dropdown-menu {
display: inline-block;
}
.dropdown-submenu>.dropdown-menu {
bottom: 0% !important;
top :auto !important;
left: 100%;
margin-top: -6px;
margin-left: -1px;
-webkit-border-radius: 0 6px 6px 6px;
-moz-border-radius: 0 6px 6px;
border-radius: 0 6px 6px 6px;
}
.dropup-menu { bottom:0% !important; top:auto !important; }
.dropdown-submenu>a:after {
display: block;
content: " ";
float: right;
width: 0;
height: 0;
border-bottom: 4px solid transparent;
border-top: 4px solid transparent;
border-left: 4px solid;
margin-top: 5px;
margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
left: -100%;
margin-left: 10px;
-webkit-border-radius: 6px 0 6px 6px;
-moz-border-radius: 6px 0 6px 6px;
border-radius: 6px 0 6px 6px;
}
......@@ -808,7 +808,7 @@ class Instance
#
# Return a list of types not to show user.
#
function NodeTypePruneList($aggregate = null) {
function NodeTypePruneList($aggregate = null, $all = false) {
global $ISEMULAB, $ISCLOUD, $ISAPT, $ISPNET, $ISPOWDER, $TBMAINSITE;
global $DEFAULT_AGGREGATE_URN;
$aggregate_urn = ($aggregate ? $aggregate->urn() : "");
......@@ -833,7 +833,7 @@ class Instance
#
if ($TBMAINSITE &&
!($ISPOWDER || $ISPNET) &&
$aggregate_urn == $DEFAULT_AGGREGATE_URN) {
($all || $aggregate_urn == $DEFAULT_AGGREGATE_URN)) {
$skiptypes["sdr"] = true;
$skiptypes["nuc5300"] = true;
$skiptypes["enodeb"] = true;
......@@ -1237,10 +1237,16 @@ function CalculateAggregateStatus(&$amlist, &$fedlist, &$status,
$urn = $aggregate->urn();
$am = $aggregate->name();
if ($extended) {
$typelist = array();
$types = $aggregate->TypeList();
foreach ($types as $type => $ignore) {
$typelist[$type] = $aggregate->TypeAttributes($type);
}
$amlist[$urn] = array("urn" => $urn,
"name" => $am,
"nickname" => $aggregate->nickname(),
"typelist" => $aggregate->TypeList());
"typelist" => $typelist);
}
else {
$amlist[$urn] = $am;
......@@ -1261,10 +1267,16 @@ function CalculateAggregateStatus(&$amlist, &$fedlist, &$status,
$urn = $aggregate->urn();
$am = $aggregate->name();
if ($extended) {
$typelist = array();
$types = $aggregate->TypeList();
foreach ($types as $type => $ignore) {
$typelist[$type] = $aggregate->TypeAttributes($type);
}
$amlist[$urn] = array("urn" => $urn,
"name" => $am,
"nickname" => $aggregate->nickname(),
"typelist" => $aggregate->TypeList());
"typelist" => $typelist);
}
else {
$amlist[$urn] = $am;
......
......@@ -383,6 +383,11 @@ function SPITFORM($formfields, $newuser, $errors)
}
SpitAggregateStatus(true, $this_user);
$prunelist = Instance::NodeTypePruneList(null, true);
echo "<script type='text/plain' id='prunelist-json'>\n";
echo htmlentities(json_encode($prunelist));
echo "</script>\n";
SpitOopsModal("oops");
echo "<script type='text/javascript'>\n";
echo " window.PROFILE = '" . $formfields["profile"] . "';\n";
......
......@@ -45,6 +45,7 @@ $(function ()
var ppchanged = false;
var monitor = null;
var types = null;
var prunetypes = null;
var hardware = null;
var resinfo = null;
var currentStep = 0;
......@@ -77,12 +78,15 @@ $(function ()
amValueToKey[amlist[key].name] = key;
});
amstatus = decodejson('#amstatus-json');
console.info(amlist);
}
if ($('#projects-json').length) {
projlist = decodejson('#projects-json');
}
profilelist = decodejson('#profiles-json');
var profileToArray = _.pairs(profilelist);
prunetypes = decodejson('#prunelist-json');
console.info(prunetypes);
/*
* Sort the entire list by recently used if a registered user,
......@@ -563,6 +567,8 @@ $(function ()
modified_callback : function () { ppchanged = true; },
rspec : null,
multisite : multisite,
amlist : amlist,
prunetypes : prunetypes,
jacksGraphCallback: updateJacksGraph
});
loaded_uuid = selected_uuid;
......
This diff is collapsed.
......@@ -35,7 +35,53 @@
}
svg {
display: block;
}
}
.scrollable-submenu {
height: auto;
max-height: 350px;
overflow-x: hidden;
}
.scrollable-menubroken {
height: auto;
max-height: 350px;
overflow-y: scroll;
}
.icon-info-right {
position: absolute;
right: 10px;
top: 3px;
padding: 0px;
pointer: pointer;
}
.right-menu {
top: 0;
left: unset;
}
.open > .right-menu {
display: inline-block;
}
.right-caret {
border-bottom: 4px solid transparent;
border-top: 4px solid transparent;
border-left: 4px solid;
display: inline-block;
margin-left: 2px;
margin-top: 5px;
margin-right: -10px;
height: 0;
width: 0;
float: right;
}
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
padding-top: 2px;
padding-bottom: 2px;
}
</style>
<div>
<div id='about_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