mise en place de sprint dans les jalons

This commit is contained in:
afornerot 2024-02-15 18:59:09 +01:00
parent ecb1d43b38
commit 9205735d1f
21 changed files with 1768 additions and 729 deletions

View File

@ -182,22 +182,10 @@ app_scrum:
path: /user/scrum
defaults: { _controller: App\Controller\ScrumController:list }
app_scrum_view:
path: /user/scrum/{id}
defaults: { _controller: App\Controller\ScrumController:view }
app_scrum_submit:
path: /master/scrum/submit
defaults: { _controller: App\Controller\ScrumController:submit }
app_scrum_stat:
path: /user/scrum/stat/{id}
defaults: { _controller: App\Controller\ScrumController:stat }
app_scrum_info:
path: /user/scrum/info/{id}
defaults: { _controller: App\Controller\ScrumController:info }
app_scrum_update:
path: /master/scrum/update/{id}
defaults: { _controller: App\Controller\ScrumController:update }
@ -206,6 +194,24 @@ app_scrum_delete:
path: /master/scrum/delete/{id}
defaults: { _controller: App\Controller\ScrumController:delete }
app_scrum_view:
path: /user/scrum/{id}
defaults: { _controller: App\Controller\ScrumController:view }
app_scrum_table:
path: /user/scrum/table/{id}
defaults: { _controller: App\Controller\ScrumController:table }
app_scrum_stat:
path: /user/scrum/stat/{id}
defaults: { _controller: App\Controller\ScrumController:stat }
app_scrum_info:
path: /user/scrum/info/{id}
defaults: { _controller: App\Controller\ScrumController:info }
#== Scrumcolumn ========================================================================================================
app_scrumcolumn_submit:
@ -272,6 +278,27 @@ app_scrumpriority_order:
path: /master/scrumpriority/order/{scrumid}
defaults: { _controller: App\Controller\ScrumpriorityController:order }
#== Scrumsprint ========================================================================================================
app_scrumsprint_submit:
path: /master/scrumsprint/submit/{scrumid}
defaults: { _controller: App\Controller\ScrumsprintController:submit }
app_scrumsprint_update:
path: /master/scrumsprint/update/{id}
defaults: { _controller: App\Controller\ScrumsprintController:update }
app_scrumsprint_delete:
path: /master/scrumsprint/delete/{id}
defaults: { _controller: App\Controller\ScrumsprintController:delete }
app_scrumsprint_select:
path: /master/scrumsprint/select/{scrumid}
defaults: { _controller: App\Controller\ScrumsprintController:select }
app_scrumsprint_order:
path: /master/scrumsprint/order/{scrumid}
defaults: { _controller: App\Controller\ScrumsprintController:order }
#== Scrumtype ========================================================================================================
app_scrumtype_submit:
@ -314,12 +341,3 @@ app_scrumissue_update:
app_scrumissue_ctrlchange:
path: /user/scrumissue/ctrlchange
defaults: { _controller: App\Controller\ScrumissueController:ctrlchange }
#== Issue ========================================================================================================
app_issue:
path: /user/issue
defaults: { _controller: App\Controller\IssueController:list, id: 0 }
app_issuescrum:
path: /user/issuescrum/{id}
defaults: { _controller: App\Controller\IssueController:list }

View File

@ -22,7 +22,7 @@ services:
container_name: ninegitea-app
image: reg.cadoles.com/envole/ninegitea
ports:
- "8000:80"
- "8005:80"
volumes:
- ./src:/app/src:delegated
- ./templates:/app/templates:delegated
@ -31,6 +31,12 @@ services:
- ./.env.local:/app/.env.local:delegated
- ./public/uploads:/app/public/uploads:delegated
adminer:
image: adminer
container_name: ninegitea-adminer
restart: always
ports:
- 6081:8080
volumes:
mariadb-data:

View File

@ -1,212 +0,0 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use App\Service\giteaService;
class IssueController extends AbstractController
{
private $appKernel;
private $data = "issue";
private $route = "app_issue";
private $render = "Issue/";
private $entity = "App:Issue";
public function __construct(KernelInterface $appKernel,giteaService $giteaservice) {
$this->appKernel = $appKernel;
$this->giteaservice = $giteaservice;
}
public function list($id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$fgcsv = $request->get("fgcsv");
// Récupérer les repos de gitea
if($id==0) $scrums=$em->getRepository("App:Scrum")->findBy([],["name"=>"ASC"]);
else $scrums=$em->getRepository("App:Scrum")->findBy(["id"=>$id],["name"=>"ASC"]);
$giteacategorys=[];
$gitearepos=[];
$giteamilestones=[];
$giteacolumns=[];
$giteateams=[];
$giteaprioritys=[];
$giteatypes=[];
$gitealabels=[];
$giteaassignees=$em->getRepository("App:User")->findBy([],["username"=>"ASC"]);
$viewclosed = $request->getSession()->get("viewclosed");
foreach($scrums as $key => $scrum) {
if(!in_array($scrum->getCategory(),$giteacategorys))
array_push($giteacategorys,$scrum->getCategory());
$gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]);
if(!$gitearepo) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) {
$scrum->setGiteajson(json_decode(json_encode($gitearepo), true));
$em->persist($scrum);
$em->flush();
}
if($gitearepo->open_issues_count>0) {
$giteatmp=$this->giteaservice->getMilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
foreach($giteatmp as $key => $value) {
$giteatmp[$key]->title = $scrum->getGiteajson()["full_name"]. " = ".$giteatmp[$key]->title;
}
array_push($giteatmp,["id"=>$scrum->getGiteajson()["full_name"],"title"=> $scrum->getGiteajson()["full_name"]. " = Aucun Jalon"]);
$giteamilestones=array_merge($giteamilestones,$giteatmp);
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
$json=$scrum->getGiteajson();
$json["issues"]=$giteaissues;
$json["category"]=$scrum->getCategory();
foreach($json["issues"] as $key => $giteaissue) {
$issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]);
if($issue) {
$json["issues"][$key]->weight=$issue->getWeight();
$json["issues"][$key]->issueid=$issue->getId();
$json["issues"][$key]->scrumid=$issue->getScrum()->getId();
}
else {
$json["issues"][$key]->weight=0;
$json["issues"][$key]->issueid=0;
$json["issues"][$key]->scrumid=0;
}
}
$tmp=[];
foreach($scrum->getScrumcolumns() as $column) {
array_push($tmp,$column->getGiteaid());
if(!in_array($column->getGiteajson()["name"],$giteacolumns))
array_push($giteacolumns,$column->getGiteajson()["name"]);
}
$json["columns"]=$tmp;
array_push($gitearepos,$json);
foreach($scrum->getScrumteams() as $team) {
if(!in_array($team->getGiteajson()["name"],$giteateams))
array_push($giteateams,$team->getGiteajson()["name"]);
}
foreach($scrum->getScrumprioritys() as $priority) {
if(!in_array($priority->getGiteajson()["name"],$giteaprioritys))
array_push($giteaprioritys,$priority->getGiteajson()["name"]);
}
foreach($scrum->getScrumtypes() as $type) {
if(!in_array($type->getGiteajson()["name"],$giteatypes))
array_push($giteatypes,$type->getGiteajson()["name"]);
}
foreach($giteaissues as $giteaissue) {
foreach($giteaissue->labels as $label) {
if(!in_array($label->name,$gitealabels))
array_push($gitealabels,$label->name);
}
}
}
}
$keysort = array_column($giteamilestones, 'title');
array_multisort($keysort, SORT_DESC, $giteamilestones);
sort($giteacolumns);
sort($giteateams);
sort($giteaprioritys);
sort($giteatypes);
sort($gitealabels);
sort($giteacategorys);
// Préférences utilisateur
$filtercategorys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercategorys",$id);
$filterrepos = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterrepos",$id);
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filtercolumns = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercolumns",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$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);
if($fgcsv) {
$dir = $this->appKernel->getProjectDir() . '/uploads/issues/';
$file = "issues-".$id.".csv";
$fs = new Filesystem();
$fs->mkdir($dir);
$csvh = fopen($dir.$file, 'w');
$d = ';'; // this is the default but i like to be explicit
$e = '"'; // this is the default but i like to be explicit
$tmp=["Projet","Jalon","Type","Id","Titre","Statut","Label"];
fputcsv($csvh, $tmp, $d, $e);
foreach($gitearepos as $gitearepo) {
foreach($gitearepo["issues"] as $giteaissue) {
$statut="";
$type="";
$labels="";
foreach($giteaissue->labels as $label) {
if(in_array($label->id,$gitearepo["columns"]))
$statut=$label->name;
elseif(in_array($label->name,$giteatypes))
$type=$label->name;
else
$labels=$labels.($labels!=""?"\n":"").$label->name;
}
$tmp=[
$gitearepo["name"],
(isset($giteaissue->milestone->title)?$giteaissue->milestone->title:""),
$type,
$giteaissue->number,
$giteaissue->title,
$statut,
$labels
];
fputcsv($csvh, $tmp, $d, $e);
}
}
fclose($csvh);
$response = new BinaryFileResponse($dir.$file);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
return $response;
}
return $this->render($this->render.'list.html.twig',[
"useheader" => true,
"usesidebar" => false,
"id" => $id,
"giteacategorys" => $giteacategorys,
"gitearepos" => $gitearepos,
"giteamilestones" => $giteamilestones,
"giteacolumns" => $giteacolumns,
"giteateams" => $giteateams,
"giteaprioritys" => $giteaprioritys,
"giteatypes" => $giteatypes,
"gitealabels" => $gitealabels,
"giteaassignees" => $giteaassignees,
"filtercategorys" => $filtercategorys,
"filterrepos" => $filterrepos,
"filtermilestones" => $filtermilestones,
"filtercolumns" => $filtercolumns,
"filterteams" => $filterteams,
"filterprioritys" => $filterprioritys,
"filtertypes" => $filtertypes,
"filterlabels" => $filterlabels,
"filterexcludes" => $filterexcludes,
"filterassignees" => $filterassignees,
"showfilters" => $showfilters,
]);
}
}

View File

