mirror of
https://github.com/Karaka-Management/oms-Workflow.git
synced 2026-02-11 03:48:39 +00:00
rector fixes + bug fixes
This commit is contained in:
parent
7cf3ca1098
commit
f8b0914601
|
|
@ -369,7 +369,7 @@
|
||||||
"de": "Zeitgesteuerter Trigger (Job/Task)"
|
"de": "Zeitgesteuerter Trigger (Job/Task)"
|
||||||
},
|
},
|
||||||
"function_type": "Api",
|
"function_type": "Api",
|
||||||
"function": "apiRun",
|
"function": "",
|
||||||
"module": "Workflow",
|
"module": "Workflow",
|
||||||
"function_install": {
|
"function_install": {
|
||||||
"module": "Workflow",
|
"module": "Workflow",
|
||||||
|
|
@ -408,7 +408,7 @@
|
||||||
"de": "Konsolenbefehl"
|
"de": "Konsolenbefehl"
|
||||||
},
|
},
|
||||||
"function_type": "Api",
|
"function_type": "Api",
|
||||||
"function": "apiRun",
|
"function": "",
|
||||||
"module": "Workflow",
|
"module": "Workflow",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"cmd",
|
"cmd",
|
||||||
|
|
@ -443,7 +443,7 @@
|
||||||
"de": "Workflow Script"
|
"de": "Workflow Script"
|
||||||
},
|
},
|
||||||
"function_type": "Api",
|
"function_type": "Api",
|
||||||
"function": "apiRun",
|
"function": "",
|
||||||
"module": "Workflow",
|
"module": "Workflow",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
"{*}"
|
"{*}"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ return [
|
||||||
'^.*/workflow/instance.*$' => [
|
'^.*/workflow/instance.*$' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\Workflow\Controller\CliController:cliWorkflowInstanceCreate',
|
'dest' => '\Modules\Workflow\Controller\CliController:cliWorkflowInstanceCreate',
|
||||||
'verb' => RouteVerb::PUT,
|
'verb' => RouteVerb::ANY,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ use Modules\Media\Models\PathSettings;
|
||||||
use Modules\Workflow\Models\PermissionCategory;
|
use Modules\Workflow\Models\PermissionCategory;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceAbstract;
|
use Modules\Workflow\Models\WorkflowInstanceAbstract;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceAbstractMapper;
|
use Modules\Workflow\Models\WorkflowInstanceAbstractMapper;
|
||||||
use Modules\Workflow\Models\WorkflowStatus;
|
|
||||||
use Modules\Workflow\Models\WorkflowTemplate;
|
use Modules\Workflow\Models\WorkflowTemplate;
|
||||||
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
|
|
@ -497,7 +496,7 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
$job->interval = $settings['settings']['interval'] ?? '';
|
$job->interval = $settings['settings']['interval'] ?? '';
|
||||||
$job->command = 'php '
|
$job->command = 'php '
|
||||||
. FileUtils::absolute(__DIR__ . '/../../../Cli/cli.php')
|
. FileUtils::absolute(__DIR__ . '/../../../cli.php')
|
||||||
. ' /workflow/instance -id '
|
. ' /workflow/instance -id '
|
||||||
. $template->id
|
. $template->id
|
||||||
. ' -trigger 1005500005';
|
. ' -trigger 1005500005';
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Modules\Workflow\Controller;
|
||||||
|
|
||||||
use Modules\Workflow\Models\WorkflowInstance;
|
use Modules\Workflow\Models\WorkflowInstance;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceAbstract;
|
use Modules\Workflow\Models\WorkflowInstanceAbstract;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceMapper;
|
use Modules\Workflow\Models\WorkflowInstanceAbstractMapper;
|
||||||
use Modules\Workflow\Models\WorkflowStatus;
|
use Modules\Workflow\Models\WorkflowStatus;
|
||||||
use Modules\Workflow\Models\WorkflowTemplate;
|
use Modules\Workflow\Models\WorkflowTemplate;
|
||||||
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
||||||
|
|
@ -60,18 +60,14 @@ final class CliController extends Controller
|
||||||
$triggerIsRegex = \stripos($data['@triggerGroup'], '/') === 0;
|
$triggerIsRegex = \stripos($data['@triggerGroup'], '/') === 0;
|
||||||
$matched = false;
|
$matched = false;
|
||||||
|
|
||||||
if ($triggerIsRegex) {
|
$matched = $triggerIsRegex
|
||||||
$matched = \preg_match($data['@triggerGroup'], $hook) === 1;
|
? \preg_match($data['@triggerGroup'], $hook) === 1
|
||||||
} else {
|
: $data['@triggerGroup'] === $hook;
|
||||||
$matched = $data['@triggerGroup'] === $hook;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$matched && \stripos($hook, '/') === 0) {
|
|
||||||
$matched = \preg_match($hook, $data['@triggerGroup']) === 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($matched) {
|
if ($matched) {
|
||||||
$this->runWorkflow($workflow, $hook, $data);
|
$this->runWorkflow($workflow, $hook, $data);
|
||||||
|
} elseif (\stripos($hook, '/') === 0) {
|
||||||
|
$matched = \preg_match($hook, $data['@triggerGroup']) === 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,13 +112,13 @@ final class CliController extends Controller
|
||||||
$response->header->status = RequestStatusCode::R_400;
|
$response->header->status = RequestStatusCode::R_400;
|
||||||
}
|
}
|
||||||
|
|
||||||
$instance = $this->createInstanceFromRequest($request, $response);
|
$instance = $this->createInstanceFromRequest($request);
|
||||||
$this->createModel($request->header->account, $instance, WorkflowInstanceMapper::class, 'instance', $request->getOrigin());
|
$this->createModel($request->header->account, $instance, WorkflowInstanceAbstractMapper::class, 'instance', $request->getOrigin());
|
||||||
$this->startInstance($request, $response, $instance);
|
$this->startInstance($request, $response, $instance);
|
||||||
|
|
||||||
$new = clone $instance;
|
$new = clone $instance;
|
||||||
$new->end = new \DateTime('now');
|
$new->end = new \DateTimeImmutable('now');
|
||||||
$this->updateModel($request->header->account, $instance, $new, WorkflowInstanceMapper::class, 'instance', $request->getOrigin());
|
$this->updateModel($request->header->account, $instance, $new, WorkflowInstanceAbstractMapper::class, 'instance', $request->getOrigin());
|
||||||
|
|
||||||
$view->setTemplate('/Modules/Workflow/Theme/Cli/empty-command');
|
$view->setTemplate('/Modules/Workflow/Theme/Cli/empty-command');
|
||||||
|
|
||||||
|
|
@ -141,7 +137,7 @@ final class CliController extends Controller
|
||||||
private function validateInstanceCreate(RequestAbstract $request) : array
|
private function validateInstanceCreate(RequestAbstract $request) : array
|
||||||
{
|
{
|
||||||
$val = [];
|
$val = [];
|
||||||
if (($val['id'] = !$request->hasData('id'))) {
|
if (($val['id'] = !$request->hasData('-id'))) {
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,7 +159,7 @@ final class CliController extends Controller
|
||||||
{
|
{
|
||||||
/** @var \Modules\Workflow\Models\WorkflowTemplate $template */
|
/** @var \Modules\Workflow\Models\WorkflowTemplate $template */
|
||||||
$template = WorkflowTemplateMapper::get()
|
$template = WorkflowTemplateMapper::get()
|
||||||
->where('id', (int) $request->getData('id'))
|
->where('id', (int) $request->getData('-id'))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$instance = new WorkflowInstance();
|
$instance = new WorkflowInstance();
|
||||||
|
|
@ -185,7 +181,7 @@ final class CliController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($instance->template->schema as $e) {
|
foreach ($instance->template->schema as $e) {
|
||||||
if ($e['id'] === $request->getDataString('trigger')) {
|
if ($e['id'] === $request->getDataString('-trigger')) {
|
||||||
$this->runWorkflowElement($request, $response, $actions, $instance, $e);
|
$this->runWorkflowElement($request, $response, $actions, $instance, $e);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
@ -198,10 +194,12 @@ final class CliController extends Controller
|
||||||
array $actions, WorkflowInstanceAbstract $instance, array $element
|
array $actions, WorkflowInstanceAbstract $instance, array $element
|
||||||
) : void
|
) : void
|
||||||
{
|
{
|
||||||
if (isset($actions[$element['id']])) {
|
if (isset($actions[(int) $element['id']])
|
||||||
|
&& $actions[(int) $element['id']]['function'] !== ''
|
||||||
|
) {
|
||||||
$this->app->moduleManager
|
$this->app->moduleManager
|
||||||
->get($actions[$element['id']]['modules'], $actions[$element['id']]['function_type'])
|
->get($actions[(int) $element['id']]['module'], $actions[(int) $element['id']]['function_type'])
|
||||||
->{$actions[$element['id']]['function']}($request, $response, [$element]);
|
->{$actions[(int) $element['id']]['function']}($request, $response, [$element]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo: currently all children are executed one after another, maybe consider parallel execution
|
// @todo: currently all children are executed one after another, maybe consider parallel execution
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,14 @@ class WorkflowInstanceAbstract
|
||||||
*/
|
*/
|
||||||
public string $title = '';
|
public string $title = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance data.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public string $data = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance status.
|
* Instance status.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<span class="checkmark"></span>
|
<span class="checkmark"></span>
|
||||||
</label>
|
</label>
|
||||||
<td>
|
<td>
|
||||||
|
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||||
<label for="workflowTemplateList-sort-1">
|
<label for="workflowTemplateList-sort-1">
|
||||||
<input type="radio" name="workflowTemplateList-sort" id="workflowTemplateList-sort-1">
|
<input type="radio" name="workflowTemplateList-sort" id="workflowTemplateList-sort-1">
|
||||||
|
|
@ -83,16 +84,6 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<i class="filter fa fa-filter"></i>
|
<i class="filter fa fa-filter"></i>
|
||||||
</label>
|
</label>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if (!empty($parentPath)) : $url = UriFactory::build('{/base}/workflow/template/list?path=' . $parentPath); ?>
|
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
|
||||||
<td>
|
|
||||||
<td data-label="<?= $this->getHtml('Type'); ?>"><a href="<?= $url; ?>"><i class="fa fa-folder-open-o"></i></a>
|
|
||||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>">..
|
|
||||||
</a>
|
|
||||||
<td>
|
|
||||||
<td>
|
|
||||||
<td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php $count = 0; foreach ($templates as $key => $template) : ++$count;
|
<?php $count = 0; foreach ($templates as $key => $template) : ++$count;
|
||||||
$url = UriFactory::build('{/base}/workflow/template/profile?{?}&id=' . $template->id); ?>
|
$url = UriFactory::build('{/base}/workflow/template/profile?{?}&id=' . $template->id); ?>
|
||||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||||
|
|
@ -101,6 +92,7 @@ echo $this->getData('nav')->render(); ?>
|
||||||
<span class="checkmark"></span>
|
<span class="checkmark"></span>
|
||||||
</label>
|
</label>
|
||||||
<td>
|
<td>
|
||||||
|
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml((string) $template->id); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->name); ?></a>
|
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->name); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $template->createdBy->id); ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$template->createdBy->name1, $template->createdBy->name2, $template->createdBy->name3, $template->createdBy->login ?? ''])); ?></a>
|
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $template->createdBy->id); ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$template->createdBy->name1, $template->createdBy->name2, $template->createdBy->name3, $template->createdBy->login ?? ''])); ?></a>
|
||||||
<td data-label="<?= $this->getHtml('Updated'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->createdAt->format('Y-m-d')); ?></a>
|
<td data-label="<?= $this->getHtml('Updated'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->createdAt->format('Y-m-d')); ?></a>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user