Commit 86f6218e authored by Leigh Stoller's avatar Leigh Stoller

Bring back project experiment list on user dashboard.

parent b0bb1017
......@@ -114,6 +114,7 @@ function ExperimentList($which, $target)
{
global $urn_mapping, $TBBASE;
global $this_user;
$extraclause = "";
if ($which == "user") {
$target_uuid = $target->uuid();
......@@ -124,6 +125,15 @@ function ExperimentList($which, $target)
$target_gid = $target->gid();
$whereclause = "where a.pid='$target_pid' and a.gid='$target_gid'";
}
elseif ($which == "membership") {
$target_uuid = $target->uuid();
$target_idx = $target->idx();
$whereclause = "where a.creator_uuid='$target_uuid' or ".
" g.uid_idx is not null ";
$extraclause = "left join group_membership as g on ".
" g.uid_idx='$target_idx' and ".
" g.pid_idx=a.pid_idx ";
}
else {
$target_pid = $target->pid();
$whereclause = "where a.pid='$target_pid'";
......@@ -149,6 +159,7 @@ function ExperimentList($which, $target)
"left join geni.geni_slices as s on ".
" s.uuid=a.slice_uuid ".
"left join geni.geni_users as u on u.uuid=a.creator_uuid ".
"$extraclause ".
"$whereclause");
while ($row = mysql_fetch_array($query_result)) {
......
......@@ -113,36 +113,56 @@ $(function ()
function LoadExperimentTab()
{
var template = _.template(experimentString);
var callback = function(json) {
console.info(json);
console.info("experiments", json);
if (json.code) {
console.info(json.value);
return;
}
if (json.value.length == 0) {
if (json.value.user_experiments.length == 0) {
$('#experiments_loading').addClass("hidden");
$('#experiments_noexperiments').removeClass("hidden");
return;
}
var template = _.template(experimentString);
$('#experiments_content')
.html(template({"experiments" : json.value,
"showCreator" : false,
"showProject" : true}));
else {
$('#experiments_content')
.html(template({"experiments" : json.value.user_experiments,
"showCreator" : false,
"showProject" : true}));
}
if (json.value.project_experiments.length != 0) {
$('#project_experiments_content')
.html("<div><h4 class='text-center'>" +
"Experiments in my Projects</h4>" +
template({"experiments" :
json.value.project_experiments,
"showCreator" : true,
"showProject" : true}) +
"</div>");
}
// Format dates with moment before display.
$('#experiments_table .format-date').each(function() {
$('#experiments_content .format-date, ' +
'#project_experiments_content .format-date')
.each(function() {
var date = $.trim($(this).html());
if (date != "") {
$(this).html(moment($(this).html()).format("ll"));
}
});
var table = $('#experiments_table')
.tablesorter({
theme : 'green',
});
if (json.value.user_experiments.length != 0) {
$('#experiments_content #experiments_table')
.tablesorter({
theme : 'green',
});
}
if (json.value.project_experiments.length != 0) {
$('#project_experiments_content #experiments_table')
.tablesorter({
theme : 'green',
});
}
}
var xmlthing = sup.CallServerMethod(null,
"user-dashboard", "ExperimentList",
......
......@@ -111,6 +111,7 @@
</div>
</div>
<br>
<div id="project_experiments_content"></div>
<div id="classic_experiments_content"></div>
</div>
<div role="tabpanel" class="tab-pane" id="profiles">
......
......@@ -74,8 +74,11 @@ function Do_ExperimentList()
if (CheckPageArgs()) {
return;
}
$results = ExperimentList("user", $target_user);
SPITAJAX_RESPONSE($results);
$blob = array("user_experiments" =>
ExperimentList("user", $target_user),
"project_experiments" =>
ExperimentList("membership", $target_user));
SPITAJAX_RESPONSE($blob);
}
function Do_ClassicExperimentList()
......
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