@ -20,6 +20,7 @@ class ScrumController extends AbstractController
private $route = "app_scrum";
private $render = "Scrum/";
private $entity = "App:Scrum";
private $giteaservice;
public function __construct(giteaService $giteaservice) { $this->giteaservice = $giteaservice; }
@ -178,11 +179,197 @@ class ScrumController extends AbstractController
$forcereload=false;
if($request->get("forcereload")) $forcereload=$request->get("forcereload");
// Mise à jour des issues par rapport à gitea
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels,$forcereload);
// Création du tableau des issues
$issues=$data->getScrumissues();
$tbissues=[];
$tbcols=[];
$tbjals=[];
$tbsprs=[];
$tbestim=[];
$viewclosed = $this->get('session')->get("viewclosed");
foreach($issues as $issue) {
// bypass closed
if($viewclosed=="false"&&$issue->getGiteastate()=="closed") continue;
// Ids
$idcol=$issue->getScrumcolumn()->getId();
$idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
// Roworders
$rowcol=$issue->getScrumcolumn()->getRowid();
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
// Names
$nmcol=$issue->getScrumcolumn()->getName();
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
// Idgiteas
$gicol=$issue->getScrumcolumn()->getGiteaid();
$gijal=$issue->getGiteaMilestone();
// Liste des colonnes/jalons/sprint avec des issues
if(!in_array($idcol,$tbcols)) array_push($tbcols,$idcol);
if(!in_array($idcol."|".$idjal,$tbjals)) array_push($tbjals,$idcol."|".$idjal);
if(!in_array($idcol."|".$idjal."|".$idspr,$tbsprs)) array_push($tbsprs,$idcol."|".$idjal."|".$idspr);
// Initialisation du tableau des estimations
if(!array_key_exists($idjal,$tbestim)) {
$tbestim[$idjal] = [
"rowjal" => $rowjal,
"idjal" => $idjal,
"nmjal" => $nmjal,
"gijal" => $gijal,
"nbjrs" => 0,
"sprints" => []
];
}
if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) {
$tbestim[$idjal]["sprints"][$idspr] = [
"rowspr" => $rowspr,
"idspr" => $idspr,
"nmspr" => $nmspr,
"nbjrs" => 0,
];
}
// Initialisation du tableau des colonnes
if(!array_key_exists($idcol,$tbissues)) {
$tbissues[$idcol]=[
"rowcol" => $rowcol,
"idcol" => $idcol,
"nmcol" => $nmcol,
"gicol" => $gicol,
"nbjrs" => 0,
"jalons" => [],
];
}
// Initialisation du tableau des jalons de la colonne encours
if(!array_key_exists($idjal,$tbissues[$idcol]["jalons"])) {
$tbissues[$idcol]["jalons"][$idjal] = [
"rowjal" => $rowjal,
"idjal" => $idjal,
"nmjal" => $nmjal,
"gijal" => $gijal,
"nbjrs" => 0,
"sprints" => [],
];
}
// Initialisation du tableau des sprint de la colonne/jalon encours
if(!array_key_exists($idspr,$tbissues[$idcol]["jalons"][$idjal]["sprints"])) {
$tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr] = [
"rowspr" => $rowspr,
"idspr" => $idspr,
"nmspr" => $nmspr,
"nbjrs" => 0,
"issues" => [],
];
}
// On cumule les estimations
$tbissues[$idcol]["nbjrs"]+=$issue->getWeight();
$tbissues[$idcol]["jalons"][$idjal]["nbjrs"]+=$issue->getWeight();
$tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
// On sauvegarde l'issue
array_push($tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["issues"],$issue);
}
// On ajoute les colonnes sans issues
$columns=$data->getScrumcolumns();
foreach($columns as $column) {
if(!in_array($column->getId(),$tbcols)) {
$tbissues[$column->getId()] = [
"rowcol" => $column->getRowid(),
"idcol" => $column->getId(),
"nmcol" => $column->getName(),
"gicol" => $column->getGiteaid(),
"nbjrs" => 0,
"jalons" => [],
];
}
// On ajoute les jalons sans issues
foreach($giteamilestones as $milestone) {
if(!in_array($column->getId()."|".$milestone->id,$tbjals)) {
$tbissues[$column->getId()]["jalons"][$milestone->id] = [
"rowjal" => $milestone->title,
"idjal" => $milestone->id,
"nmjal" => $milestone->title,
"gijal" => $milestone->id,
"nbjrs" => 0,
"sprints" => [],
];
}
}
// On ajoute le jalon aucun si sans issue
if(!in_array($column->getId()."|-100",$tbjals)) {
$tbissues[$column->getId()]["jalons"][-100] = [
"rowjal" => -100,
"idjal" => -100,
"nmjal" => "Aucun",
"gijal" => null,
"nbjrs" => 0,
"sprints" => [],
];
}
// On ajoutes les sprints sans issues
foreach($tbissues[$column->getId()]["jalons"] as $jalon) {
$sprints=$em->getRepository("App:Scrumsprint")->findBy(["scrum"=>$data,"giteamilestone"=>$jalon["idjal"]]);
foreach($sprints as $sprint) {
if(!in_array($column->getId()."|".$jalon["idjal"]."|".$sprint->getId(),$tbsprs)) {
$tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][$sprint->getId()] = [
"rowspr" => $sprint->getRowid(),
"idspr" => $sprint->getId(),
"nmspr" => $sprint->getName(),
"nbjrs" => 0,
"issues" => [],
];
}
}
// On ajoute les sprint aucun sans issue
if(!in_array($column->getId()."|".$jalon["idjal"]."|-100",$tbsprs)) {
$tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][-100] = [
"rowspr" => -100,
"idspr" => -100,
"nmspr" => "Aucun",
"nbjrs" => 0,
"issues" => [],
];
}
}
}
// Tri des issues par colonne/jalon/sprint/issue
$rowcol = array_column($tbissues, 'rowcol');
array_multisort($rowcol, SORT_ASC, $tbissues);
foreach($tbissues as $keycol=>$column) {
$rowjal = array_column($tbissues[$keycol]["jalons"], 'rowjal');
array_multisort($rowjal, SORT_DESC, $tbissues[$keycol]["jalons"]);
foreach($tbissues[$keycol]["jalons"] as $keyjal=>$jalon) {
$rowspr = array_column($tbissues[$keycol]["jalons"][$keyjal]["sprints"], 'rowspr');
array_multisort($rowspr, SORT_DESC, $tbissues[$keycol]["jalons"][$keyjal]["sprints"]);
}
}
// Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id);
@ -198,11 +385,13 @@ class ScrumController extends AbstractController
'giteaassignees' => $giteaassignees,
'giteacolumns' => $giteacolumns,
'giteamilestones' => $giteamilestones,
'sprints' => $data->getScrumsprints(),
'giteateams' => $giteateams,
'giteaprioritys' => $giteaprioritys,
'giteatypes' => $giteatypes,
'gitealabels' => $gitealabels,
'filtermilestones' => $filtermilestones,
'filtersprints' => $filtersprints,
'filterteams' => $filterteams,
'filterprioritys' => $filterprioritys,
'filtertypes' => $filtertypes,
@ -210,10 +399,187 @@ class ScrumController extends AbstractController
'filterassignees' => $filterassignees,
'filterexcludes' => $filterexcludes,
'showfilters' => $showfilters,
'tbissues' => $tbissues,
'tbestim' => $tbestim,
$this->data => $data,
]);
}
public function table($id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$fgcsv = $request->get("fgcsv");
// Récupérer les repos de gitea
$scrum=$em->getRepository("App:Scrum")->findOneBy(["id"=>$id]);
$gitearepos=[];
$giteamilestones=[];
$giteacolumns=[];
$giteateams=[];
$giteaprioritys=[];
$giteatypes=[];
$gitealabels=[];
$giteaassignees=$em->getRepository("App:User")->findBy([],["username"=>"ASC"]);
$viewclosed = $request->getSession()->get("viewclosed");
$gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]);
if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) {
$scrum->setGiteajson(json_decode(json_encode($gitearepo), true));
$em->persist($scrum);
$em->flush();
}
$giteamilestones=$this->giteaservice->getMilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));
$json=$scrum->getGiteajson();
$json["issues"]=$giteaissues;
foreach($json["issues"] as $key => $giteaissue) {
$issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]);
if($issue) {
$json["issues"][$key]->weight=$issue->getWeight();
$json["issues"][$key]->issueid=$issue->getId();
$json["issues"][$key]->scrumid=$issue->getScrum()->getId();
$json["issues"][$key]->sprintid=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
$json["issues"][$key]->sprintname=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
}
else {
$json["issues"][$key]->weight=0;
$json["issues"][$key]->issueid=0;
$json["issues"][$key]->scrumid=0;
$json["issues"][$key]->sprintid=-100;
$json["issues"][$key]->sprintname="Aucun";
}
}
$tmp=[];
foreach($scrum->getScrumcolumns() as $column) {
array_push($tmp,$column->getGiteaid());
if(!in_array($column->getGiteajson()["name"],$giteacolumns))
array_push($giteacolumns,$column->getGiteajson()["name"]);
}
$json["columns"]=$tmp;
array_push($gitearepos,$json);
foreach($scrum->getScrumteams() as $team) {
if(!in_array($team->getGiteajson()["name"],$giteateams))
array_push($giteateams,$team->getGiteajson()["name"]);
}
foreach($scrum->getScrumprioritys() as $priority) {
if(!in_array($priority->getGiteajson()["name"],$giteaprioritys))
array_push($giteaprioritys,$priority->getGiteajson()["name"]);
}
foreach($scrum->getScrumtypes() as $type) {
if(!in_array($type->getGiteajson()["name"],$giteatypes))
array_push($giteatypes,$type->getGiteajson()["name"]);
}
foreach($giteaissues as $giteaissue) {
foreach($giteaissue->labels as $label) {
if(!in_array($label->name,$gitealabels))
array_push($gitealabels,$label->name);
}
}
$keysort = array_column($giteamilestones, 'title');
array_multisort($keysort, SORT_DESC, $giteamilestones);
sort($giteacolumns);
sort($giteateams);
sort($giteaprioritys);
sort($giteatypes);
sort($gitealabels);
// Préférences utilisateur
$filtercategorys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercategorys",$id);
$filterrepos = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterrepos",$id);
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
$filtercolumns = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercolumns",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$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);
if($fgcsv) {
$dir = $this->appKernel->getProjectDir() . '/uploads/issues/';
$file = "issues-".$id.".csv";
$fs = new Filesystem();
$fs->mkdir($dir);
$csvh = fopen($dir.$file, 'w');
$d = ';'; // this is the default but i like to be explicit
$e = '"'; // this is the default but i like to be explicit
$tmp=["Projet","Jalon","Type","Id","Titre","Statut","Label"];
fputcsv($csvh, $tmp, $d, $e);
foreach($gitearepos as $gitearepo) {
foreach($gitearepo["issues"] as $giteaissue) {
$statut="";
$type="";
$labels="";
foreach($giteaissue->labels as $label) {
if(in_array($label->id,$gitearepo["columns"]))
$statut=$label->name;
elseif(in_array($label->name,$giteatypes))
$type=$label->name;
else
$labels=$labels.($labels!=""?"\n":"").$label->name;
}
$tmp=[
$gitearepo["name"],
(isset($giteaissue->milestone->title)?$giteaissue->milestone->title:""),
$type,
$giteaissue->number,
$giteaissue->title,
$statut,
$labels
];
fputcsv($csvh, $tmp, $d, $e);
}
}
fclose($csvh);
$response = new BinaryFileResponse($dir.$file);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
return $response;
}
return $this->render($this->render.'table.html.twig',[
"useheader" => true,
"usesidebar" => false,
"id" => $id,
"gitearepos" => $gitearepos,
"giteamilestones" => $giteamilestones,
"sprints" => $scrum->getScrumsprints(),
"giteacolumns" => $giteacolumns,
"giteateams" => $giteateams,
"giteaprioritys" => $giteaprioritys,
"giteatypes" => $giteatypes,
"gitealabels" => $gitealabels,
"giteaassignees" => $giteaassignees,
"filtercategorys" => $filtercategorys,
"filterrepos" => $filterrepos,
"filtermilestones" => $filtermilestones,
"filtersprints" => $filtersprints,
"filtercolumns" => $filtercolumns,
"filterteams" => $filterteams,
"filterprioritys" => $filterprioritys,
"filtertypes" => $filtertypes,
"filterlabels" => $filterlabels,
"filterexcludes" => $filterexcludes,
"filterassignees" => $filterassignees,
"showfilters" => $showfilters,
]);
}
public function stat($id,Request $request)
{
// Initialisation de l'enregistrement
@ -225,94 +591,94 @@ class ScrumController extends AbstractController
// Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$filtersprints = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtersprints",$id);
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
$tbstat=[];
foreach($data->getScrumIssues() as $issue) {
// Création du tableau des issues
$issues=$data->getScrumissues();
$tbissues=[];
$tbcols=[];
$tbjals=[];
$tbsprs=[];
$tbestim=[];
$viewclosed = $this->get('session')->get("viewclosed");
foreach($issues as $issue) {
// bypass closed
if($viewclosed=="false"&&$issue->getGiteastate()=="closed") continue;
$labels=$issue->getGiteajson()["labels"];
$haveteams=true;
if($filterteams) {
$haveteams=false;
foreach($filterteams as $filterteam) {
foreach($labels as $label) {
if($label["id"]==$filterteam) {
$haveteams=true;
}
}
}
// Ids
$idcol=$issue->getScrumcolumn()->getId();
$idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
// Roworders
$rowcol=$issue->getScrumcolumn()->getRowid();
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
// Names
$nmcol=$issue->getScrumcolumn()->getName();
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
if(!array_key_exists($idjal,$tbestim)) {
$tbestim[$idjal] = [
"rowjal" => $rowjal,
"idjal" => $idjal,
"nmjal" => $nmjal,
"nbjrs" => 0,
"columns" => [],
"sprints" => [],
];
}
if($haveteams) {
$idmilestone=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
$lbmilestone=($issue->getGiteamilestone()?$issue->getGiteamilestonename():"Aucun");
if(!array_key_exists($idmilestone,$tbstat)) {
$tbstat[$idmilestone]=["id"=>$idmilestone,"name"=>$lbmilestone,"stat"=>[]];
}
if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) {
$tbestim[$idjal]["sprints"][$idspr] = [
"rowspr" => $rowspr,
"idspr" => $idspr,
"nmspr" => $nmspr,
"nbjrs" => 0,
"columns" => [],
];
}
if(!$issue->getScrumcolumn()) $ordercolumns=0;
else $ordercolumns=array_search($issue->getScrumcolumn()->getGiteaid(),$giteacolumns);
//$ordercolumns=$issue->getScrumcolumn()->getId();
if(!array_key_exists($ordercolumns,$tbstat[$idmilestone]["stat"])) {
$tbstat[$idmilestone]["stat"][$ordercolumns]=[
"id"=>$issue->getScrumcolumn()->getId(),
"label"=>$issue->getScrumcolumn()->getName(),
"total"=>0,
"color"=>"#".$issue->getScrumcolumn()->getGiteajson()["color"],
"labels"=>[],
];
}
foreach($labels as $label) {
if($ordercolumns!=$label["id"]) {
if(!array_key_exists($label["id"],$tbstat[$idmilestone]["stat"][$ordercolumns]["labels"])) {
$tbstat[$idmilestone]["stat"][$ordercolumns]["labels"][$label["id"]] = [
"id"=>$label["id"],
"label"=>$label["name"],
"total"=>0,
"color"=>"#".$label["color"],
];
}
$tbstat[$idmilestone]["stat"][$ordercolumns]["labels"][$label["id"]]["total"]+=$issue->getWeight();
}
}
$tbstat[$idmilestone]["stat"][$ordercolumns]["total"]+=$issue->getWeight();
}
if(!array_key_exists($idcol,$tbestim[$idjal]["columns"])) {
$tbestim[$idjal]["columns"][$idcol] = [
"rowcol" => $rowcol,
"idcol" => $idcol,
"nmcol" => $nmcol,
"color" => $issue->getScrumcolumn()->getGiteajson()["color"],
"nbjrs" => 0,
];
}
if(!array_key_exists($idcol,$tbestim[$idjal]["sprints"][$idspr]["columns"])) {
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol] = [
"rowcol" => $rowcol,
"idcol" => $idcol,
"nmcol" => $nmcol,
"color" => $issue->getScrumcolumn()->getGiteajson()["color"],
"nbjrs" => 0,
];
}
// On cumule les estimations
$tbestim[$idjal]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["columns"][$idcol]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["sprints"][$idspr]["columns"][$idcol]["nbjrs"]+=$issue->getWeight();
}
foreach($tbstat as $k1=>$milestone) {
$tmp=$tbstat[$k1]["stat"];
ksort($tmp);
$tbstat[$k1]["stat"]=$tmp;
}
foreach($tbstat as $k1=>$milestone) {
foreach($tbstat[$k1]["stat"] as $k2=>$statut) {
$keysort = array_column($tbstat[$k1]["stat"][$k2]["labels"], 'label');
array_multisort($keysort, SORT_ASC, $tbstat[$k1]["stat"][$k2]["labels"]);
}
}
return $this->render($this->render.'stat.html.twig', [
'useheader' => true,
'usesidebar' => false,
'usetitle' => $data->getName(),
'giteaassignees' => $giteaassignees,
'giteacolumns' => $giteacolumns,
'giteamilestones' => $giteamilestones,
'giteateams' => $giteateams,
'giteaprioritys' => $giteaprioritys,
'giteatypes' => $giteatypes,
'gitealabels' => $gitealabels,
'filtermilestones' => $filtermilestones,
'filterteams' => $filterteams,
'showfilters' => $showfilters,
$this->data => $data,
'tbstat' => $tbstat,
'tbestim' => $tbestim,
]);
}
@ -345,6 +711,196 @@ class ScrumController extends AbstractController
return new JsonResponse($output);
}
private function consolidateScrum($scrum,$giteamilestones,&$tbissues,&$tbestim) {
$em = $this->getDoctrine()->getManager();
$issues=$scrum->getScrumissues();
$tbissues=[];
$tbestim=[];
$tbcols=[];
$tbjals=[];
$tbsprs=[];
$viewclosed = $this->get('session')->get("viewclosed");
foreach($issues as $issue) {
// bypass closed
if($viewclosed=="false"&&$issue->getGiteastate()=="closed") continue;
// Ids
$idcol=$issue->getScrumcolumn()->getId();
$idjal=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
$idspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getId():-100);
// Roworders
$rowcol=$issue->getScrumcolumn()->getRowid();
$rowjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():-100);
$rowspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getRowid():-100);
// Names
$nmcol=$issue->getScrumcolumn()->getName();
$nmjal=($issue->getGiteaMilestonename()?$issue->getGiteaMilestonename():"Aucun");
$nmspr=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():"Aucun");
// Idgiteas
$gicol=$issue->getScrumcolumn()->getGiteaid();
$gijal=$issue->getGiteaMilestone();
// Liste des colonnes/jalons/sprint avec des issues
if(!in_array($idcol,$tbcols)) array_push($tbcols,$idcol);
if(!in_array($idcol."|".$idjal,$tbjals)) array_push($tbjals,$idcol."|".$idjal);
if(!in_array($idcol."|".$idjal."|".$idspr,$tbsprs)) array_push($tbsprs,$idcol."|".$idjal."|".$idspr);
// Initialisation du tableau des estimations
if(!array_key_exists($idjal,$tbestim)) {
$tbestim[$idjal] = [
"rowjal" => $rowjal,
"idjal" => $idjal,
"nmjal" => $nmjal,
"gijal" => $gijal,
"nbjrs" => 0,
"sprints" => []
];
}
if(!array_key_exists($idspr,$tbestim[$idjal]["sprints"])) {
$tbestim[$idjal]["sprints"][$idspr] = [
"rowspr" => $rowspr,
"idspr" => $idspr,
"nmspr" => $nmspr,
"nbjrs" => 0,
];
}
// Initialisation du tableau des colonnes
if(!array_key_exists($idcol,$tbissues)) {
$tbissues[$idcol]=[
"rowcol" => $rowcol,
"idcol" => $idcol,
"nmcol" => $nmcol,
"gicol" => $gicol,
"nbjrs" => 0,
"jalons" => [],
];
}
// Initialisation du tableau des jalons de la colonne encours
if(!array_key_exists($idjal,$tbissues[$idcol]["jalons"])) {
$tbissues[$idcol]["jalons"][$idjal] = [
"rowjal" => $rowjal,
"idjal" => $idjal,
"nmjal" => $nmjal,
"gijal" => $gijal,
"nbjrs" => 0,
"sprints" => [],
];
}
// Initialisation du tableau des sprint de la colonne/jalon encours
if(!array_key_exists($idspr,$tbissues[$idcol]["jalons"][$idjal]["sprints"])) {
$tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr] = [
"rowspr" => $rowspr,
"idspr" => $idspr,
"nmspr" => $nmspr,
"nbjrs" => 0,
"issues" => [],
];
}
// On cumule les estimations
$tbissues[$idcol]["nbjrs"]+=$issue->getWeight();
$tbissues[$idcol]["jalons"][$idjal]["nbjrs"]+=$issue->getWeight();
$tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["nbjrs"]+=$issue->getWeight();
$tbestim[$idjal]["sprints"][$idspr]["nbjrs"]+=$issue->getWeight();
// On sauvegarde l'issue
array_push($tbissues[$idcol]["jalons"][$idjal]["sprints"][$idspr]["issues"],$issue);
}
// On ajoute les colonnes sans issues
$columns=$scrum->getScrumcolumns();
foreach($columns as $column) {
if(!in_array($column->getId(),$tbcols)) {
$tbissues[$column->getId()] = [
"rowcol" => $column->getRowid(),
"idcol" => $column->getId(),
"nmcol" => $column->getName(),
"gicol" => $column->getGiteaid(),
"nbjrs" => 0,
"jalons" => [],
];
}
// On ajoute les jalons sans issues
foreach($giteamilestones as $milestone) {
if(!in_array($column->getId()."|".$milestone->id,$tbjals)) {
$tbissues[$column->getId()]["jalons"][$milestone->id] = [
"rowjal" => $milestone->title,
"idjal" => $milestone->id,
"nmjal" => $milestone->title,
"gijal" => $milestone->id,
"nbjrs" => 0,
"sprints" => [],
];
}
}
// On ajoute le jalon aucun si sans issue
if(!in_array($column->getId()."|-100",$tbjals)) {
$tbissues[$column->getId()]["jalons"][-100] = [
"rowjal" => -100,
"idjal" => -100,
"nmjal" => "Aucun",
"gijal" => null,
"nbjrs" => 0,
"sprints" => [],
];
}
// On ajoutes les sprints sans issues
foreach($tbissues[$column->getId()]["jalons"] as $jalon) {
$sprints=$em->getRepository("App:Scrumsprint")->findBy(["scrum"=>$scrum,"giteamilestone"=>$jalon["idjal"]]);
foreach($sprints as $sprint) {
if(!in_array($column->getId()."|".$jalon["idjal"]."|".$sprint->getId(),$tbsprs)) {
$tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][$sprint->getId()] = [
"rowspr" => $sprint->getRowid(),
"idspr" => $sprint->getId(),
"nmspr" => $sprint->getName(),
"nbjrs" => 0,
"issues" => [],
];
}
}
// On ajoute les sprint aucun sans issue
if(!in_array($column->getId()."|".$jalon["idjal"]."|-100",$tbsprs)) {
$tbissues[$column->getId()]["jalons"][$jalon["idjal"]]["sprints"][-100] = [
"rowspr" => -100,
"idspr" => -100,
"nmspr" => "Aucun",
"nbjrs" => 0,
"issues" => [],
];
}
}
}
// Tri des issues par colonne/jalon/sprint/issue
$rowcol = array_column($tbissues, 'rowcol');
array_multisort($rowcol, SORT_ASC, $tbissues);
foreach($tbissues as $keycol=>$column) {
$rowjal = array_column($tbissues[$keycol]["jalons"], 'rowjal');
array_multisort($rowjal, SORT_DESC, $tbissues[$keycol]["jalons"]);
foreach($tbissues[$keycol]["jalons"] as $keyjal=>$jalon) {
$rowspr = array_column($tbissues[$keycol]["jalons"][$keyjal]["sprints"], 'rowspr');
array_multisort($rowspr, SORT_DESC, $tbissues[$keycol]["jalons"][$keyjal]["sprints"]);
}
}
}
protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") {
}

