This commit is contained in:
afornerot 2022-06-29 11:50:27 +02:00
parent 5db15283f2
commit 3fd8afbc8f
9 changed files with 145 additions and 11 deletions

View File

@ -8,6 +8,7 @@ framework:
session: session:
name: '%env(APP_ALIAS)%' name: '%env(APP_ALIAS)%'
handler_id: null handler_id: null
gc_probability: null
cookie_secure: auto cookie_secure: auto
cookie_samesite: lax cookie_samesite: lax

View File

@ -110,6 +110,7 @@ class IssueController extends AbstractController
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id); $filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$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); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
return $this->render($this->render.'list.html.twig',[ return $this->render($this->render.'list.html.twig',[
@ -131,6 +132,7 @@ class IssueController extends AbstractController
"filterteams" => $filterteams, "filterteams" => $filterteams,
"filterprioritys" => $filterprioritys, "filterprioritys" => $filterprioritys,
"filterlabels" => $filterlabels, "filterlabels" => $filterlabels,
"filterexcludes" => $filterexcludes,
"filterassignees" => $filterassignees, "filterassignees" => $filterassignees,
"showfilters" => $showfilters, "showfilters" => $showfilters,
]); ]);

View File

@ -25,7 +25,7 @@ class ScrumController extends AbstractController
public function list(Request $request) public function list(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$scrums = $em->getRepository($this->entity)->findBy([],["name"=>"ASC"]); $scrums = $em->getRepository($this->entity)->findByUser($this->getUser());
$giteacategorys=[]; $giteacategorys=[];
$gitearepos=[]; $gitearepos=[];
@ -183,6 +183,7 @@ class ScrumController extends AbstractController
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id); $filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id); $filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$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); $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
return $this->render($this->render.'view.html.twig', [ return $this->render($this->render.'view.html.twig', [
@ -200,6 +201,7 @@ class ScrumController extends AbstractController
'filterprioritys' => $filterprioritys, 'filterprioritys' => $filterprioritys,
'filterlabels' => $filterlabels, 'filterlabels' => $filterlabels,
'filterassignees' => $filterassignees, 'filterassignees' => $filterassignees,
'filterexcludes' => $filterexcludes,
'showfilters' => $showfilters, 'showfilters' => $showfilters,
$this->data => $data, $this->data => $data,
]); ]);

View File

@ -152,15 +152,13 @@ class UserController extends AbstractController
$qb = $em->createQueryBuilder(); $qb = $em->createQueryBuilder();
$qb->select('table')->from($this->entity,'table') $qb->select('table')->from($this->entity,'table')
->where('table.lastname LIKE :value') ->where('table.username LIKE :value')
->where('table.firstname LIKE :value')
->setParameter("value", "%".$q."%") ->setParameter("value", "%".$q."%")
->orderBy('table.firstname') ->orderBy('table.username');
->orderBy('table.lastname');
$datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult(); $datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach($datas as $data) { 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; $ret_string["results"]=$output;

View File

@ -61,7 +61,7 @@ class ScrumType extends AbstractType
"remote_route" => "app_user_select", "remote_route" => "app_user_select",
"class" => "App:User", "class" => "App:User",
"primary_key" => "id", "primary_key" => "id",
"text_property" => "displayname", "text_property" => "username",
"minimum_input_length" => 0, "minimum_input_length" => 0,
"page_limit" => 100, "page_limit" => 100,
"allow_clear" => true, "allow_clear" => true,

View File

@ -16,6 +16,20 @@ class ScrumRepository extends ServiceEntityRepository
$this->giteaservice = $giteaservice; $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) { public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$gitealabels) {
// Récupérer le dernier order // Récupérer le dernier order
$last = $this->_em->getRepository('App:Scrumissue')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']); $last = $this->_em->getRepository('App:Scrumissue')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']);

View File

