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:
name: '%env(APP_ALIAS)%'
handler_id: null
gc_probability: null
cookie_secure: auto
cookie_samesite: lax

View File

@ -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,
]);

View File

@ -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,
]);

View File

@ -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;

View File

@ -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,

View File

@ -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']);

View File

@ -111,7 +111,19 @@
<option value="{{giteaassignee.username}}">{{giteaassignee.username}}</option>
{% endfor %}
</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 class="pl-3" style="width:100%;">
@ -130,12 +142,12 @@
<th class="no-sort"></th>
{%if id==0 %}<th style="width:100px">Projet</th>{%endif%}
<th style="width:200px">Jalon</th>
<th style="width:135px">Statut</th>
<th style="width:135px"class="no-string">N°</th>
<th style="width:1000px">Titre</th>
<th style="width:200px">Equipe</th>
<th style="width:250px">Priorité</th>
<th style="width:135px">Affecté à</th>
<th style="width:135px">Statut</th>
<th style="width:300px">Etiquettes</th>
</tr>
</thead>
@ -188,7 +200,6 @@
</td>
{%if id==0 %}<td>{{ gitearepo.full_name }}</td>{%endif%}
<td>{% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%}</td>
<td>{{ statut }}</td>
<td>{{ giteaissue.number }}</td>
<td><a target="_blank" href="{{giteaissue.html_url}}">{{ giteaissue.title }}</a></td>
<td>{{ teams|raw }}</td>
@ -203,6 +214,7 @@
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
{% endfor %}
</td>
<td>{{ statut }}</td>
<td>{{ labels|raw }}</td>
</tr>
{% 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+"&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);
@ -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,

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_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>
{% 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>
{% endif %}
</td>
<td>
{{scrum.category}}

View File

@ -89,6 +89,16 @@
{% endfor %}
</select>
</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 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();
});
@ -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);
}
@ -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");