View File

@ -31,8 +31,10 @@ class ScrumissueController extends AbstractController
$newcolumn=$request->get('newcolumn');
$oldmilestone=$request->get('oldmilestone');
$newmilestone=$request->get('newmilestone');
$oldsprint=$request->get('oldsprint');
$newsprint=$request->get('newsprint');
if($oldcolumn!=$newcolumn||$oldmilestone!=$newmilestone) {
if($oldcolumn!=$newcolumn||$oldmilestone!=$newmilestone||$oldsprint!=$newsprint) {
// Rechercher l'issue en cours
$scrumissue=$em->getRepository("App:Scrumissue")->find($id);
if(!$scrumissue) return new JsonResponse(['message' => 'No Issue'], 403);
@ -68,16 +70,31 @@ class ScrumissueController extends AbstractController
$return=$this->giteaservice->patchIssue($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber(),$patchs);
if(!$return) return new JsonResponse(['message' => 'No API patchIssue'], 403);
}
// Mettre à jour le sprint
if($oldsprint!=$newsprint) {
$scrumissue->setScrumsprint(null);
$sprint=$em->getRepository("App:Scrumsprint")->find($newsprint);
if($sprint) {
$scrumissue->setScrumsprint($sprint);
}
$em->flush();
}
// Récupérer l'issue modifiée pour mettre à jour la date de modification gitea
$giteaissue=$this->giteaservice->getIssue($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber());
if(!$giteaissue) return new JsonResponse(['message' => 'No API getIssue'], 403);
$updatedate=new \DateTime($giteaissue->updated_at);
if($updatedate > $scrumissue->getScrum()->getUpdatedate()) {
$scrumissue->getScrum()->setUpdatedate(new \DateTime($giteaissue->updated_at));
$updateissue=new \DateTime($giteaissue->updated_at);
$updateissue->setTimezone(new \DateTimeZone("UTC"));
$lastupdate=$scrumissue->getScrum()->getUpdatedate();
if($updateissue > $lastupdate) {
$scrumissue->getScrum()->setUpdatedate($updateissue);
$em->persist($scrumissue->getScrum());
$em->flush();
return new JsonResponse($updatedate->format("Ymd H:i:s"));
return new JsonResponse($lastupdate->format("Ymd H:i:s"));
}
}
return new JsonResponse(false);
@ -159,10 +176,10 @@ class ScrumissueController extends AbstractController
$em = $this->getDoctrine()->getManager();
$id=$request->get('id');
$lastupdate=new \DateTime($request->get('lastupdate'));
$scrum=$em->getRepository("App:Scrum")->find($id);
if(!$scrum) return new JsonResponse(['message' => 'No Scrum'], 403);
$lastupdate=$scrum->getUpdatedate();
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
@ -174,12 +191,15 @@ class ScrumissueController extends AbstractController
$scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]);
if(!$scrumissue)
if(!$scrumissue) {
return new JsonResponse(true);
}
$fgissueupdated=false;
$updatedate=new \DateTime(json_decode(json_encode($giteaissue), true)["updated_at"]);
if($updatedate>$lastupdate) {
$updateissue=new \DateTime(json_decode(json_encode($giteaissue), true)["updated_at"]);
$updateissue->setTimezone(new \DateTimeZone("UTC"));
if($updateissue>$lastupdate) {
$fgissueupdated=true;
}

View File

@ -0,0 +1,194 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormError;
use App\Entity\Scrumsprint as Entity;
use App\Form\ScrumsprintType as Form;
use App\Service\giteaService;
class ScrumsprintController extends AbstractController
{
private $data = "scrumsprint";
private $route = "app_scrumsprint";
private $render = "Scrumsprint/";
private $entity = "App:Scrumsprint";
public function __construct(giteaService $giteaservice) { $this->giteaservice = $giteaservice; }
public function submit($scrumid, Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$scrum=$em->getRepository("App:Scrum")->find($scrumid);
$data = new Entity();
$data->setScrum($scrum);
$last = $em->getRepository('App:Scrumsprint')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']);
if(!$last) $data->setRowid(0);
else $data->setRowid($last->getRowid()+1);
// Récupérer les repos de gitea
$giteamilestones=$this->giteaservice->getmilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
if(!is_array($giteamilestones)) die("Probleme de connexion avec gitea veuillez vous <a href='".$this->getParameters("appAlias")."/logout'>reconnecter</a>");
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"submit","giteamilestones"=>$giteamilestones));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"submit");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$getmilestone=$this->giteaservice->getmilestone($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$data->getGiteamilestone());
$data->setGiteamilestonename($getmilestone->title);
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->render($this->render.'close.html.twig');
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => false,
'usesidebar' => false,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView()
]);
}
public function update($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
$scrum=$data->getScrum();
// Récupérer les repos de gitea
$giteamilestones=$this->giteaservice->getmilestones($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"update","giteamilestones"=>$giteamilestones));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"update");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$getmilestone=$this->giteaservice->getmilestone($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$data->getGiteamilestone());
$data->setGiteamilestonename($getmilestone->title);
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->render($this->render.'close.html.twig');
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => false,
'usesidebar' => false,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView()
]);
}
public function delete($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
// Controle avant suppression
$error=false;
if($id<0) $error=true;
if($error)
return $this->redirectToRoute($this->route."_update",["id"=>$id]);
else {
$em->remove($data);
$em->flush();
// Retour à la liste
return $this->render($this->render.'close.html.twig');
}
}
public function select($scrumid, Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$em = $this->getDoctrine()->getManager();
$scrum=$em->getRepository("App:Scrum")->find($scrumid);
$scrumsprints = $scrum->getScrumsprints();
$output=array();
foreach($scrumsprints as $scrumsprint) {
array_push($output,array("id"=>$scrumsprint->getId(),"name"=>"<b>".$scrumsprint->getName()."</b><br><small>liè au jalon gitea ".$scrumsprint->getGiteamilestonename()."</small>"));
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function order($scrumid, Request $request)
{
$em = $this->getDoctrine()->getManager();
$scrumsprintids=explode(",",$request->get('lstordered'));
$i=1;
foreach($scrumsprintids as $id) {
$scrumsprint=$em->getRepository($this->entity)->find($id);
if($scrumsprint) {
$scrumsprint->setRowid($i);
$em->persist($scrumsprint);
$em->flush();
}
$i++;
}
$response = new Response();
$response->headers->set('Content-Type', 'application/json');
return $response;
}
protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") {
}
if ($form->get('submit')->isClicked() && $mode=="submit") {
}
if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach( $errors as $error ) {
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
}
}
}
}

