Skip to content

Commit

Permalink
Added Datalib Online edit and creation from testcase script page.
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Jun 8, 2024
1 parent f290552 commit cd54042
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1417,8 +1417,8 @@ public ArrayList<String> getSqlDocumentation() {
b.append(",('testdatalib','lastmodifier','','fr','Dernier modificateur','Utilisateur qui a modifié en dernier la donnée','_librairie_de_données')");
b.append(",('testdatalib','method','','en','Operation','<p>Operation that is invoked by the SOAP request/call.</p>','_data_library')");
b.append(",('testdatalib','method','','fr','Operation','<p>Operation à appeler pour la Requête SOAP.</p>','_librairie_de_données')");
b.append(",('testdatalib','name','','en','Name','<p>Name of the entry. It is a <b>mandatory</b> attribute.</p><p><b><u>Note</u></b>: The combination of <u>Name</u>, <u>System</u>, <u>Environment</u> and <u>Country</u> can be duplicated when the type is STATIC in order to allow a list of data to be available.</p>','_data_library')");
b.append(",('testdatalib','name','','fr','Nom','<p>Nom de la donnée</p>','_librairie_de_données')");
b.append(",('testdatalib','name','','en','Data Library Name','<p>Name of the entry. It is a <b>mandatory</b> attribute.</p><p><b><u>Note</u></b>: The combination of <u>Name</u>, <u>System</u>, <u>Environment</u> and <u>Country</u> can be duplicated when the type is STATIC in order to allow a list of data to be available.</p>','_data_library')");
b.append(",('testdatalib','name','','fr','Nom de la DataLib','<p>Nom de la donnée</p>','_librairie_de_données')");
b.append(",('testdatalib','privateData','','en','Private','<p>Determine if the data is private or not.</p><p><b><u>Note</u></b>: If the data is private, only the Creator will be able to modify it.</p>','_data_library')");
b.append(",('testdatalib','privateData','','fr','Privé','<p>Défini si la donnée est privée ou non</p><p><b><u>Note</u></b>: Une donnée privée ne peut être modifiée que par le créateur.</p>','_librairie_de_données')");
b.append(",('testdatalib','script','','en','Script','<p>SQL commands that should be executed to retrieve test data.</p><p>Examples:</p><table><tr><td>select * from table;</td></tr><tr><td>select * from table where column = %COLUMN%;</td></tr></table>','_data_library')");
Expand Down
5 changes: 2 additions & 3 deletions source/src/main/webapp/TestCaseScript.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
<script type="text/javascript" src="dependencies/Tinymce-6.7.0/tinymce.min.js"></script>
<script type="text/javascript" src="dependencies/Bootstrap-treeview-1.2.0/js/bootstrap-treeview.js"></script>
<script type="text/javascript" src="dependencies/Ace-1.2.6/ext-language_tools.js"></script>
<script type="text/javascript" src="js/transversalobject/ApplicationObject.js"></script>
<script type="text/javascript" src="js/transversalobject/TestCase.js"></script>
<script type="text/javascript" src="js/transversalobject/AppService.js"></script>
<script type="text/javascript" src="js/pages/TestCaseScript.js"></script>
<script type="text/javascript" src="js/transversalobject/TestCase.js"></script>
<script type="text/javascript" src="js/transversalobject/ApplicationObject.js"></script>
<script type="text/javascript" src="js/transversalobject/TestDataLib.js"></script>
<script type="text/javascript" src="js/transversalobject/AppService.js"></script>
<script type="text/javascript" src="js/transversalobject/TestCaseExecutionQueue.js"></script>
Expand Down
16 changes: 13 additions & 3 deletions source/src/main/webapp/include/transversalobject/TestDataLib.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<h4 class="modal-title" id="editTestDataLibModalLabel"><span id="editTestDataLibTitle">Edit Test Data Lib </span> <span id="NameEdit" ></span> </h4>
</div>
<div class="modal-body">
<form id="editTestLibData" role="form" >
<form id="editTestLibData" role="form" autocomplete="off" >
<input autocomplete="false" name="hidden" type="text" style="display:none;">
<!-- messages area-->
<div id="DialogMessagesAreaEdit">
<div class="alert" id="DialogMessagesAlertEdit" style="display:none;">
Expand All @@ -18,6 +19,15 @@ <h4 class="modal-title" id="editTestDataLibModalLabel"><span id="editTestDataLib
</div>
</div>
<!-- type and system-->
<div class="row" id="selectDatalibID">
<div class="form-group col-sm-12">
<label name="lbl_datalibEntry" for="datalibEntry">Select the datalib to edit</label>
<div>
<select class="form-control" id="datalibEntry" name="datalibEntry">
</select>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-sm-2">
<label name="lbl_id" for="testdatalibid">ID</label>
Expand All @@ -26,9 +36,9 @@ <h4 class="modal-title" id="editTestDataLibModalLabel"><span id="editTestDataLib
</div>
</div>
<div class="form-group col-sm-6">
<label name="lbl_name" for="name">Name</label>
<label name="lbl_tdlname" for="tdlname">Data Lib Name</label>
<div>
<input id="name" name="name" class="form-control" readonly="readonly" />
<input id="tdlname" name="tdlname" class="form-control" readonly="readonly" />
</div>
</div>
<div class="form-group col-sm-4">
Expand Down
41 changes: 0 additions & 41 deletions source/src/main/webapp/js/global/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,47 +366,6 @@ function displayAppServiceList(selectName, defaultValue, extraValue) {

}

function displayDataLibList(selectName, defaultValue, data) {

$("#" + selectName).parent().find("select").find('option').remove();

for (var option in data.contentTable) {
let system = "";
let environment = "";
let country = "";
let value = "";
let context = "";
if (!isEmpty(data.contentTable[option].system)) {
system = data.contentTable[option].system + " - ";
}
if (!isEmpty(data.contentTable[option].environment)) {
environment = data.contentTable[option].environment + " - ";
}
if (!isEmpty(data.contentTable[option].country)) {
country = data.contentTable[option].country + " - ";
}

if (data.contentTable[option].type === "INTERNAL") {
if (!isEmpty(data.contentTable[option].subDataValue)) {
value = data.contentTable[option].subDataValue + " - ";
}
}

if (!isEmpty(system) || !isEmpty(environment) || !isEmpty(country) || !isEmpty(value)) {
context = system + environment + country + value;
context = context.substr(0, context.length - 3);
context = " [" + context + "]";
}

$("#" + selectName).parent().find("select").append($('<option></option>').text(data.contentTable[option].name + context).val(data.contentTable[option].testDataLibID));
}

if (defaultValue !== undefined) {
$("#" + selectName).parent().find("select").val(defaultValue);
}
}


/**
* Method that display a combo box in all the selectName tags with the value retrieved from the Application list
* @param {String} selectName value name of the select tag in the html
Expand Down
71 changes: 34 additions & 37 deletions source/src/main/webapp/js/pages/TestCaseScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -3634,10 +3634,8 @@ var autocompleteAllFields, getTags, setTags, handlerToDeleteOnStepChange = [];
.attr("src", "ReadApplicationObjectImage?application=" + tcInfo.application + "&object=" + name + "&time=" + new Date().getTime())
.attr("data-toggle", "tooltip").attr("title", name).attr("onclick", "displayPictureOfMinitature1(this)");
}
console.info(TagsToUse[1]);
console.info(name);
if (!objectIntoTagToUseExist(TagsToUse[1], name)) {
var addEntry = $('<span class="input-group-btn many ' + name + '"><button id="editEntry" onclick="openModalApplicationObject(\'' + tcInfo.application + '\', \'' + name + '\',\'ADD\' ,\'testCaseScript\' );"\n\
var addEntry = $('<span class="input-group-btn many ' + name + '"><button id="editEntry" onclick="openModalApplicationObject(\'' + tcInfo.application + '\', \'' + name + '\',\'ADD\' , \'testCaseScript\');"\n\
class="buttonObject btn btn-default input-sm " \n\
title="' + name + '" type="button">\n\
<span class="glyphicon glyphicon-plus"></span></button></span>');
Expand All @@ -3646,7 +3644,26 @@ var autocompleteAllFields, getTags, setTags, handlerToDeleteOnStepChange = [];
typeNotExist = "applicationObject";
$(htmlElement).attr("style", "width:80%").parent().append(addEntry);
} else if (objectIntoTagToUseExist(TagsToUse[1], name)) {
var editEntry = '<span class="input-group-btn many ' + name + '"><button id="editEntry" onclick="openModalApplicationObject(\'' + tcInfo.application + '\', \'' + name + '\',\'EDIT\' ,\'testCaseScript\' );"\n\
var editEntry = '<span class="input-group-btn many ' + name + '"><button id="editEntry" onclick="openModalApplicationObject(\'' + tcInfo.application + '\', \'' + name + '\',\'EDIT\' , \'testCaseScript\');"\n\
class="buttonObject btn btn-default input-sm " \n\
title="' + name + '" type="button">\n\
<span class="glyphicon glyphicon-pencil"></span></button></span>';
$(htmlElement).attr("style", "width:80%").parent().append(editEntry);
}
} else if (betweenPercent[i].startsWith("%datalib.") && findname !== null && findname.length > 0) {
name = findname[0];
name = name.slice(1, name.length - 1);
if (!objectIntoTagToUseExist(TagsToUse[3], name)) {
var addEntry = $('<span class="input-group-btn many ' + name + '"><button id="editEntry" onclick="openModalDataLib(null, \'' + name + '\', \'ADD\' ,\'TestCaseScript_Steps\', null);"\n\
class="buttonObject btn btn-default input-sm " \n\
title="' + name + '" type="button">\n\
<span class="glyphicon glyphicon-plus"></span></button></span>');
objectNotExist = true;
nameNotExist = name;
typeNotExist = "applicationObject";
$(htmlElement).attr("style", "width:80%").parent().append(addEntry);
} else if (objectIntoTagToUseExist(TagsToUse[3], name)) {
var editEntry = '<span class="input-group-btn many ' + name + '"><button id="editEntry" onclick="openModalDataLib(null, \'' + name + '\', \'EDIT\' ,\'TestCaseScript_Steps\', null);"\n\
class="buttonObject btn btn-default input-sm " \n\
title="' + name + '" type="button">\n\
<span class="glyphicon glyphicon-pencil"></span></button></span>';
Expand All @@ -3656,7 +3673,7 @@ var autocompleteAllFields, getTags, setTags, handlerToDeleteOnStepChange = [];
let data = loadGuiProperties();
name = findname[0];
name = name.slice(1, name.length - 1);
if (objectIntoTagToUseExist(TagsToUse[2], name)) {
if (objectIntoTagToUseExist(TagsToUse[4], name)) {
var viewEntry = $('<span class="input-group-btn many ' + name + '"><button id="editEntry" data-toggle="modal" data-target="#modalProperty" "\n\
class="buttonObject btn btn-default input-sm " \n\
title="' + name + '" type="button">\n\
Expand Down Expand Up @@ -3907,39 +3924,19 @@ function setPlaceholderProperty(propertyElement, property) {
// Feed the data to the screen and manage
// authorities.
var service = data.contentTable;
if (service.length >= 2) {

$("#" + editor.container.id).parent().find('.input-group').remove();
$("#" + editor.container.id).parent().parent().find('.col-btn').remove();

var editEntry = $('<div class="input-group col-sm-5 col-sm-offset-3"><label>Choose one data library</label><select class="datalib form-control"></select><span class="input-group-btn" style="vertical-align:bottom"><button class="btn btn-secondary" type="button"><span class="glyphicon glyphicon-pencil"></span></button></span></div>');
$("#" + editor.container.id).parent().append(editEntry);

displayDataLibList(editor.container.id, undefined, data);
$("#" + editor.container.id).parent().find("button").attr('onclick', 'openModalDataLib(\'' + editor.container.id + "\','" + $("#" + editor.container.id).parent().find("select").val() + "\','EDIT'," + "'" + escaped + "')");
$("#" + editor.container.id).parent().find("select").unbind("change").change(function () {
$("#" + editor.container.id).parent().find("button").attr('onclick', 'openModalDataLib(\'' + editor.container.id + "\','" + $("#" + editor.container.id).parent().find("select").val() + "\','EDIT'," + "'" + escaped + "')");
});


$("#" + editor.container.id).parent().find('.input-group').remove();
$("#" + editor.container.id).parent().parent().find('.col-btn').remove();
if (service.length >= 1) {
var editEntry = $('<div class="col-btn col-sm-2" style="text-align:center"><label style="width:100%">Edit the DataLib</label><button class="btn btn-secondary" type="button"><span class="glyphicon glyphicon-pencil"></span></button></div>');
$("#" + editor.container.id).parent().removeClass("col-sm-10").addClass("col-sm-8");
$("#" + editor.container.id).parent().parent().append(editEntry);
$("#" + editor.container.id).parent().parent().find("button:eq(0)").attr('onclick', 'openModalDataLib(null, \'' + escaped + "\', 'EDIT', \'TestCaseScript_Props\', \'" + editor.container.id + "\')");
} else {
$("#" + editor.container.id).parent().find('.input-group').remove();
$("#" + editor.container.id).parent().parent().find('.col-btn').remove();
if (service.length === 1) {
var editEntry = $('<div class="col-btn col-sm-2" style="text-align:center"><label style="width:100%">Edit the DataLib</label><button class="btn btn-secondary" type="button"><span class="glyphicon glyphicon-pencil"></span></button></div>');
var addEntry = $('<div class="col-btn col-sm-2" style="text-align:center"><label style="width:100%">Add the DataLib</label><button class="btn btn-secondary" type="button"><span class="glyphicon glyphicon-plus"></span></button></div>');
$("#" + editor.container.id).parent().removeClass("col-sm-10").addClass("col-sm-8");
$("#" + editor.container.id).parent().parent().append(editEntry);
$("#" + editor.container.id).parent().parent().append(addEntry);
$("#" + editor.container.id).parent().parent().find("button:eq(0)").attr('onclick', 'openModalDataLib(\'' + editor.container.id + "\','" + service[0].testDataLibID + "\','EDIT'," + "'" + escaped + "')");
$("#" + editor.container.id).parent().parent().find("button:eq(1)").attr('onclick', 'openModalDataLib(\'' + editor.container.id + "\','" + escaped + "\','ADD'," + "'" + escaped + "')");
} else {
var addEntry = $('<div class="col-btn col-sm-2" style="text-align:center"><label style="width:100%">Add the DataLib</label><button class="btn btn-secondary ' + escaped + '" type="button"><span class="glyphicon glyphicon-plus"></span></button></div>');
addEntry.find("button").attr("disabled", !canUpdate);
$("#" + editor.container.id).parent().removeClass("col-sm-10").addClass("col-sm-8");
$("#" + editor.container.id).parent().parent().append(addEntry);
$("#" + editor.container.id).parent().parent().find("button").attr('onclick', 'openModalDataLib(\'' + editor.container.id + "\','" + escaped + "\','ADD'," + "'" + escaped + "')");
}
var addEntry = $('<div class="col-btn col-sm-2" style="text-align:center"><label style="width:100%">Add the DataLib</label><button class="btn btn-secondary ' + escaped + '" type="button"><span class="glyphicon glyphicon-plus"></span></button></div>');
addEntry.find("button").attr("disabled", !canUpdate);
$("#" + editor.container.id).parent().removeClass("col-sm-10").addClass("col-sm-8");
$("#" + editor.container.id).parent().parent().append(addEntry);
$("#" + editor.container.id).parent().parent().find("button").attr('onclick', 'openModalDataLib(null, \'' + escaped + "\', 'ADD', \'TestCaseScript_Props\', \'" + editor.container.id + "\')");
}
}
},
Expand Down
Loading

0 comments on commit cd54042

Please sign in to comment.