Maintenance - Mise à jour mensuelle Lundi 1 Juin 2020 entre 7h00 et 9h00

Commit c5f5c618 authored by Romain Therville's avatar Romain Therville 🐭

Update for the page Administration > Mail obsolete project

- The "size" filter criteria has been replaced by a "space" filter.
- The default value is "no filter".
- The result table has one more column, "Project space".
-The search algorithm has been updated.

WARNING : Check the issue #151 to find the SQL commands to update the
views's structures.

(Issue #151)
parent 9d08b8aa
......@@ -870,13 +870,14 @@ class tx_nG6_eid {
$purge_delay = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_delay'));
print json_encode(tx_nG6_db::get_purge_demand_list($purge_delay));
} elseif ($type == 'refresh_purge_list') {
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
$filter_size = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filter_size'));
$max_retention_date = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('max_retention_date'));
$filter_space = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('filter_space'));
$without_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('without_lab'));
$with_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('with_lab'));
$with_laboratories_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('with_lab'));
$create_users = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('create_users'));
//Change date format
print json_encode(tx_nG6_db::filter_list_retention_data_info($filter_size,$max_retention_date,$create_users, $without_laboratories_id,$with_laboratories_id));
print json_encode(tx_nG6_db::filter_list_retention_data_info($filter_space,$max_retention_date,$create_users, $without_laboratories_id,$with_laboratories_id));
} elseif ($type == 'delete_purge_data') {
//Delete data link to the list of purge demand
$purge_ids = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('purge_demand'));
......
......@@ -169,7 +169,10 @@ class tx_nG6_db {
# OBSOLETE / PURGE management
################################
//Get list of obsolete run/analyses per project
static function filter_list_retention_data_info($filter_size, $max_retention_date, $create_user_id, $without_user_group_id,$with_user_group_id) {
static function filter_list_retention_data_info($filter_space, $max_retention_date, $create_user_id, $without_user_group_id,$with_user_group_id) {
//file_put_contents("/work/ng6-test/jflow_rtherville/ng6_php.log","IN tx_nG6_db.php, Hello!", FILE_APPEND);
$conditions=Array();
//filter by date
if ( $max_retention_date != "" ) {
......@@ -182,9 +185,9 @@ class tx_nG6_db {
$conditions[] = 'purge_demand_id IS NULL';
$conditions[] = 'state IN ( \'stored\', \'extended\')';
if ($filter_size != "") {
$conditions[] = "storage_size > $filter_size";
}
if ($filter_space != "") {
$conditions[] = "space_id = '$filter_space'";
}
$project_list_ids = "";
if ($create_user_id != "" or $without_user_group_id != "" or $with_user_group_id != "") {
......@@ -192,7 +195,10 @@ class tx_nG6_db {
$project_list_ids = tx_nG6_db::get_project_list_by_group_filter($create_user_id,$without_user_group_id, $with_user_group_id);
$conditions[] = "project_id in (" . $project_list_ids.")" ;
}
$where = join(' AND ', $conditions);
$where = join(' AND ', $conditions);
//file_put_contents("/work/ng6-test/jflow_rtherville/ng6_php.log","IN tx_nG6_db.php, returned=".print_r(tx_nG6_db::select_list_retention_data_info($where),TRUE), FILE_APPEND);
return (tx_nG6_db::select_list_retention_data_info($where));
}
......@@ -225,7 +231,8 @@ class tx_nG6_db {
),
'total_purgeable_size' => 0,
'nb_runs' =>0,
'nb_analyses' =>0);
'nb_analyses' =>0,
'space_id' => "");
//select obsolete runs
$res = tx_nG6_db::select_all_in_view( "tx_nG6_view_project_run" , $where);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
......@@ -233,7 +240,11 @@ class tx_nG6_db {
if (!isset ($by_project[$res_row['project_id']])) {
$by_project[$current_project_id]= $empty_res_structure;
$by_project[$current_project_id]['project_name']= $res_row['project_name'];
$by_project[$res_row['project_id']]['space_id'] = $res_row['space_id'];
}
if ($res_row['run_id'] != "") {
$by_project[$res_row['project_id']]['state'][$res_row['state']]['nb_run']+=1;
$key = 'storage_size';
......@@ -253,6 +264,7 @@ class tx_nG6_db {
if (!isset ($by_project[$res_row['project_id']])) {
$by_project[$current_project_id]= $empty_res_structure;
$by_project[$current_project_id]['project_name']= $res_row['project_name'];
$by_project[$current_project_id]['space_id'] = $res_row['space_id'];
}
if ($res_row['analyze_id'] != ""){
$by_project[$current_project_id]['state'][$res_row['state']]['nb_analyze'] += 1;
......@@ -273,6 +285,7 @@ class tx_nG6_db {
if (!isset ($by_project[$res_row['project_id']])) {
$by_project[$current_project_id]= $empty_res_structure;
$by_project[$current_project_id]['project_name']= $res_row['project_name'];
$by_project[$current_project_id]['space_id'] = $res_row['space_id'];
}
if ($res_row['analyze_id'] != ""){
......
......@@ -330,11 +330,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>1. Filter on size greater than</h4>
<h4>1. Filter on space</h4>
<div class="text">
<label class="text">
<input type="text" name="size" id="filter_size" > bytes
</label>
<select name="space_select_options" id="filter_space" >
<option value="">No filter</option>
{foreach $available_space_ids key=space_id item=space_name}
<option value="{$space_name}">{$space_name}</option>
{/foreach}
</select>
<!-- <input type="text" name="size" id="filter_size" > bytes -->
</div>
</fieldset>
</div>
......@@ -428,6 +435,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<th colspan="2"><center>Obsoletes Analyzes</center></th>
<th rowspan="2">Total Size Purgeable</th>
<th rowspan="2">Project category</th>
<th rowspan="2">Project space</th>
<th rowspan="2">Users</th>
</tr>
<tr>
......@@ -441,7 +449,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tbody>
<tfoot>
<tr>
<th align="left" colspan="10">
<th align="left" colspan="12">
With selection :
<div class="btn-group">
<button id="btn_obsolete_mail" type="button" class="btn btn-sm btn-default" ><i class="glyphicon glyphicon-envelope"></i> Send mail </button>
......
......@@ -100,6 +100,7 @@ class tx_nG6_pi6 extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
$smarty->assign('ng6_superadmin_users', tx_nG6_db::get_ng6_superadmin_users() );
$smarty->assign('is_current_user_superadmin', tx_nG6_db::is_user_ng6_superadmin($GLOBALS['TSFE']->fe_user->user['uid']) );
$smarty->assign('available_space_ids', tx_nG6_utils::get_available_space_ids() );
$smarty->assign('ng6_purge_delay',$this->conf['delay_purge']);
return $smarty->fetch('administration_view.tpl');
......
......@@ -507,7 +507,7 @@ $(function () {
"order": [[ 1, "asc" ]],
"columns": [
{ "orderable": false },
null,null,null,null,null,null,null,null,null,null]
null,null,null,null,null,null,null,null,null,null,null]
});
purge_table["demand"] = $("#data_table_demand").DataTable({
"language": {
......@@ -864,7 +864,8 @@ $(function () {
$('#data_table_obsolete_wait').show();
$('#obsolete_list').hide();
var filter_size = $("#filter_size").val(),
//var filter_size = $("#filter_size").val(),
filter_space = $("#filter_space").val(),
max_retention_date = $("#max_retention_date").val(),
without_lab=[],
with_lab=[],
......@@ -882,8 +883,9 @@ $(function () {
with_laboratories = with_lab.join(',');
create_users_string = create_users.join(',');
$.ajax({
url: "index.php?eID=tx_nG6&type=refresh_purge_list&max_retention_date="+max_retention_date+"&filter_size="+filter_size+"&create_users="+create_users_string+"&without_lab="+without_laboratories+"&with_lab="+with_laboratories,
dataType: 'json',
//url: "index.php?eID=tx_nG6&type=refresh_purge_list&max_retention_date="+max_retention_date+"&filter_size="+filter_size+"&create_users="+create_users_string+"&without_lab="+without_laboratories+"&with_lab="+with_laboratories,
url: "index.php?eID=tx_nG6&type=refresh_purge_list&max_retention_date="+max_retention_date+"&filter_space="+filter_space+"&create_users="+create_users_string+"&without_lab="+without_laboratories+"&with_lab="+with_laboratories,
dataType: 'json',
success: function(val, status, xhr) {
var nb_purgeable_project=0,
global_purgeable_size=0;
......@@ -929,6 +931,8 @@ $(function () {
}else{
row.push("finished")
}
row.push(values["space_id"])
var string_user= "";
$.each(values["users"], function(key_user,values_user){
if (values_user["right_level_label"]=="manager") {
......
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