Skip to content

Commit

Permalink
support to filter experiment instances by state
Browse files Browse the repository at this point in the history
the first commit only supports to filter for error states
  • Loading branch information
AlexanderFroemmgen committed Mar 9, 2018
1 parent d150a42 commit 1d687bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions maci_backend/Controllers/ExperimentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ public IActionResult GetExperimentParameters(int id)
return new ObjectResult(result.Parameters);
}

[HttpGet("{id}/{pageIndex}")]
public IActionResult GetExperimentInstances(int id, int pageIndex)
[HttpGet("{id}/{pageIndex}/{withStatus}")]
public IActionResult GetExperimentInstances(int id, int pageIndex, string withStatus)
{
var experimentInstances =
_context.Experiments
Expand All @@ -140,7 +140,7 @@ public IActionResult GetExperimentInstances(int id, int pageIndex)
return NotFound();
}

var result = experimentInstances.MapTo<ExperimentInstanceDto>(_mapper);
var result = experimentInstances.Where(ei => withStatus == "all" || ei.Status.ToString() == withStatus).MapTo<ExperimentInstanceDto>(_mapper);

/* Do not transfer log messages, but generate aggregated HasWarning info */
foreach (var si in result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ angular.module("frontend").controller("ExperimentViewController", function ($sco
$scope.getExperimentInstances = function (pageId) {
pageId = pageId || 1;

$http.get("experiments/" + $routeParams.id + "/" + pageId).then(function (r) {
var experimentStatus = $scope.showJustErrors ? "Error" : "all";
$http.get("experiments/" + $routeParams.id + "/" + pageId + "/" + experimentStatus).then(function (r) {
$scope.experimentInstancesData = r.data;
}, Utils.handleApiError);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ <h4>Instances</h4>
<div class="input-group-addon"><i class="fa fa-search"></i></div>
<input type="text" class="form-control" placeholder="Filter" ng-model="searchFilter">
</div>
<label>Just errors</label><input type="checkbox" ng-model="showJustErrors" ng-click="getExperimentInstances(0)">
</div>

<div class="form-group">
Expand Down

0 comments on commit 1d687bf

Please sign in to comment.