forked from beltrame/mmMRI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request beltrame#19 from cesine/master
Some widgets
- Loading branch information
Showing
17 changed files
with
263 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,76 @@ | ||
angular.module('app') | ||
.controller('MainCtrl', function($scope, $location, benchmarkData) { | ||
$scope.benchmarks = benchmarkData.getAll(); | ||
$scope.benchmark = null; | ||
.controller('MainCtrl', function($scope, $location, dataTransformOrPipelineData) { | ||
$scope.dataTransformOrPipelines = dataTransformOrPipelineData.getAll(); | ||
$scope.dataTransformOrPipeline = null; | ||
|
||
$scope.matrix = [ | ||
[, "subject1", "subject2", "subject3", "subject4", "subject5", "subject6", "subject7", "subject8", "subject9", "subject10", "subject11", "subject12"], | ||
["subject1", 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], | ||
["subject2", 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], | ||
["subject3", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], | ||
["subject4", 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], | ||
["subject5", 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], | ||
["subject6", 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], | ||
["subject7", 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], | ||
["subject8", 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], | ||
["subject9", 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0], | ||
["subject10", 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0], | ||
["subject11", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], | ||
["subject12", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] | ||
]; | ||
|
||
$scope.layers = [{ | ||
label: "layer1", | ||
visibility: 50 | ||
}, { | ||
label: "layer2", | ||
visibility: 20 | ||
}, { | ||
label: "layer3", | ||
visibility: 0 | ||
}]; | ||
|
||
$scope.runScript = function(scriptname) { | ||
console.warn("security hole, this should not permit execution of unknown scripts."); | ||
scriptname = scriptname.trim().replace(/[\/\\]+/g, ""); | ||
console.log("TODO call api to run this " + scriptname + "script on the data."); | ||
}; | ||
|
||
$scope.useLogScaleForBubbleSize = false; | ||
$scope.toogleButtonScale = function() { | ||
$scope.useLogScaleForBubbleSize = !$scope.useLogScaleForBubbleSize; | ||
}; | ||
|
||
$scope.selectBenchmark = function(benchmark) { | ||
$scope.benchmark = benchmark; | ||
if (benchmark) { | ||
$location.url('/benchmark/' + benchmarkUrl(benchmark)); | ||
$scope.selectBenchmark = function(dataTransformOrPipeline) { | ||
$scope.dataTransformOrPipeline = dataTransformOrPipeline; | ||
if (dataTransformOrPipeline) { | ||
$location.url('/dataTransformOrPipeline/' + dataTransformOrPipelineUrl(dataTransformOrPipeline)); | ||
} | ||
}; | ||
|
||
var stopBenchmarksWatch = $scope.$watch('benchmarks.length', function(length) { | ||
var stopBenchmarksWatch = $scope.$watch('dataTransformOrPipelines.length', function(length) { | ||
if (length) { | ||
if ($location.url().indexOf("/benchmark/") == 0) { | ||
var benchmarkName = $location.url().match(/^\/benchmark\/(.+)/); | ||
if (benchmarkName) { | ||
benchmarkName = benchmarkName[1]; | ||
angular.forEach($scope.benchmarks, function(benchmark) { | ||
if (benchmarkName === benchmarkUrl(benchmark)) { | ||
$scope.selectBenchmark(benchmark); | ||
if ($location.url().indexOf("/dataTransformOrPipeline/") == 0) { | ||
var dataTransformOrPipelineName = $location.url().match(/^\/dataTransformOrPipeline\/(.+)/); | ||
if (dataTransformOrPipelineName) { | ||
dataTransformOrPipelineName = dataTransformOrPipelineName[1]; | ||
angular.forEach($scope.dataTransformOrPipelines, function(dataTransformOrPipeline) { | ||
if (dataTransformOrPipelineName === dataTransformOrPipelineUrl(dataTransformOrPipeline)) { | ||
$scope.selectBenchmark(dataTransformOrPipeline); | ||
} | ||
}); | ||
} else { | ||
$scope.selectBenchmark($scope.benchmarks[0]); | ||
$scope.selectBenchmark($scope.dataTransformOrPipelines[0]); | ||
} | ||
} else { | ||
$scope.selectBenchmark($scope.benchmarks[0]); | ||
$scope.selectBenchmark($scope.dataTransformOrPipelines[0]); | ||
} | ||
stopBenchmarksWatch(); | ||
} | ||
}); | ||
|
||
|
||
function benchmarkUrl(benchmark) { | ||
return encodeURIComponent(benchmark.name.replace(/ /, '-')); | ||
function dataTransformOrPipelineUrl(dataTransformOrPipeline) { | ||
return encodeURIComponent(dataTransformOrPipeline.name.replace(/ /, '-')); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
angular.module('app') | ||
.service('dataTransformOrPipelineData', function ($http, $q, Benchmark) { | ||
var dataTransformOrPipelines = []; | ||
// 184.107.193.50:8080/performance | ||
return { | ||
getAll: function () { | ||
$http.get("http://184.107.193.50:8080/performance").success(function (data) { | ||
var dataTransformOrPipelineByName = {}; | ||
|
||
angular.forEach(data.result, function (dataTransformOrPipeline) { | ||
var name = dataTransformOrPipeline.dataTransformOrPipelineName + " " + dataTransformOrPipeline.dataTransformOrPipelineVersion; | ||
if (!dataTransformOrPipelineByName[name]) { | ||
dataTransformOrPipelineByName[name] = []; | ||
} | ||
|
||
dataTransformOrPipelineByName[name].push(dataTransformOrPipeline); | ||
}); | ||
|
||
var existingBenchmarks = {}; | ||
angular.forEach(dataTransformOrPipelines, function (dataTransformOrPipeline) { | ||
existingBenchmarks[dataTransformOrPipeline.name] = dataTransformOrPipeline; | ||
}); | ||
|
||
angular.forEach(dataTransformOrPipelineByName, function (allData, name) { | ||
if (!existingBenchmarks.hasOwnProperty(name)) { | ||
dataTransformOrPipelines.push(new Benchmark(name, allData)); | ||
} else { | ||
var dataTransformOrPipeline = existingBenchmarks[name]; | ||
angular.forEach(allData, function (data) { | ||
if (!dataTransformOrPipeline.hasEntry(data)) { | ||
dataTransformOrPipeline.addEntry(data); | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
return dataTransformOrPipelines; | ||
} | ||
} | ||
}); |
Oops, something went wrong.