diff --git a/src/ninegitea-1.0/config/packages/framework.yaml b/src/ninegitea-1.0/config/packages/framework.yaml index 41c8912..e9598ee 100644 --- a/src/ninegitea-1.0/config/packages/framework.yaml +++ b/src/ninegitea-1.0/config/packages/framework.yaml @@ -8,6 +8,7 @@ framework: session: name: '%env(APP_ALIAS)%' handler_id: null + gc_probability: null cookie_secure: auto cookie_samesite: lax diff --git a/src/ninegitea-1.0/src/Controller/IssueController.php b/src/ninegitea-1.0/src/Controller/IssueController.php index 45f6f07..bc9b01f 100755 --- a/src/ninegitea-1.0/src/Controller/IssueController.php +++ b/src/ninegitea-1.0/src/Controller/IssueController.php @@ -110,6 +110,7 @@ class IssueController extends AbstractController $filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id); + $filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id); return $this->render($this->render.'list.html.twig',[ @@ -131,6 +132,7 @@ class IssueController extends AbstractController "filterteams" => $filterteams, "filterprioritys" => $filterprioritys, "filterlabels" => $filterlabels, + "filterexcludes" => $filterexcludes, "filterassignees" => $filterassignees, "showfilters" => $showfilters, ]); diff --git a/src/ninegitea-1.0/src/Controller/ScrumController.php b/src/ninegitea-1.0/src/Controller/ScrumController.php index 61568a1..1e9272f 100755 --- a/src/ninegitea-1.0/src/Controller/ScrumController.php +++ b/src/ninegitea-1.0/src/Controller/ScrumController.php @@ -25,7 +25,7 @@ class ScrumController extends AbstractController public function list(Request $request) { $em = $this->getDoctrine()->getManager(); - $scrums = $em->getRepository($this->entity)->findBy([],["name"=>"ASC"]); + $scrums = $em->getRepository($this->entity)->findByUser($this->getUser()); $giteacategorys=[]; $gitearepos=[]; @@ -183,6 +183,7 @@ class ScrumController extends AbstractController $filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id); + $filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id); return $this->render($this->render.'view.html.twig', [ @@ -200,6 +201,7 @@ class ScrumController extends AbstractController 'filterprioritys' => $filterprioritys, 'filterlabels' => $filterlabels, 'filterassignees' => $filterassignees, + 'filterexcludes' => $filterexcludes, 'showfilters' => $showfilters, $this->data => $data, ]); diff --git a/src/ninegitea-1.0/src/Controller/UserController.php b/src/ninegitea-1.0/src/Controller/UserController.php index e495e7d..4dfc8f9 100755 --- a/src/ninegitea-1.0/src/Controller/UserController.php +++ b/src/ninegitea-1.0/src/Controller/UserController.php @@ -152,15 +152,13 @@ class UserController extends AbstractController $qb = $em->createQueryBuilder(); $qb->select('table')->from($this->entity,'table') - ->where('table.lastname LIKE :value') - ->where('table.firstname LIKE :value') + ->where('table.username LIKE :value') ->setParameter("value", "%".$q."%") - ->orderBy('table.firstname') - ->orderBy('table.lastname'); + ->orderBy('table.username'); $datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult(); foreach($datas as $data) { - array_push($output,array("id"=>$data->getId(),"text"=>$data->getDisplayname())); + array_push($output,array("id"=>$data->getId(),"text"=>$data->getUsername())); } $ret_string["results"]=$output; diff --git a/src/ninegitea-1.0/src/Form/ScrumType.php b/src/ninegitea-1.0/src/Form/ScrumType.php index b3c019c..caa08e6 100644 --- a/src/ninegitea-1.0/src/Form/ScrumType.php +++ b/src/ninegitea-1.0/src/Form/ScrumType.php @@ -61,7 +61,7 @@ class ScrumType extends AbstractType "remote_route" => "app_user_select", "class" => "App:User", "primary_key" => "id", - "text_property" => "displayname", + "text_property" => "username", "minimum_input_length" => 0, "page_limit" => 100, "allow_clear" => true, diff --git a/src/ninegitea-1.0/src/Repository/ScrumRepository.php b/src/ninegitea-1.0/src/Repository/ScrumRepository.php index 9ff8c28..caded79 100644 --- a/src/ninegitea-1.0/src/Repository/ScrumRepository.php +++ b/src/ninegitea-1.0/src/Repository/ScrumRepository.php @@ -16,6 +16,20 @@ class ScrumRepository extends ServiceEntityRepository $this->giteaservice = $giteaservice; } + public function findByUser($user) { + if($user->hasRole("ROLE_MASTER") || $user->hasRole("ROLE_MODO") || $user->hasRole("ROLE_ADMIN")) + return $this->_em->getRepository("App:Scrum")->findBy([],["name"=>"ASC"]); + else { + $scrums=$this ->createQueryBuilder('s') + ->from('App:User','u') + ->Where('u.id = :id') + ->andWhere('u MEMBER OF s.users') + ->setParameter('id',$user->getId()) + ->orderBy('s.name') + ->getQuery()->getResult(); + return $scrums; + } + } public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$gitealabels) { // Récupérer le dernier order $last = $this->_em->getRepository('App:Scrumissue')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']); diff --git a/src/ninegitea-1.0/templates/Issue/list.html.twig b/src/ninegitea-1.0/templates/Issue/list.html.twig index c061f7c..103e2bf 100644 --- a/src/ninegitea-1.0/templates/Issue/list.html.twig +++ b/src/ninegitea-1.0/templates/Issue/list.html.twig @@ -111,7 +111,19 @@ {% endfor %} - + + + +
+ + +
@@ -130,12 +142,12 @@ {%if id==0 %}Projet{%endif%} Jalon - Statut N° Titre Equipe Priorité Affecté à + Statut Etiquettes @@ -188,7 +200,6 @@ {%if id==0 %}{{ gitearepo.full_name }}{%endif%} {% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%} - {{ statut }} {{ giteaissue.number }} {{ giteaissue.title }} {{ teams|raw }} @@ -203,6 +214,7 @@ {% endfor %} + {{ statut }} {{ labels|raw }} {% endif %} @@ -251,6 +263,7 @@ priorityfilters=$("#filterprioritys").val(); labelfilters=$("#filterlabels").val(); assigneefilters=$("#filterassignees").val(); + excludefilters=$("#filterexcludes").val(); $.fn.dataTable.ext.search.push(function(settings, data, dataIndex, rowObj, counter) { el=table.row(dataIndex).nodes().to$(); @@ -297,6 +310,14 @@ toreturn=false; } + if(excludefilters.length!==0) { + $.each(excludefilters, function( index, value ) { + if(jQuery.inArray(value, labels )>0) { + toreturn=false; + } + }); + } + if(toreturn&&(teamfilters.length!==0||priorityfilters.length!==0||labelfilters.length!==0||assigneefilters.length!==0)) { if(labelfilters.length!==0) { toreturn=false; @@ -414,7 +435,17 @@ if(index>0)textfilters=textfilters+" &"; textfilters=textfilters+" "+data[index].text; }); - } + } + + + if(excludefilters.length!==0) { + data = $("#filterexcludes").select2('data'); + textfilters=textfilters+"    EXCLURE ETIQUETTES ="; + $.each(excludefilters, function( index, value ) { + if(index>0)textfilters=textfilters+" &"; + textfilters=textfilters+" "+data[index].text; + }); + } $("#textfilters").html(textfilters); @@ -535,6 +566,20 @@ showhide(); } + function filterexcludes() { + $.ajax({ + method: "POST", + url: "{{ path('app_user_preference') }}", + data: { + key:'filterexcludes', + id:{{id}}, + value: $("#filterexcludes").val() + } + }); + + showhide(); + } + $(document).ready(function() { {% if id== 0 %} $('#filtercategorys').select2(); @@ -654,6 +699,20 @@ filterassignees(); }); + $('#filterexcludes').select2(); + {% if filterexcludes %} + {% for label in filterexcludes %} + $("#filterexcludes").val($("#filterexcludes").val().concat("{{label}}")); + {%endfor%} + $('#filterexcludes').trigger('change'); + {% endif %} + $('#filterexcludes').on("select2:select", function(e) { + filterexcludes(); + }); + $('#filterexcludes').on("select2:unselect", function(e) { + filterexcludes(); + }); + table = $('#dataTables').DataTable({ columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], responsive: true, diff --git a/src/ninegitea-1.0/templates/Scrum/list.html.twig b/src/ninegitea-1.0/templates/Scrum/list.html.twig index f9b4714..e6c3611 100644 --- a/src/ninegitea-1.0/templates/Scrum/list.html.twig +++ b/src/ninegitea-1.0/templates/Scrum/list.html.twig @@ -47,7 +47,10 @@ + + {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or is_granted('ROLE_MASTER') %} + {% endif %} {{scrum.category}} diff --git a/src/ninegitea-1.0/templates/Scrum/view.html.twig b/src/ninegitea-1.0/templates/Scrum/view.html.twig index 154ab01..49526c6 100644 --- a/src/ninegitea-1.0/templates/Scrum/view.html.twig +++ b/src/ninegitea-1.0/templates/Scrum/view.html.twig @@ -89,6 +89,16 @@ {% endfor %}
+ + +
+ + +
@@ -299,6 +309,13 @@ }); } + if(toshow&&$("#filterexcludes").val().length !== 0) { + $.each($("#filterexcludes").val(), function( index, value ) { + if(domissue.hasClass("datalabel"+value)) + toshow=false; + }); + } + if(!toshow) domissue.hide(); }); @@ -348,6 +365,15 @@ }); } + if($("#filterexcludes").val().length!==0) { + data = $("#filterexcludes").select2('data'); + textfilters=textfilters+"    EXCLURE ETIQUETTES ="; + $.each($("#filterexcludes").val(), function( index, value ) { + if(index>0)textfilters=textfilters+" &"; + textfilters=textfilters+" "+data[index].text; + }); + } + $("#textfilters").html(textfilters); } @@ -494,6 +520,35 @@ filterassignees(); }); + // Filter Labels + function filterexcludes() { + $.ajax({ + method: "POST", + url: "{{ path('app_user_preference') }}", + data: { + key:'filterexcludes', + id:{{scrum.id}}, + value: $("#filterexcludes").val() + } + }); + + showhide(); + } + $('#filterexcludes').select2(); + {% if filterexcludes %} + {% for label in filterexcludes %} + $("#filterexcludes").val($("#filterexcludes").val().concat("{{label}}")); + {%endfor%} + $('#filterexcludes').trigger('change'); + {% endif %} + $('#filterexcludes').on("select2:select", function(e) { + filterexcludes(); + }); + $('#filterexcludes').on("select2:unselect", function(e) { + filterexcludes(); + }); + + // Resume filtre {% if not showfilters %} $("#filters").addClass("d-none"); $("#filters").removeClass("d-flex");