Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/projects #39

Merged
merged 84 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
7c695c9
model adjustments
jeppekroghitk Dec 7, 2023
7e66cc6
entity adjustments
jeppekroghitk Dec 7, 2023
68b4ae7
repository adjustments
jeppekroghitk Dec 7, 2023
104dc52
Adjusting billigservice naming
jeppekroghitk Dec 7, 2023
d999f4e
Adjusted code to fit Leantime data
jeppekroghitk Dec 7, 2023
f860074
added client crud
jeppekroghitk Dec 7, 2023
c107211
Styled new client twig
jeppekroghitk Dec 7, 2023
ba1761c
Styled client index twig
jeppekroghitk Dec 7, 2023
6774e61
Added Client to menu
jeppekroghitk Dec 8, 2023
47fb9f7
Edit view as content
jeppekroghitk Dec 8, 2023
da2a6c9
Cleaned up client form
jeppekroghitk Dec 8, 2023
5ece69b
added account crud
jeppekroghitk Dec 12, 2023
b1147ef
added account controller
jeppekroghitk Dec 12, 2023
ebddae0
Reverted naming to original
jeppekroghitk Dec 13, 2023
0e1168f
Added new models, collection models and reverted some renaming
jeppekroghitk Dec 13, 2023
abcbce5
Reverted milestoneRepository to versionRepository
jeppekroghitk Dec 13, 2023
6171816
Reverted epic renaming
jeppekroghitk Dec 13, 2023
5f88aa6
Implemented new methods, reverted some naming
jeppekroghitk Dec 13, 2023
081ba11
Sync leantime projects, issues, worklogs
jeppekroghitk Dec 13, 2023
da3b5ba
Added default value to model construct
jeppekroghitk Dec 14, 2023
3bd903b
includes
jeppekroghitk Dec 14, 2023
4921441
Fixed token reference
jeppekroghitk Dec 14, 2023
12a47f2
Undid model changes in construct
jeppekroghitk Dec 14, 2023
9986a87
undid model construct changes
jeppekroghitk Dec 14, 2023
6b5aa3e
Reverted defining values directly in constructor
jeppekroghitk Dec 14, 2023
25797fd
coding standards
jeppekroghitk Dec 14, 2023
520e397
coding standards
jeppekroghitk Dec 14, 2023
fbb8bbb
Removed excess accountType
jeppekroghitk Jan 2, 2024
8331722
Account crud styling
jeppekroghitk Jan 2, 2024
ffec7bd
adding pricelist entity
jeppekroghitk Jan 3, 2024
3d99b48
adding pricelist entity crud
jeppekroghitk Jan 3, 2024
3f85de6
added pricelist navigation
jeppekroghitk Jan 4, 2024
0f7126d
method renaming, coding standards
jeppekroghitk Jan 4, 2024
d71d6f3
readding pricelist crud with updated entity
jeppekroghitk Jan 4, 2024
6e31c3f
coding standards
jeppekroghitk Jan 4, 2024
0b0143c
further coding standards
jeppekroghitk Jan 4, 2024
f66afc4
Branch alignment and coding standards
jeppekroghitk Jan 11, 2024
e4bc2f0
Aligned billigservice with develop
jeppekroghitk Jan 11, 2024
934a009
Removing create project
jeppekroghitk Jan 11, 2024
169d71e
Rewritten some methods to return objects
jeppekroghitk Jan 11, 2024
f5e3af6
Fixed broken endpoint calls + alignment
jeppekroghitk Jan 11, 2024
db3f82d
coding standards
jeppekroghitk Jan 11, 2024
b008bae
updated changelog
jeppekroghitk Jan 11, 2024
e41505f
Generated migration
jeppekroghitk Jan 11, 2024
fb5a2c9
removed faulty migration
jeppekroghitk Jan 11, 2024
d7f1da9
#182: Added migrations file
tuj Jan 11, 2024
ffb349a
Remove readded unused functions
jeppekroghitk Jan 12, 2024
3a54df0
minor corrections
jeppekroghitk Jan 12, 2024
977c0f5
alignment
jeppekroghitk Jan 12, 2024
36468e7
pricelist extends AbstractBaseEntity - removed id
jeppekroghitk Jan 12, 2024
e2e972a
Price list created + updated fields migration
jeppekroghitk Jan 12, 2024
98419ee
added translations for client, account, pricelist
jeppekroghitk Jan 12, 2024
4fb1994
typo fixes
jeppekroghitk Jan 12, 2024
a5e3a4f
coding standards
jeppekroghitk Jan 12, 2024
5da8291
Added missing translation
jeppekroghitk Jan 15, 2024
94c77d2
Fixed issue sync issue
jeppekroghitk Jan 15, 2024
4c411a4
Fitted customer and accounts twig to fit synced data
jeppekroghitk Jan 15, 2024
f2ed1c8
translation yaml formatting
jeppekroghitk Jan 15, 2024
80fa10e
coding standards
jeppekroghitk Jan 15, 2024
675055b
coding standards
jeppekroghitk Jan 15, 2024
61e4279
fixed displaying client type in table view
jeppekroghitk Jan 15, 2024
750c012
Merge branch 'develop' into feature/projects
jeppekroghitk Jan 15, 2024
41f6302
Removed projecttrackerid and source fiels for edit and creation
jeppekroghitk Jan 16, 2024
325c887
removed projecttrackerid from edit and creation
jeppekroghitk Jan 16, 2024
2433b0a
Removed unused function and outcommented code
jeppekroghitk Jan 16, 2024
9de737a
Streamlining edit forms
jeppekroghitk Jan 16, 2024
51cde69
Merge branch 'develop' into feature/projects
jeppekroghitk Jan 16, 2024
f3b0da7
Merge branch 'feature/projects' of github.com:itk-dev/economics into …
tuj Jan 16, 2024
83074c2
#182: Removed PriceList. Adjusted home and navigation
tuj Jan 17, 2024
c939a99
#182: Aligned account templates with other templates
tuj Jan 17, 2024
493a9c9
#182: Aligned client templates
tuj Jan 17, 2024
9001633
#182: Cleaned up account form
tuj Jan 17, 2024
e2dd995
#182: Fixed client form
tuj Jan 17, 2024
68069c1
#182: Added null case to choice
tuj Jan 17, 2024
9951781
#182: Changed class
tuj Jan 17, 2024
596464b
Merge pull request #63 from itk-dev/feature/projects-adjustments
tuj Jan 18, 2024
1680336
#182: Added filter to issues to compensate for broken Leantime API
tuj Jan 18, 2024
44cae63
#182: Added filter to issues and worklogs from leantime
tuj Jan 18, 2024
1baad93
#182: Added option to disable a data provider
tuj Jan 18, 2024
0447974
#182: Added username as worklog.worker
tuj Jan 18, 2024
025e210
#182: Applied coding standards
tuj Jan 18, 2024
6e4fb3b
#182: Added required searchCriteria to getProjectIssuesPaged
tuj Jan 19, 2024
f0be9a1
Merge pull request #64 from itk-dev/feature/projects-sync-adjustments
tuj Jan 19, 2024
3d13aa5
#182: Removed unused code
tuj Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

