svg
This commit is contained in:
parent
d35ae80af5
commit
59f16701a6
|
@ -13,6 +13,31 @@ use App\Form\ScrumType as Form;
|
||||||
|
|
||||||
use App\Service\giteaService;
|
use App\Service\giteaService;
|
||||||
|
|
||||||
|
class ExecutionTime
|
||||||
|
{
|
||||||
|
private $startTime;
|
||||||
|
private $endTime;
|
||||||
|
|
||||||
|
public function start(){
|
||||||
|
$this->startTime = getrusage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function end(){
|
||||||
|
$this->endTime = getrusage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function runTime($ru, $rus, $index) {
|
||||||
|
return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000))
|
||||||
|
- ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString(){
|
||||||
|
return "This process used " . $this->runTime($this->endTime, $this->startTime, "utime") .
|
||||||
|
" ms for its computations\nIt spent " . $this->runTime($this->endTime, $this->startTime, "stime") .
|
||||||
|
" ms in system calls\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ScrumController extends AbstractController
|
class ScrumController extends AbstractController
|
||||||
{
|
{
|
||||||
private $data = "scrum";
|
private $data = "scrum";
|
||||||
|
@ -26,6 +51,12 @@ class ScrumController extends AbstractController
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$datas = $em->getRepository($this->entity)->findAll();
|
$datas = $em->getRepository($this->entity)->findAll();
|
||||||
|
/*
|
||||||
|
foreach($datas as $data) {
|
||||||
|
dump($data->getGiteajson()["name"]);
|
||||||
|
dump($this->giteaservice->getRepoNotifications($data->getGiteajson()["owner"]["login"],$data->getGiteajson()["name"]));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return $this->render($this->render.'list.html.twig',[
|
return $this->render($this->render.'list.html.twig',[
|
||||||
$this->data."s" => $datas,
|
$this->data."s" => $datas,
|
||||||
|
@ -143,6 +174,9 @@ class ScrumController extends AbstractController
|
||||||
|
|
||||||
public function view($id,Request $request)
|
public function view($id,Request $request)
|
||||||
{
|
{
|
||||||
|
$executionTime = new ExecutionTime();
|
||||||
|
$executionTime->start();
|
||||||
|
|
||||||
// Initialisation de l'enregistrement
|
// Initialisation de l'enregistrement
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$data=$em->getRepository($this->entity)->find($id);
|
$data=$em->getRepository($this->entity)->find($id);
|
||||||
|
@ -171,12 +205,14 @@ class ScrumController extends AbstractController
|
||||||
$giteaassignees=[];
|
$giteaassignees=[];
|
||||||
|
|
||||||
$giteateams=$this->giteaservice->getOrgateams($data->getGiteajson()["owner"]["login"]);
|
$giteateams=$this->giteaservice->getOrgateams($data->getGiteajson()["owner"]["login"]);
|
||||||
if($giteateams) {
|
if($giteateams&&is_array($giteateams)) {
|
||||||
foreach($giteateams as $team) {
|
foreach($giteateams as $team) {
|
||||||
$giteamembers=$this->giteaservice->getTeammembers($team->id);
|
$giteamembers=$this->giteaservice->getTeammembers($team->id);
|
||||||
foreach($giteamembers as $giteamember) {
|
if($giteamembers&&is_array($giteamembers)) {
|
||||||
if(!in_array($giteamember,$giteaassignees))
|
foreach($giteamembers as $giteamember) {
|
||||||
array_push($giteaassignees,$giteamember);
|
if(!in_array($giteamember,$giteaassignees))
|
||||||
|
array_push($giteaassignees,$giteamember);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,6 +305,9 @@ class ScrumController extends AbstractController
|
||||||
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
|
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
|
||||||
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
|
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
|
||||||
|
|
||||||
|
$executionTime->end();
|
||||||
|
//dump($executionTime->__toString());
|
||||||
|
|
||||||
return $this->render($this->render.'view.html.twig', [
|
return $this->render($this->render.'view.html.twig', [
|
||||||
'useheader' => true,
|
'useheader' => true,
|
||||||
'usesidebar' => false,
|
'usesidebar' => false,
|
||||||
|
|
|
@ -57,10 +57,27 @@ class Scrum
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
|
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
|
||||||
* @ORM\OrderBy({"rowid" = "ASC"})
|
* @ORM\OrderBy({"giteamilestonename" = "DESC", "rowid" = "ASC"})
|
||||||
*/
|
*/
|
||||||
private $scrumissues;
|
private $scrumissues;
|
||||||
|
|
||||||
|
public function getStatistique()
|
||||||
|
{
|
||||||
|
$id=-100;
|
||||||
|
$issues=$this->getScrumissues();
|
||||||
|
$tab=[];
|
||||||
|
foreach($issues as $issue) {
|
||||||
|
if($id!=$issue->getGiteamilestone()) {
|
||||||
|
$id=$issue->getGiteamilestone();
|
||||||
|
$label=($issue->getGiteamilestonename()?$issue->getGiteamilestonename():"Aucun");
|
||||||
|
$tab[$id]=[$label,0];
|
||||||
|
}
|
||||||
|
$tab[$id][1]=$tab[$id][1]+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tab;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->users = new ArrayCollection();
|
$this->users = new ArrayCollection();
|
||||||
|
|
|
@ -93,6 +93,13 @@ class giteaService
|
||||||
return $repos;
|
return $repos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getnotifications() {
|
||||||
|
$apiurl = $this->url."/notifications?all=true";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
public function getrepo($id) {
|
public function getrepo($id) {
|
||||||
$apiurl = $this->url."/repositories/$id";
|
$apiurl = $this->url."/repositories/$id";
|
||||||
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
@ -100,6 +107,20 @@ class giteaService
|
||||||
else return $response->body;
|
else return $response->body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getrepocontents($owner,$name) {
|
||||||
|
$apiurl = $this->url."/repos/$owner/$name/contents";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getreponotifications($owner,$name) {
|
||||||
|
$apiurl = $this->url."/repos/$owner/$name/notifications";
|
||||||
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
if(!$response||$response->code!="200") return false;
|
||||||
|
else return $response->body;
|
||||||
|
}
|
||||||
|
|
||||||
public function getlabels($owner,$name) {
|
public function getlabels($owner,$name) {
|
||||||
$apiurl = $this->url."/repos/$owner/$name/labels";
|
$apiurl = $this->url."/repos/$owner/$name/labels";
|
||||||
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
$response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken"));
|
||||||
|
|
|
@ -1,23 +1,38 @@
|
||||||
{% extends "base.html.twig" %}
|
{% extends "base.html.twig" %}
|
||||||
|
|
||||||
|
{% block localstyle %}
|
||||||
|
hr { margin:5px 0px 5px 0px; }
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="mt-1 mb-3">
|
<div class="mt-1 mb-3">
|
||||||
<a class="btn btn-success btn-sm" href={{ path('app_scrum_submit') }}><i class="fa fa-plus mr-2"></i>Ajouter un Scrum</a>
|
<a class="btn btn-success btn-sm" href={{ path('app_scrum_submit') }}><i class="fa fa-plus mr-2"></i>Ajouter un Scrum</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div id="grid" class="margin:auto">
|
||||||
|
|
||||||
{% for scrum in scrums %}
|
{% for scrum in scrums %}
|
||||||
<div class="card float-left mb-1 mr-1" style="width:400px">
|
<div class="card float-left mb-1 mr-1" style="width:374px">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<a href="{{path('app_scrum_view',{id:scrum.id})}}">{{scrum.name}}</a>
|
<a href="{{path('app_scrum_view',{id:scrum.id})}}">{{scrum.name}}</a>
|
||||||
|
|
||||||
<a class="float-right" href="{{path('app_scrum_update',{id:scrum.id})}}"><i class="fas fa-file"></i></a>
|
<a class="float-right" href="{{path('app_scrum_update',{id:scrum.id})}}"><i class="fas fa-file"></i></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p style="min-height:50px">{{scrum.giteajson.description}}</p>
|
<small>
|
||||||
<small><a href="{{scrum.giteajson.html_url}}" target="_blank"">{{scrum.giteajson.html_url}}</a></small>
|
<p style="min-height:35px">
|
||||||
|
{{scrum.giteajson.description}}</p>
|
||||||
|
Nombre de tickets = {{ scrum.scrumissues|length}}<br>
|
||||||
|
{% for statistique in scrum.statistique %}
|
||||||
|
{% if loop.first %}<hr>{%endif%}
|
||||||
|
{{ statistique[0] }} = {{ statistique[1] }}<br>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-footer small">
|
||||||
|
<a href="{{scrum.giteajson.html_url}}" target="_blank"">{{scrum.giteajson.html_url}}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -25,5 +40,8 @@
|
||||||
|
|
||||||
{% block localjavascript %}
|
{% block localjavascript %}
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
$('#grid').masonry({
|
||||||
|
itemSelector: '.card',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue