Skip to content

Commit

Permalink
Merge pull request beltrame#19 from cesine/master
Browse files Browse the repository at this point in the history
Some widgets
  • Loading branch information
cesine committed Oct 19, 2014
2 parents 2053245 + a92e333 commit 3196063
Show file tree
Hide file tree
Showing 17 changed files with 263 additions and 200 deletions.
10 changes: 10 additions & 0 deletions client/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ body,
border-radius: 5px;
padding: 10px;
}

.brainbrowser {
height: 100%;
width: 100%;
}

.matrix {
text-align: center;
vertical-align: center;
}
18 changes: 9 additions & 9 deletions client/js/controllers/ExperimentRunnerCtrl.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
angular.module('app')
.controller('ExperimentRunnerCtrl', function($scope, $rootScope, $http, benchmarkData) {
.controller('ExperimentRunnerCtrl', function($scope, $rootScope, $http, dataTransformOrPipelineData) {
$scope.data = {
"backend": {
"name": "Octave",
"version": "3.4.3"
},
"benchmark": {
"dataTransformOrPipeline": {
"name": "escoufier",
"version": "1.0",
"iteration": 3,
Expand All @@ -17,8 +17,8 @@ angular.module('app')
$scope.sendRunCommand = function () {
$scope.isPolling = true;

$scope.data.benchmark.iteration = parseInt($scope.data.benchmark.iteration, 10);
$scope.data.benchmark.scale = parseInt($scope.data.benchmark.scale, 10);
$scope.data.dataTransformOrPipeline.iteration = parseInt($scope.data.dataTransformOrPipeline.iteration, 10);
$scope.data.dataTransformOrPipeline.scale = parseInt($scope.data.dataTransformOrPipeline.scale, 10);
$http.post('http://184.107.193.50:8080/performance/run', $scope.data)
.success(function (response) {
var taskId = response.result[1].id,
Expand All @@ -31,7 +31,7 @@ angular.module('app')
if (response.result.status === "done") {
clearInterval(intervalId);
$scope.$apply(function() {
benchmarkData.getAll();
dataTransformOrPipelineData.getAll();
$scope.isPolling = false;
});
} else if(response.result.status === "failed") {
Expand All @@ -54,9 +54,9 @@ angular.module('app')
$scope.open = function (evt, data) {
if (!data) {
data = {
"benchmark": {
"name": $scope.benchmark.instances[0].benchmarkName,
"version": $scope.benchmark.instances[0].benchmarkVersion
"dataTransformOrPipeline": {
"name": $scope.dataTransformOrPipeline.instances[0].dataTransformOrPipelineName,
"version": $scope.dataTransformOrPipeline.instances[0].dataTransformOrPipelineVersion
}
}
}
Expand All @@ -77,4 +77,4 @@ angular.module('app')
backdropFade: true,
dialogFade:true
};
});
});
73 changes: 53 additions & 20 deletions client/js/controllers/MainCtrl.js
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(/ /, '-'));
}
});
});
8 changes: 4 additions & 4 deletions client/js/directives/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ angular.module('app')
});
}

scope.$watch(attr.benchmarkName, function (name) {
scope.$watch(attr.dataTransformOrPipelineName, function (name) {

if (sources.hasOwnProperty(name)) {
element.html(sources[name]);
prettyPrint();
addExecutionByNumber();
} else {
var info = name.split(' ');
$http.post("http://184.107.193.50:8080/benchmarks/src", {
"benchmark": {
$http.post("http://184.107.193.50:8080/dataTransformOrPipelines/src", {
"dataTransformOrPipeline": {
"name": info[0],
"version": info[1]
}
Expand All @@ -101,4 +101,4 @@ angular.module('app')
});
}
};
});
});
14 changes: 7 additions & 7 deletions client/js/directives/scatterplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module('app')
"name": "Octave",
"version": "3.4.3",
},
"benchmark": {
"dataTransformOrPipeline": {
"name": "escoufier",
"version": "1.0",
"iteration": 3,
Expand All @@ -20,10 +20,10 @@ angular.module('app')
jsonForServer.backend.version = json.backendVersion;
jsonForServer.backend.name = json.backendName;

jsonForServer.benchmark.name = json.benchmarkName;
jsonForServer.benchmark.version = json.benchmarkVersion;
jsonForServer.benchmark.iteration = json.iteration;
jsonForServer.benchmark.scale = json.scale;
jsonForServer.dataTransformOrPipeline.name = json.dataTransformOrPipelineName;
jsonForServer.dataTransformOrPipeline.version = json.dataTransformOrPipelineVersion;
jsonForServer.dataTransformOrPipeline.iteration = json.iteration;
jsonForServer.dataTransformOrPipeline.scale = json.scale;

scope.$apply(function () {
scope.$emit("openExperimentRunner", jsonForServer);
Expand Down Expand Up @@ -163,7 +163,7 @@ angular.module('app')
.on("mouseover", function(object) {
return tooltip
.style("visibility", "visible")
.html("<div class='run_details_tooltip'>Benchmark: " + object.benchmarkName + "<br/> Time: " + object.runtime + "<br/> Iterations: " + object.iteration + "<br/> Dataset Size: " + object.scale + "</div>");
.html("<div class='run_details_tooltip'>Benchmark: " + object.dataTransformOrPipelineName + "<br/> Time: " + object.runtime + "<br/> Iterations: " + object.iteration + "<br/> Dataset Size: " + object.scale + "</div>");
})
.on("mousemove", function(object) {
return tooltip.style("top", (event.pageY - 10) + "px")
Expand All @@ -189,4 +189,4 @@ angular.module('app')

}
}
});
});
40 changes: 0 additions & 40 deletions client/js/services/benchmarkData.js

This file was deleted.

40 changes: 40 additions & 0 deletions client/js/services/dataTransformOrPipelineData.js
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;
}
}
});
Loading

0 comments on commit 3196063

Please sign in to comment.