Commit d25e846d authored by tzwickl's avatar tzwickl
Browse files

Added repository addresses and repository names history to facilitate the...

Added repository addresses and repository names history to facilitate the switching process between different repositories.
parent 486aecf4
......@@ -20,6 +20,8 @@
<script>
var selection1;
var selection2;
var repositoryAddressList = [];
var repositoryNameList = [];
function compare() {
if ($('.nav-tabs .active').text() == SvS) {
......@@ -82,8 +84,6 @@
helperClass.setButtonLoading($("#connectButton"), true);
selection1.repository = $("#repository").val();
selection1.repositoryName = $("#repositoryName").val();
$.jStorage.set(repositoryAddress, $("#repository").val());
$.jStorage.set(repositoryName, $("#repositoryName").val());
post(JSON.stringify(selection1), "text/plain", setSelection, selected);
}
......@@ -140,6 +140,18 @@
helperClass.setButtonLoading($("#connectButton"), false);
helperClass.setButtonDisabled($('#compare'), false);
helperClass.setButtonStatus($("#connectButton"), "success");
$.jStorage.set(repositoryAddress, selection1.repository);
if (repositoryAddressList.indexOf(selection1.repository) == -1) {
repositoryAddressList.push(selection1.repository);
}
$.jStorage.set(repositoryName, selection1.repositoryName);
if (repositoryNameList.indexOf(selection1.repositoryName) == -1) {
repositoryNameList.push(selection1.repositoryName);
}
$.jStorage.set(repositoryAddressHistory, repositoryAddressList);
$.jStorage.set(repositoryNameHistory, repositoryNameList);
updateRepositoryAddressList();
updateRepositoryNameList();
get("/simulation/simulations", addSimulations);
get("/responseTimes/runInfos", addRunId);
get("/measurement/experiments", addExperiments);
......@@ -161,6 +173,26 @@
document.getElementById("repositoryName").value = selection1.repositoryName;
}
}
function updateRepositoryAddressList() {
var repositoryAddresses = $('#repositoryAddressList');
repositoryAddresses.empty();
for (var i = 0; i < repositoryAddressList.length; i++) {
repositoryAddresses.append($('<option>', {
value: repositoryAddressList[i]
}));
}
}
function updateRepositoryNameList() {
var repositoryNames = $('#repositoryNameList');
repositoryNames.empty();
for (var i = 0; i < repositoryNameList.length; i++) {
repositoryNames.append($('<option>', {
value: repositoryNameList[i]
}));
}
}
$(function() {
$("#header").load("header.html");
......@@ -180,6 +212,14 @@
});
$('#compare').prop('disabled', true);
$('#compare').addClass("disabled");
if ($.jStorage.get(repositoryAddressHistory) != null) {
repositoryAddressList = $.jStorage.get(repositoryAddressHistory);
}
if ($.jStorage.get(repositoryNameHistory) != null) {
repositoryNameList = $.jStorage.get(repositoryNameHistory);
}
updateRepositoryAddressList();
updateRepositoryNameList();
});
</script>
......@@ -188,18 +228,24 @@
<div class="container-fluid" style="margin-top: 60px">
<h4>1. Specify the repository and repository name:</h4>
<datalist id="repositoryAddressList">
</datalist>
<datalist id="repositoryNameList">
</datalist>
<div class="panel panel-default">
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<label>Repository Address</label> <input class="form-control"
id="repository" type="text" placeholder="xxx.xxx.xxx.xxx">
<label>Repository Address</label> <input class="form-control" list="repositoryAddressList"
id="repository" placeholder="xxx.xxx.xxx.xxx">
</div>
<div class="form-group">
<label>Repository Name:</label> <input class="form-control"
id="repositoryName" type="text" placeholder="Repository Name">
<label>Repository Name:</label> <input class="form-control" list="repositoryNameList"
id="repositoryName" placeholder="Repository Name">
</div>
</form>
</div>
......
......@@ -24,6 +24,8 @@
var modelFilesUploadFinished = false;
var csvFilesUploadFinished = false;
var repositoryAddressList = [];
var repositoryNameList = [];
$(function() {
$("#header").load("header.html");
......@@ -33,6 +35,14 @@
$('#simulationName').val($.jStorage.get(simulatorResultUploaderSimName));
helperClass.setButtonDisabled($('#uploadToRepository'), true);
get(clearRepositoryUpload);
if ($.jStorage.get(repositoryAddressHistory) != null) {
repositoryAddressList = $.jStorage.get(repositoryAddressHistory);
}
if ($.jStorage.get(repositoryNameHistory) != null) {
repositoryNameList = $.jStorage.get(repositoryNameHistory);
}
updateRepositoryAddressList();
updateRepositoryNameList();
});
Dropzone.options.csvSimulationResultsDropzone = {
......@@ -134,13 +144,45 @@
console.log("Success Status: " + textStatus);
Dropzone.forElement("#csvSimulationResultsDropzone").removeAllFiles();
Dropzone.forElement("#simulationModelDropZone").removeAllFiles();
$.jStorage.set(simulatorResultUploaderRepo, $('#repository').val());
$.jStorage.set(simulatorResultUploaderRepoName, $('#repositoryName').val());
var repositoryAddress = $('#repository').val();
var repositoryName = $('#repositoryName').val();
$.jStorage.set(simulatorResultUploaderRepo, repositoryAddress);
$.jStorage.set(simulatorResultUploaderRepoName, repositoryName);
$.jStorage.set(simulatorResultUploaderSimName, $('#simulationName').val());
if (repositoryAddressList.indexOf(repositoryAddress) == -1) {
repositoryAddressList.push(repositoryAddress);
}
if (repositoryNameList.indexOf(repositoryName) == -1) {
repositoryNameList.push(repositoryName);
}
$.jStorage.set(repositoryAddressHistory, repositoryAddressList);
$.jStorage.set(repositoryNameHistory, repositoryNameList);
updateRepositoryAddressList();
updateRepositoryNameList();
helperClass.setButtonStatus($("#uploadToRepository"), "success");
alert("Successfuly Uploaded Simulation Results to Repository!");
}
function updateRepositoryAddressList() {
var repositoryAddresses = $('#repositoryAddressList');
repositoryAddresses.empty();
for (var i = 0; i < repositoryAddressList.length; i++) {
repositoryAddresses.append($('<option>', {
value: repositoryAddressList[i]
}));
}
}
function updateRepositoryNameList() {
var repositoryNames = $('#repositoryNameList');
repositoryNames.empty();
for (var i = 0; i < repositoryNameList.length; i++) {
repositoryNames.append($('<option>', {
value: repositoryNameList[i]
}));
}
}
</script>
<div id="header"></div>
......@@ -149,18 +191,24 @@
<h4>1. Specify the Repository, Repository Name and the Simulation
Name:</h4>
<datalist id="repositoryAddressList">
</datalist>
<datalist id="repositoryNameList">
</datalist>
<div class="panel panel-default">
<div class="panel-body">
<form class="form-inline">
<div class="form-group">
<label>Repository Address</label> <input class="form-control"
id="repository" type="text" placeholder="xxx.xxx.xxx.xxx">
<label>Repository Address</label> <input class="form-control" list="repositoryAddressList"
id="repository" placeholder="xxx.xxx.xxx.xxx">
</div>
<div class="form-group">
<label>Repository Name:</label> <input class="form-control"
id="repositoryName" type="text" placeholder="Repository Name">
<label>Repository Name:</label> <input class="form-control" list="repositoryNameList"
id="repositoryName" placeholder="Repository Name">
</div>
<div class="form-group">
......
......@@ -24,18 +24,6 @@ barPlotWithDrilldown.plot = function (containerId, title, subtitle, xAxisTitle,
xAxis: {
type: 'category',
labels: {
formatter: function() {
var substrings = this.value.match(/.{1,46}/g);
var str = "";
for (var i = 0; i < substrings.length; i++) {
str += substrings[i] + "<br/>";
}
return str;
}
}
},
yAxis: {
......
......@@ -22,7 +22,9 @@ var select1 = "selection1";
var select2 = "selection2";
var repositoryAddress = "repositoryAddress";
var repositoryAddressHistory = "repositoryAddressHistory";
var repositoryName = "repositoryName";
var repositoryNameHistory = "repositoryNameHistory";
var simulatorResultUploaderRepo = "simulatorResultUploaderRepo";
var simulatorResultUploaderRepoName = "simulatorResultUploaderRepoName";
......
......@@ -4,6 +4,15 @@
var utilityFunction = {};
Array.prototype.unique = function() {
return this.reduce(function(accum, current) {
if (accum.indexOf(current) < 0) {
accum.push(current);
}
return accum;
}, []);
}
String.prototype.levenshteinDistance = function(str) {
var cost = new Array(),
str1 = str,
......
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