detail issue

This commit is contained in:
2024-02-21 20:58:38 +01:00
parent 3d949eefce
commit 2df92a3b7f
7 changed files with 297 additions and 198 deletions

View File

@ -12,6 +12,7 @@ use App\Entity\Scrumissue as Entity;
use App\Form\ScrumissueType as Form;
use App\Service\giteaService;
use stdClass;
class ScrumissueController extends AbstractController
{
@ -141,6 +142,68 @@ class ScrumissueController extends AbstractController
return new JsonResponse($output);
}
public function view($id, Request $request) {
$em = $this->getDoctrine()->getManager();
$issue=$em->getRepository("App:Scrumissue")->find($id);
$scrum = $issue->getScrum();
$repoid = $scrum->getGiteaid();
$repoowner = $scrum->getGiteajson()["owner"]["login"];
$reponame = $scrum->getGiteajson()["name"];
$repo=$this->giteaservice->getRepo($repoid);
$giteaissue=$this->giteaservice->getIssue($repoowner,$reponame,$issue->getGiteanumber());
$giteaissue->body = $this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$giteaissue->body);
$giteaissue->comments=$this->giteaservice->getIssueComments($repoowner,$reponame,$giteaissue->number);
$giteaissue->statuslife=$issue->getScrumcolumn()->getName();
$giteaissue->sprint=($issue->getScrumsprint()?$issue->getScrumsprint()->getName():null);
foreach($giteaissue->comments as $keycomment => $comment) {
$giteaissue->comments[$keycomment]->body=$this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$giteaissue->comments[$keycomment]->body);
}
$giteaissue->timelines=$this->giteaservice->getIssueTimelines($repoowner,$reponame,$giteaissue->number);
$giteaissue->labelhistos=[];
$giteaissue->refs=[];
foreach($giteaissue->timelines as $key => $timeline) {
if($timeline->type == "label"){
$tmp=new stdClass();
$tmp->label=($timeline->body==1?"Ajout Label":"Suppression Label")." <i>".$timeline->label->name."<i>";
$tmp->user=$timeline->user;
$tmp->created_at=$timeline->created_at;
array_push($giteaissue->labelhistos,$tmp);
unset($giteaissue->timelines[$key]);
}
elseif($timeline->type == "comment_ref" || $timeline->type == "pull_ref" || $timeline->type == "issue_ref"){
$tmp=new stdClass();
$tmp->label ="<a href='".$timeline->ref_issue->html_url."' target='_blank'>";
$tmp->label.=($timeline->type=="pull_ref"?"Request":"Issue")." = ";
$tmp->label.="#".$timeline->ref_issue->number." = ".$timeline->ref_issue->title."</a></i>";
$tmp->user=$timeline->user;
$tmp->created_at=$timeline->created_at;
array_push($giteaissue->refs,$tmp);
unset($giteaissue->timelines[$key]);
}
}
// Affichage du formulaire
return $this->render('Scrum/issue.html.twig', [
'useheader' => false,
'usesidebar' => false,
'maxwidth' => true,
'repo' => $repo,
'issue' => $giteaissue,
]);
}
public function update(Request $request)
{
$em = $this->getDoctrine()->getManager();