* Added commands to manage data providers.
* Changed how errors are handled in Leantime api calls.
* Modified getSprintReportData to work with Leantime data
* Added project lead to client when syncing projects.
Expand All @@ -30,6 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Refactored error handling.
* Added support for multiple data providers
* Removed project creator for Jira.
* Added client view.
* Added account view.
* Added leantime support for projects and project sync.


* RELEASE NOTES:
Expand Down
31 changes: 31 additions & 0 deletions migrations/Version20240118132209.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240118132209 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE data_provider ADD enabled TINYINT(1) DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE data_provider DROP enabled');
}
}
8 changes: 5 additions & 3 deletions src/Command/DataProviderCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use Symfony\Component\Console\Style\SymfonyStyle;

#[AsCommand(
name: 'app:project-tracker:create',
description: 'Create a new Project Tracker',
name: 'app:data-provider:create',
description: 'Create a new Data Provider',
)]
class DataProviderCreateCommand extends Command
{
Expand All @@ -37,7 +37,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$question->setAutocompleterValues(DataProviderService::IMPLEMENTATIONS);
$class = $io->askQuestion($question);

$dataProvider = $this->dataProviderService->createDataProvider($name, $class, $url, $secret, false, false);
$dataProvider = $this->dataProviderService->createDataProvider($name, $class, $url, $secret);
$dataProvider->setCreatedBy('CLI');
$dataProvider->setUpdatedBy('CLI');

$text = "Created the following data provider\n\n";
$text .= 'ID: '.$dataProvider->getId()."\n";
Expand Down
48 changes: 48 additions & 0 deletions src/Command/DataProviderListCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace App\Command;

use App\Entity\DataProvider;
use App\Repository\DataProviderRepository;
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;

#[AsCommand(
name: 'app:data-provider:list',
description: 'List data providers',
)]
class DataProviderListCommand extends Command
{
public function __construct(
private readonly DataProviderRepository $dataProviderRepository
) {
parent::__construct($this->getName());
}

protected function configure(): void
{
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$dataProviders = $this->dataProviderRepository->findAll();

/* @var DataProvider $provider */
$io->table(['id', 'name', 'enabled', 'class', 'url', 'sync clients', 'sync accounts'], array_map(fn ($provider) => [
$provider->getId(),
$provider->getName(),
$provider->isEnabled() ? 'true' : 'false',
$provider->getClass(),
$provider->getUrl(),
$provider->isEnableClientSync(),
$provider->isEnableAccountSync(),
], $dataProviders));

return Command::SUCCESS;
}
}
54 changes: 54 additions & 0 deletions src/Command/DataProviderSetEnableCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Command;

use App\Repository\DataProviderRepository;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

#[AsCommand(
name: 'app:data-provider:set-enable',
description: 'Enable/disable a data provider',
)]
class DataProviderSetEnableCommand extends Command
{
public function __construct(
private readonly DataProviderRepository $dataProviderRepository
) {
parent::__construct($this->getName());
}

protected function configure(): void
{
$this->addArgument('id', InputArgument::REQUIRED, 'data provider id');
$this->addArgument('enable', InputArgument::REQUIRED, 'data provider enable');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$id = (int) $input->getArgument('id');
$enable = $input->getArgument('enable');

$dataProvider = $this->dataProviderRepository->find($id);

if (null != $dataProvider) {
$dataProvider->setEnabled('true' == $enable);
$dataProvider->setUpdatedBy('CLI');
$this->dataProviderRepository->save($dataProvider, true);

$io->info('Data provider with id: '.$dataProvider->getId().' '.($dataProvider->isEnabled() ? 'enabled' : 'disabled'));

return Command::SUCCESS;
} else {
$io->error('Data provider not found');

return Command::FAILURE;
}
}
}
2 changes: 1 addition & 1 deletion src/Command/SyncAccountsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$dataProviders = $this->dataProviderRepository->findAll();
$dataProviders = $this->dataProviderRepository->findBy(['enabled' => true]);

