svg
This commit is contained in:
52
src/Command/RedmineCommand.php
Normal file
52
src/Command/RedmineCommand.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Command;
|
||||||
|
|
||||||
|
use App\Entity\Project;
|
||||||
|
use App\Service\RedmineService;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
|
|
||||||
|
#[AsCommand(
|
||||||
|
name: 'app:redmine',
|
||||||
|
description: 'Refresh Redmine Project',
|
||||||
|
)]
|
||||||
|
class RedmineCommand extends Command
|
||||||
|
{
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
private ParameterBagInterface $params;
|
||||||
|
private RedmineService $redmineService;
|
||||||
|
|
||||||
|
public function __construct(EntityManagerInterface $em, ParameterBagInterface $params, RedmineService $redmineService)
|
||||||
|
{
|
||||||
|
$this->em = $em;
|
||||||
|
$this->params = $params;
|
||||||
|
$this->redmineService = $redmineService;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
$io->title('APP:REDMINE');
|
||||||
|
$io->text('Refresh Redmine Project');
|
||||||
|
$io->text('');
|
||||||
|
|
||||||
|
$projects = $this->em->getRepository(Project::class)->findAll();
|
||||||
|
foreach ($projects as $project) {
|
||||||
|
$io->text('> Project = '.$project->getTitle());
|
||||||
|
$redmine = $this->redmineService->getProject($project->getId(), $this->params->get('redmineApikey'));
|
||||||
|
$project->setRedmine($redmine);
|
||||||
|
$this->em->flush();
|
||||||
|
$this->redmineService->majProjectIssues($project, $this->params->get('redmineApikey'), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
@ -116,9 +116,9 @@ class IssueController extends AbstractController
|
|||||||
$issue = $issueRepository->find($rissue);
|
$issue = $issueRepository->find($rissue);
|
||||||
if ($issue) {
|
if ($issue) {
|
||||||
$issue->setRowissue($key);
|
$issue->setRowissue($key);
|
||||||
$em->flush();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$em->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Controller;
|
|||||||
use App\Entity\Project;
|
use App\Entity\Project;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Form\ProjectType;
|
use App\Form\ProjectType;
|
||||||
|
use App\Repository\IssueRepository;
|
||||||
use App\Repository\ProjectRepository;
|
use App\Repository\ProjectRepository;
|
||||||
use App\Service\RedmineService;
|
use App\Service\RedmineService;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
@ -25,7 +26,7 @@ class ProjectController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/user/project/{id}', name: 'app_project_view')]
|
#[Route('/user/project/{id}', name: 'app_project_view')]
|
||||||
public function viewProject(int $id, ProjectRepository $projectRepository): Response
|
public function viewProject(int $id, ProjectRepository $projectRepository, IssueRepository $issueRepository): Response
|
||||||
{
|
{
|
||||||
$project = $projectRepository->find($id);
|
$project = $projectRepository->find($id);
|
||||||
if (!$project) {
|
if (!$project) {
|
||||||
@ -63,6 +64,7 @@ class ProjectController extends AbstractController
|
|||||||
'usemenu' => true,
|
'usemenu' => true,
|
||||||
'usesidebar' => false,
|
'usesidebar' => false,
|
||||||
'project' => $project,
|
'project' => $project,
|
||||||
|
'issues' => $issueRepository->findIssues($project),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ class Issue
|
|||||||
#[ORM\Column(nullable: true)]
|
#[ORM\Column(nullable: true)]
|
||||||
private ?string $color = null;
|
private ?string $color = null;
|
||||||
|
|
||||||
|
#[ORM\Column(nullable: false)]
|
||||||
|
private bool $isClosed = false;
|
||||||
|
|
||||||
#[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'issues')]
|
#[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'issues')]
|
||||||
#[ORM\JoinColumn(nullable: false)]
|
#[ORM\JoinColumn(nullable: false)]
|
||||||
private Project $project;
|
private Project $project;
|
||||||
@ -130,9 +133,13 @@ class Issue
|
|||||||
|
|
||||||
public function getColor(): ?string
|
public function getColor(): ?string
|
||||||
{
|
{
|
||||||
if($this->color) return $this->color;
|
if ($this->color) {
|
||||||
elseif($this->parent) return $this->parent->getColor();
|
return $this->color;
|
||||||
else return null;
|
} elseif ($this->parent) {
|
||||||
|
return $this->parent->getColor();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setColor(?string $color): static
|
public function setColor(?string $color): static
|
||||||
@ -142,6 +149,18 @@ class Issue
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isClosed(): bool
|
||||||
|
{
|
||||||
|
return $this->isClosed();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setIsClosed(bool $isClosed): static
|
||||||
|
{
|
||||||
|
$this->isClosed = $isClosed;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function getProject(): Project
|
public function getProject(): Project
|
||||||
{
|
{
|
||||||
return $this->project;
|
return $this->project;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\Issue;
|
use App\Entity\Issue;
|
||||||
|
use App\Entity\Project;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@ -16,28 +17,19 @@ class IssueRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, Issue::class);
|
parent::__construct($registry, Issue::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
public function findIssues(Project $project, bool $closed = false): array
|
||||||
// * @return Issue[] Returns an array of Issue objects
|
{
|
||||||
// */
|
$criteria = ['project' => $project];
|
||||||
// public function findByExampleField($value): array
|
if (!$closed) {
|
||||||
// {
|
$criteria['isClosed'] = false;
|
||||||
// return $this->createQueryBuilder('c')
|
}
|
||||||
// ->andWhere('c.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->orderBy('c.id', 'ASC')
|
|
||||||
// ->setMaxResults(10)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function findOneBySomeField($value): ?Issue
|
return $this->findBy($criteria, [
|
||||||
// {
|
'rowstatus' => 'ASC',
|
||||||
// return $this->createQueryBuilder('c')
|
'rowsprint' => 'DESC',
|
||||||
// ->andWhere('c.exampleField = :val')
|
'rowversion' => 'DESC',
|
||||||
// ->setParameter('val', $value)
|
'rowissue' => 'ASC',
|
||||||
// ->getQuery()
|
'id' => 'DESC',
|
||||||
// ->getOneOrNullResult()
|
]);
|
||||||
// ;
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@ class RedmineService
|
|||||||
}
|
}
|
||||||
$issue->setRedmine($rissue);
|
$issue->setRedmine($rissue);
|
||||||
$issue->setProject($project);
|
$issue->setProject($project);
|
||||||
|
$issue->setIsClosed($rissue['status']['is_closed']);
|
||||||
|
|
||||||
// Calcul de la position du status
|
// Calcul de la position du status
|
||||||
$issueStatusId = $rissue['status']['id'];
|
$issueStatusId = $rissue['status']['id'];
|
||||||
|
@ -316,7 +316,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% for issue in project.issues %}
|
{% for issue in issues %}
|
||||||
<div class="issueCard {{issue.color}} card tracker{{issue.redmine.tracker.id}} category{{(issue.redmine.category is defined?issue.redmine.category.id:'0') }}" data-status='{{issue.redmine.status.id}}' data-sprint='{{issue.rowsprint}}' data-version='{{(issue.redmine.fixed_version is defined?issue.redmine.fixed_version.id:'')}}' data-id='{{issue.id}}'>
|
<div class="issueCard {{issue.color}} card tracker{{issue.redmine.tracker.id}} category{{(issue.redmine.category is defined?issue.redmine.category.id:'0') }}" data-status='{{issue.redmine.status.id}}' data-sprint='{{issue.rowsprint}}' data-version='{{(issue.redmine.fixed_version is defined?issue.redmine.fixed_version.id:'')}}' data-id='{{issue.id}}'>
|
||||||
<div class='issueHeader'>
|
<div class='issueHeader'>
|
||||||
<div class='issueId'>#{{issue.id}}</div>
|
<div class='issueId'>#{{issue.id}}</div>
|
||||||
@ -413,7 +413,7 @@
|
|||||||
$column.append($(this));
|
$column.append($(this));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log ('no ='+id);
|
console.log ('no ='+$(this).data('id'));
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -511,7 +511,6 @@
|
|||||||
|
|
||||||
url='{{path('app_issue_view',{id:'xxx'})}}';
|
url='{{path('app_issue_view',{id:'xxx'})}}';
|
||||||
url=url.replace('xxx',issueId);
|
url=url.replace('xxx',issueId);
|
||||||
console.log(url);
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
|
Reference in New Issue
Block a user