View File

@ -67,6 +67,12 @@ class Scrum
*/
private $scrumcolumns;
/**
* @ORM\OneToMany(targetEntity="Scrumsprint", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"rowid" = "ASC"})
*/
private $scrumsprints;
/**
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"giteamilestonename" = "DESC", "rowid" = "ASC"})
@ -117,6 +123,7 @@ class Scrum
$this->scrumteams = new ArrayCollection();
$this->scrumprioritys = new ArrayCollection();
$this->scrumtypes = new ArrayCollection();
$this->scrumsprints = new ArrayCollection();
}
public function getId(): ?int
@ -378,4 +385,35 @@ class Scrum
return $this;
}
/**
* @return Collection|Scrumsprint[]
*/
public function getScrumsprints(): Collection
{
return $this->scrumsprints;
}
public function addScrumsprint(Scrumsprint $scrumsprint): self
{
if (!$this->scrumsprints->contains($scrumsprint)) {
$this->scrumsprints[] = $scrumsprint;
$scrumsprint->setScrum($this);
}
return $this;
}
public function removeScrumsprint(Scrumsprint $scrumsprint): self
{
if ($this->scrumsprints->contains($scrumsprint)) {
$this->scrumsprints->removeElement($scrumsprint);
// set the owning side to null (unless already changed)
if ($scrumsprint->getScrum() === $this) {
$scrumsprint->setScrum(null);
}
}
return $this;
}
}

View File

@ -49,8 +49,8 @@ class Scrumcolumn
private $scrum;
/**
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumcolumn", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"giteamilestonename" = "DESC", "rowid" = "ASC"})
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumcolumn", cascade={"persist"}, orphanRemoval=false)
* @ORM\OrderBy({"giteamilestonename" = "DESC", "scrumsprint" = "DESC", "rowid" = "ASC"})
*/
private $scrumissues;

View File

@ -75,9 +75,16 @@ class Scrumissue
/**
* @ORM\ManyToOne(targetEntity="Scrumcolumn", inversedBy="Scrumissues")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $scrumcolumn;
/**
* @ORM\ManyToOne(targetEntity="Scrumsprint", inversedBy="Scrumissues")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $scrumsprint;
public function getId(): ?int
{
return $this->id;
@ -215,6 +222,18 @@ class Scrumissue
return $this;
}
public function getScrumsprint(): ?Scrumsprint
{
return $this->scrumsprint;
}
public function setScrumsprint(?Scrumsprint $scrumsprint): self
{
$this->scrumsprint = $scrumsprint;
return $this;
}
}

159
src/Entity/Scrumsprint.php Normal file
View File

@ -0,0 +1,159 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Scrumcolumn
*
* @ORM\Entity()
* @ORM\Table(name="scrumsprint")
*/
class Scrumsprint
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="string")
*
*/
private $name;
/**
* @ORM\Column(type="integer")
*/
private $rowid;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $giteamilestone;
/**
* @ORM\Column(type="string", nullable=true)
*
*/
private $giteamilestonename;
/**
* @ORM\ManyToOne(targetEntity="Scrum", inversedBy="scrumsprints")
*/
private $scrum;
/**
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumsprint", cascade={"persist"}, orphanRemoval=false)
*/
private $scrumissues;
public function __construct()
{
$this->scrumissues = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getRowid(): ?int
{
return $this->rowid;
}
public function setRowid(int $rowid): self
{
$this->rowid = $rowid;
return $this;
}
public function getGiteamilestone(): ?int
{
return $this->giteamilestone;
}
public function setGiteamilestone(?int $giteamilestone): self
{
$this->giteamilestone = $giteamilestone;
return $this;
}
public function getGiteamilestonename(): ?string
{
return $this->giteamilestonename;
}
public function setGiteamilestonename(?string $giteamilestonename): self
{
$this->giteamilestonename = $giteamilestonename;
return $this;
}
public function getScrum(): ?Scrum
{
return $this->scrum;
}
public function setScrum(?Scrum $scrum): self
{
$this->scrum = $scrum;
return $this;
}
/**
* @return Collection|Scrumissue[]
*/
public function getScrumissues(): Collection
{
return $this->scrumissues;
}
public function addScrumissue(Scrumissue $scrumissue): self
{
if (!$this->scrumissues->contains($scrumissue)) {
$this->scrumissues[] = $scrumissue;
$scrumissue->setScrumsprint($this);
}
return $this;
}
public function removeScrumissue(Scrumissue $scrumissue): self
{
if ($this->scrumissues->contains($scrumissue)) {
$this->scrumissues->removeElement($scrumissue);
// set the owning side to null (unless already changed)
if ($scrumissue->getScrumsprint() === $this) {
$scrumissue->setScrumsprint(null);
}
}
return $this;
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ScrumsprintType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
"label" => "Valider",
"attr" => ["class" => "btn btn-success no-print"],
]
);
$builder->add('name',
TextType::class, [
"label" =>"Nom",
]
);
$choices=[];
foreach($options["giteamilestones"] as $milestone) {
$choices[$milestone->title]=$milestone->id;
}
$builder->add('giteamilestone',
ChoiceType::class, [
"label" => "Jalon Gitea",
"choices" => $choices,
"disabled" => ($options["mode"]=="submit"?false:true),
"placeholder" => "Selectionnez un label gitea",
]
);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'App\Entity\Scrumsprint',
'mode' => 'string',
'giteamilestones' => 'string',
));
}
}

View File

@ -39,6 +39,60 @@ class ScrumRepository extends ServiceEntityRepository
public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$giteatypes,&$gitealabels, $forcereload=false) {
$viewclosed = $this->session->get("viewclosed");
// Récupérer les labels de gitea
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
if(!is_array($gitealabels)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
// S'assurer que nos colonnes existes toujours
$scrumcolumns=$scrum->getScrumcolumns();
foreach($scrumcolumns as $scrumcolumn) {
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumcolumn->getGiteaid());
if(!$gitealabel) {
$this->_em->remove($scrumcolumn);
$this->_em->flush();
}
}
// S'assurer que nos teams existes toujours
$scrumteams=$scrum->getScrumteams();
foreach($scrumteams as $scrumteam) {
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumteam->getGiteaid());
if(!$gitealabel) {
$this->_em->remove($scrumteam);
$this->_em->flush();
}
}
// S'assurer que nos prioritys existes toujours
$scrumprioritys=$scrum->getScrumprioritys();
foreach($scrumprioritys as $scrumpriority) {
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumpriority->getGiteaid());
if(!$gitealabel) {
$this->_em->remove($scrumpriority);
$this->_em->flush();
}
}
// S'assurer que nos types existes toujours
$scrumtypes=$scrum->getScrumtypes();
foreach($scrumtypes as $scrumtype) {
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumtype->getGiteaid());
if(!$gitealabel) {
$this->_em->remove($scrumtype);
$this->_em->flush();
}
}
// S'assurer que nos sprint sont toujours lié à un jalon existant
$scrumsprints=$scrum->getScrumsprints();
foreach($scrumsprints as $scrumsprint) {
$giteamilestone=$this->giteaservice->getMilestone($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumsprint->getGiteamilestone());
if(!$giteamilestone) {
$this->_em->remove($scrumsprint);
$this->_em->flush();
}
}
// Récupérer le dernier order
$last = $this->_em->getRepository('App:Scrumissue')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']);
if(!$last) $lastrowid=-1;
@ -110,7 +164,7 @@ class ScrumRepository extends ServiceEntityRepository
// Récupérer les labels de gitea
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
if(!is_array($gitealabels)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
// Formatter les labels non colomn/team/priority/type
foreach($gitealabels as $key => $gitealabel) {
if(in_array($gitealabel->id,$giteacolumns)||in_array($gitealabel->id,$giteateams)||in_array($gitealabel->id,$giteaprioritys)||in_array($gitealabel->id,$giteatypes))
unset($gitealabels[$key]);
@ -126,10 +180,6 @@ class ScrumRepository extends ServiceEntityRepository
$this->datescrumupdate=new \DateTime();
foreach($giteaissues as $giteaissue) {
// On ne prend pas les pull request
if(!is_null($giteaissue->pull_request)) {
continue;
}
$scrumissue=$this->_em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]);
@ -139,42 +189,51 @@ class ScrumRepository extends ServiceEntityRepository
$scrumissue->setScrum($scrum);
$scrumissue->setRowid($lastrowid);
$scrumissue->setGiteaid($giteaissue->id);
$this->majissue($scrumissue,$giteaissue,true);
}
else {
$fgissueupdated=false;
if($scrumissue->getGiteajson()["updated_at"]!=json_decode(json_encode($giteaissue), true)["updated_at"])
$fgissueupdated=true;
if($scrumissue->getGiteajson()["closed_at"]!=json_decode(json_encode($giteaissue), true)["closed_at"])
$fgissueupdated=true;
if($giteaissue->milestone&&$scrumissue->getGiteamilestonename()!=$giteaissue->milestone->title)
$fgissueupdated=true;
if(!$giteaissue->milestone&&!is_null($scrumissue->getGiteamilestone()))
$fgissueupdated=true;
$fgissueupdated=false;
if($scrumissue->getGiteajson()["updated_at"]!=json_decode(json_encode($giteaissue), true)["updated_at"])
$fgissueupdated=true;
if($scrumissue->getGiteajson()["closed_at"]!=json_decode(json_encode($giteaissue), true)["closed_at"])
$fgissueupdated=true;
if($giteaissue->milestone&&$scrumissue->getGiteamilestonename()!=$giteaissue->milestone->title)
$fgissueupdated=true;
if(!$giteaissue->milestone&&!is_null($scrumissue->getGiteamilestone()))
$fgissueupdated=true;
if($forcereload) {
$fgissueupdated=true;
}
if($forcereload) {
$fgissueupdated=true;
}
if($fgissueupdated) {
$fgscrumupdate=true;
$this->majissue($scrumissue,$giteaissue);
if($fgissueupdated) {
$fgscrumupdate=true;
$this->majissue($scrumissue,$giteaissue,false);
}
}
array_push($tbgiteaissues,$giteaissue->number);
}
// Bug faudrait placer à closed l'ensemble des issues vu comme open mais qui ne le sont plus
// Placer à closed l'ensemble des issues vu comme open mais qui ne le sont plus
if($viewclosed=="false") {
$scrumissues=$scrum->getScrumissues();
foreach($scrumissues as $scrumissue) {
if($scrumissue->getGiteastate()=="open"&&!in_array($scrumissue->getGiteanumber(),$tbgiteaissues)) {
$giteaissue=$this->giteaservice->getIssue($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$scrumissue->getGiteanumber());
$fgscrumupdate=true;
$this->majissue($scrumissue,$giteaissue);
// S'il ne trouve pas d'issue c'est qu'elle n'existe plus
if(!$giteaissue) {
// Faudrait supprimer mais pour l'instant pas touche
//dump("netrouvepasissue alors");
//dump($scrumissue->getGiteanumber());
}
// Sinon mise
else $this->majissue($scrumissue,$giteaissue,false);
}
}
}
if($fgscrumupdate) {
$scrum->setUpdatedate($this->datescrumupdate);
$this->_em->persist($scrum);
@ -182,13 +241,11 @@ class ScrumRepository extends ServiceEntityRepository
}
}
function majissue($scrumissue,$giteaissue) {
if($scrumissue->getGiteajson()["updated_at"]>$this->datescrumupdate)
$this->datescrumupdate=$scrumissue->getGiteajson()["updated_at"];
function majissue($scrumissue,$giteaissue,$issubmit) {
$scrumissue->setGiteanumber($giteaissue->number);
$scrumissue->setGiteastate($giteaissue->state);
$scrumissue->setGiteatitle($giteaissue->title);
if($giteaissue->milestone) {
$scrumissue->setGiteamilestone($giteaissue->milestone->id);
$scrumissue->setGiteamilestonename($giteaissue->milestone->title);

View File

@ -202,8 +202,15 @@ class giteaService
else return $response->body;
}
public function getmilestone($owner,$name,$id) {
$apiurl = $this->url."/repos/$owner/$name/milestones/".$id;
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
if(!$response||$response->code!="200") return false;
else return $response->body;
}
public function getissues($owner,$name,$state="?state=open") {
$apiurl = $this->url."/repos/$owner/$name/issues".$state;
$apiurl = $this->url."/repos/$owner/$name/issues".$state."&type=issues";
$page=1;
$limit=20;

View File

@ -45,7 +45,7 @@
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
@ -57,6 +57,21 @@
{{ form_row(form.users) }}
</div>
</div>
{% if mode=="update" %}
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Sprints
<button id="addsprint" type="button" class="btn float-right fa fa-plus"></button>
</div>
<div id="scrumsprints" class="card-body">
<ol id="scrumsprints" class="list-group list-group-numbered">
</ol>
</div>
</div>
{% endif %}
</div>
{% if mode=="update" %}
@ -185,6 +200,23 @@
</div>
</div>
<div id="mymodalsprint" class="modal" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<iframe frameborder=0 width="100%" height="600px"></iframe>
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
@ -196,6 +228,7 @@
loadscrumteams();
loadscrumprioritys();
loadscrumtypes();
loadscrumsprints();
{%endif%}
});
@ -375,7 +408,67 @@
},
});
}
$("#addsprint").click(function() {
ModalLoad('mymodalsprint','Ajouter un sprint','{{path('app_scrumsprint_submit',{scrumid:scrum.id})}}');
});
$('#scrumsprints').on('click', '.modsprint', function(event) {
url="{{path('app_scrumsprint_update',{id:'xxx'})}}";
url=url.replace("xxx",$(this).data("id"));
ModalLoad('mymodalsprint','Modifier un sprint',url);
});
$('#mymodalsprint').on('hidden.bs.modal', function () {
loadscrumsprints();
});
function loadscrumsprints() {
$("#scrumsprints").empty();
$.ajax({
method: "POST",
url: "{{path("app_scrumsprint_select",{scrumid:scrum.id})}}",
success: function(datas, dataType)
{
jQuery.each(datas, function(i, wid) {
html ='<li data-id="'+wid.id+'" class="list-group-item d-flex justify-content-between">';
html+='<div>';
html+='<div class="mr-3 p-2 d-inline-block"><i class="fas fa-arrows-alt-v fa-2x"></i></div>';
html+='<div class="d-inline-block">';
html+=wid.name;
html+='</div>';
html+='</div>';
html+='<button type="button" data-id="'+wid.id+'" class="modsprint btn float-right fa fa-file"></button>';
html+='</li>';
$("#scrumsprints").append(html);
});
$( "#scrumsprints" ).sortable({
axis: "y",
handle: ".fa-arrows-alt-v",
update: function( event, ui ) {
lstordered="";
$( "#scrumsprints li" ).each(function( index ) {
if(index==0) lstordered=$(this).data("id");
else lstordered=lstordered+","+$(this).data("id");
});
$.ajax({
method: "POST",
url: "{{path("app_scrumsprint_order",{scrumid:scrum.id})}}",
data: {
lstordered:lstordered
}
});
}
});
},
});
}
$("#addtype").click(function() {
ModalLoad('mymodaltype','Ajouter une colonne','{{path('app_scrumtype_submit',{scrumid:scrum.id})}}');
});