@ -112,6 +112,18 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre EXCLUSIONS</label>
<select id="filterexcludes" multiple="multiple" class="form-control">
{% for gitealabel in gitealabels %}
{% if gitealabel not in giteacolumns and gitealabel not in giteateams and gitealabel not in giteaprioritys %}
<option value="{{gitealabel}}">{{gitealabel}}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div> </div>
<div class="pl-3" style="width:100%;"> <div class="pl-3" style="width:100%;">
@ -130,12 +142,12 @@
<th class="no-sort"></th> <th class="no-sort"></th>
{%if id==0 %}<th style="width:100px">Projet</th>{%endif%} {%if id==0 %}<th style="width:100px">Projet</th>{%endif%}
<th style="width:200px">Jalon</th> <th style="width:200px">Jalon</th>
<th style="width:135px">Statut</th>
<th style="width:135px"class="no-string">N°</th> <th style="width:135px"class="no-string">N°</th>
<th style="width:1000px">Titre</th> <th style="width:1000px">Titre</th>
<th style="width:200px">Equipe</th> <th style="width:200px">Equipe</th>
<th style="width:250px">Priorité</th> <th style="width:250px">Priorité</th>
<th style="width:135px">Affecté à</th> <th style="width:135px">Affecté à</th>
<th style="width:135px">Statut</th>
<th style="width:300px">Etiquettes</th> <th style="width:300px">Etiquettes</th>
</tr> </tr>
</thead> </thead>
@ -188,7 +200,6 @@
</td> </td>
{%if id==0 %}<td>{{ gitearepo.full_name }}</td>{%endif%} {%if id==0 %}<td>{{ gitearepo.full_name }}</td>{%endif%}
<td>{% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%}</td> <td>{% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%}</td>
<td>{{ statut }}</td>
<td>{{ giteaissue.number }}</td> <td>{{ giteaissue.number }}</td>
<td><a target="_blank" href="{{giteaissue.html_url}}">{{ giteaissue.title }}</a></td> <td><a target="_blank" href="{{giteaissue.html_url}}">{{ giteaissue.title }}</a></td>
<td>{{ teams|raw }}</td> <td>{{ teams|raw }}</td>
@ -203,6 +214,7 @@
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}"> <img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
{% endfor %} {% endfor %}
</td> </td>
<td>{{ statut }}</td>
<td>{{ labels|raw }}</td> <td>{{ labels|raw }}</td>
</tr> </tr>
{% endif %} {% endif %}
@ -251,6 +263,7 @@
priorityfilters=$("#filterprioritys").val(); priorityfilters=$("#filterprioritys").val();
labelfilters=$("#filterlabels").val(); labelfilters=$("#filterlabels").val();
assigneefilters=$("#filterassignees").val(); assigneefilters=$("#filterassignees").val();
excludefilters=$("#filterexcludes").val();
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex, rowObj, counter) { $.fn.dataTable.ext.search.push(function(settings, data, dataIndex, rowObj, counter) {
el=table.row(dataIndex).nodes().to$(); el=table.row(dataIndex).nodes().to$();
@ -297,6 +310,14 @@
toreturn=false; 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(toreturn&&(teamfilters.length!==0||priorityfilters.length!==0||labelfilters.length!==0||assigneefilters.length!==0)) {
if(labelfilters.length!==0) { if(labelfilters.length!==0) {
toreturn=false; toreturn=false;
@ -416,6 +437,16 @@
}); });
} }
if(excludefilters.length!==0) {
data = $("#filterexcludes").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EXCLURE ETIQUETTES</b> =";
$.each(excludefilters, function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
$("#textfilters").html(textfilters); $("#textfilters").html(textfilters);
table.draw(); table.draw();
@ -535,6 +566,20 @@
showhide(); showhide();
} }
function filterexcludes() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterexcludes',
id:{{id}},
value: $("#filterexcludes").val()
}
});
showhide();
}
$(document).ready(function() { $(document).ready(function() {
{% if id== 0 %} {% if id== 0 %}
$('#filtercategorys').select2(); $('#filtercategorys').select2();
@ -654,6 +699,20 @@
filterassignees(); 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({ table = $('#dataTables').DataTable({
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ], columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
responsive: true, responsive: true,

View File

@ -47,7 +47,10 @@
<a href="{{path('app_scrum_view',{id:scrum.id})}}"><i class="fas fa-columns fa-2x mr-1"></i></a> <a href="{{path('app_scrum_view',{id:scrum.id})}}"><i class="fas fa-columns fa-2x mr-1"></i></a>
<a href="{{path('app_issuescrum',{id:scrum.id})}}"><i class="fas fa-ticket-alt fa-2x mr-1"></i></a> <a href="{{path('app_issuescrum',{id:scrum.id})}}"><i class="fas fa-ticket-alt fa-2x mr-1"></i></a>
<a href="{{path('app_scrum_stat',{id:scrum.id})}}"><i class="fas fa-chart-area fa-2x mr-1"></i></a> <a href="{{path('app_scrum_stat',{id:scrum.id})}}"><i class="fas fa-chart-area fa-2x mr-1"></i></a>
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or is_granted('ROLE_MASTER') %}
<a href="{{path('app_scrum_update',{id:scrum.id})}}"><i class="fas fa-file fa-2x"></i></a> <a href="{{path('app_scrum_update',{id:scrum.id})}}"><i class="fas fa-file fa-2x"></i></a>
{% endif %}
</td> </td>
<td> <td>
{{scrum.category}} {{scrum.category}}

View File

@ -89,6 +89,16 @@
{% endfor %} {% endfor %}
</select> </select>
</div> </div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre EXCLUSIONS</label>
<select id="filterexcludes" multiple="multiple" class="form-control">
{% for gitealabel in gitealabels %}
<option value="{{gitealabel.id}}">{{gitealabel.name}}</option>
{% endfor %}
</select>
</div>
</div> </div>
<div class="pl-3" style="width:100%;"> <div class="pl-3" style="width:100%;">
@ -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(); if(!toshow) domissue.hide();
}); });
@ -348,6 +365,15 @@
}); });
} }
if($("#filterexcludes").val().length!==0) {
data = $("#filterexcludes").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EXCLURE ETIQUETTES</b> =";
$.each($("#filterexcludes").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
$("#textfilters").html(textfilters); $("#textfilters").html(textfilters);
} }
@ -494,6 +520,35 @@
filterassignees(); 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 %} {% if not showfilters %}
$("#filters").addClass("d-none"); $("#filters").addClass("d-none");
$("#filters").removeClass("d-flex"); $("#filters").removeClass("d-flex");