svg
This commit is contained in:
parent
4506d3c259
commit
d35ae80af5
|
@ -139,6 +139,10 @@ app_user_profil:
|
||||||
path: /user/profil
|
path: /user/profil
|
||||||
defaults: { _controller: App\Controller\UserController:profil }
|
defaults: { _controller: App\Controller\UserController:profil }
|
||||||
|
|
||||||
|
app_user_preference:
|
||||||
|
path: /user/preference
|
||||||
|
defaults: { _controller: App\Controller\UserController:preference }
|
||||||
|
|
||||||
#== Group ========================================================================================================
|
#== Group ========================================================================================================
|
||||||
app_group:
|
app_group:
|
||||||
path: /admin/group
|
path: /admin/group
|
||||||
|
@ -207,3 +211,7 @@ app_scrumcolumn_order:
|
||||||
app_scrumissue_change:
|
app_scrumissue_change:
|
||||||
path: /user/scrumissue/change
|
path: /user/scrumissue/change
|
||||||
defaults: { _controller: App\Controller\ScrumissueController:change }
|
defaults: { _controller: App\Controller\ScrumissueController:change }
|
||||||
|
|
||||||
|
app_scrumissue_order:
|
||||||
|
path: /user/scrumissue/order
|
||||||
|
defaults: { _controller: App\Controller\ScrumissueController:order }
|
||||||
|
|
|
@ -157,17 +157,62 @@ class ScrumController extends AbstractController
|
||||||
$firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$data], ['rowid' => 'ASC']);
|
$firstcolumn=$em->getRepository('App:Scrumcolumn')->findOneBy(["scrum"=>$data], ['rowid' => 'ASC']);
|
||||||
if(!$firstcolumn) return $this->redirectToRoute($this->route."_update",["id"=>$data->getId()]);
|
if(!$firstcolumn) return $this->redirectToRoute($this->route."_update",["id"=>$data->getId()]);
|
||||||
|
|
||||||
|
// Récupérer la premier column scrum
|
||||||
|
$columns=$em->getRepository('App:Scrumcolumn')->findBy(["scrum"=>$data], ['rowid' => 'ASC']);
|
||||||
|
$giteacolumns=[];
|
||||||
|
foreach($columns as $column) {
|
||||||
|
array_push($giteacolumns,$column->getGiteaid());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupérer la orga de gitea
|
||||||
|
if(!empty($data->getGiteajson()["owner"]["email"]))
|
||||||
|
$giteaassignees=[$data->getGiteajson()["owner"]];
|
||||||
|
else
|
||||||
|
$giteaassignees=[];
|
||||||
|
|
||||||
|
$giteateams=$this->giteaservice->getOrgateams($data->getGiteajson()["owner"]["login"]);
|
||||||
|
if($giteateams) {
|
||||||
|
foreach($giteateams as $team) {
|
||||||
|
$giteamembers=$this->giteaservice->getTeammembers($team->id);
|
||||||
|
foreach($giteamembers as $giteamember) {
|
||||||
|
if(!in_array($giteamember,$giteaassignees))
|
||||||
|
array_push($giteaassignees,$giteamember);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$giteacollaborators=$this->giteaservice->getCollaborators($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
|
||||||
|
if(!is_array($giteacollaborators)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
|
||||||
|
foreach($giteacollaborators as $giteacollaborator) {
|
||||||
|
if(!in_array($giteacollaborator,$giteaassignees))
|
||||||
|
array_push($giteaassignees,$giteacollaborator);
|
||||||
|
}
|
||||||
|
|
||||||
// Récupérer les milestones de gitea
|
// Récupérer les milestones de gitea
|
||||||
$giteamilestones=$this->giteaservice->getMilestones($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
|
$giteamilestones=$this->giteaservice->getMilestones($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
|
||||||
if(!is_array($giteamilestones)) die("Probleme de connexion avec gitea veuillez vous <a href='logout'>reconnecter</a>");
|
if(!is_array($giteamilestones)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
|
||||||
|
$keysort = array_column($giteamilestones, 'title');
|
||||||
|
array_multisort($keysort, SORT_DESC, $giteamilestones);
|
||||||
|
|
||||||
|
// Récupérer les labels de gitea
|
||||||
|
$gitealabels=$this->giteaservice->getLabels($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
|
||||||
|
if(!is_array($gitealabels)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
|
||||||
|
foreach($gitealabels as $key => $gitealabel) {
|
||||||
|
if(in_array($gitealabel->id,$giteacolumns))
|
||||||
|
unset($gitealabels[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
// Récupérer les issues de gitea
|
// Récupérer les issues de gitea
|
||||||
$giteaissues=$this->giteaservice->getIssues($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
|
$giteaissues=$this->giteaservice->getIssues($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]);
|
||||||
if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='logout'>reconnecter</a>");
|
if(!is_array($giteaissues)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
|
||||||
|
|
||||||
// Génération des issues
|
// Génération des issues
|
||||||
$tbgiteaissues=[];
|
$tbgiteaissues=[];
|
||||||
foreach($giteaissues as $giteaissue) {
|
foreach($giteaissues as $giteaissue) {
|
||||||
|
// On ne prend pas les pull request
|
||||||
|
if(!is_null($giteaissue->pull_request)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$data,"giteaid"=>$giteaissue->id]);
|
$scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$data,"giteaid"=>$giteaissue->id]);
|
||||||
|
|
||||||
if(!$scrumissue) {
|
if(!$scrumissue) {
|
||||||
|
@ -181,8 +226,14 @@ class ScrumController extends AbstractController
|
||||||
$scrumissue->setGiteanumber($giteaissue->number);
|
$scrumissue->setGiteanumber($giteaissue->number);
|
||||||
$scrumissue->setGiteastate($giteaissue->state);
|
$scrumissue->setGiteastate($giteaissue->state);
|
||||||
$scrumissue->setGiteatitle($giteaissue->title);
|
$scrumissue->setGiteatitle($giteaissue->title);
|
||||||
if($giteaissue->milestone) $scrumissue->setGiteamilestone($giteaissue->milestone->id);
|
if($giteaissue->milestone) {
|
||||||
else $scrumissue->setGiteamilestone(null);
|
$scrumissue->setGiteamilestone($giteaissue->milestone->id);
|
||||||
|
$scrumissue->setGiteamilestonename($giteaissue->milestone->title);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$scrumissue->setGiteamilestone(null);
|
||||||
|
$scrumissue->setGiteamilestonename(null);
|
||||||
|
}
|
||||||
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
|
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
|
||||||
|
|
||||||
$em->persist($scrumissue);
|
$em->persist($scrumissue);
|
||||||
|
@ -200,6 +251,7 @@ class ScrumController extends AbstractController
|
||||||
}
|
}
|
||||||
if(!$havecolumn) $scrumissue->setScrumcolumn($firstcolumn);
|
if(!$havecolumn) $scrumissue->setScrumcolumn($firstcolumn);
|
||||||
|
|
||||||
|
// Sauvegarde de l'issue
|
||||||
$em->persist($scrumissue);
|
$em->persist($scrumissue);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
}
|
}
|
||||||
|
@ -211,11 +263,22 @@ class ScrumController extends AbstractController
|
||||||
$em->flush();
|
$em->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Préférences utilisateur
|
||||||
|
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
|
||||||
|
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
|
||||||
|
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
|
||||||
|
|
||||||
return $this->render($this->render.'view.html.twig', [
|
return $this->render($this->render.'view.html.twig', [
|
||||||
'useheader' => true,
|
'useheader' => true,
|
||||||
'usesidebar' => false,
|
'usesidebar' => false,
|
||||||
|
'giteaassignees' => $giteaassignees,
|
||||||
|
'giteacolumns' => $giteacolumns,
|
||||||
'giteamilestones' => $giteamilestones,
|
'giteamilestones' => $giteamilestones,
|
||||||
|
'gitealabels' => $gitealabels,
|
||||||
|
'filtermilestones' => $filtermilestones,
|
||||||
|
'filterlabels' => $filterlabels,
|
||||||
|
'filterassignees' => $filterassignees,
|
||||||
$this->data => $data,
|
$this->data => $data,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ class ScrumissueController extends AbstractController
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$id=$request->get('id');
|
$id=$request->get('id');
|
||||||
$oldlabel=$request->get('oldlabel');
|
$oldcolumn=$request->get('oldcolumn');
|
||||||
$newlabel=$request->get('newlabel');
|
$newcolumn=$request->get('newcolumn');
|
||||||
$oldmilestone=$request->get('oldmilestone');
|
$oldmilestone=$request->get('oldmilestone');
|
||||||
$newmilestone=$request->get('newmilestone');
|
$newmilestone=$request->get('newmilestone');
|
||||||
|
|
||||||
|
@ -40,19 +40,18 @@ class ScrumissueController extends AbstractController
|
||||||
$gitealabels=$this->giteaservice->getIssuelabels($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber());
|
$gitealabels=$this->giteaservice->getIssuelabels($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber());
|
||||||
if(!is_array($gitealabels)) return new JsonResponse(['message' => 'No API getIssuelabels'], 403);
|
if(!is_array($gitealabels)) return new JsonResponse(['message' => 'No API getIssuelabels'], 403);
|
||||||
|
|
||||||
// Remplacer l'ancien label par le nouveau
|
// Remplacer l'ancien column par la nouvelle
|
||||||
$newgitelabels=[];
|
$newgitelabels=[];
|
||||||
$haveold=false;
|
$haveold=false;
|
||||||
foreach($gitealabels as $gitealabel) {
|
foreach($gitealabels as $gitealabel) {
|
||||||
if($gitealabel->id!=$oldlabel) array_push($newgitelabels,$gitealabel->id);
|
if($gitealabel->id!=$oldcolumn) array_push($newgitelabels,$gitealabel->id);
|
||||||
else $haveold=true;
|
else $haveold=true;
|
||||||
}
|
}
|
||||||
if(!in_array($newlabel,$newgitelabels)) array_push($newgitelabels,intval($newlabel));
|
if(!in_array($newcolumn,$newgitelabels)) array_push($newgitelabels,intval($newcolumn));
|
||||||
|
|
||||||
// Supprimer l'ancien label
|
// Supprimer l'ancien label
|
||||||
if($haveold) {
|
if($haveold) {
|
||||||
dump($oldlabel);
|
$return=$this->giteaservice->deleteIssuelabel($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber(),$oldcolumn);
|
||||||
$return=$this->giteaservice->deleteIssuelabel($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber(),$oldlabel);
|
|
||||||
if(!$return) return new JsonResponse(['message' => 'No API deleteIssuelabel'], 403);
|
if(!$return) return new JsonResponse(['message' => 'No API deleteIssuelabel'], 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,4 +66,30 @@ class ScrumissueController extends AbstractController
|
||||||
|
|
||||||
return new JsonResponse();
|
return new JsonResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function order(Request $request)
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
$id=$request->get('id');
|
||||||
|
$lstordered=explode(",",$request->get('lstordered'));
|
||||||
|
|
||||||
|
$scrum=$em->getRepository("App:Scrum")->find($id);
|
||||||
|
if(!$scrum) return new JsonResponse(['message' => 'No Scrum'], 403);
|
||||||
|
|
||||||
|
$order=0;
|
||||||
|
foreach($lstordered as $item) {
|
||||||
|
$scrumissue=$em->getRepository("App:Scrumissue")->find($item);
|
||||||
|
if($scrumissue) {
|
||||||
|
$scrumissue->setRowid($order);
|
||||||
|
$order++;
|
||||||
|
$em->persist($scrumissue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
|
||||||
|
return new JsonResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,23 @@ class UserController extends AbstractController
|
||||||
$response->headers->set('Content-Type', 'application/json');
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function preference(Request $request)
|
||||||
|
{
|
||||||
|
// S'assurer que c'est un appel ajax
|
||||||
|
if (!$request->isXmlHttpRequest()) {
|
||||||
|
return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$key=$request->request->get('key');
|
||||||
|
$id=$request->request->get('id');
|
||||||
|
$value=$request->request->get('value');
|
||||||
|
|
||||||
|
$this->getDoctrine()->getManager()->getRepository("App:User")->setUserpreference($this->getUser(),$key,$id,$value);
|
||||||
|
|
||||||
|
return new Response();
|
||||||
|
}
|
||||||
|
|
||||||
protected function getErrorForm($id,$form,$request,$data,$mode) {
|
protected function getErrorForm($id,$form,$request,$data,$mode) {
|
||||||
if ($form->get('submit')->isClicked()&&$mode=="delete") {
|
if ($form->get('submit')->isClicked()&&$mode=="delete") {
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Scrumcolumn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumcolumn", cascade={"persist"}, orphanRemoval=true)
|
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumcolumn", cascade={"persist"}, orphanRemoval=true)
|
||||||
* @ORM\OrderBy({"giteamilestone" = "DESC", "rowid" = "ASC"})
|
* @ORM\OrderBy({"giteamilestonename" = "DESC", "rowid" = "ASC"})
|
||||||
*/
|
*/
|
||||||
private $scrumissues;
|
private $scrumissues;
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,12 @@ class Scrumissue
|
||||||
*/
|
*/
|
||||||
private $giteamilestone;
|
private $giteamilestone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", nullable=true)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private $giteamilestonename;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
*/
|
*/
|
||||||
|
@ -180,5 +186,17 @@ class Scrumissue
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getGiteamilestonename(): ?string
|
||||||
|
{
|
||||||
|
return $this->giteamilestonename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setGiteamilestonename(?string $giteamilestonename): self
|
||||||
|
{
|
||||||
|
$this->giteamilestonename = $giteamilestonename;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -80,6 +80,10 @@ class User implements UserInterface, \Serializable
|
||||||
*/
|
*/
|
||||||
private $apikey;
|
private $apikey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\Column(name="preference", type="array", nullable=true)
|
||||||
|
*/
|
||||||
|
private $preference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToMany(targetEntity="Group", inversedBy="users", cascade={"persist"})
|
* @ORM\ManyToMany(targetEntity="Group", inversedBy="users", cascade={"persist"})
|
||||||
|
@ -321,4 +325,15 @@ class User implements UserInterface, \Serializable
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPreference(): ?array
|
||||||
|
{
|
||||||
|
return $this->preference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPreference(?array $preference): self
|
||||||
|
{
|
||||||
|
$this->preference = $preference;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,46 @@ class UserRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
parent::__construct($registry, User::class);
|
parent::__construct($registry, User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserpreference($user,$key,$id) {
|
||||||
|
// Récupérer les préférences de l'utilisateur
|
||||||
|
$preference=$user->getPreference();
|
||||||
|
|
||||||
|
if(is_array($preference)&&array_key_exists($key,$preference)&&array_key_exists($id,$preference[$key]))
|
||||||
|
return $preference[$key][$id];
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUserpreference($user,$key,$id,$value) {
|
||||||
|
// Récupérer les préférences de l'utilisateur
|
||||||
|
$preference=$user->getPreference();
|
||||||
|
|
||||||
|
// Mise à jour de la préférence
|
||||||
|
$toupdate=false;
|
||||||
|
if(!is_array($preference)) {
|
||||||
|
$toupdate=true;
|
||||||
|
$preference=[];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!array_key_exists($key,$preference)) {
|
||||||
|
$toupdate=true;
|
||||||
|
$preference[$key]=[];
|
||||||
|
}
|
||||||
|
if((!array_key_exists($id,$preference[$key]))) {
|
||||||
|
$toupdate=true;
|
||||||
|
$preference[$key][$id]=$value;
|
||||||
|
}
|
||||||
|
if($preference[$key][$id]!=$value) {
|
||||||
|
$toupdate=true;
|
||||||
|
$preference[$key][$id]=$value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mise à jour des préferences
|
||||||
|
if($toupdate) {
|
||||||
|
$user->setPreference($preference);
|
||||||
|
$this->_em->persist($user);
|
||||||
|
$this->_em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,35 @@ class giteaService
|
||||||
else return $response->body;
|
else return $response->body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getuserprofil($id) {
|
||||||
|
$apiurl = $this->url."/users/$id";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
dump($response);
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getorga($id) {
|
||||||
|
$apiurl = $this->url."/orgs/$id";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getorgateams($id) {
|
||||||
|
$apiurl = $this->url."/orgs/$id/teams";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getteammembers($id) {
|
||||||
|
$apiurl = $this->url."/teams/$id/members";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
public function getrepos() {
|
public function getrepos() {
|
||||||
$apiurl = $this->url."/user/repos";
|
$apiurl = $this->url."/user/repos";
|
||||||
$page=1;
|
$page=1;
|
||||||
|
@ -85,6 +114,20 @@ class giteaService
|
||||||
else return $response->body;
|
else return $response->body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getcollaborators($owner,$name) {
|
||||||
|
$apiurl = $this->url."/repos/$owner/$name/collaborators";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getcollaborator($owner,$name,$id) {
|
||||||
|
$apiurl = $this->url."/repos/$owner/$name/collaborators/$id";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
public function getmilestones($owner,$name) {
|
public function getmilestones($owner,$name) {
|
||||||
$apiurl = $this->url."/repos/$owner/$name/milestones";
|
$apiurl = $this->url."/repos/$owner/$name/milestones";
|
||||||
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
|
|
@ -7,14 +7,72 @@
|
||||||
|
|
||||||
h3 { font-size:14px; margin-top:15px;}
|
h3 { font-size:14px; margin-top:15px;}
|
||||||
#mycontent { width: 5000px;}
|
#mycontent { width: 5000px;}
|
||||||
|
|
||||||
|
.btn-link {
|
||||||
|
cursor:pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-label {
|
||||||
|
margin-bottom:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
border-radius: 5px;
|
||||||
|
padding: 8px 8px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 35px;
|
||||||
|
text-align: center;
|
||||||
|
color: #ffffff !important;
|
||||||
|
zoom: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag i {
|
||||||
|
margin-right:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.assignee {
|
||||||
|
width:30px;
|
||||||
|
margin: 5px 5px 0px 0px;
|
||||||
|
}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
<div class="d-flex justify-content-start mt-3">
|
||||||
|
<div style="width:585px" class="pr-2">
|
||||||
|
<label class="control-label">Filtre JALONS</label>
|
||||||
|
<select id="filtermilestones" multiple="multiple" class="form-control">
|
||||||
|
{% for giteamilestone in giteamilestones %}
|
||||||
|
<option value="{{giteamilestone.id}}">{{giteamilestone.title}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
<option value="-100">Aucun</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width:585px" class="pr-2">
|
||||||
|
<label class="control-label">Filtre ETIQUETTES</label>
|
||||||
|
<select id="filterlabels" multiple="multiple" class="form-control">
|
||||||
|
{% for gitealabel in gitealabels %}
|
||||||
|
<option value="{{gitealabel.id}}">{{gitealabel.name}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width:585px" class="pr-2">
|
||||||
|
<label class="control-label">Filtre AFFECTATIONS</label>
|
||||||
|
<select id="filterassignees" multiple="multiple" class="form-control">
|
||||||
|
{% for giteaassignee in giteaassignees %}
|
||||||
|
<option value="{{giteaassignee.id}}">{{giteaassignee.login}}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% for column in scrum.scrumcolumns %}
|
{% for column in scrum.scrumcolumns %}
|
||||||
{% set idmiletone="-100" %}
|
{% set idmiletone="-100" %}
|
||||||
{% set tbidmiletone=[] %}
|
{% set tbidmiletone=[] %}
|
||||||
{% set haveissues=false %}
|
{% set haveissues=false %}
|
||||||
<div class="card d-inline-block mt-3 align-top mb-5" data-label="{{column.giteaid}}" style="width: 18rem;">
|
<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>
|
<div class="card-header">{{ column.name }}</div>
|
||||||
<div class="card-body p-1">
|
<div class="card-body p-1">
|
||||||
{% for issue in column.scrumissues %}
|
{% for issue in column.scrumissues %}
|
||||||
|
@ -22,22 +80,34 @@
|
||||||
{% if idmiletone!=issue.giteamilestone %}
|
{% if idmiletone!=issue.giteamilestone %}
|
||||||
{% if idmiletone!=-100 %}</ul>{% endif %}
|
{% if idmiletone!=-100 %}</ul>{% endif %}
|
||||||
|
|
||||||
{% if issue.giteamilestone is empty %}
|
|
||||||
<h3> JALON = Aucun</h3>
|
|
||||||
{% else %}
|
|
||||||
<h3> JALON = {{issue.giteajson.milestone.title}}</h3>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if issue.giteamilestone is empty %}
|
{% if issue.giteamilestone is empty %}
|
||||||
{% set tbidmiletone = tbidmiletone|merge([-100]) %}
|
{% set tbidmiletone = tbidmiletone|merge([-100]) %}
|
||||||
|
{% set idmilestone = -100 %}
|
||||||
|
{% set namemilestone = "Aucun" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set tbidmiletone = tbidmiletone|merge([issue.giteamilestone]) %}
|
{% set tbidmiletone = tbidmiletone|merge([issue.giteamilestone]) %}
|
||||||
|
{% set idmilestone = issue.giteamilestone %}
|
||||||
|
{% set namemilestone = issue.giteajson.milestone.title %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<ul class="scrumcolumn list-group" style="min-height:50px" data-label="{{ column.giteaid }}" data-milestone="{{issue.giteamilestone}}">
|
|
||||||
|
<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 %}
|
{% set idmiletone=issue.giteamilestone %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-label="{{ issue.scrumcolumn.giteaid }}" data-milestone="{{issue.giteamilestone}}" class="card mb-1 issue issue-{{issue.id}}">
|
{% set datalabels="" %}
|
||||||
|
{% for label in issue.giteajson.labels %}
|
||||||
|
{% if label.id not in giteacolumns %}
|
||||||
|
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% set dataassignees="" %}
|
||||||
|
{% for assignee in issue.giteajson.assignees %}
|
||||||
|
{% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}" class="card mb-1 issue issue-{{issue.id}} {{datalabels}} {{dataassignees}}">
|
||||||
<div class="card-footer p-1" style="line-height:10px; border-top:none;">
|
<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>
|
<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>
|
<a target="_blank" class="modcolumn btn btn-link float-right fa fa-file p-0 m-0" href="{{issue.giteajson.html_url}}"></a>
|
||||||
|
@ -46,7 +116,22 @@
|
||||||
<div class="card-body p-1" style="line-height:10px;">
|
<div class="card-body p-1" style="line-height:10px;">
|
||||||
<div class="d-inline-block">
|
<div class="d-inline-block">
|
||||||
<small>
|
<small>
|
||||||
{{issue.giteanumber}} - {{ issue.giteatitle }}
|
{{issue.giteanumber}} - {{ issue.giteatitle }}<br><br>
|
||||||
|
|
||||||
|
{% for label in issue.giteajson.labels %}
|
||||||
|
{% if label.id not in giteacolumns %}
|
||||||
|
<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>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,14 +144,14 @@
|
||||||
|
|
||||||
{% for giteamilestone in giteamilestones %}
|
{% for giteamilestone in giteamilestones %}
|
||||||
{% if giteamilestone.id not in tbidmiletone %}
|
{% if giteamilestone.id not in tbidmiletone %}
|
||||||
<h3> JALON = {{giteamilestone.title}}</h3>
|
<h3 data-milestone="{{giteamilestone.id}}"> JALON = {{giteamilestone.title}}</h3>
|
||||||
<ul class="scrumcolumn list-group" style="min-height:50px" data-label="{{ column.giteaid }}" data-milestone="{{giteamilestone.id}}"></ul>
|
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{ column.giteaid }}" data-milestone="{{giteamilestone.id}}"></ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%endfor%}
|
{%endfor%}
|
||||||
|
|
||||||
{% if -100 not in tbidmiletone %}
|
{% if -100 not in tbidmiletone %}
|
||||||
<h3> JALON = Aucun</h3>
|
<h3 data-milestone="-100"> JALON = Aucun</h3>
|
||||||
<ul class="scrumcolumn list-group" style="min-height:50px" data-label="{{ column.giteaid }}" data-milestone=""></ul>
|
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{ column.giteaid }}" data-milestone="-100"></ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,32 +159,158 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block localjavascript %}
|
{% block localjavascript %}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
// Apply Filter
|
||||||
|
function showhide() {
|
||||||
|
if($("#filtermilestones").val().length !== 0) {
|
||||||
|
$("[data-milestone]").hide();
|
||||||
|
$.each($("#filtermilestones").val(), function( index, value ) {
|
||||||
|
$("[data-milestone="+value+"]").show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else $("[data-milestone]").show();
|
||||||
|
|
||||||
|
$(".issue").hide();
|
||||||
|
|
||||||
|
if($("#filterlabels").val().length !== 0) {
|
||||||
|
$( ".issue" ).each(function( index ) {
|
||||||
|
domissue=$(this);
|
||||||
|
$.each($("#filterlabels").val(), function( index, value ) {
|
||||||
|
if (domissue.hasClass("datalabel"+value))
|
||||||
|
domissue.show();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if($("#filterassignees").val().length !== 0) {
|
||||||
|
$( ".issue" ).each(function( index ) {
|
||||||
|
domissue=$(this);
|
||||||
|
$.each($("#filterassignees").val(), function( index, value ) {
|
||||||
|
if (domissue.hasClass("dataassignee"+value))
|
||||||
|
domissue.show();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if($("#filterlabels").val().length === 0 && $("#filterassignees").val().length === 0)
|
||||||
|
$(".issue").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter Milestones
|
||||||
|
function filtermilestones() {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "{{ path('app_user_preference') }}",
|
||||||
|
data: {
|
||||||
|
key:'filtermilestones',
|
||||||
|
id:{{scrum.id}},
|
||||||
|
value: $("#filtermilestones").val()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
showhide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#filtermilestones').select2();
|
||||||
|
{% if filtermilestones %}
|
||||||
|
{% for milestone in filtermilestones %}
|
||||||
|
$("#filtermilestones").val($("#filtermilestones").val().concat("{{milestone}}"));
|
||||||
|
{%endfor%}
|
||||||
|
$('#filtermilestones').trigger('change');
|
||||||
|
{% endif %}
|
||||||
|
$('#filtermilestones').on("select2:select", function(e) {
|
||||||
|
filtermilestones();
|
||||||
|
});
|
||||||
|
$('#filtermilestones').on("select2:unselect", function(e) {
|
||||||
|
filtermilestones();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filter Labels
|
||||||
|
function filterlabels() {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "{{ path('app_user_preference') }}",
|
||||||
|
data: {
|
||||||
|
key:'filterlabels',
|
||||||
|
id:{{scrum.id}},
|
||||||
|
value: $("#filterlabels").val()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
showhide();
|
||||||
|
}
|
||||||
|
$('#filterlabels').select2();
|
||||||
|
{% if filterlabels %}
|
||||||
|
{% for label in filterlabels %}
|
||||||
|
$("#filterlabels").val($("#filterlabels").val().concat("{{label}}"));
|
||||||
|
{%endfor%}
|
||||||
|
$('#filterlabels').trigger('change');
|
||||||
|
{% endif %}
|
||||||
|
$('#filterlabels').on("select2:select", function(e) {
|
||||||
|
filterlabels();
|
||||||
|
});
|
||||||
|
$('#filterlabels').on("select2:unselect", function(e) {
|
||||||
|
filterlabels();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filtre Assignees
|
||||||
|
function filterassignees() {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "{{ path('app_user_preference') }}",
|
||||||
|
data: {
|
||||||
|
key:'filterassignees',
|
||||||
|
id:{{scrum.id}},
|
||||||
|
value: $("#filterassignees").val()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
showhide();
|
||||||
|
}
|
||||||
|
$('#filterassignees').select2();
|
||||||
|
{% if filterassignees %}
|
||||||
|
{% for assignee in filterassignees %}
|
||||||
|
$("#filterassignees").val($("#filterassignees").val().concat("{{assignee}}"));
|
||||||
|
{%endfor%}
|
||||||
|
$('#filterassignees').trigger('change');
|
||||||
|
{% endif %}
|
||||||
|
$('#filterassignees').on("select2:select", function(e) {
|
||||||
|
filterassignees();
|
||||||
|
});
|
||||||
|
$('#filterassignees').on("select2:unselect", function(e) {
|
||||||
|
filterassignees();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Appliy filters
|
||||||
|
showhide();
|
||||||
|
|
||||||
|
// Sort columns
|
||||||
$( ".scrumcolumn" ).sortable({
|
$( ".scrumcolumn" ).sortable({
|
||||||
handle: ".fa-arrows-alt",
|
handle: ".fa-arrows-alt",
|
||||||
connectWith: ".scrumcolumn",
|
connectWith: ".scrumcolumn",
|
||||||
cursor: "move",
|
cursor: "move",
|
||||||
update: function( event, ui ) {
|
update: function( event, ui ) {
|
||||||
id=$(ui.item).data("issue");
|
id=$(ui.item).data("issue");
|
||||||
oldlabel=$(ui.item).data("label");
|
oldcolumn=$(ui.item).data("column");
|
||||||
oldmilestone=$(ui.item).data("milestone");
|
oldmilestone=$(ui.item).data("milestone");
|
||||||
newlabel=$(ui.item).parent().data("label");
|
newcolumn=$(ui.item).parent().data("column");
|
||||||
newmilestone=$(ui.item).parent().data("milestone");
|
newmilestone=$(ui.item).parent().data("milestone");
|
||||||
console.log("ID = "+id+" = Label : "+oldlabel+">>"+newlabel+" = Milestone : "+oldmilestone+">>"+newmilestone );
|
console.log("ID = "+id+" = Column : "+oldcolumn+">>"+newcolumn+" = Milestone : "+oldmilestone+">>"+newmilestone );
|
||||||
|
|
||||||
if(oldlabel!=newlabel||oldmilestone!=newmilestone) {
|
if(oldcolumn!=newcolumn||oldmilestone!=newmilestone) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: "{{path("app_scrumissue_change")}}",
|
url: "{{path("app_scrumissue_change")}}",
|
||||||
data: {
|
data: {
|
||||||
id:id,
|
id:id,
|
||||||
oldlabel:oldlabel,
|
oldcolumn:oldcolumn,
|
||||||
oldmilestone:oldmilestone,
|
oldmilestone:oldmilestone,
|
||||||
newlabel:newlabel,
|
newcolumn:newcolumn,
|
||||||
newmilestone:newmilestone,
|
newmilestone:newmilestone,
|
||||||
},
|
},
|
||||||
success: function() {
|
success: function() {
|
||||||
$(ui.item).data("label",newlabel);
|
$(ui.item).data("column",newcolumn);
|
||||||
$(ui.item).data("milestone",newmilestone);
|
$(ui.item).data("milestone",newmilestone);
|
||||||
},
|
},
|
||||||
error: function (request, status, error) {
|
error: function (request, status, error) {
|
||||||
|
@ -113,10 +324,18 @@
|
||||||
if($(this).data("id")) {
|
if($(this).data("id")) {
|
||||||
if(index==0) lstordered=$(this).data("id");
|
if(index==0) lstordered=$(this).data("id");
|
||||||
else lstordered=lstordered+","+$(this).data("id");
|
else lstordered=lstordered+","+$(this).data("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(lstordered);
|
console.log(lstordered);
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "{{path("app_scrumissue_order")}}",
|
||||||
|
data: {
|
||||||
|
id:{{scrum.id}},
|
||||||
|
lstordered:lstordered,
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue