Skip to content

Commit

Permalink
occ command for executing dataloads #16
Browse files Browse the repository at this point in the history
  • Loading branch information
Rello committed Jan 27, 2020
1 parent 853f190 commit 46cc872
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,7 @@ From data to report. This on premise data warehouse solution provides modular da
<job>OCA\Analytics\BackgroundJob\Hourly</job>
<job>OCA\Analytics\BackgroundJob\Daily</job>
</background-jobs>
<commands>
<command>OCA\Analytics\Command\Load</command>
</commands>
</info>
1 change: 1 addition & 0 deletions js/advanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ OCA.Analytics.Advanced.Dataload = {
document.getElementById('dataloadDeleteButton').addEventListener('click', OCA.Analytics.Advanced.Dataload.handleDataloadDeleteButton);
document.getElementById('dataloadSchedule').value = dataload.schedule;
document.getElementById('dataloadSchedule').addEventListener('change', OCA.Analytics.Advanced.Dataload.updateDataload);
document.getElementById('dataloadOCC').innerText = 'occ analytics:load ' + dataload.id;

let item = document.getElementById('dataloadDetailItems');
item.innerHTML = '';
Expand Down
50 changes: 50 additions & 0 deletions lib/Command/Load.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Data Analytics
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the LICENSE.md file.
*
* @author Marcel Scherello <audioplayer@scherello.de>
* @copyright 2020 Marcel Scherello
*/

namespace OCA\Analytics\Command;

use OCA\Analytics\Controller\DataloadController;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class Load extends Command
{

private $DataloadController;

public function __construct(
DataloadController $DataloadController
)
{
$this->DataloadController = $DataloadController;
parent::__construct();
}

protected function configure()
{
$this
->setName('analytics:load')
->setDescription('execute a dataload')
->addArgument(
'dataloadId',
InputArgument::REQUIRED,
'dataload to be executed'
);
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$dataloadId = $input->getArgument('dataloadId');
$this->DataloadController->execute($dataloadId);
}
}
5 changes: 5 additions & 0 deletions templates/part.templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@
<option value="d"><?php p($l->t('daily')); ?></option>
<option value="h"><?php p($l->t('hourly')); ?></option>
</select>
<br><br>
<span><?php p($l->t('Load via occ command:')); ?></span>
<br>
<span id="dataloadOCC"></span>
<br>
<br>
<a href="https://github.com/Rello/analytics/wiki/Scheduled-dataloads"
target="_blank"><?php p($l->t('More information…')); ?></a>
Expand Down

0 comments on commit 46cc872

Please sign in to comment.