Commit 48d9fb27 authored by Anna Iutalova's avatar Anna Iutalova
Browse files

selenium tests and fixes for the site

parent 21350bd5
Pipeline #228614 passed with stage
in 1 minute and 29 seconds
......@@ -62,14 +62,14 @@ function addShare(form, tbody)
var tr = $("<tr></tr>");
var deleteBtn = $("<a class='btn btn-link'><i class='glyphicon glyphicon-trash'></i></a>");
var deleteBtn = $("<a class='btn btn-link' id='activity-share-delete-entry-btn'><i class='glyphicon glyphicon-trash'></i></a>");
tr.append($("<td></td>").append(deleteBtn))
.append($("<td></td>")
.append($("<input type='text' name='share' class='form-control'/>").val(share))
.append($("<input type='text' name='share' class='form-control' pattern='^[^\s]+$' title='Space is not allowed'/>").val(share))
)
.append($("<td></td>")
.append($("<input type='number' step='any' name='weight' class='form-control'/>").val(weight))
.append($("<input type='number' step='0.01' name='weight' class='form-control' min='0' max='1'/>").val(weight))
);
tbody.append(tr);
......@@ -90,6 +90,7 @@ function addShare(form, tbody)
function refreshActivityShares()
{
var parent = $("#activity-shares-list");
var tr = $("<tr></tr>");
$.ajax({
headers: {
......@@ -101,9 +102,9 @@ function refreshActivityShares()
parent.empty();
$.each(data, function(voName, shareConfig) {
var div = $("<div class='panel panel-info'></div>");
var div = $("<div class='panel panel-info' name='panel_"+voName+"'></div>");
var deleteBtn = $("<button class='btn btn-danger'></button>")
var deleteBtn = $("<button class='btn btn-danger' name='delete_" + voName +"'></button>")
.append("<i class='glyphicon glyphicon-trash'></i> Delete");
deleteBtn.click(function(event) {
......@@ -125,25 +126,27 @@ function refreshActivityShares()
event.preventDefault();
});
var submitBtn = $("<button class='btn btn-primary'>Save</button>");
var submitBtn = $("<button class='btn btn-primary' name='save_" +voName +"'>Save</button>");
var shareTable = $("<table class='table'></table>");
var shareTbody = $("<tbody class='share-list'></tbody>");
$.each(shareConfig.share, function(share, weight) {
var tr = $("<tr></tr>");
var shareDeleteBtn = $("<a class='btn btn-link'><i class='glyphicon glyphicon-trash'></i></a>");
var shareDeleteBtn = $("<a class='btn btn-link' id='delete-entry-for-saved' name='del_"+share+"'><i class='glyphicon glyphicon-trash'></i></a>");
shareDeleteBtn.click(function(event) {
event.preventDefault();
tr.remove()
});
tr.append(
shareval = "<input type='text' name='share' class='form-control' value='"+ share + "' pattern='^[^\s]+$' title='Space is not allowed'/>";
weightval = "<input type='number' step='0.01' name='weight' class='form-control' min ='0' max='1' value='" + weight + "'/>";
tr.append(
$("<td></td>").append(shareDeleteBtn)
).append(
$("<td></td>").append($("<input type='text' name='share' class='form-control'/>").val(share))
$("<td></td>").append($(shareval).val(share))
).append(
$("<td></td>").append($("<input type='number' step='any' name='weight' class='form-control'/>").val(weight))
$("<td></td>").append($(weightval).val(weight))
);
shareTbody.append(tr);
......@@ -152,15 +155,15 @@ function refreshActivityShares()
shareTable.append($("<thead><tr><th></th><th>Activity name</th><th>Weight</th></tr></thead>"));
shareTable.append(shareTbody);
var addOpBtn = $("<a class='btn btn-link'><i class='glyphicon glyphicon-plus'></i></a>");
var addOpBtn = $("<a class='btn btn-link' id='add-entry-for-saved'><i class='glyphicon glyphicon-plus'></i></a>");
var addForm = $("<tbody></tbody>")
.append($("<tr></tr>")
.append($("<td></td>").append(addOpBtn))
.append($("<td></td>")
.append($("<input type='text' name='share' class='form-control'/></td>"))
.append($("<input type='text' name='share' class='form-control' id='share-add-for-saved' pattern='^[^\s]+$' title='Space is not allowed'/></td>"))
)
.append("<td><input type='number' step='any' name='weight' class='form-control'/></td>")
.append("<td><input type='number' step='0.01' name='weight' class='form-control' id='weight-add-for-saved' min='0' max='1'/></td>")
);
addOpBtn.click(function(event) {
......@@ -174,7 +177,7 @@ function refreshActivityShares()
shareTable.append(addForm);
var form = $("<form class='panel-body'></form>")
var form = $("<form class='panel-body' name='" + voName + "'></form>")
.append($("<input type='hidden' name='vo'/>").val(voName))
.append(shareTable)
.append($("<div class='panel-footer'></div>").append(submitBtn).append(deleteBtn));
......@@ -222,12 +225,15 @@ function setupActivityShares()
event.preventDefault();
handleActivityShareSave($("#activity-share-add-frm"))
.done(function(data, textStatus, jqXHR) {
$("#activity-share-add-frm").trigger("reset");
refreshActivityShares();
$(".share-list td").trigger("reset");
refreshActivityShares();
})
.fail(function(jqXHR) {
errorMessage(jqXHR);
});
})
.always(function(){
$("#activity-share-add .share-list tr").remove();
});
});
$("#activity-share-add-entry-btn").click(function(event) {
......
......@@ -33,7 +33,7 @@ function refreshAuthzList()
$.each(data, function(i, user) {
var tr = $("<tr></tr>");
var deleteBtn = $("<button class='btn btn-link' type='button'></button>")
var deleteBtn = $("<button class='btn btn-link' type='button' id='button-delete-authz'></button>")
.append("<i class='glyphicon glyphicon-trash'></i>");
deleteBtn.click(function() {
......
......@@ -17,10 +17,10 @@
var globalConfigRowHtml = '\
<tr> \
<td> \
<button class="btn btn-link bt-delete" type="button" title="Delete"> \
<button class="btn btn-link bt-delete" type="button" title="Delete" id="button_delete_global"> \
<i class="glyphicon glyphicon-trash"></i> \
</button> \
<button class="btn btn-link bt-save" type="button" title="Save"> \
<button class="btn btn-link bt-save" type="button" title="Save" id="button_save_global"> \
\<i class="glyphicon glyphicon-floppy-disk"></i> \
</button> \
</td> \
......@@ -28,16 +28,16 @@ var globalConfigRowHtml = '\
VO NAME \
</td> \
<td> \
<input type="number" name="retry" value="0" min="0" max="10" class="form-control"/> \
<input type="number" name="retry" min="0" max="10" class="form-control"/> \
</td> \
<td> \
<input type="number" name="global_timeout" class="form-control"/> \
<input type="number" name="global_timeout" class="form-control" min="0"/> \
</td> \
<td> \
<input type="number" name="max_time_queue" class="form-control"/> \
<input type="number" name="max_time_queue" class="form-control" min="0"/> \
</td> \
<td> \
<input type="number" name="sec_per_mb" class="form-control"/> \
<input type="number" name="sec_per_mb" class="form-control" min="0"/> \
</td> \
<td> \
<select name="show_user_dn" id="show_user_dn" class="form-control"> \
......@@ -69,14 +69,19 @@ function refreshVoConfigList()
tr.find(".vo_name").text(vo_name);
$.each(vo, function(op_name, op_value) {
if (op_name != "show_user_dn") {
tr.find("input[name='" + op_name + "']").val(op_value);
}
else {
tr.find("select[name='" + op_name + "']").val(op_value.toString());
}
tr.attr('name',vo.vo_name);
tr.find("button[id='button_delete_global']").attr('name', vo.vo_name);
tr.find("input[name='" + op_name + "']").each(function(){
$(this).attr('value',op_value);
});
tr.find("select[name='" + op_name + "']").each(function(){
$(this).attr('value',op_value.toString());
tr.find("select[name='" + op_name + "']").val(op_value.toString());
});
});
tr.find(".bt-delete").click(function() {
tr.css("background", "#d9534f");
$.ajax({
......@@ -94,9 +99,25 @@ function refreshVoConfigList()
});
tr.find(".bt-save").click(function() {
var ret_wrong = tr.find("input[name='retry']");
var max_wrong = tr.find("input[name='max_time_queue']");
var glo_wrong = tr.find("input[name='global_timeout']");
var sec_wrong = tr.find("input[name='sec_per_mb']");
tr.find("input").prop("disabled", true);
tr.find("select").prop("disabled", true);
tr.css("background", "#3c763d");
if ((tr.find("input[name='retry']").val() > 10)||(tr.find("input[name='retry']").val() < 0) ||(tr.find("input[name='max_time_queue']").val() < 0)||(tr.find("input[name='global_timeout']").val() < 0)||(tr.find("input[name='sec_per_mb']").val() < 0)){
errorMessage(jqXHR);
tr.find("input").prop("disabled", false);
tr.find("select").prop("disabled", false);
tr.css("background", "#ffffff");
ret_wrong.val(encodeURIComponent(vo.retry));
max_wrong.val(encodeURIComponent(vo.max_time_queue));
glo_wrong.val(encodeURIComponent(vo.global_timeout));
sec_wrong.val(encodeURIComponent(vo.sec_per_mb));
}
else{
$.ajax({
url: "/config/global?",
type: "POST",
......@@ -108,17 +129,24 @@ function refreshVoConfigList()
max_time_queue: tr.find("input[name='max_time_queue']").val(),
global_timeout: tr.find("input[name='global_timeout']").val(),
sec_per_mb: tr.find("input[name='sec_per_mb']").val(),
sec_per_mb: tr.find("input[name='sec_per_mb']").val(),
show_user_dn: tr.find("select[name='show_user_dn']").val()
})
})
.done(function() {
tr.css("background", "none");
tr.find("input").prop("disabled", false);
tr.find("select").prop("disabled", false);
})
.fail(function(jqXHR) {
errorMessage(jqXHR);
});
tr.find("input").prop("disabled", false);
tr.find("select").prop("disabled", false);
tr.css("background", "#ffffff");
ret_wrong.val(encodeURIComponent(vo.retry));
max_wrong.val(encodeURIComponent(vo.max_time_queue));
glo_wrong.val(encodeURIComponent(vo.global_timeout));
sec_wrong.val(encodeURIComponent(vo.sec_per_mb));
})};
});
tbody.append(tr);
......@@ -145,8 +173,8 @@ function setupGlobalConfig()
var obj={};
for(var key in data)
{
console.log(data[key]);
obj[data[key].split("=")[0]] = data[key].split("=")[1];
console.log(decodeURIComponent(data[key]));
obj[decodeURIComponent(data[key].split("=")[0])] = decodeURIComponent(data[key].split("=")[1]);
}
$.ajax({
url: "/config/global?",
......
......@@ -34,7 +34,7 @@ function refreshLinks()
$.each(data, function(i, link) {
var tr = $("<tr></tr>");
var deleteBtn = $("<button class='btn btn-link' type='button'></button>")
var deleteBtn = $("<button class='btn btn-link' type='button' id='button_delete_link' name='lndel_"+link.symbolicname+"'></button>")
.append("<i class='glyphicon glyphicon-trash'></i>");
deleteBtn.click(function() {
......@@ -54,8 +54,8 @@ function refreshLinks()
});
tr.append($("<td></td>").append(deleteBtn))
.append($("<td></td>").text(link.symbolicname))
.append($("<td></td>").text(link.source))
.append($("<td id='symname'></td>").text(link.symbolicname))
.append($("<td id='srcname'></td>").text(link.source))
.append($("<td></td>").text(link.destination))
.append($("<td></td>").text(link.nostreams))
.append($("<td></td>").text(link.min_active))
......@@ -88,18 +88,18 @@ function refreshShares()
$.each(data, function(i, share) {
var tr = $("<tr></tr>");
var deleteBtn = $("<a class='btn btn-link'><i class='glyphicon glyphicon-trash'></i></a>");
tr.append($("<td></td>").append(deleteBtn))
.append($("<td></td>").text(share.source)
.append($("<input type='hidden' name='source'/>").val(share.source)))
.append($("<td></td>").text(share.destination)
.append($("<input type='hidden' name='destination'/>").val(share.destination)))
.append($("<td></td>").text(share.vo)
.append($("<input type='hidden' name='vo'/>").val(share.vo)))
.append($("<td></td>")
.append($("<input type='number' name='share' class='form-control'/>").val(share.share))
var deleteBtn = $("<a class='btn btn-link' id='button_delete_share' name='shdel_"+share.source+"_"+share.vo+"'><i class='glyphicon glyphicon-trash'></i></a>");
var saveBtn = $("<a class='btn btn-link' id='button_save_share'><i class='glyphicon glyphicon-floppy-disk'></i></a>");
tr.append($("<td></td>").append(deleteBtn, saveBtn))
.append($("<td id='share_name'></td>").text(share.source)
.append($("<input type='hidden' name='source-saved'/>").val(share.source)))
.append($("<td id='dn_name'></td>").text(share.destination)
.append($("<input type='hidden' name='destination-saved'/>").val(share.destination)))
.append($("<td id='vo_name'></td>").text(share.vo)
.append($("<input type='hidden' name='vo-saved'/>").val(share.vo)))
.append($("<td id='sh_name'></td>")
.append($("<input type='number' name='share-saved' class='form-control' min='1'/>").val(share.share))
);
tbody.append(tr);
......@@ -121,6 +121,49 @@ function refreshShares()
});
});
saveBtn.click(function(event) {
var share_wrong = tr.find("input[name='share-saved']")
//console.log(encodeURIComponent(share.share))
tr.css("background", "#3c763d");
tr.find("input").prop("disabled", true);
tr.find("select").prop("disabled", true);
if (tr.find("input[name='share-saved']").val() < 0){
errorMessage(jqXHR);
tr.find("input").prop("disabled", false);
tr.find("select").prop("disabled", false);
tr.css("background", "#ffffff");
share_wrong.val(encodeURIComponent(share.share));
}
else{
$.ajax({
url: "/config/shares?",
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify({
source: share.source,
destination: share.destination,
vo: share.vo,
share: tr.find("input[name='share-saved']").val()
})
})
.done(function(data, textStatus, jqXHR) {
tr.css("background", "none");
tr.find("input").prop("disabled", false);
tr.find("select").prop("disabled", false);
})
.fail(function(jqXHR) {
errorMessage(jqXHR);
tr.find("input").prop("disabled", false);
tr.find("select").prop("disabled", false);
tr.css("background", "#ffffff");
share_wrong.val(encodeURIComponent(share.share))
})};
});
});
})
.fail(function(jqXHR) {
......@@ -201,7 +244,7 @@ function setupLinks()
$("#link-config-add-frm").trigger("reset");
})
.fail(function(jqXHR) {
alert(jqXHR.responseJSON.message);
errorMessage(jqXHR);
})
.always(function() {
$("#link-config-add-frm input").prop("disabled", false);
......
......@@ -35,13 +35,13 @@ function addOperation(form, tbody)
tr.append($("<td></td>").append(deleteBtn))
.append($("<td></td>").text(vo)
.append($("<input type='hidden' name='vo'/>").val(vo))
.append($("<input type='hidden' name='vo' class='form-control'/>").val(vo))
)
.append($("<td></td>").text(op)
.append($("<input type='hidden' name='operation'/>").val(op))
.append($("<input type='hidden' name='operation' class='form-control'/>").val(op))
)
.append($("<td></td>")
.append($("<input type='number' name='limit'/>").val(limit))
.append($("<input type='number' name='limit' class='form-control' min='0'/>").val(limit))
);
tbody.append(tr);
......
......@@ -11,7 +11,7 @@
<div class="panel-heading">
<h2 class="panel-title">
<input type="text" name="vo" placeholder="VO Name" class="form-control"
id="activity-share-add-field-vo"/>
id="activity-share-add-field-vo" pattern="^[^\s]+$" required title="Space is not allowed"/>
</h2>
</div>
<div class="panel-body">
......@@ -34,18 +34,18 @@
</td>
<td>
<input type="text" id="activity-share-add-field-share-name"
name="share" class="form-control"/>
name="share" class="form-control" pattern="^[^\s]+$" title="Space is not allowed"/>
</td>
<td>
<input type="number" step="any" id="activity-share-add-field-share-value"
name="weight" class="form-control"/>
<input type="number" step="0.01" id="activity-share-add-field-share-value"
name="weight" class="form-control" min="0" max="1"/>
</td>
</tr>
</tbody>
</table>
</div>
<div class="panel-footer">
<button type="submit" class="btn btn-primary">Add</button>
<button type="submit" class="btn btn-primary" id="button-add">Add</button>
</div>
</form>
</div>
......
......@@ -30,7 +30,8 @@
</button>
</td>
<td>
<input type="text" placeholder="User dn" size="60" name="dn" id="authz-add-field-dn" class="form-control"/>
<input type="text" placeholder="User dn" size="60" name="dn" id="authz-add-field-dn" class="form-control" pattern="/.*[\w:]+" required
title="some examples: /C=RU/O=RDIG/OU=users/OU=ihep.su/CN=Name Surname ---or--- /DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=cernlogin/CN=XXXXXX/CN=Name Surname"/>
</td>
<td>
<select name="operation" class="form-control">
......
......@@ -8,7 +8,7 @@
These settings apply to all transfers belonging to the same Virtual Organization.
</p>
<form method="POST" id="vo-config-add-frm">
<form method="POST" id="vo-config-save-frm">
<table class="table">
<thead>
<tr>
......@@ -34,28 +34,30 @@
</thead>
<tbody id="vo-config-list">
</tbody>
</form>
<form method="POST" id="vo-config-add-frm">
<tbody id="vo-config-add">
<tr>
<td>
<button class="btn btn-link" type="submit">
<button class="btn btn-link" type="submit" id="button_add_global">
<i class="glyphicon glyphicon-plus"></i>
</button>
</td>
<td>
<input type="text" name="vo_name" placeholder="VO name" class="form-control"
id="vo-config-add-field-vo"/>
id="vo-config-add-field-vo" pattern="^[^\s]+$" required title="Space is not allowed""/>
</td>
<td>
<input type="number" name="retry" value="0" min="0" max="10" class="form-control"/>
<input type="number" id="retry" name="retry" min="0" max="10" class="form-control"/>
</td>
<td>
<input type="number" name="global_timeout" class="form-control" min="0" />
<input type="number" id="global_timeout" name="global_timeout" class="form-control" min="0" />
</td>
<td>
<input type="number" name="max_time_queue" class="form-control" min="0"/>
<input type="number" id="max_time_queue" name="max_time_queue" class="form-control" min="0"/>
</td>
<td>
<input type="number" name="sec_per_mb" class="form-control" min="0"/>
<input type="number" id="sec_per_mb" name="sec_per_mb" class="form-control" min="0"/>
</td>
<td>
<select name="show_user_dn" id="show_user_dn" class="form-control">
......
......@@ -28,20 +28,20 @@
<tbody id="link-config-add">
<tr>
<td>
<button class="btn btn-link" type="submit">
<button class="btn btn-link" type="submit" id="button_add_link">
<i class="glyphicon glyphicon-plus"></i>
</button>
</td>
<td>
<input class="form-control" type="text" placeholder="Symbolic name" name="symbolicname"/>
<input class="form-control" type="text" placeholder="Symbolic name" name="symbolicname" pattern="^[^\s]+$" required title="Space is not allowed"/>
</td>
<td>
<input class="form-control" type="text" placeholder="Source" name="source"
id="link-add-field-source"/>
id="link-add-field-source" pattern="(\*|.*://?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))" required title="i.e. http://mysite.ch or *" />
</td>
<td>
<input class="form-control" type="text" placeholder="Destination" name="destination"
id="link-add-field-destination"/>
id="link-add-field-destination" pattern="(\*|.*://?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*))" required title="i.e. http://mysite.ch or *" />
</td>
<td>
<input class="form-control" type="number" placeholder="Streams" name="nostreams"
......@@ -94,7 +94,7 @@
<tbody id="share-add">
<tr>
<td>
<button class="btn btn-link" type="submit">
<button class="btn btn-link" type="submit" id="button_share_link">
<i class="glyphicon glyphicon-plus"></i>
</button>
</td>
......@@ -107,10 +107,10 @@
id="share-add-field-destination"/>
</td>
<td>
<input type="text" name="vo" placeholder="VO" class="form-control"/>
<input type="text" name="vo" placeholder="VO" class="form-control" id="share-add-field-vo" pattern="^[^\s]+$" required title="Space is not allowed"/>
</td>
<td>
<input type="number" name="share" placeholder="Share" class="form-control" min="0" max="100"/>
<input type="number" name="share" placeholder="Share" class="form-control" id="share-add-field-share" min="0"/>
</td>
</tr>
</tbody>
......
......@@ -8,13 +8,13 @@
<div id="se-list">
<script id="se-template" type="text/x-handlebars-template">
{{#each this}}
<div class="panel panel-primary panel-collapse">
<div class="panel panel-primary panel-collapse" name="panelc_{{@key}}">
<div class="panel-heading" style="cursor: pointer;">
<h2 class="panel-title">
{{@key}}
</h2>
</div>
<form class="panel-body se-modify-frm" id="se-save-frm">
<form class="panel-body se-modify-frm" id="se-save-frm" name="{{@key}}">
<input type="hidden" name="se" value="{{@key}}">
<div class="row">
<div class="panel panel-default se-info">
......@@ -44,11 +44,11 @@
</div>
<div class="form-group">
<label>IPv6</label>
<input id="ipv6_hidden" class="form-control" type="number" name="ipv6" value="{{se_info.ipv6}}" min="0", max="1"/>
<input id="ipv6_hidden" class="form-control" type="number" name="ipv6" value="{{se_info.ipv6}}" min="0" max="1"/>
</div>
<div class="form-group">
<label>UDT</label>
<input id="udt_hidden" class="form-control" type="number" name="udt" value="{{se_info.udt}}" min="0", max="1"/>
<input id="udt_hidden" class="form-control" type="number" name="udt" value="{{se_info.udt}}" min="0" max="1"/>
</div>
<div class="form-group">
<label>Debug Level</label>
......@@ -63,7 +63,7 @@
<h3 class="panel-title">Operations</h3>
</div>
<div class="panel-body">
<table class="table">
<table class="table" id="saved_table">
<thead>
<tr>
<th></th>
......@@ -77,20 +77,20 @@
{{#each ops }}
<tr class="frm-set-operation">
<td>
<a class="btn btn-link btn-delete-operation">
<a class="btn btn-link btn-delete-operation" id="se-add-ops-delete-btn" name="{{vo_name}}">
<i class="glyphicon glyphicon-trash"></i>
</a>
</td>
<td>
<input id="vo_hidden" type="hidden" name="vo" class="form-control" value="{{vo_name}}">
<input id="vo_value" type="hidden" name="vo" class="form-control" value="{{vo_name}}">
{{@vo_name}}
</td>
<td>
<input id="operation_hidden" type="hidden" name="operation" class="form-control" value="{{@key}}">