foreach ($dataProviders as $dataProvider) {
$io->info('Processing accounts in '.$dataProvider->getName());
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$io->info('Processing projects');

$dataProviders = $this->dataProviderRepository->findAll();
$dataProviders = $this->dataProviderRepository->findBy(['enabled' => true]);

foreach ($dataProviders as $dataProvider) {
$this->dataSynchronizationService->syncProjects(function ($i, $length) use ($io) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncIssuesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$dataProviders = $this->dataProviderRepository->findAll();
$dataProviders = $this->dataProviderRepository->findBy(['enabled' => true]);

foreach ($dataProviders as $dataProvider) {
$projects = $this->projectRepository->findBy(['include' => true, 'dataProvider' => $dataProvider]);
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncProjectsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$dataProviders = $this->dataProviderRepository->findAll();
$dataProviders = $this->dataProviderRepository->findBy(['enabled' => true]);

foreach ($dataProviders as $dataProvider) {
$this->dataSynchronizationService->syncProjects(function ($i, $length) use ($io) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncWorklogsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);

$dataProviders = $this->dataProviderRepository->findAll();
$dataProviders = $this->dataProviderRepository->findBy(['enabled' => true]);

foreach ($dataProviders as $dataProvider) {
$projects = $this->projectRepository->findBy(['include' => true, 'dataProvider' => $dataProvider]);
Expand Down
82 changes: 82 additions & 0 deletions src/Controller/AccountController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace App\Controller;

use App\Entity\Account;
use App\Form\AccountType;
use App\Repository\AccountRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[Route('/admin/account')]
class AccountController extends AbstractController
{
#[Route('/', name: 'app_account_index', methods: ['GET'])]
public function index(AccountRepository $accountRepository): Response
{
return $this->render('account/index.html.twig', [
'accounts' => $accountRepository->findAll(),
]);
}

#[Route('/new', name: 'app_account_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$account = new Account();
$form = $this->createForm(AccountType::class, $account);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($account);
$entityManager->flush();

return $this->redirectToRoute('app_account_index', [], Response::HTTP_SEE_OTHER);
}

return $this->render('account/new.html.twig', [
'account' => $account,
'form' => $form,
]);
}

#[Route('/{id}', name: 'app_account_show', methods: ['GET'])]
public function show(Account $account): Response
{
return $this->render('account/show.html.twig', [
'account' => $account,
]);
}

#[Route('/{id}/edit', name: 'app_account_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Account $account, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(AccountType::class, $account);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();

return $this->redirectToRoute('app_account_index', [], Response::HTTP_SEE_OTHER);
}

return $this->render('account/edit.html.twig', [
'account' => $account,
'form' => $form,
]);
}

#[Route('/{id}', name: 'app_account_delete', methods: ['POST'])]
public function delete(Request $request, Account $account, EntityManagerInterface $entityManager): Response
{
$token = $request->request->get('_token');
if (is_string($token) && $this->isCsrfTokenValid('delete'.$account->getId(), $token)) {
$entityManager->remove($account);
$entityManager->flush();
}

return $this->redirectToRoute('app_account_index', [], Response::HTTP_SEE_OTHER);
}
}
82 changes: 82 additions & 0 deletions src/Controller/ClientController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace App\Controller;

use App\Entity\Client;
use App\Form\ClientType;
use App\Repository\ClientRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[Route('/admin/client')]
class ClientController extends AbstractController
{
#[Route('/', name: 'app_client_index', methods: ['GET'])]
public function index(ClientRepository $clientRepository): Response
{
return $this->render('client/index.html.twig', [
'clients' => $clientRepository->findAll(),
]);
}

#[Route('/new', name: 'app_client_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$client = new Client();
$form = $this->createForm(ClientType::class, $client);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($client);
$entityManager->flush();

return $this->redirectToRoute('app_client_index', [], Response::HTTP_SEE_OTHER);
}

return $this->render('client/new.html.twig', [
'client' => $client,
'form' => $form,
]);
}

#[Route('/{id}', name: 'app_client_show', methods: ['GET'])]
public function show(Client $client): Response
{
return $this->render('client/show.html.twig', [
'client' => $client,
]);
}

#[Route('/{id}/edit', name: 'app_client_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Client $client, EntityManagerInterface $entityManager): Response
{
$form = $this->createForm(ClientType::class, $client);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$entityManager->flush();

return $this->redirectToRoute('app_client_index', [], Response::HTTP_SEE_OTHER);
}

return $this->render('client/edit.html.twig', [
'client' => $client,
'form' => $form,
]);
}

#[Route('/{id}', name: 'app_client_delete', methods: ['POST'])]
public function delete(Request $request, Client $client, EntityManagerInterface $entityManager): Response
{
$token = $request->request->get('_token');
if (is_string($token) && $this->isCsrfTokenValid('delete'.$client->getId(), $token)) {
$entityManager->remove($client);
$entityManager->flush();
}

return $this->redirectToRoute('app_client_index', [], Response::HTTP_SEE_OTHER);
}
}
Loading
Loading