mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 20:48:46 +02:00
N°3712 - Activity panel: Improve history entries to have a different icon depending the origin (interactive, webservices, csv, ...)
This commit is contained in:
@@ -40,7 +40,6 @@ class ActivityEntry extends UIBlock
|
||||
public const BLOCK_CODE = 'ibo-activity-entry';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/activity-panel/activity-entry/layout';
|
||||
|
||||
// Specific constants
|
||||
/** @var string DEFAULT_ORIGIN */
|
||||
public const DEFAULT_ORIGIN = 'unknown';
|
||||
/** @var string DEFAULT_TYPE */
|
||||
@@ -286,7 +285,7 @@ class ActivityEntry extends UIBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function SetOrigin(string $sOrigin)
|
||||
public function SetOrigin(string $sOrigin)
|
||||
{
|
||||
$this->sOrigin = $sOrigin;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use AttributeDateTime;
|
||||
use CMDBChange;
|
||||
use CMDBChangeOp;
|
||||
use DateTime;
|
||||
use DBObject;
|
||||
@@ -43,11 +44,13 @@ class ActivityEntryFactory
|
||||
* Make an ActivityEntry entry (for ActivityPanel) based on the $oChangeOp.
|
||||
*
|
||||
* @param \CMDBChangeOp $oChangeOp
|
||||
* @param \CMDBChange $oChange
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\ActivityEntry
|
||||
* @throws \ReflectionException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function MakeFromCmdbChangeOp(CMDBChangeOp $oChangeOp)
|
||||
public static function MakeFromCmdbChangeOp(CMDBChangeOp $oChangeOp, CMDBChange $oChange)
|
||||
{
|
||||
$sFactoryFqcn = static::GetFactoryClass($oChangeOp, 'CMDBChangeOp');
|
||||
|
||||
@@ -59,6 +62,7 @@ class ActivityEntryFactory
|
||||
/** @var \Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\ActivityEntry $oEntry */
|
||||
/** @noinspection PhpUndefinedMethodInspection Call static method from the $sFactoryFqcn class */
|
||||
$oEntry = $sFactoryFqcn::MakeFromCmdbChangeOp($oChangeOp);
|
||||
$oEntry->SetOrigin($oChange->Get('origin'));
|
||||
|
||||
return $oEntry;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use Combodo\iTop\Core\CMDBChange\CMDBChangeOrigin;
|
||||
use DateTime;
|
||||
use Dict;
|
||||
use Exception;
|
||||
@@ -222,4 +223,40 @@ class EditsEntry extends ActivityEntry
|
||||
|
||||
return $sDescriptionAsHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null The CSS decoration classes for the origin of the entry
|
||||
* @see \CMDBChangeOrigin
|
||||
*/
|
||||
public function GetOriginDecorationClasses(): ?string
|
||||
{
|
||||
$sDecorationClasses = null;
|
||||
|
||||
// Note: We put fa-fw on all cases instead of just in the template as one of the cases could (in the future) not use FA icons. This will ensure that any use of the FA icons are always the same width.
|
||||
switch($this->GetOrigin()) {
|
||||
case CMDBChangeOrigin::CSV_INTERACTIVE:
|
||||
case CMDBChangeOrigin::CSV_IMPORT:
|
||||
$sDecorationClasses = 'fas fa-fw fa-file-import';
|
||||
break;
|
||||
|
||||
case CMDBChangeOrigin::EMAIL_PROCESSING:
|
||||
$sDecorationClasses = 'fas fa-fw fa-envelope-open';
|
||||
break;
|
||||
|
||||
case CMDBChangeOrigin::SYNCHRO_DATA_SOURCE:
|
||||
$sDecorationClasses = 'fas fa-fw fa-lock';
|
||||
break;
|
||||
|
||||
case CMDBChangeOrigin::WEBSERVICE_REST:
|
||||
case CMDBChangeOrigin::WEBSERVICE_SOAP:
|
||||
$sDecorationClasses = 'fas fa-fw fa-cloud';
|
||||
break;
|
||||
|
||||
case CMDBChangeOrigin::CUSTOM_EXTENSION:
|
||||
$sDecorationClasses = 'fas fa-fw fa-parachute-box';
|
||||
break;
|
||||
}
|
||||
|
||||
return $sDecorationClasses;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user