This repository has been archived by the owner on Oct 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 55efda3
Showing
31 changed files
with
2,264 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
###> symfony/framework-bundle ### | ||
/.env | ||
/.env.local | ||
/.env.local.php | ||
/.env.test | ||
/.env.*.local | ||
/config/secrets/prod/prod.decrypt.private.php | ||
/public/bundles/ | ||
/var/ | ||
/vendor/ | ||
###< symfony/framework-bundle ### | ||
###> custom ### | ||
/docker-compose.override.yml | ||
/.idea | ||
/.pdepend | ||
/.composer/cache | ||
###< custom ### | ||
|
||
###> symfony/webpack-encore-bundle ### | ||
/node_modules/ | ||
/public/build/ | ||
npm-debug.log | ||
yarn-error.log | ||
###< symfony/webpack-encore-bundle ### | ||
|
||
###> squizlabs/php_codesniffer ### | ||
/.phpcs-cache | ||
/phpcs.xml | ||
/.php-cs-fixer.cache | ||
###< squizlabs/php_codesniffer ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
## CleverAge/ProcessUIBundle | ||
A simple UX for cleverage/processbundle using EasyAdmin | ||
|
||
**Installation** | ||
* Import routes | ||
```yaml | ||
#config/routes.yaml | ||
process-ui: | ||
resource: '@CleverAgeProcessUiBundle/Resources/config/routes.yaml' | ||
``` | ||
* Run doctrine migration | ||
* Create an user using cleverage:process-ui:user-create console. | ||
Now you can access Process UI via http://your-domain.com/process | ||
**About performance** | ||
In order to make search into ****Process > History**** UI, ProcessUiBundle "index" process logs line into mysql database. | ||
This indexation is made on process end and use symfony/messenger component. | ||
So you can simply say to ProcessUsBundle to index log async. | ||
```yaml | ||
#config/messenger.yaml | ||
framework: | ||
messenger: | ||
transports: | ||
log_index: 'doctrine://default' | ||
|
||
routing: | ||
CleverAge\ProcessUiBundle\Message\LogIndexerMessage: log_index | ||
``` | ||
Then you have to consume messages by running (use a supervisor to keep consumer alive) | ||
``` | ||
bin/console messenger:consume log_index --memory-limit=64M | ||
``` | ||
|
||
See official symfony/messenger component documentations for more informations https://symfony.com/doc/current/messenger.html | ||
|
||
**Integrate CrudController** | ||
|
||
Of course you can integrate ProcessUI CRUD into your own easy admin Dashboard | ||
```php | ||
public function configureMenuItems(): iterable | ||
{ | ||
/* ... your configuration */ | ||
yield MenuItem::linkToCrud('History', null, ProcessExecution::class); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
{ | ||
"name": "cleverage/process-ui-bundle", | ||
"type": "symfony-bundle", | ||
"license": "MIT", | ||
"description": "UI for cleverage/process-bundle", | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"authors": [ | ||
{ | ||
"name": "Baudouin Douliery", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "Grégory Tonon", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=8.0", | ||
"ext-ctype": "*", | ||
"ext-iconv": "*", | ||
"cleverage/process-bundle": "^3.2", | ||
"easycorp/easyadmin-bundle": "^3.5", | ||
"ddtraceweb/monolog-parser": "^1.3", | ||
"composer/package-versions-deprecated": "1.11.99.2", | ||
"doctrine/doctrine-bundle": "^2.4", | ||
"doctrine/doctrine-migrations-bundle": "^3.1", | ||
"doctrine/orm": "^2.9", | ||
"sensio/framework-extra-bundle": "^6.1", | ||
"symfony/console": "*", | ||
"symfony/messenger": "^5.3", | ||
"symfony/doctrine-messenger": "^5.3", | ||
"symfony/dotenv": "5.3.*", | ||
"symfony/filesystem": "5.3.*", | ||
"symfony/flex": "^1.3.1", | ||
"symfony/form": "5.3.*", | ||
"symfony/framework-bundle": "*", | ||
"symfony/mime": "5.3.*", | ||
"symfony/proxy-manager-bridge": "5.3.*", | ||
"symfony/runtime": "5.3", | ||
"symfony/security-bundle": "5.3.*", | ||
"symfony/stopwatch": "^5.3", | ||
"symfony/twig-bundle": "^5.3", | ||
"symfony/validator": "*", | ||
"symfony/webpack-encore-bundle": "^1.11", | ||
"symfony/yaml": "*", | ||
"twig/extra-bundle": "^2.12|^3.0", | ||
"twig/intl-extra": "^3.3" | ||
}, | ||
"config": { | ||
"optimize-autoloader": true, | ||
"preferred-install": { | ||
"*": "dist" | ||
}, | ||
"sort-packages": true | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"CleverAge\\ProcessUiBundle\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"CleverAge\\ProcessUiBundle\\Tests\\": "tests/" | ||
} | ||
}, | ||
"replace": { | ||
"symfony/polyfill-ctype": "*", | ||
"symfony/polyfill-iconv": "*", | ||
"symfony/polyfill-php72": "*" | ||
}, | ||
"scripts": { | ||
"auto-scripts": { | ||
"cache:clear": "symfony-cmd", | ||
"assets:install %PUBLIC_DIR%": "symfony-cmd" | ||
}, | ||
"post-install-cmd": [ | ||
"@auto-scripts" | ||
], | ||
"post-update-cmd": [ | ||
"@auto-scripts" | ||
] | ||
}, | ||
"conflict": { | ||
"symfony/symfony": "*" | ||
}, | ||
"extra": { | ||
"symfony": { | ||
"allow-contrib": false, | ||
"require": "5.3.*" | ||
} | ||
}, | ||
"require-dev": { | ||
"doctrine/doctrine-fixtures-bundle": "^3.4", | ||
"phpmd/phpmd": "^2.10", | ||
"phpstan/phpstan": "^0.12.89", | ||
"squizlabs/php_codesniffer": "^3.6", | ||
"symfony/maker-bundle": "^1.31", | ||
"symfony/web-profiler-bundle": "^5.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
_process-ui: | ||
prefix: '/process' | ||
resource: ../src/Controller/ | ||
type: annotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
parameters: | ||
uploads_directory: '%kernel.project_dir%/public/uploads' | ||
cleverage_processes: '%kernel.project_dir%/config/packages' | ||
process_logs_dir: '%kernel.logs_dir%/process' | ||
|
||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
bind: | ||
$processLogDir: '%process_logs_dir%' | ||
|
||
CleverAge\ProcessUiBundle\: | ||
resource: '../src' | ||
exclude: | ||
- '../src/DependencyInjection/' | ||
- '../src/Entity/' | ||
- '../src/Tests/' | ||
- '../src/Migrations' | ||
|
||
CleverAge\ProcessUiBundle\Monolog\Handler\ProcessLogHandler: | ||
arguments: ['%process_logs_dir%'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"devDependencies": { | ||
"@symfony/stimulus-bridge": "^2.0.0", | ||
"@symfony/webpack-encore": "^1.0.0", | ||
"core-js": "^3.0.0", | ||
"regenerator-runtime": "^0.13.2", | ||
"sass": "^1.34.1", | ||
"stimulus": "^2.0.0", | ||
"webpack-notifier": "^1.6.0" | ||
}, | ||
"license": "UNLICENSED", | ||
"private": true, | ||
"scripts": { | ||
"dev-server": "encore dev-server", | ||
"dev": "encore dev", | ||
"watch": "encore dev --watch", | ||
"build": "encore production --progress" | ||
}, | ||
"dependencies": { | ||
"@popperjs/core": "^2.9.2", | ||
"bootstrap": "^5.0.1", | ||
"font-awesome": "^4.7.0", | ||
"sass-loader": "11" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
|
||
<arg name="basepath" value="."/> | ||
<arg name="cache" value=".phpcs-cache"/> | ||
<arg name="colors"/> | ||
<arg name="extensions" value="php"/> | ||
|
||
<rule ref="PSR12"/> | ||
|
||
<file>bin/</file> | ||
<file>config/</file> | ||
<file>public/</file> | ||
<file>src/</file> | ||
<file>tests/</file> | ||
|
||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
namespace CleverAge\ProcessUiBundle; | ||
|
||
use CleverAge\ProcessUiBundle\DependencyInjection\Compiler\RegisterLogHandlerCompilerPass; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class CleverAgeProcessUiBundle extends Bundle | ||
{ | ||
public const ICON_NEW = 'fa fa-plus'; | ||
public const ICON_EDIT = 'far fa-edit'; | ||
public const ICON_DELETE = 'fa fa-trash-o'; | ||
public const LABEL_NEW = false; | ||
public const LABEL_EDIT = false; | ||
public const LABEL_DELETE = false; | ||
public const CLASS_NEW = ''; | ||
public const CLASS_EDIT = 'text-warning'; | ||
public const CLASS_DELETE = ''; | ||
|
||
|
||
public function build(ContainerBuilder $container): void | ||
{ | ||
parent::build($container); | ||
$container->addCompilerPass(new RegisterLogHandlerCompilerPass()); | ||
} | ||
|
||
public function getPath(): string | ||
{ | ||
return \dirname(__DIR__); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
namespace CleverAge\ProcessUiBundle\Command; | ||
|
||
use CleverAge\ProcessUiBundle\Entity\ProcessExecution; | ||
use CleverAge\ProcessUiBundle\Repository\ProcessExecutionRepository; | ||
use Doctrine\Persistence\ManagerRegistry; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputDefinition; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
class PurgeProcessExecution extends Command | ||
{ | ||
private ManagerRegistry $managerRegistry; | ||
|
||
private string $processLogDir; | ||
|
||
/** | ||
* @required | ||
*/ | ||
public function setManagerRegistry(ManagerRegistry $managerRegistry): void | ||
{ | ||
$this->managerRegistry = $managerRegistry; | ||
} | ||
|
||
/** | ||
* @required | ||
*/ | ||
public function setProcessLogDir(string $processLogDir): void | ||
{ | ||
$this->processLogDir = $processLogDir; | ||
} | ||
|
||
protected function configure(): void | ||
{ | ||
$this->setName('cleverage:process-ui:purge'); | ||
$this->setDescription('Purge process_execution table.'); | ||
$this->setDefinition( | ||
new InputDefinition([ | ||
new InputOption('days', 'd', InputOption::VALUE_OPTIONAL, 'Days to keep. Default 180', 180), | ||
new InputOption('remove-files', 'rf', InputOption::VALUE_NEGATABLE, 'Remove log files ? (default false)', false) | ||
]) | ||
); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$days = $input->getOption('days'); | ||
$removeFiles = $input->getOption('remove-files'); | ||
$date = new \DateTime(); | ||
$date->modify("-$days day"); | ||
if ($removeFiles) { | ||
$finder = new Finder(); | ||
$fs = new Filesystem(); | ||
$finder->in($this->processLogDir)->date("before " . $date->format(\DateTime::ATOM)); | ||
$count = $finder->count(); | ||
$fs->remove($finder); | ||
$output->writeln("<info>$count log files are deleted on filesystem.</info>"); | ||
} | ||
/** @var ProcessExecutionRepository $repository */ | ||
$repository = $this->managerRegistry->getRepository(ProcessExecution::class); | ||
$repository->deleteBefore($date); | ||
|
||
$output->writeln('<info>Process Execution before '.$date->format(\DateTime::ATOM).' are deleted into database.</info>'); | ||
return Command::SUCCESS; | ||
} | ||
} |
Oops, something went wrong.