Commit 5e80a4e0 authored by Celine Noirot's avatar Celine Noirot

Merge branch 'issue#151' into 'master'

Merge branch Issue#151 with master

See merge request !84
parents 41cb0fd2 8f94341b
......@@ -1213,25 +1213,25 @@ INSERT INTO `tx_nG6_project` (`uid`, `pid`, `tstamp`, `crdate`, `cruser_id`, `de
--
-- Structure de la vue `tx_nG6_view_project_analyze`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id`, `tx_nG6_analyze`.`hidden` AS `hidden` from ((`tx_nG6_project` join `tx_nG6_project_analyze` on((`tx_nG6_project_analyze`.`project_id` = `tx_nG6_project`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_project_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_project`.`space_id` AS `space_id`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id`,`tx_nG6_analyze`.`hidden` AS `hidden` from ((`tx_nG6_project` join `tx_nG6_project_analyze` on((`tx_nG6_project_analyze`.`project_id` = `tx_nG6_project`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_project_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
--
-- Structure de la vue `tx_nG6_view_project_run`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_run`.`uid` AS `run_id`,`tx_nG6_run`.`storage_size` AS `storage_size`,`tx_nG6_run`.`purged_size` AS `purged_size`,`tx_nG6_run`.`data_state` AS `state`,`tx_nG6_run`.`retention_date` AS `retention_date`,`tx_nG6_run`.`purge_demand_id` AS `purge_demand_id`, `tx_nG6_run`.`hidden` AS `hidden` from ((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_project`.`space_id` AS `space_id`,`tx_nG6_run`.`uid` AS `run_id`,`tx_nG6_run`.`storage_size` AS `storage_size`,`tx_nG6_run`.`purged_size` AS `purged_size`,`tx_nG6_run`.`data_state` AS `state`,`tx_nG6_run`.`retention_date` AS `retention_date`,`tx_nG6_run`.`purge_demand_id` AS `purge_demand_id`,`tx_nG6_run`.`hidden` AS `hidden` from ((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`)));
--
-- Structure de la vue `tx_nG6_view_project_run_analyze`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id`, `tx_nG6_analyze`.`hidden` AS `hidden` from ((((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`))) join `tx_nG6_run_analyze` on((`tx_nG6_run_analyze`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_run_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_run_analyze` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`name` AS `project_name`,`tx_nG6_project`.`space_id` AS `space_id`,`tx_nG6_analyze`.`uid` AS `analyze_id`,`tx_nG6_analyze`.`storage_size` AS `storage_size`,`tx_nG6_analyze`.`purged_size` AS `purged_size`,`tx_nG6_analyze`.`data_state` AS `state`,`tx_nG6_analyze`.`retention_date` AS `retention_date`,`tx_nG6_analyze`.`purge_demand_id` AS `purge_demand_id`,`tx_nG6_analyze`.`hidden` AS `hidden` from ((((`tx_nG6_run` join `tx_nG6_project_run` on((`tx_nG6_project_run`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_project` on((`tx_nG6_project`.`uid` = `tx_nG6_project_run`.`project_id`))) join `tx_nG6_run_analyze` on((`tx_nG6_run_analyze`.`run_id` = `tx_nG6_run`.`uid`))) join `tx_nG6_analyze` on((`tx_nG6_run_analyze`.`analyze_id` = `tx_nG6_analyze`.`uid`)));
--
-- Structure de la vue `tx_nG6_view_project_user`
--
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_user` AS select `tx_nG6_project`.`uid` AS `project_id`,`fe_users`.`uid` AS `user_id`, `fe_users`.`username` AS `user_name`,`fe_users`.`email` AS `email`,`fe_users`.`usergroup` AS `user_group`,`fe_rights_levels`.`right_level_label` AS `right_level_label`,`fe_groups`.`title` AS `user_group_title` from ((((`tx_nG6_project` join `fe_rights` on((`fe_rights`.`project_id` = `tx_nG6_project`.`uid`))) join `fe_users` on((`fe_rights`.`fe_user_id` = `fe_users`.`uid`))) join `fe_groups` on((`fe_users`.`usergroup` = `fe_groups`.`uid`))) join `fe_rights_levels` on((`fe_rights_levels`.`right_level_id` = `fe_rights`.`right_id`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`ng6`@`localhost` SQL SECURITY DEFINER VIEW `tx_nG6_view_project_user` AS select `tx_nG6_project`.`uid` AS `project_id`,`tx_nG6_project`.`space_id` AS `space_id`,`fe_users`.`uid` AS `user_id`, `fe_users`.`username` AS `user_name`,`fe_users`.`email` AS `email`,`fe_users`.`usergroup` AS `user_group`,`fe_rights_levels`.`right_level_label` AS `right_level_label`,`fe_groups`.`title` AS `user_group_title` from ((((`tx_nG6_project` join `fe_rights` on((`fe_rights`.`project_id` = `tx_nG6_project`.`uid`))) join `fe_users` on((`fe_rights`.`fe_user_id` = `fe_users`.`uid`))) join `fe_groups` on((`fe_users`.`usergroup` = `fe_groups`.`uid`))) join `fe_rights_levels` on((`fe_rights_levels`.`right_level_id` = `fe_rights`.`right_id`)));
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
......
......@@ -918,13 +918,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,8 @@ 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) {
$conditions=Array();
//filter by date
if ( $max_retention_date != "" ) {
......@@ -182,9 +183,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,8 +193,9 @@ 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);
return (tx_nG6_db::select_list_retention_data_info($where));
$where = join(' AND ', $conditions);
return (tx_nG6_db::select_list_retention_data_info($where));
}
static function select_a_project_retention_data_info($project_id=null, $all=FALSE, $count_hidden=FALSE) {
......@@ -225,7 +227,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 +236,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 +260,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 +281,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'] != ""){
......
......@@ -329,14 +329,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div>
<div class="col-sm-6">
<fieldset class="col-sm-12">
<h4>1. Filter on size greater than</h4>
<fieldset class="col-sm-12">
<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>
</div>
</fieldset>
</fieldset>
</div>
<div class="col-sm-6">
......@@ -428,6 +433,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 +447,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tbody>
<tfoot>
<tr>
<th align="left" colspan="11">
<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,7 @@ $(function () {
$('#data_table_obsolete_wait').show();
$('#obsolete_list').hide();
var filter_size = $("#filter_size").val(),
filter_space = $("#filter_space").val(),
max_retention_date = $("#max_retention_date").val(),
without_lab=[],
with_lab=[],
......@@ -882,8 +882,8 @@ $(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_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 +929,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") {
......
......@@ -30,7 +30,7 @@ class AddProject (Workflow):
self.add_parameter("admin_login", "The login of a ng6 administrator", required = True, type = ng6adminlogin)
self.add_parameter("project_name", "Give a name to your project (has to be unique)", flag = "--name", required = True, type = uniqproject)
self.add_parameter("project_description", "Give a description to your project", flag = "--description", required = True)
self.add_parameter("space", "Where to store data", flag = "--space", default="default", type="ng6space")
self.add_parameter("space", "Where to store data", flag = "--space", default="default", type=ng6space)
def process(self):
project = Project(self.project_name, self.project_description, self.admin_login, None, self.space)
......
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