Skip to content

Commit

Permalink
app_version in log
Browse files Browse the repository at this point in the history
  • Loading branch information
Vítězslav Dvořák committed Jun 20, 2024
1 parent 43d9711 commit 093d43b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 5 deletions.
26 changes: 26 additions & 0 deletions db/migrations/20240620144845_job_app_version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class JobAppVersion extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change(): void
{
$table = $this->table('job');
$table
->addColumn('app_version', 'string', ['default' => 'n/a','comment'=>'version of application in time of launch'])
->save();
}
}
1 change: 1 addition & 0 deletions debian/multiflexi.cron.d
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#Run AbraFlexi scripts once per year
0 0 1 1 * www-data multiflexi-scheduler y
#Schedule ad-hoc actions
* * * * * www-data multiflexi-scheduler i
7 changes: 6 additions & 1 deletion lib/zabbixcompanylld.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
$appsAssigned = $ca->getAll()->leftJoin('apps ON apps.id = companyapp.app_id')->select(['apps.name', 'apps.description', 'apps.id', 'apps.image, apps.code, apps.uuid'], true)->fetchAll('id');
$runtemplates = $ap2c->listingQuery()->leftJoin('company ON company.id = runtemplate.company_id')->select(['runtemplate.id', 'interv', 'company.code AS company_code', 'company.name AS company_name']);

$actions = new \MultiFlexi\ActionConfig();
$succesActions = ActionsChooser::toggles('success');
$failActions = ActionsChooser::toggles('fail');

foreach ($runtemplates as $runtemplateData) {
if (strlen($companyCode) && $companyCode != $runtemplateData['company_code']) {
continue;
Expand All @@ -60,7 +64,8 @@
'{#RUNTEMPLATE}' => $runtemplateData['id'],
'{#COMPANY_NAME}' => $runtemplateData['company_name'],
'{#COMPANY_CODE}' => $runtemplateData['company_code'],
'{#COMPANY_SERVER}' => \Ease\Shared::cfg('ZABBIX_HOST')
'{#COMPANY_SERVER}' => \Ease\Shared::cfg('ZABBIX_HOST'),
'{#DATA_ITEM}' => false
];
} else {
$ap2c->addStatusMessage('Application ' . $runtemplateData['app_id'] . ' is not assigned with company ?');
Expand Down
1 change: 1 addition & 0 deletions src/MultiFlexi/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public function runEnd($statusCode, $stdout, $stderr)
'end' => new \Envms\FluentPDO\Literal(\Ease\Shared::cfg('DB_CONNECTION') == 'sqlite' ? "date('now')" : 'NOW()'),
'stdout' => addslashes($stdout),
'stderr' => addslashes($stderr),
'app_ver' => $this->application->getDataValue('version'),
//'command' => $this->commandline,
'exitcode' => $statusCode
], ['id' => $this->getMyKey()]);
Expand Down
4 changes: 4 additions & 0 deletions src/MultiFlexi/Ui/JobChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public function __construct(\MultiFlexi\Job $engine, $properties = [])
// $this->addJavaScript($graph->fetchJavascript());
}

/**
*
* @return \Envms\FluentPDO\Queries\Select
*/
public function getJobs()
{
return $this->engine->listingQuery()->select(['begin', 'exitcode'], 1)->order('begin');
Expand Down
2 changes: 1 addition & 1 deletion src/MultiFlexi/Ui/JobInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(\MultiFlexi\Job $job, $properties = [])

$jobInfoRow = new \Ease\TWB4\Row();
$jobInfoRow->addColumn(1, [_('Exitcode') . '<br>', new ExitCode($job->getDataValue('exitcode'), ['style' => 'font-size: 2.0em; font-family: monospace;'])]);
$jobInfoRow->addColumn(4, [_('Commandline') . '<br>', $job->getDataValue('command')]);
$jobInfoRow->addColumn(4, [_('Commandline') . '<br>', $job->getDataValue('command'),'<br>', $job->application->getRecordName() . ' v.:' . $job->getDataValue('app_version')]);
$jobInfoRow->addColumn(2, [_('Scheduled') . '<br>', $job->getDataValue('schedule')]);
$jobInfoRow->addColumn(2, [_('Begin') . '<br>', [
$job->getDataValue('begin'),
Expand Down
8 changes: 5 additions & 3 deletions src/job.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Multi Flexi - Job Run Overview.
*
* @author Vítězslav Dvořák <info@vitexsoftware.cz>
* @copyright 2023 Vitex Software
* @copyright 2023-2024 Vitex Software
*/

namespace MultiFlexi\Ui;
Expand All @@ -18,8 +18,10 @@
$oPage->addItem(new PageTop(_('Archived Job Run')));
$jobID = $oPage->getRequestValue('id', 'int');
$jobber = new \MultiFlexi\Job($jobID);
$runTemplate = new \MultiFlexi\RunTemplate();
$runTemplate->setMyKey($runTemplate->runTemplateID($jobber->getDataValue('app_id'), $jobber->getDataValue('company_id')));
$runTemplate = new \MultiFlexi\RunTemplate($jobber->getDataValue('runtemplate_id'));
if(is_null($runTemplate->getMyKey())){ // TODO: Remove
$runTemplate->setMyKey($runTemplate->runTemplateID($jobber->getDataValue('app_id'), $jobber->getDataValue('company_id')));
}
$appInfo = $runTemplate->getAppInfo();
$apps = new Application($appInfo['app_id']);
$instanceName = $appInfo['app_name'];
Expand Down

0 comments on commit 093d43b

Please sign in to comment.