diff --git a/source/src/main/webapp/js/global/global.js b/source/src/main/webapp/js/global/global.js index f2fdfc03f..42a55800b 100644 --- a/source/src/main/webapp/js/global/global.js +++ b/source/src/main/webapp/js/global/global.js @@ -1633,7 +1633,7 @@ function showUnexpectedError(jqXHR, textStatus, errorThrown) { * @param {Function} createdRowCallback callback function to be called after each row * @return {Object} Return the dataTable object to use the api */ -function createDataTableWithPermissions(tableConfigurations, callbackFunction, objectWaitingLayer, filtrableColumns, checkPermissions, userCallbackFunction, createdRowCallback, async) { +function createDataTableWithPermissions(tableConfigurations, callbackFunction, objectWaitingLayer, filtrableColumns, checkPermissions, userCallbackFunction, createdRowCallback, async = true) { /** * Define datatable config with tableConfiguration object received */ @@ -1711,18 +1711,7 @@ function createDataTableWithPermissions(tableConfigurations, callbackFunction, o $("#" + tableConfigurations.divId).DataTable().ajax.reload(); } } : false; - filtrableColumns = undefined; - if (filtrableColumns !== undefined) { - configs["fnServerParams"] = function (aoData) { - var filters = generateFiltersOnMultipleColumns(tableConfigurations.divId, filtrableColumns); - for (var f = 0; f < filters.length; f++) { - aoData.push(filters[f]); - } - aoData.push({name: "iSortCol_0", value: configs["aaSorting"][0][0]}); - aoData.push({name: "sSortDir_0", value: configs["aaSorting"][0][1]}); - }; - } configs["fnServerData"] = function (sSource, aoData, fnCallback, oSettings) { var like = ""; @@ -2595,7 +2584,7 @@ function getHumanReadableDuration(durInSec, nbUnits = 2) { return cnt1 + " " + unit + " " + getHumanReadableDuration(cnt2, (nbUnits - 1)); } else { return cnt1 + " " + unit; - } +} } diff --git a/source/src/main/webapp/js/global/table-filter.js b/source/src/main/webapp/js/global/table-filter.js index f84290a30..dabe79a7a 100644 --- a/source/src/main/webapp/js/global/table-filter.js +++ b/source/src/main/webapp/js/global/table-filter.js @@ -22,11 +22,12 @@ /** * Function that allow to reset the filter selected * @param {type} oTable datatable object - * @param {columnNumber} columnNumber. If empty, reset all the column's filter - * @param {clearGlobalSearch} boolean. true if global search should be cleared. + * @param {int} columnNumber If empty, reset all the column's filter + * @param {boolean} clearGlobalSearch true if global search should be cleared. + * @param {boolean} doRedraw true if draw should be triggeres. * @returns {undefined} */ -function resetFilters(oTable, columnNumber, clearGlobalSearch) { +function resetFilters(oTable, columnNumber, clearGlobalSearch = false, doRedraw = true) { var oSettings = oTable.fnSettings(); for (iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) { /** @@ -49,7 +50,9 @@ function resetFilters(oTable, columnNumber, clearGlobalSearch) { if (clearGlobalSearch) { oSettings.oPreviousSearch.sSearch = ''; } - oTable.fnDraw(); + if (doRedraw) { + oTable.fnDraw(); + } } function resetTooltip() { @@ -66,7 +69,7 @@ function resetTooltip() { */ function filterOnColumn(tableId, column, value) { var oTable = $('#' + tableId).dataTable(); - resetFilters(oTable); + resetFilters(oTable, undefined, undefined, false); var oSettings = oTable.fnSettings(); for (iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) { if (oSettings.aoColumns[iCol].data === column) { @@ -82,40 +85,40 @@ function filterOnColumn(tableId, column, value) { * @param {type} searchColums > Array of columns * @returns {undefined} */ -function generateFiltersOnMultipleColumns(tableId, searchColumns) { - var filterConfiguration = Array(); - /** - * Loop on searchColumns and get Parameter values >> Build an array of object - */ - var searchArray = new Array; - for (var searchColumn = 0; searchColumn < searchColumns.length; searchColumn++) { - var param = GetURLParameters(searchColumns[searchColumn]); - var searchObject = { - param: searchColumns[searchColumn], - values: param}; - searchArray.push(searchObject); - } - /** - * Apply the filter to the table - */ - var oTable = $('#' + tableId).dataTable(); - //resetFilters(oTable); - var oSettings = oTable.fnSettings(); - for (iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) { - for (sCol = 0; sCol < searchArray.length; sCol++) { - if (oSettings.aoColumns[iCol].data === searchArray[sCol].param - && searchArray[sCol].values.length !== 0) { - var filter = { - name: "sSearch_" + iCol, - value: searchArray[sCol].values.join(", ")}; - filterConfiguration.push(filter); - } - } - - } - - return (filterConfiguration); -} +//function generateFiltersOnMultipleColumns(tableId, searchColumns) { +// var filterConfiguration = Array(); +// /** +// * Loop on searchColumns and get Parameter values >> Build an array of object +// */ +// var searchArray = new Array; +// for (var searchColumn = 0; searchColumn < searchColumns.length; searchColumn++) { +// var param = GetURLParameters(searchColumns[searchColumn]); +// var searchObject = { +// param: searchColumns[searchColumn], +// values: param}; +// searchArray.push(searchObject); +// } +// /** +// * Apply the filter to the table +// */ +// var oTable = $('#' + tableId).dataTable(); +// //resetFilters(oTable); +// var oSettings = oTable.fnSettings(); +// for (iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) { +// for (sCol = 0; sCol < searchArray.length; sCol++) { +// if (oSettings.aoColumns[iCol].data === searchArray[sCol].param +// && searchArray[sCol].values.length !== 0) { +// var filter = { +// name: "sSearch_" + iCol, +// value: searchArray[sCol].values.join(", ")}; +// filterConfiguration.push(filter); +// } +// } +// +// } +// +// return (filterConfiguration); +//} /** * Function that apply filters on given datatable's columns @@ -142,7 +145,7 @@ function applyFiltersOnMultipleColumns(tableId, searchColumns, fromURL) { // Apply filter on table var oTable = $('#' + tableId).dataTable(); - resetFilters(oTable); + resetFilters(oTable, undefined, undefined, false); var oSettings = oTable.fnSettings(); for (iCol = 0; iCol < oSettings.aoPreSearchCols.length; iCol++) { for (sCol = 0; sCol < searchArray.length; sCol++) { diff --git a/source/src/main/webapp/js/pages/AppServiceList.js b/source/src/main/webapp/js/pages/AppServiceList.js index 64ea73d65..d10f75e42 100644 --- a/source/src/main/webapp/js/pages/AppServiceList.js +++ b/source/src/main/webapp/js/pages/AppServiceList.js @@ -37,8 +37,7 @@ function initPage() { var configurations = new TableConfigurationsServerSide("soapLibrarysTable", "ReadAppService", "contentTable", aoColumnsFunc("soapLibrarysTable"), [1, 'asc']); - createDataTableWithPermissions(configurations, renderOptionsForAppService, - "#soapLibraryList", undefined, true); + createDataTableWithPermissions(configurations, renderOptionsForAppService, "#soapLibraryList", undefined, true); $('#testCaseListModal').on('hidden.bs.modal', getTestCasesUsingModalCloseHandler); } diff --git a/source/src/main/webapp/js/pages/Environment.js b/source/src/main/webapp/js/pages/Environment.js index 82f61d86f..30a2d4b91 100644 --- a/source/src/main/webapp/js/pages/Environment.js +++ b/source/src/main/webapp/js/pages/Environment.js @@ -230,7 +230,9 @@ function loadEnvTable(selectCountry, selectEnvironment, selectBuild, selectRevis searchObject = {param: "system", values: selectSystem}; searchArray.push(searchObject); } - applyFiltersOnMultipleColumns("environmentsTable", searchArray, false); + if (searchArray.length > 0) { + applyFiltersOnMultipleColumns("environmentsTable", searchArray, false); + } return table; } diff --git a/source/src/main/webapp/js/pages/TestCaseExecutionList.js b/source/src/main/webapp/js/pages/TestCaseExecutionList.js index b0e1db5ba..36caa32fc 100644 --- a/source/src/main/webapp/js/pages/TestCaseExecutionList.js +++ b/source/src/main/webapp/js/pages/TestCaseExecutionList.js @@ -57,12 +57,10 @@ function initPage() { searchArray.push(searchObject); } - $.when(loadTable()).then(function () { - applyFiltersOnMultipleColumns("testCaseExecutionTable", searchArray, false); - }); + loadTable(searchArray); } -function loadTable() { +function loadTable(searchArray) { //clear the old report content before reloading it $("#testCaseExecution").empty(); $("#testCaseExecution").html('