From 1cc4db4943080d09b4fddd2ac366e9cd240dabd9 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 9 Jul 2025 22:12:43 +0200 Subject: [PATCH] svg --- src/Controller/IssueController.php | 6 +- src/Entity/Issue.php | 41 +++++++++ src/Service/RedmineService.php | 12 ++- templates/issue/view.html.twig | 34 ++++--- templates/project/view.html.twig | 142 +++++++++++++++++++++++++++-- 5 files changed, 207 insertions(+), 28 deletions(-) diff --git a/src/Controller/IssueController.php b/src/Controller/IssueController.php index 6f6756e..4ebc912 100644 --- a/src/Controller/IssueController.php +++ b/src/Controller/IssueController.php @@ -38,7 +38,7 @@ class IssueController extends AbstractController } #[Route('/user/issue/order/{id}', name: 'app_issue_order', methods: ['POST'])] - public function orderIssue(int $id, Request $request): JsonResponse + public function orderIssue(int $id, Request $request, IssueRepository $issueRepository): JsonResponse { $data = $request->request; @@ -57,8 +57,8 @@ class IssueController extends AbstractController $allowed = false; if (in_array($id, $targetIssues)) { // Verifier que l'on a la permission de changer de statut - $rissue = $this->redmineService->getIssue($id, $this->getParameter('redmineApikey')); - foreach ($rissue['allowed_statuses'] as $status) { + $issue = $issueRepository->find($id); + foreach ($issue->getRedmine()['allowed_statuses'] as $status) { if ($status['id'] == $targetStatus) { $allowed = true; break; diff --git a/src/Entity/Issue.php b/src/Entity/Issue.php index 33a1abb..3fac425 100644 --- a/src/Entity/Issue.php +++ b/src/Entity/Issue.php @@ -3,6 +3,8 @@ namespace App\Entity; use App\Repository\IssueRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: IssueRepository::class)] @@ -32,6 +34,25 @@ class Issue #[ORM\JoinColumn(nullable: false)] private Project $project; + #[ORM\ManyToOne(targetEntity: Issue::class, inversedBy: 'childs')] + #[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')] + private ?Issue $parent = null; + + #[ORM\OneToMany(targetEntity: Issue::class, mappedBy: 'parent', cascade: ['persist'])] + #[ORM\OrderBy([ + 'rowstatus' => 'ASC', + 'rowsprint' => 'DESC', + 'rowversion' => 'DESC', + 'rowissue' => 'ASC', + 'id' => 'DESC', + ])] + private Collection $childs; + + public function __construct() + { + $this->childs = new ArrayCollection(); + } + public function getId(): ?int { return $this->id; @@ -115,4 +136,24 @@ class Issue return $this; } + + public function getParent(): ?Issue + { + return $this->parent; + } + + public function setParent(?Issue $issue): self + { + $this->parent = $issue; + + return $this; + } + + /** + * @return Collection + */ + public function getChilds(): Collection + { + return $this->childs; + } } diff --git a/src/Service/RedmineService.php b/src/Service/RedmineService.php index 5df4999..ca8464b 100644 --- a/src/Service/RedmineService.php +++ b/src/Service/RedmineService.php @@ -238,6 +238,15 @@ class RedmineService } } } + + // Parent + foreach ($project->getIssues() as $issue) { + $parent = null; + if (array_key_exists('parent', $issue->getRedmine())) { + $parent = $this->issueRepository->find($issue->getRedmine()['parent']['id']); + } + $issue->setParent($parent); + } } public function getProjectIssues(int $projectId, string $apiKey, ?\DateTimeInterface $updatedSince = null): array @@ -251,7 +260,7 @@ class RedmineService 'project_id' => $projectId, 'limit' => $limit, 'offset' => $offset, - 'status_id' => '*', // Inclure toutes les issues + 'status_id' => '*', ]; if (null !== $updatedSince) { @@ -274,6 +283,7 @@ class RedmineService $issues = $data['issues'] ?? []; foreach ($issues as $key => $issue) { + $issues[$key] = $this->getIssue($issue['id'], $apiKey); $issues[$key]['sprint'] = $this->getIssueAgile($issue['id'], $apiKey); } diff --git a/templates/issue/view.html.twig b/templates/issue/view.html.twig index 9a2aad5..a3e8f57 100644 --- a/templates/issue/view.html.twig +++ b/templates/issue/view.html.twig @@ -1,7 +1,7 @@
-
#{{ issue.redmine.id }} – {{ issue.redmine.subject }}
+
#{{ issue.redmine.id }} = {{ issue.redmine.subject }}
@@ -12,8 +12,10 @@
- Statut : {{ issue.redmine.status.name }}
- Priorité : {{ issue.redmine.priority.name }}

+ Tracker = {{issue.redmine.tracker.name}}
+ Catégorie = {{issue.redmine.category is defined?issue.redmine.category.name:''}}
+ Statut = {{ issue.redmine.status.name }}
+ Priorité = {{ issue.redmine.priority.name }}

{% set sprintName = null %} {% for sprint in issue.project.redmine.sprints %} @@ -22,21 +24,23 @@ {% endif %} {% endfor %} {% if sprintName %} - Sprint : {{sprintName}} (Position {{ issue.redmine.sprint.position }})
+ Sprint = {{sprintName}} (Position {{ issue.redmine.sprint.position }})
{% else %} - Sprint : Aucun (Position {{ issue.redmine.sprint.position }})
+ Sprint = Aucun (Position {{ issue.redmine.sprint.position }})
{% endif %} - Version Cible : {{(issue.redmine.fixed_version is defined?issue.redmine.fixed_version.name:'Aucune')}}
- Story Point : {{issue.redmine.sprint.story_points}}
+ Version Cible = {{(issue.redmine.fixed_version is defined?issue.redmine.fixed_version.name:'Aucune')}}
+ Story Point = {{issue.redmine.sprint.story_points}}
- Auteur : {{ issue.redmine.author.name }}
- Progression : {{ issue.redmine.done_ratio }}%
- Créé le :{{ issue.redmine.created_on|date('d/m/Y H:i') }}
- Mis à jour le :{{ issue.redmine.updated_on|date('d/m/Y H:i') }}
- Date de début : {{ issue.redmine.start_date|date('d/m/Y') }}
- Date de fin : {{ issue.redmine.due_date|date('d/m/Y') }}
+ Auteur = {{ issue.redmine.author.name }}
+ Progression = {{ issue.redmine.done_ratio }}%
+ Créé le ={{ issue.redmine.created_on|date('d/m/Y H:i') }}
+ Mis à jour le ={{ issue.redmine.updated_on|date('d/m/Y H:i') }}
+ Date de début = {{ issue.redmine.start_date|date('d/m/Y') }}
+ Date de fin = {{ issue.redmine.due_date|date('d/m/Y') }}

+ + Affecté à = {{(issue.redmine.assigned_to is defined?issue.redmine.assigned_to.name:'')}}
@@ -71,7 +75,7 @@
{% endif %} - {{dump(issue.redmine)}} + {{dump(issue)}} +

-

diff --git a/templates/project/view.html.twig b/templates/project/view.html.twig index 893d66d..d32b857 100644 --- a/templates/project/view.html.twig +++ b/templates/project/view.html.twig @@ -109,9 +109,42 @@ cursor: pointer; } - .issueSubject{ + .issueTitle{ zoom: 70%; flex-grow: 1; + cursor: pointer; + line-height:18px; + } + + .issueParent{ + font-size:12px; + line-height:12px; + color:var(--bs-green); + } + + .issueBody { + font-size:10px; + display:flex; + flex-direction: column; + border-top: 1px solid var(--bs-gray-100); + margin-top:5px; + padding-top:5px; + } + + .issueChilds { + font-size:10px; + display:flex; + flex-direction: column; + border-top: 1px solid var(--bs-gray-100); + margin-top:5px; + padding-top:5px; + line-height:11px; + } + + .issueChild { + display:flex; + cursor: pointer; + margin-top:5px; } .issueContainer table { @@ -140,11 +173,14 @@ } .pulse-highlight { - animation: pulse 1.5s ease-in-out 1; - z-index: 1000; - position: relative; + animation: pulse 1.5s ease-in-out 1; + z-index: 1000; + position: relative; } + .through { + text-decoration: line-through; + } {% endblock %} @@ -205,6 +241,15 @@ + + + {% for sprint in project.redmine.sprints|reverse %} + {% if sprint.story_points is defined and sprint.id not in project.hiddensprints %} + + {% endif %} + {% endfor %} +
{{sprint.name}}{{sprint.story_points.total}}
+
@@ -270,17 +315,38 @@
#{{issue.id}}
-
{{issue.redmine.subject}}
+
+ {% if issue.parent %} +
#{{issue.parent.id}} = {{issue.parent.redmine.subject}}
+ {% endif %} + +
+ {{issue.redmine.subject}} +
+
{{issue.redmine.sprint.story_points}}
- sprint = {{issue.rowsprint}}
- version = {{issue.rowversion}}
- status = {{issue.redmine.status.name}} +
Tracker = {{issue.redmine.tracker.name}}
+
Catégorie = {{issue.redmine.category is defined?issue.redmine.category.name:''}}
+
Affecté à = {{(issue.redmine.assigned_to is defined?issue.redmine.assigned_to.name:'')}}
+
Créé le = {{ issue.redmine.created_on|date('d/m/Y H:i') }}
+
Mis à jour le = {{ issue.redmine.updated_on|date('d/m/Y H:i') }}
+ + {% if issue.childs is not empty %} +
+ {% for child in issue.childs %} +
+
#{{child.id}}
+
{{child.redmine.subject}}
+
+ {% endfor %} +
+ {% endif %}
{% endfor %}
@@ -291,6 +357,8 @@