View File

@ -5,10 +5,9 @@
{% block body %}
<div class="d-flex justify-content-start mt-3">
<div class="pr-2">
{% if app.user and is_granted('ROLE_MASTER') %}
<a class="btn btn-success btn-sm mt-2" href={{ path('app_scrum_submit') }}><i class="fa fa-plus mr-2"></i>Ajouter un Scrum</a>
<a class="btn btn-success btn-sm d-flex" style="height:69px; justify-content: center; flex-direction: column" href={{ path('app_scrum_submit') }}><i class="fa fa-plus mr-2"></i>Ajouter un Scrum</a>
{% endif %}
</div>
@ -47,7 +46,7 @@
<tr data-category="{{scrum.category}}" data-repo="{{scrum.giteaid}}">
<td>
<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_table',{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') %}

View File

@ -18,7 +18,7 @@
.flot-chart-subcontent {
height: 200px;
width: 40%;
width: 350px;
}
{% endblock %}
@ -35,54 +35,61 @@
{% endfor %}
<option value="-100">Aucun</option>
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre EQUIPES</label>
<select id="filterteams" multiple="multiple" class="form-control">
{% for team in scrum.scrumteams %}
<option value="{{team.giteaid}}">{{team.name}}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="pl-3" style="width:100%;">
<div class="mt-4 mb-3" style="zoom:80%">
<button class="btn btn-success" onClick="showFilters()"><i class="fas fa-filter"></i></button>
<a class="btn btn-success" href="{{path('app_scrum_view',{id:scrum.id})}}"><i class="fas fa-columns"></i></a>
<a class="btn btn-success" href="{{path('app_issuescrum',{id:scrum.id})}}"><i class="fas fa-ticket-alt"></i></a>
<a class="btn btn-success" href="{{path('app_scrum_table',{id:scrum.id})}}"><i class="fas fa-ticket-alt"></i></a>
<span id="textfilters"></span>
</div>
<h1>{{ scrum.name }}</h1>
<div class="d-flex flex-column mt-4">
{% for milestone in tbstat %}
<div class="flot-chart mr-4" data-milestone="{{ milestone.id }}">
<h4>{{milestone.name}}</h4>
<div class="mt-4">
<div id="floatdonut{{ milestone.id }}" class="flot-chart-content" style="float:left"></div>
<div class="mt-3 pb-3" style="width:100%">
<div class="d-flex justify-content-between mt-4">
{% for column in milestone.stat %}
<div style="width:250px">
<div style="background-color:{{column.color}}; padding:3px;margin-bottom:3px;">{{ column.label }} = {{ column.total }}</div>
<small>
<div style="line-height:15px; width:100%">
{% for label in column.labels %}
<li >{{label.label}} = {{label.total}}</li>
{% endfor %}
</div>
</small>
{% for jalon in tbestim %}
{% if jalon.nbjrs>0 %}
<div class="card mb-4" data-milestone="{{ jalon.idjal }}">
<div class="card-header">{{jalon.nmjal}}</div>
<div class="card-body d-flex justify-content-center">
<div class="d-flex flex-column">
<div class="d-flex justify-content-center">
<div id="floatdonut{{ jalon.idjal }}" class="flot-chart-content"></div>
<div style="min-width:250px; color: #ffffff; padding: 3px;">
{% for column in jalon.columns %}
<div style="padding: 3px; background-color:#{{column.color}}">{{column.nmcol}}<span class="float-right">{{column.nbjrs}}</<span></div>
{% endfor %}
<div style="padding: 3px;color: #000">TOTAL<span class="float-right">{{jalon.nbjrs}}</<span></div>
</div>
</div>
{%endfor%}
<div class="d-flex flex-wrap justify-content-center">
{% for sprint in jalon.sprints %}
{% if jalon.nbjrs != sprint.nbjrs and sprint.nbjrs>0 %}
<div class="card mt-4 mr-4" data-sprint="{{ jalon.idjal~"-"~sprint.idspr }}">
<div class="card-header">{{sprint.nmspr}}</div>
<div class="card-body d-flex flex-column">
<div id="floatdonut{{ jalon.idjal~"-"~sprint.idspr }}" class="flot-chart-subcontent" style="float:left"></div>
<div class="mt-3" style="color: #ffffff;">
{% for column in sprint.columns %}
<div style="padding: 3px; background-color:#{{column.color}}">{{column.nmcol}}<span class="float-right">{{column.nbjrs}}</<span></div>
{% endfor %}
<div style="padding: 3px;color: #000">TOTAL<span class="float-right">{{sprint.nbjrs}}</<span></div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
@ -134,15 +141,6 @@
});
}
if($("#filterteams").val().length!==0) {
data = $("#filterteams").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
$.each($("#filterteams").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
$("#textfilters").html(textfilters);
}
@ -173,48 +171,20 @@
});
$('#filtermilestones').on("select2:unselect", function(e) {
filtermilestones();
});
});
// Filter Teams
function filterteams() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterteams',
id:{{scrum.id}},
value: $("#filterteams").val()
}
});
location.reload();
}
$('#filterteams').select2();
{% if filterteams %}
{% for team in filterteams %}
$("#filterteams").val($("#filterteams").val().concat("{{team}}"));
{%endfor%}
$('#filterteams').trigger('change');
{% endif %}
$('#filterteams').on("select2:select", function(e) {
filterteams();
});
$('#filterteams').on("select2:unselect", function(e) {
filterteams();
});
{% for milestone in tbstat %}
{% for jalon in tbestim %}
var data = [
{% for data in milestone.stat %}
{% for column in jalon.columns %}
{
label: "{{ data.label}}",
data: {{ data.total }},
color: "{{ data.color }}",
label: "{{ column.nmcol}}",
data: {{ column.nbjrs }},
color: "#{{ column.color }}",
},
{% endfor %}
];
var plotObj = $.plot($("#floatdonut{{ milestone.id }}"), data, {
var plotObj = $.plot($("#floatdonut{{ jalon.idjal }}"), data, {
series: {
pie: {
show: true,
@ -238,39 +208,42 @@
},
});
{% for data in milestone.stat %}
{% for data in milestone.stat %}
var data = [
{% for label in data.labels %}
{
label: "{{ label.label}}",
data: {{ label.total }},
color: "{{ label.color }}",
},
{% endfor %}
];
var plotObj = $.plot($("#floatsubdonut{{ milestone.id }}-{{ data.id }}"), data, {
series: {
pie: {
show: true,
label: {
show: false,
radius: 3/4,
threshold: 0.1,
background: {
opacity: 0.5,
color: '#cdcdcd',
},
}
}
},
legend: {
show: false,
},
});
{% for sprint in jalon.sprints %}
var data = [
{% for column in sprint.columns %}
{
label: "{{ column.nmcol}}",
data: {{ column.nbjrs }},
color: "#{{ column.color }}",
},
{% endfor %}
];
var plotObj = $.plot($("#floatdonut{{ jalon.idjal~"-"~sprint.idspr }}"), data, {
series: {
pie: {
show: true,
radius: 1,
label: {
show: true,
radius: 1,
threshold: 0.1,
background: {
opacity: 0.5,
color: '#cdcdcd',
},
formatter: function(label, series) {
return '<span style="color:#000; padding:3px;">' + label + '</span>';
}
}
}
},
legend: {
show: false,
},
});
{% endfor %}
{% endfor %}
{% endfor %}
{% if not showfilters %}
$("#filters").addClass("d-none");

View File

@ -37,26 +37,6 @@
<input type="number" id="filterticket" class=" form-control">
</div>
{% if id == 0 %}
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre CATEGORIES</label>
<select id="filtercategorys" multiple="multiple" class="form-control">
{% for giteacategory in giteacategorys %}
<option value="{{giteacategory}}">{{giteacategory}}</option>
{% endfor %}
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre PROJETS</label>
<select id="filterrepos" multiple="multiple" class="form-control">
{% for gitearepo in gitearepos %}
<option value="{{gitearepo.id}}">{{gitearepo.full_name}}</option>
{% endfor %}
</select>
</div>
{% endif %}
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre JALONS</label>
<select id="filtermilestones" multiple="multiple" class="form-control">
@ -66,6 +46,18 @@
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre SPRINT</label>
<select id="filtersprints" multiple="multiple" class="form-control">
{% for sprint in sprints %}
<option value="{{sprint.giteamilestone~"-"~sprint.id}}">{{sprint.giteamilestonename}}-{{sprint.name}}</option>
{% endfor %}
{% for giteamilestone in giteamilestones %}
<option value="{{giteamilestone.id~"--100"}}">{{giteamilestone.title}}-Aucun</option>
{% endfor %}
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre STATUTS</label>
<select id="filtercolumns" multiple="multiple" class="form-control">
@ -143,7 +135,7 @@
<a class="btn btn-success" href="{{path('app_scrum_stat',{id:id})}}"><i class="fas fa-chart-area"></i></a>
{% endif %}
<span id="textfilters"></span>
<a class="btn btn-success float-right" href="{{path('app_issuescrum',{id:id,'fgcsv':true})}}">Export CSV</a>
<a class="btn btn-success float-right" href="{{path('app_scrum_table',{id:id,'fgcsv':true})}}">Export CSV</a>
</div>
@ -153,6 +145,7 @@
<th class="no-sort"></th>
{%if id==0 %}<th style="width:100px">Projet</th>{%endif%}
<th style="width:200px">Jalon</th>
<th style="width:200px">Sprint</th>
<th style="width:200px">Type</th>
<th style="width:70px"class="no-string">N°</th>
<th style="width:1000px">Titre</th>
@ -182,13 +175,9 @@
{% if tosee %}
{% set dataticket = giteaissue.number %}
{% set datarepo = gitearepo.id %}
{% set datamilestone = (giteaissue.milestone?giteaissue.milestone.id:-100) %}
{% set datasprint = datamilestone~"-"~giteaissue.sprintid %}
{% if giteaissue.milestone %}
{% set datamilestone = giteaissue.milestone.id %}
{%else%}
{% set datamilestone = gitearepo.full_name %}
{%endif%}
{% set statut = "Backlog" %}
{% set teams = "" %}
{% set types = "" %}
@ -221,12 +210,13 @@
{% set dataassignees=dataassignees~','~assignee.username %}
{% endfor %}
<tr data-category="{{gitearepo.category}}" data-repo="{{datarepo}}" data-milestone="{{datamilestone}}" data-ticket="{{dataticket}}" data-column="{{statut}}" data-teams="{{datateams}}" data-prioritys="{{dataprioritys}}" data-types="{{datatypes}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
<tr data-milestone="{{datamilestone}}" data-sprint="{{datasprint}}" data-ticket="{{dataticket}}" data-column="{{statut}}" data-teams="{{datateams}}" data-prioritys="{{dataprioritys}}" data-types="{{datatypes}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
<td>
<a target="_blank" class="btn btn-link fa fa-file" href="{{giteaissue.html_url}}"></a>
</td>
{%if id==0 %}<td>{{ gitearepo.full_name }}</td>{%endif%}
<td>{% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%}</td>
<td>{% if giteaissue.sprintid %}{{ giteaissue.sprintname }} {%endif%}</td>
<td>{{ types|raw }}</td>
<td>{{ giteaissue.number }}</td>
<td>
@ -320,9 +310,8 @@
function showhide() {
textfilters="";
ticketfilter=$("#filterticket").val();
categoryfilters=$("#filtercategorys").val();
repofilters=$("#filterrepos").val();
milestonefilters=$("#filtermilestones").val();
sprintfilters=$("#filtersprints").val();
columnfilters=$("#filtercolumns").val();
teamfilters=$("#filterteams").val();
priorityfilters=$("#filterprioritys").val();
@ -340,6 +329,7 @@
{% endif %}
ticket= $(el).data('ticket');
milestone = $(el).data('milestone');
sprint = $(el).data('sprint');
column = $(el).data('column');
teams = $(el).data('teams').split(',');
prioritys = $(el).data('prioritys').split(',');
@ -373,6 +363,11 @@
toreturn=false;
}
if(sprintfilters.length!==0 && jQuery.inArray(sprint.toString(), sprintfilters )<0) {
toreturn=false;
}
if(columnfilters.length!==0 && jQuery.inArray(column.toString(), columnfilters )<0) {
toreturn=false;
}
@ -439,26 +434,6 @@
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>TICKET</b> ="+ticketfilter;
}
{% if id == 0 %}
if(categoryfilters.length!==0) {
data = $("#filtercategorys").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>CATEGORIES</b> =";
$.each(categoryfilters, function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
if(repofilters.length!==0) {
data = $("#filterrepos").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>PROJETS</b> =";
$.each(repofilters, function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
{% endif %}
if(milestonefilters.length!==0) {
data = $("#filtermilestones").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>JALONS</b> =";
@ -468,6 +443,15 @@
});
}
if(sprintfilters.length!==0) {
data = $("#filtersprints").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>SPRINTS</b> =";
$.each(sprintfilters, function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
if(columnfilters.length!==0) {
data = $("#filtercolumns").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>STATUS</b> =";
@ -537,36 +521,6 @@
table.draw();
}
{% if id == 0 %}
function filtercategorys() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtercategorys',
id:{{id}},
value: $("#filtercategorys").val()
}
});
showhide();
}
function filterrepos() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterrepos',
id:{{id}},
value: $("#filterrepos").val()
}
});
showhide();
}
{% endif %}
function filtermilestones() {
$.ajax({
method: "POST",
@ -581,6 +535,20 @@
showhide();
}
function filtersprints() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtersprints',
id:{{id}},
value: $("#filtersprints").val()
}
});
showhide();
}
function filtercolumns() {
$.ajax({
method: "POST",
@ -732,36 +700,6 @@
});
$(document).ready(function() {
{% if id== 0 %}
$('#filtercategorys').select2();
{% if filtercategorys %}
{% for category in filtercategorys %}
$("#filtercategorys").val($("#filtercategorys").val().concat("{{category}}"));
{%endfor%}
$('#filtercategorys').trigger('change');
{% endif %}
$('#filtercategorys').on("select2:select", function(e) {
filtercategorys();
});
$('#filtercategorys').on("select2:unselect", function(e) {
filtercategorys();
});
$('#filterrepos').select2();
{% if filterrepos %}
{% for repo in filterrepos %}
$("#filterrepos").val($("#filterrepos").val().concat("{{repo}}"));
{%endfor%}
$('#filterrepos').trigger('change');
{% endif %}
$('#filterrepos').on("select2:select", function(e) {
filterrepos();
});
$('#filterrepos').on("select2:unselect", function(e) {
filterrepos();
});
{% endif %}
$("#filterticket").on("keyup", function() {
showhide();
});
@ -780,6 +718,20 @@
filtermilestones();
});
$('#filtersprints').select2();
{% if filtersprints %}
{% for sprint in filtersprints %}
$("#filtersprints").val($("#filtersprints").val().concat("{{sprint}}"));
{%endfor%}
$('#filtersprints').trigger('change');
{% endif %}
$('#filtersprints').on("select2:select", function(e) {
filtersprints();
});
$('#filtersprints').on("select2:unselect", function(e) {
filtersprints();
});
$('#filtercolumns').select2();
{% if filtercolumns %}
{% for column in filtercolumns %}

View File

@ -58,6 +58,18 @@
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre SPRINT</label>
<select id="filtersprints" multiple="multiple" class="form-control">
{% for sprint in sprints %}
<option value="{{sprint.giteamilestone~"-"~sprint.id}}">{{sprint.giteamilestonename}}-{{sprint.name}}</option>
{% endfor %}
{% for giteamilestone in giteamilestones %}
<option value="{{giteamilestone.id~"--100"}}">{{giteamilestone.title}}-Aucun</option>
{% endfor %}
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre TYPES</label>
<select id="filtertypes" multiple="multiple" class="form-control">
@ -115,10 +127,13 @@
<div style="color:var(--colorftbodydark);zoom:75%;" class="mt-5">
{% for giteamilestone in giteamilestones %}
{{giteamilestone.title}} = <span id="total{{giteamilestone.id}}" class="totalweight">0</span><br>
{% endfor %}
Aucun = <span id="total-100" class="totalweight">0</span><br>
<table>
{% for jalon in tbestim %}
<tr>
<td>{{jalon.nmjal}}</td>
<td><span id="total{{jalon.gijal}}" class="totalweight">{{jalon.nbjrs}}</span></td>
{% endfor %}
</table>
</div>
</div>
@ -130,160 +145,137 @@
<div class="mt-4" style="zoom:80%">
<button class="btn btn-success" onClick="showFilters()"><i class="fas fa-filter"></i></button>
<a class="btn btn-success" href="{{path('app_issuescrum',{id:scrum.id})}}"><i class="fas fa-ticket-alt"></i></a>
<a class="btn btn-success" href="{{path('app_scrum_table',{id:scrum.id})}}"><i class="fas fa-ticket-alt"></i></a>
<a class="btn btn-success" href="{{path('app_scrum_stat',{id:scrum.id})}}"><i class="fas fa-chart-area"></i></a>
<a href="{{giteaUrl}}/{{scrum.giteajson.owner.login}}/{{scrum.giteajson.name}}/issues/new" class="btn btn-success" target="_blank">Nouveau Ticket</a>
<span id="textfilters"></span>
</div>
{% for column in scrum.scrumcolumns %}
{% set idmiletone="-100" %}
{% set tbidmiletone=[] %}
{% set haveissues=false %}
<div class="card d-inline-block mt-3 align-top mb-5" data-column="{{column.giteaid}}" style="width: 18rem;">
<div class="card-header">{{ column.name }}</div>
{% for column in tbissues %}
<div class="d-inline-block mt-3 align-top mb-5 p-2" data-column="{{column.gicol}}" style="width: 18rem;">
<h2 style="text-transform: uppercase; text-align:center; font-size:28px">{{ column.nmcol }}</h2>
<div class="card-body p-1">
{% for issue in column.scrumissues %}
{% set tosee=false %}
{% if app.session.get('viewclosed')=="true" and issue.giteastate=="closed" %}
{% set tosee=true %}
{% endif %}
{% if issue.giteastate!="closed" %}
{% set tosee=true %}
{% endif %}
{% for jalon in column.jalons %}
{% for sprint in jalon.sprints %}
<div class="card mb-3" data-column="{{column.gicol}}" data-milestone="{{jalon.gijal}}" data-sprint="{{sprint.idspr}}" data-millestonesprint="{{jalon.gijal~"-"~sprint.idspr}}">
<div class="card-header p-1" style="font-size:16px">
JALON = {{jalon.nmjal}}<br>
SPRINT = {{sprint.nmspr}}
</div>
{% if tosee %}
{% set haveissues=true %}
{% if idmiletone!=issue.giteamilestone %}
{% if idmiletone!=-100 %}</ul>{% endif %}
{% if issue.giteamilestone is empty %}
{% set tbidmiletone = tbidmiletone|merge([-100]) %}
{% set idmilestone = -100 %}
{% set namemilestone = "Aucun" %}
{% else %}
{% set tbidmiletone = tbidmiletone|merge([issue.giteamilestone]) %}
{% set idmilestone = issue.giteamilestone %}
{% set namemilestone = issue.giteajson.milestone.title %}
{% endif %}
<h3 data-milestone="{{idmilestone}}">JALON = {{namemilestone}}</h3>
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}">
{% set idmiletone=issue.giteamilestone %}
{% endif %}
{% set datalabels="" %}
{% set datateams="" %}
{% set datatypes="" %}
{% set dataprioritys="datapriority"~giteaprioritys|last %}
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteateams %}
{% set datateams=datateams~"datateam"~label.id~" " %}
{% endif %}
{% if label.id not in giteacolumns and label.id in giteatypes %}
{% set datatypes=datatypes~"datatype"~label.id~" " %}
{% endif %}
{% if label.id not in giteacolumns and label.id in giteaprioritys %}
{% set dataprioritys="datapriority"~label.id~" " %}
{% endif %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteatypes and label.id not in giteaprioritys %}
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
{% endif %}
{% endfor %}
{% set dataassignees="" %}
{% for assignee in issue.giteajson.assignees %}
{% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %}
{% endfor %}
<div id="issu{{ issue.id }}" data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}" class="card mb-1 issue issue-{{issue.id}} {{datateams}} {{datatypes}} {{dataprioritys}} {{datalabels}} {{dataassignees}} state-{{issue.giteastate}}">
<div class="card-footer p-1" style="line-height:10px; border-top:none;">
<div class="float-left btn btn-link p-0 m-0 fas fa-arrows-alt" style="cursor:move"></div>
<a target="_blank" class="modcolumn btn btn-link float-right fa fa-file p-0 m-0" href="{{issue.giteajson.html_url}}"></a>
</div>
<div class="card-body p-1" style="line-height:10px;">
<div>
<small>
{{issue.giteanumber}} - {{ issue.giteatitle }}<br><br>
<small>Crée le {{issue.giteajson.created_at|date("d/m/y")}}</small><small style ="float:right">Modifié le {{issue.giteajson.updated_at|date("d/m/y")}}</small>
{% if issue.giteastate=="closed" %}
<br><small>Clos le {{issue.giteajson.closed_at|date("d/m/y")}}</small>
<div class="card-body p-1">
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{column.gicol}}" data-milestone="{{jalon.gijal}}" data-sprint="{{sprint.idspr}}" data-millestonesprint="{{jalon.gijal~"-"~sprint.idspr}}">
{% for issue in sprint.issues %}
{% set tosee=false %}
{% if app.session.get('viewclosed')=="true" and issue.giteastate=="closed" %}
{% set tosee=true %}
{% endif %}
{% if issue.giteastate!="closed" %}
{% set tosee=true %}
{% endif %}
<br><br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteaprioritys %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteatypes %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteateams %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteaprioritys and label.id not in giteatypes %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
{% if tosee %}
{% set datalabels="" %}
{% set datateams="" %}
{% set datatypes="" %}
{% set dataprioritys="datapriority"~giteaprioritys|last %}
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteateams %}
{% set datateams=datateams~"datateam"~label.id~" " %}
{% endif %}
<div>
{% for assignee in issue.giteajson.assignees %}
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
{% endfor %}
</div>
{% if label.id not in giteacolumns and label.id in giteatypes %}
{% set datatypes=datatypes~"datatype"~label.id~" " %}
{% endif %}
<div id="modissu{{ issue.id }}" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}" type="button" class="modissu btn btn-link float-right">
<i class="fas fa-weight-hanging"></i> = <span id="issue{{issue.id}}-weight">{{ issue.weight }}</span>
</div>
</small>
</div>
{% if label.id not in giteacolumns and label.id in giteaprioritys %}
{% set dataprioritys="datapriority"~label.id~" " %}
{% endif %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteatypes and label.id not in giteaprioritys %}
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
{% endif %}
{% endfor %}
{% set dataassignees="" %}
{% for assignee in issue.giteajson.assignees %}
{% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %}
{% endfor %}
<div id="issu{{ issue.id }}" data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-column="{{column.gicol}}" data-milestone="{{jalon.gijal}}" data-sprint="{{sprint.idspr}}" class="card mb-1 issue issue-{{issue.id}} {{datateams}} {{datatypes}} {{dataprioritys}} {{datalabels}} {{dataassignees}} state-{{issue.giteastate}}">
<div class="card-footer p-1" style="line-height:10px; border-top:none;">
<div class="float-left btn btn-link p-0 m-0 fas fa-arrows-alt" style="cursor:move"></div>
<a target="_blank" class="modcolumn btn btn-link float-right fa fa-file p-0 m-0" href="{{issue.giteajson.html_url}}"></a>
</div>
<div class="card-body p-1" style="line-height:10px;">
<div>
<small>
{{issue.giteanumber}} - {{ issue.giteatitle }}<br><br>
<small>Crée le {{issue.giteajson.created_at|date("d/m/y")}}</small><small style ="float:right">Modifié le {{issue.giteajson.updated_at|date("d/m/y")}}</small>
{% if issue.giteastate=="closed" %}
<br><small>Clos le {{issue.giteajson.closed_at|date("d/m/y")}}</small>
{% endif %}
<br><br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteaprioritys %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteatypes %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteateams %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteaprioritys and label.id not in giteatypes %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<div>
{% for assignee in issue.giteajson.assignees %}
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
{% endfor %}
</div>
<div id="modissu{{ issue.id }}" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}" type="button" class="modissu btn btn-link float-right">
<i class="fas fa-weight-hanging"></i> = <span id="issue{{issue.id}}-weight">{{ issue.weight }}</span>
</div>
</small>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
{% if haveissues %}
</ul>
{% endif %}
{% for giteamilestone in giteamilestones %}
{% if giteamilestone.id not in tbidmiletone %}
<h3 data-milestone="{{giteamilestone.id}}"> JALON = {{giteamilestone.title}}</h3>
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{ column.giteaid }}" data-milestone="{{giteamilestone.id}}"></ul>
{% endif %}
{%endfor%}
{% if -100 not in tbidmiletone %}
<h3 data-milestone="-100"> JALON = Aucun</h3>
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{ column.giteaid }}" data-milestone="-100"></ul>
{% endif %}
</div>
</div>
{% endfor %}
@ -316,9 +308,6 @@
{% endblock %}
{% block localjavascript %}
function showFilters() {
if($("#filters").hasClass("d-flex")) {
toshow=0;
@ -345,7 +334,9 @@
$(document).ready(function() {
// Apply Filter
function showhide() {
if($("#filtermilestones").val().length !== 0) {
// Afficher masquer les jalons
if($("#filtermilestones").val().length !== 0 && $("#filtersprints").val().length === 0) {
$("[data-milestone]").hide();
$.each($("#filtermilestones").val(), function( index, value ) {
$("[data-milestone="+value+"]").show();
@ -353,6 +344,15 @@
}
else $("[data-milestone]").show();
// Afficher masquer les sprints
if($("#filtersprints").val().length !== 0) {
$("[data-millestonesprint]").hide();
$.each($("#filtersprints").val(), function( index, value ) {
$("[data-millestonesprint="+value+"]").show();
});
}
else if($("#filtermilestones").val().length === 0)$("[data-millestonesprint]").show();
$(".issue").show();
$( ".issue" ).each(function( index ) {
@ -419,6 +419,15 @@
});
}
if($("#filtersprints").val().length!==0) {
data = $("#filtersprints").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>SPRINT</b> =";
$.each($("#filtersprints").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
if($("#filterteams").val().length!==0) {
data = $("#filterteams").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
@ -557,6 +566,35 @@
filtermilestones();
});
// Filter Sprint
function filtersprints() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtersprints',
id:{{scrum.id}},
value: $("#filtersprints").val()
}
});
showhide();
}
$('#filtersprints').select2({sorter: data => data.sort((a, b) => a.text.localeCompare(b.text)),});
{% if filtersprints %}
{% for sprint in filtersprints %}
$("#filtersprints").val($("#filtersprints").val().concat("{{sprint}}"));
{%endfor%}
$('#filtersprints').trigger('change');
{% endif %}
$('#filtersprints').on("select2:select", function(e) {
filtersprints();
});
$('#filtersprints').on("select2:unselect", function(e) {
filtersprints();
});
// Filter Teams
function filterteams() {
$.ajax({
@ -750,12 +788,13 @@
id=$(ui.item).data("issue");
oldcolumn=$(ui.item).data("column");
oldmilestone=$(ui.item).data("milestone");
oldsprint=$(ui.item).data("sprint");
newcolumn=$(ui.item).parent().data("column");
newmilestone=$(ui.item).parent().data("milestone");
console.log("ID = "+id+" = Column : "+oldcolumn+">>"+newcolumn+" = Milestone : "+oldmilestone+">>"+newmilestone );
if(oldcolumn!=newcolumn||oldmilestone!=newmilestone) {
newsprint=$(ui.item).parent().data("sprint");
console.log("ID = "+id+" = Column : "+oldcolumn+">>"+newcolumn+" = Milestone : "+oldmilestone+">>"+newmilestone+" = Sprint : "+oldsprint+">>"+newsprint );
if(oldcolumn!=newcolumn||oldmilestone!=newmilestone||oldsprint!=newsprint) {
$.ajax({
method: "POST",
url: "{{path("app_scrumissue_change")}}",
@ -763,12 +802,15 @@
id:id,
oldcolumn:oldcolumn,
oldmilestone:oldmilestone,
oldsprint:oldsprint,
newcolumn:newcolumn,
newmilestone:newmilestone,
newsprint:newsprint
},
success: function(data) {
$(ui.item).data("column",newcolumn);
$(ui.item).data("milestone",newmilestone);
$(ui.item).data("sprint",newsprint);
if(data) lastupdate=data;
refreshinfo();
@ -814,7 +856,7 @@
}
}
});
}, 60000);
}, 6000);
});
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block body %}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
window.parent.$("#mymodalsprint").modal('hide');
});
{% endblock %}

View File

@ -0,0 +1,51 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
{{ form_widget(form.submit) }}
<button class="btn btn-secondary" onClick="closeModal();">Annuler</button>
{% if mode=="update" %}
<a href="{{ path('app_scrumsprint_delete',{'id':scrumsprint.id}) }}"
class="btn btn-danger float-right"
data-method="delete"
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.giteamilestone) }}
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$("#scrumsprint_name").focus();
});
function closeModal() {
window.parent.$("#mymodaltype").modal('hide');
}
{% endblock %}

View File

@ -66,8 +66,6 @@
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="nav navbar-nav">
<li class="nav-item"><a href="{{path("app_scrum")}}">Scrums</a></li>
<a href="{{path("app_issue")}}">Issues</a>
</ul>
</div>