mirror of
https://github.com/werkraum-media/thuecat.git
synced 2024-12-05 03:26:13 +01:00
Show last import time beside each import configuration in backend module (#77)
This commit is contained in:
parent
0ae738c1f2
commit
5447b95c0a
6 changed files with 55 additions and 4 deletions
|
@ -26,6 +26,7 @@ namespace WerkraumMedia\ThueCat\Domain\Model\Backend;
|
||||||
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
|
||||||
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
|
||||||
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
|
||||||
use WerkraumMedia\ThueCat\Domain\Import\ImportConfiguration as ImportConfigurationInterface;
|
use WerkraumMedia\ThueCat\Domain\Import\ImportConfiguration as ImportConfigurationInterface;
|
||||||
use WerkraumMedia\ThueCat\Domain\Import\ResolveForeignReference;
|
use WerkraumMedia\ThueCat\Domain\Import\ResolveForeignReference;
|
||||||
|
@ -52,6 +53,11 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI
|
||||||
*/
|
*/
|
||||||
protected $tstamp = null;
|
protected $tstamp = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ObjectStorage<ImportLog>
|
||||||
|
*/
|
||||||
|
protected $logs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[]|null
|
* @var string[]|null
|
||||||
*/
|
*/
|
||||||
|
@ -62,6 +68,11 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI
|
||||||
*/
|
*/
|
||||||
protected $allowedTypes = [];
|
protected $allowedTypes = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->logs = new ObjectStorage();
|
||||||
|
}
|
||||||
|
|
||||||
public function getTitle(): string
|
public function getTitle(): string
|
||||||
{
|
{
|
||||||
return $this->title;
|
return $this->title;
|
||||||
|
@ -82,6 +93,17 @@ class ImportConfiguration extends AbstractEntity implements ImportConfigurationI
|
||||||
return $this->tstamp;
|
return $this->tstamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLastImported(): ?\DateTimeImmutable
|
||||||
|
{
|
||||||
|
$positionOfLastLog = count($this->logs) - 1;
|
||||||
|
$lastImport = $this->logs->offsetGet((string) $positionOfLastLog);
|
||||||
|
if (!$lastImport instanceof ImportLog) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $lastImport->getCreated();
|
||||||
|
}
|
||||||
|
|
||||||
public function getStoragePid(): int
|
public function getStoragePid(): int
|
||||||
{
|
{
|
||||||
if ($this->configuration === '') {
|
if ($this->configuration === '') {
|
||||||
|
|
|
@ -68,6 +68,15 @@ return (static function (string $extensionKey, string $tableName) {
|
||||||
'readOnly' => true,
|
'readOnly' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
// Configured for usage within Extbase, not TCA itself
|
||||||
|
'logs' => [
|
||||||
|
'config' => [
|
||||||
|
'type' => 'inline',
|
||||||
|
'foreign_table' => 'tx_thuecat_import_log',
|
||||||
|
'foreign_field' => 'configuration',
|
||||||
|
'readOnly' => true,
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'types' => [
|
'types' => [
|
||||||
'0' => [
|
'0' => [
|
||||||
|
|
|
@ -9,7 +9,9 @@ Nothing
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Add support for TYPO3 v11 and PHP 8.0 + 8.1.
|
* Add support for TYPO3 v11 and PHP 8.0 + 8.1.
|
||||||
|
|
||||||
|
* Last import date is now shown within backend module beside each import configuration.
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
-----
|
-----
|
||||||
|
@ -34,9 +36,9 @@ Fixes
|
||||||
Tasks
|
Tasks
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Removed API Key from site configuration.
|
* Removed API Key from site configuration.
|
||||||
The key was already moved to extension configuration as documented.
|
The key was already moved to extension configuration as documented.
|
||||||
Still we extended the site configuration, which is now cleaned up, see: https://github.com/werkraum-media/thuecat/issues/55
|
Still we extended the site configuration, which is now cleaned up, see: https://github.com/werkraum-media/thuecat/issues/55
|
||||||
|
|
||||||
Deprecation
|
Deprecation
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -46,6 +46,12 @@
|
||||||
<trans-unit id="module.importConfigurations.lastChanged" xml:space="preserve">
|
<trans-unit id="module.importConfigurations.lastChanged" xml:space="preserve">
|
||||||
<source>Last changed</source>
|
<source>Last changed</source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="module.importConfigurations.lastImported" xml:space="preserve">
|
||||||
|
<source>Last imported</source>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="module.importConfigurations.lastImported.never" xml:space="preserve">
|
||||||
|
<source>Never</source>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="module.importConfigurations.missing.text" xml:space="preserve">
|
<trans-unit id="module.importConfigurations.missing.text" xml:space="preserve">
|
||||||
<source><![CDATA[No import configuration is available yet. Please <a href="%1$s">create the first</a> to get started.]]></source>
|
<source><![CDATA[No import configuration is available yet. Please <a href="%1$s">create the first</a> to get started.]]></source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>{f:translate(id: 'module.importConfigurations.title')}</th>
|
<th>{f:translate(id: 'module.importConfigurations.title')}</th>
|
||||||
<th>{f:translate(id: 'module.importConfigurations.lastChanged')}</th>
|
<th>{f:translate(id: 'module.importConfigurations.lastChanged')}</th>
|
||||||
|
<th>{f:translate(id: 'module.importConfigurations.lastImported')}</th>
|
||||||
<th>{f:translate(id: 'module.actions')}</th>
|
<th>{f:translate(id: 'module.actions')}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -63,6 +64,16 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{importConfiguration.title}</td>
|
<td>{importConfiguration.title}</td>
|
||||||
<td>{importConfiguration.lastChanged -> f:format.date(format: 'd.m.Y H:i')}</td>
|
<td>{importConfiguration.lastChanged -> f:format.date(format: 'd.m.Y H:i')}</td>
|
||||||
|
<td>
|
||||||
|
<f:if condition="{importConfiguration.lastImported}">
|
||||||
|
<f:then>
|
||||||
|
{importConfiguration.lastImported -> f:format.date(format: 'd.m.Y H:i')}
|
||||||
|
</f:then>
|
||||||
|
<f:else>
|
||||||
|
{f:translate(id: 'module.importConfigurations.lastImported.never')}
|
||||||
|
</f:else>
|
||||||
|
</f:if>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<f:link.editRecord
|
<f:link.editRecord
|
||||||
uid="{importConfiguration.uid}"
|
uid="{importConfiguration.uid}"
|
||||||
|
|
|
@ -6,6 +6,7 @@ CREATE TABLE tx_thuecat_import_configuration (
|
||||||
title varchar(255) DEFAULT '' NOT NULL,
|
title varchar(255) DEFAULT '' NOT NULL,
|
||||||
type varchar(255) DEFAULT '' NOT NULL,
|
type varchar(255) DEFAULT '' NOT NULL,
|
||||||
configuration text,
|
configuration text,
|
||||||
|
logs int(11) unsigned DEFAULT '0' NOT NULL,
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE tx_thuecat_import_log (
|
CREATE TABLE tx_thuecat_import_log (
|
||||||
|
|
Loading…
Reference in a new issue