Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/parklab/refinery-platform
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
flekschas committed Jun 30, 2015
2 parents a78681d + 57eb38c commit 909da82
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 8 deletions.
8 changes: 7 additions & 1 deletion refinery/analysis_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ def run(request):
study_uuid = analysis_config['studyUuid']
node_set_uuid = analysis_config['nodeSetUuid']
node_relationship_uuid = analysis_config['nodeRelationshipUuid']
custom_name = analysis_config['name']
except KeyError:
return HttpResponseBadRequest() # 400
# must provide workflow and study UUIDs,
Expand Down Expand Up @@ -417,7 +418,12 @@ def run(request):

######### ANALYSIS MODEL ########
# How to create a simple analysis object
temp_name = curr_workflow.name + " " + datetime.now().strftime("%Y-%m-%d @ %H:%M:%S")

if not custom_name:
temp_name = curr_workflow.name + " " + datetime.now().strftime("%Y-%m-%d @ %H:%M:%S")
else:
temp_name = custom_name

summary_name = "None provided."

analysis = Analysis(summary=summary_name,
Expand Down
4 changes: 4 additions & 0 deletions refinery/static/source/styles/less/refinery-style.less
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ ul#externalToolListPopover li{
margin: 0;
}

.bootboxAnalysisWidth form input{
width: 96%;
}

@media (max-width: 760px) {
#textToolStatus{
width: 100%;
Expand Down
42 changes: 37 additions & 5 deletions refinery/ui/src/js/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ angular.module('refineryAnalysis', [])

.controller('AnalysisCtrl', function(
$scope, $rootScope, $http, $window, $log, $timeout, workflow) {
var vm = this;

'use strict';

$scope.analysisConfig = {
studyUuid: $window.externalStudyUuid,
workflowUuid: null,
nodeSetUuid: null,
nodeRelationshipUuid: null
nodeRelationshipUuid: null,
name: null,
};

$scope.$onRootScope('nodeSetChangedEvent', function(event, currentNodeSet) {
Expand All @@ -31,22 +33,52 @@ angular.module('refineryAnalysis', [])
$scope.analysisConfig.nodeSetUuid = null;
});

$scope.launchAnalysis = function() {
$scope.analysisConfig.workflowUuid = workflow.getUuid();
$scope.setAnalysisName = function(){
var timeStamp = vm.getTimeStamp();
var workflowUuid = workflow.getName();
var tempName = workflowUuid + " " + timeStamp;
bootbox.prompt("Enter an Analysis Name:", "Cancel Analysis", "Confirm" +
" Name", function(name) {
if (name == null) {
bootbox.alert("Analysis was canceled.");
}else {
vm.launchAnalysis(name);
}
}, tempName).addClass("bootboxAnalysisWidth");
};

vm.launchAnalysis = function(analysisName) {
$scope.analysisConfig.name = analysisName;
$scope.analysisConfig.workflowUuid = workflow.getUuid();
$http({
method: 'POST',
url: '/analysis_manager/run/',
headers: {'X-Requested-With': 'XMLHttpRequest'},
data: $scope.analysisConfig,
}).success(function(response) {
}).success(function (response) {
$log.debug("Launching analysis with config:");
$log.debug("Workflow: " + $scope.analysisConfig.workflowUuid);
$log.debug("NodeSET: " + $scope.analysisConfig.nodeSetUuid);
$log.debug("NodeREL: " + $scope.analysisConfig.nodeRelationshipUuid);
$window.location.assign(response);
}).error(function(response, status) {
}).error(function (response, status) {
$log.debug("Request failed: error " + status);
});
};

vm.getTimeStamp = function(){
var currentDate = new Date();
var month = currentDate.getMonth() + 1;
var day = currentDate.getDate();
var year = currentDate.getFullYear();
var hour = currentDate.getHours();
var mins= currentDate.getMinutes();
var sec = currentDate.getSeconds();

var dateStr = month + "-" + day + "-" + year;
var timeStr = "@" + hour + ":" + mins + ":" + sec;

return (dateStr + timeStr);

}
});
5 changes: 3 additions & 2 deletions refinery/ui/src/partials/data_set_ui_mode_analyze.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ <h4>Inputs ({{currentWorkflow.getCategory()}})</h4>
-->

<!-- no external tool status monitoring -->
<button class="btn btn-warning" ng-click="launchAnalysis()" ng-disabled="!(currentNodeSet && currentNodeSet.node_count > 0)" style="width: 100%">Launch Analysis</button>
<button class="btn btn-warning" ng-click="setAnalysisName()"
ng-disabled="!(currentNodeSet && currentNodeSet.node_count > 0)" style="width: 100%">Launch Analysis</button>

</div>
</div>
Expand All @@ -69,7 +70,7 @@ <h4>Inputs ({{currentWorkflow.getCategory()}})</h4>
</div>
-->
<!-- no external tool status monitoring -->
<button class="btn btn-warning" ng-click="launchAnalysis()" ng-disabled="!(currentNodeRelationship && currentNodeRelationship.node_pairs.length > 0 )" style="width: 100%">Launch Analysis</button>
<button class="btn btn-warning" ng-click="setAnalysisName()" ng-disabled="!(currentNodeRelationship && currentNodeRelationship.node_pairs.length > 0 )" style="width: 100%">Launch Analysis</button>
</div>
</div>
</div>
Expand Down

0 comments on commit 909da82

Please sign in to comment.