Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Dec 21, 2024
2 parents f958043 + cd54d8e commit cfe85db
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,9 @@ && isNotAlreadyDefined(caps, "appWaitActivity"))) {
if (isNotAlreadyDefined(caps, "name")) {
String externalExeName = parameterService.getParameterStringByKey("cerberus_browserstack_defaultexename", tCExecution.getSystem(), "Exe : %EXEID%");
externalExeName = externalExeName.replace("%EXEID%", String.valueOf(tCExecution.getId()));
externalExeName = externalExeName.replace("%TESTFOLDER%", String.valueOf(tCExecution.getTest()));
externalExeName = externalExeName.replace("%TESTID%", String.valueOf(tCExecution.getTestCase()));
externalExeName = externalExeName.replace("%TESTDESCRIPTION%", String.valueOf(tCExecution.getDescription()));
caps.setCapability("name", externalExeName);
}
if (tCExecution.getVerbose() >= 2) {
Expand Down
28 changes: 14 additions & 14 deletions source/src/main/webapp/ReportingCampaignStatistics.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -45,47 +45,47 @@
<div class="row" id="envCountryFilters" style="display: none;">
<div class='col-md-4'>
<div class="form-group">
<label for="environment-select" id="labelEnvironmentSelect">Environnement</label>
<select id="environment-select" class="form-control" multiple="multiple">
<label for="environmentSelect" id="labelEnvironmentSelect">Environnement</label>
<select id="environmentSelect" class="form-control" multiple="multiple">
</select>
</div>
</div>
<div class='col-md-4'>
<div class="form-group">
<label for="country-select" id="labelCountrySelect">Pays</label>
<select id="country-select" class="form-control" multiple="multiple">
<label for="countrySelect" id="labelCountrySelect">Pays</label>
<select id="countrySelect" class="form-control" multiple="multiple">
</select>
</div>
</div>
</div>
<div class="row" id="systemAppGroup1Filters">
<div class='col-md-4'>
<div class="form-group">
<label for="system-select" id="labelSystemSelect">Système</label>
<select id="system-select" class="form-control" multiple="multiple">
<label for="systemSelect" id="labelSystemSelect">Système</label>
<select id="systemSelect" class="form-control" multiple="multiple">
</select>
</div>
</div>
<div class='col-md-4'>
<div class="form-group">
<label for="application-select" id="labelApplicationSelect">Application</label>
<select id="application-select" class="form-control" multiple="multiple">
<label for="applicationSelect" id="labelApplicationSelect">Application</label>
<select id="applicationSelect" class="form-control" multiple="multiple">
</select>
</div>
</div>
<div class='col-md-4'>
<div class="form-group">
<label for="group1-select" id="labelGroup1Select">Group 1</label>
<select id="group1-select" class="form-control" multiple="multiple">
<label for="group1Select" id="labelGroup1Select">Group 1</label>
<select id="group1Select" class="form-control" multiple="multiple">
</select>
</div>
</div>
</div>
<div class="row">
<div class='col-md-4'>
<div class="form-group">
<label for="frompicker" id="labelFromPicker">From</label>
<div class='input-group date' id='frompicker'>
<label for="fromPicker" id="labelFromPicker">From</label>
<div class='input-group date' id='fromPicker'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
Expand All @@ -95,8 +95,8 @@
</div>
<div class='col-md-4'>
<div class="form-group">
<label for="topicker" id="labelToPicker">To</label>
<div class='input-group date' id='topicker'>
<label for="toPicker" id="labelToPicker">To</label>
<div class='input-group date' id='toPicker'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
Expand Down
180 changes: 91 additions & 89 deletions source/src/main/webapp/js/pages/ReportingCampaignStatistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ $.when($.getScript("js/global/global.js")).then(function () {
if (campaign !== null && campaign !== "" && campaign !== undefined) {
initDetailedPage();
if ((fromDate !== null && fromDate !== "" && fromDate !== undefined) && (toDate !== null && toDate !== "" && toDate !== undefined)) {
$('#frompicker').datetimepicker().data("DateTimePicker").date(new Date(fromDate));
$('#topicker').datetimepicker().data("DateTimePicker").date(new Date(toDate));
$('#fromPicker').datetimepicker().data("DateTimePicker").date(new Date(fromDate));
$('#toPicker').datetimepicker().data("DateTimePicker").date(new Date(toDate));
getStatisticsByEnvCountry();
}
} else {
Expand All @@ -42,19 +42,19 @@ $.when($.getScript("js/global/global.js")).then(function () {
'container': 'body'}
);

$("#system-select").change(function () {
$("#systemSelect").change(function () {
if ($(this).val() == null) {
$('#application-select').multiselect("deselectAll", false);
$('#application-select').multiselect('updateButtonText');
$('#application-select').next('div').find('button').prop('disabled', true);
$('#applicationSelect').multiselect("deselectAll", false);
$('#applicationSelect').multiselect('updateButtonText');
$('#applicationSelect').next('div').find('button').prop('disabled', true);
$('#loadButton').prop('disabled', true);
} else {
setApplicationSelectOptions($(this).val());
$('#application-select').next('div').find('button').prop('disabled', false);
$('#applicationSelect').next('div').find('button').prop('disabled', false);
}
});

$("#application-select").change(function () {
$("#applicationSelect").change(function () {
if ($(this).val() == null) {
$('#loadButton').prop('disabled', true);
} else {
Expand All @@ -76,6 +76,11 @@ function createMultiSelect(select) {
});
}

function createDateTimePicker(select) {
select.datetimepicker();
select.data("DateTimePicker").date(new Date());
}

function prepareFilterList(filter) {
if (filter !== null) {
for (let i = 0; i < filter.length; i++) {
Expand All @@ -86,6 +91,7 @@ function prepareFilterList(filter) {
}
return filter;
}

function updateDatatable(datatable, data) {
datatable.DataTable().clear();
datatable.DataTable().rows.add(data.campaignStatistics);
Expand All @@ -112,7 +118,7 @@ function removeLoadingStatus(datatable) {
}

function setSelectOptions(selectId, options, param) {
let select = $('#' + selectId);
let select = $(selectId);
if (select.val() === null) {
let selectOptions = select.html("");
$.each(options, function(index, value) {
Expand All @@ -130,18 +136,18 @@ function setSelectOptions(selectId, options, param) {
function setSystemSelectOptions() {
let user = JSON.parse(sessionStorage.getItem('user'));
let systems = user.system;
let options = $("#system-select").html("");
let options = $("#systemSelect").html("");
$.each(systems, function(index, value) {
options += `<option value="${value}">${value}</option>`;
})
$('#system-select').html(options);
$("#system-select").multiselect('rebuild');
$('#systemSelect').html(options);
$("#systemSelect").multiselect('rebuild');
}

function setApplicationSelectOptions(systems) {
let systemsQ = "";
$("#application-select").html("");
$('#application-select').multiselect('refresh')
$("#applicationSelect").html("");
$('#applicationSelect').multiselect('refresh')
$.each(systems, function(index, value) {
systemsQ += "&system=" + encodeURI(systems[index]);
})
Expand All @@ -156,28 +162,44 @@ function setApplicationSelectOptions(systems) {
},
success: function(data) {
let result = data.contentTable;
let options = $("#application-select").html();
let options = $("#applicationSelect").html();
$.each(result, function(index, value) {
options += `<option value="${result[index].application}">${result[index].application}</option>`;
})
$('#application-select').html(options);
$("#application-select").multiselect('rebuild');
$('#applicationSelect').html(options);
$("#applicationSelect").multiselect('rebuild');
}
});
}

function createDateTimePicker(select) {
select.datetimepicker();
select.data("DateTimePicker").date(new Date());
function initGlobalPage() {
createMultiSelect($('#systemSelect'));
createMultiSelect($('#applicationSelect'));
createMultiSelect($('#group1Select'));
createDateTimePicker($('#fromPicker'));
createDateTimePicker($('#toPicker'));
let config = new TableConfigurationsClientSide("tagStatisticTable", "", aoColumnsFunc(), true, [1, 'asc']);
createDataTableWithPermissions(config, undefined, "#tagStatisticList", undefined, undefined, undefined, undefined);
displayPageLabel();
setSystemSelectOptions();
$('#applicationSelect').next('div').find('button').prop('disabled', true);
$('#group1Select').next('div').find('button').prop('disabled', true);
$('#loadButton').prop('disabled', true);

$('#loadButton').click(function()
{
getStatistics();
}
);
}

function initDetailedPage() {
displayPageLabel();
$('#systemAppGroup1Filters').hide();
createMultiSelect($('#environment-select'));
createMultiSelect($('#country-select'));
createDateTimePicker($('#frompicker'));
createDateTimePicker($('#topicker'));
createMultiSelect($('#environmentSelect'));
createMultiSelect($('#countrySelect'));
createDateTimePicker($('#fromPicker'));
createDateTimePicker($('#toPicker'));
$('#campaign').text('"' + GetURLParameter("campaign") + '"');
$('#envCountryFilters').show();
$('#tagStatisticList').hide();
Expand All @@ -194,12 +216,50 @@ function initDetailedPage() {
);
}

function getStatistics() {
let systems = prepareFilterList($('#systemSelect').val());
let applications = prepareFilterList($('#applicationSelect').val());
let group1 = prepareFilterList($('#group1Select').val());

$.ajax
({
url: "api/campaignexecutions/statistics",
async: true,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
data: JSON.stringify({
systems: encodeURI(systems),
applications: encodeURI(applications),
group1: encodeURI(group1),
from: encodeURIComponent(new Date($('#fromPicker').data("DateTimePicker").date()).toISOString()),
to: encodeURIComponent(new Date($('#toPicker').data("DateTimePicker").date()).toISOString())
}),
beforeSend: function() {
setLoadingStatus($("#tagStatisticList"));
},
error: function(jqXHR, textStatus, errorThrown) {
removeLoadingStatus($("#tagStatisticList"));
let response = JSON.parse(jqXHR.responseText);
clearDatatable($("#tagStatisticTable"));
showMessageMainPage("danger", response.message, false);
},
success: function(data) {
updateDatatable($("#tagStatisticTable"), data);
removeLoadingStatus($("#tagStatisticList"));
$('#group1Select').prop('disabled', false);
setSelectOptions("#group1Select", data.globalGroup1List);
}
});
}

function getStatisticsByEnvCountry() {
let campaign = GetURLParameter("campaign");
let environments = prepareFilterList($('#environment-select').val());
let countries = prepareFilterList($('#country-select').val());
let from = new Date($('#frompicker').data("DateTimePicker").date()).toISOString();
let to = new Date($('#topicker').data("DateTimePicker").date()).toISOString();
let environments = prepareFilterList($('#environmentSelect').val());
let countries = prepareFilterList($('#countrySelect').val());
let from = new Date($('#fromPicker').data("DateTimePicker").date()).toISOString();
let to = new Date($('#toPicker').data("DateTimePicker").date()).toISOString();

$.ajax
({
Expand All @@ -224,71 +284,13 @@ function getStatisticsByEnvCountry() {
success: function(data) {
updateDatatable($("#tagStatisticDetailTable"), data);
removeLoadingStatus($("#tagStatisticDetailList"));
setSelectOptions("environment-select", data.environments, "selectAll");
setSelectOptions("country-select", data.countries, "selectAll");
setSelectOptions("#environmentSelect", data.environments, "selectAll");
setSelectOptions("#countrySelect", data.countries, "selectAll");
InsertURLInHistory('ReportingCampaignStatistics.jsp?campaign=' + encodeURIComponent(campaign) + '&from=' + encodeURIComponent(from) + '&to=' + encodeURIComponent(to) + '&environments=' + encodeURI(environments) + '&countries=' + encodeURI(countries));
}
});
}

function initGlobalPage() {
createMultiSelect($('#system-select'));
createMultiSelect($('#application-select'));
createMultiSelect($('#group1-select'));
createDateTimePicker($('#frompicker'));
createDateTimePicker($('#topicker'));
let config = new TableConfigurationsClientSide("tagStatisticTable", "", aoColumnsFunc(), true, [1, 'asc']);
createDataTableWithPermissions(config, undefined, "#tagStatisticList", undefined, undefined, undefined, undefined);
displayPageLabel();
setSystemSelectOptions();
$('#application-select').next('div').find('button').prop('disabled', true);
$('#group1-select').next('div').find('button').prop('disabled', true);
$('#loadButton').prop('disabled', true);

$('#loadButton').click(function()
{
getStatistics();
}
);
}
function getStatistics() {
let systems = prepareFilterList($('#system-select').val());
let applications = prepareFilterList($('#application-select').val());
let group1 = prepareFilterList($('#group1-select').val());

$.ajax
({
url: "api/campaignexecutions/statistics",
async: true,
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
data: JSON.stringify({
systems: encodeURI(systems),
applications: encodeURI(applications),
group1: encodeURI(group1),
from: encodeURIComponent(new Date($('#frompicker').data("DateTimePicker").date()).toISOString()),
to: encodeURIComponent(new Date($('#topicker').data("DateTimePicker").date()).toISOString())
}),
beforeSend: function() {
setLoadingStatus($("#tagStatisticList"));
},
error: function(jqXHR, textStatus, errorThrown) {
removeLoadingStatus($("#tagStatisticList"));
let response = JSON.parse(jqXHR.responseText);
clearDatatable($("#tagStatisticTable"));
showMessageMainPage("danger", response.message, false);
},
success: function(data) {
updateDatatable($("#tagStatisticTable"), data);
removeLoadingStatus($("#tagStatisticList"));
$('#group1-select').prop('disabled', false);
setSelectOptions("group1-select", data.globalGroup1List);
}
});
}

function displayPageLabel() {
var doc = new Doc();
$("#pageTitle").html(doc.getDocLabel("page_campaignstatistics", "title"));
Expand Down Expand Up @@ -318,7 +320,7 @@ function aoColumnsFunc(tableId) {
"width": "50px",
"render": function (data, type, obj) {
const viewDetailByCountryEnv = `<a id="viewDetailByCountryEnv"
href="ReportingCampaignStatistics.jsp?campaign=${obj.campaign}&from=${$('#frompicker').data("DateTimePicker").date()}&to=${$('#topicker').data("DateTimePicker").date()}"
href="ReportingCampaignStatistics.jsp?campaign=${obj.campaign}&from=${$('#fromPicker').data("DateTimePicker").date()}&to=${$('#toPicker').data("DateTimePicker").date()}"
target="_blank"
class="viewDetailByCountryEnv btn btn-default btn-xs margin-right5"
title="${doc.getDocLabel("page_campaignstatistics", "buttonDetailByCountryEnv")}"
Expand Down

0 comments on commit cfe85db

Please sign in to comment.