N°2847 - Activity panel: Fix filtering on CMDBChangeOp entries

This commit is contained in:
Molkobain
2020-08-19 11:01:13 +02:00
parent 880be200ae
commit da1d3db204
12 changed files with 47 additions and 25 deletions

View File

@@ -678,6 +678,8 @@ return array(
'PhpParser\\Serializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php',
'PhpParser\\Unserializer' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer.php',
'PhpParser\\Unserializer\\XML' => $vendorDir . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php',
'PluginInstanciationManager' => $baseDir . '/core/metamodel.class.php',
'PluginManager' => $baseDir . '/core/metamodel.class.php',
'PortalDispatcher' => $baseDir . '/application/portaldispatcher.class.inc.php',
'PortalURLMaker' => $baseDir . '/application/applicationcontext.class.inc.php',
'PrintableDataTable' => $baseDir . '/application/datatable.class.inc.php',

View File

@@ -13,9 +13,6 @@ class ComposerAutoloaderInit0018331147de7601e7552f7da8e3bb8b
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {

View File

@@ -908,6 +908,8 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'PhpParser\\Serializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Serializer/XML.php',
'PhpParser\\Unserializer' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer.php',
'PhpParser\\Unserializer\\XML' => __DIR__ . '/..' . '/nikic/php-parser/lib/PhpParser/Unserializer/XML.php',
'PluginInstanciationManager' => __DIR__ . '/../..' . '/core/metamodel.class.php',
'PluginManager' => __DIR__ . '/../..' . '/core/metamodel.class.php',
'PortalDispatcher' => __DIR__ . '/../..' . '/application/portaldispatcher.class.inc.php',
'PortalURLMaker' => __DIR__ . '/../..' . '/application/applicationcontext.class.inc.php',
'PrintableDataTable' => __DIR__ . '/../..' . '/application/datatable.class.inc.php',

View File

@@ -43,9 +43,13 @@ class ActivityEntry extends UIBlock
// Specific constants
/** @var string DEFAULT_ORIGIN */
const DEFAULT_ORIGIN = 'unknown';
/** @var string DEFAULT_TYPE */
const DEFAULT_TYPE = 'generic';
/** @var string DEFAULT_DECORATION_CLASSES */
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-mortar-pestle';
/** @var string $sType Type of entry, used for filtering (eg. caselog, edits, transition, ...) */
protected $sType;
/** @var string $sDecorationClasses CSS classes to use to decorate the entry */
protected $sDecorationClasses;
/** @var string $sContent Raw content of the entry itself (should not have been processed / escaped) */
@@ -79,6 +83,7 @@ class ActivityEntry extends UIBlock
{
parent::__construct($sIdCode);
$this->SetType(static::DEFAULT_TYPE);
$this->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
$this->SetContent($sContent);
$this->SetDateTime($oDateTime);
@@ -86,6 +91,30 @@ class ActivityEntry extends UIBlock
$this->SetOrigin(static::DEFAULT_ORIGIN);
}
/**
* Set the type of the entry (eg. case log, edits, transition, ...)
*
* @param string $sType
*
* @return $this
*/
public function SetType($sType)
{
$this->sType = $sType;
return $this;
}
/**
* Return the type of the entry (eg. caselog, edits, transition, ...)
*
* @return string
*/
public function GetType()
{
return $this->sType;
}
/**
* Set the CSS decoration classes
*

View File

@@ -22,6 +22,7 @@ namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBCha
use AttributeDateTime;
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\ActivityEntry;
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\EditsEntry;
use DateTime;
use iCMDBChangeOp;
@@ -35,8 +36,10 @@ use iCMDBChangeOp;
*/
class CMDBChangeOpFactory
{
/** @var string DEFAULT_DECORATION_CLASSES Use to overload the decoration classes from the ActivityEntry */
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-mortar-pestle';
/** @var string DEFAULT_TYPE Used to overload the type from the ActivityEntry */
const DEFAULT_TYPE = EditsEntry::DEFAULT_TYPE;
/** @var string DEFAULT_DECORATION_CLASSES Used to overload the decoration classes from the ActivityEntry */
const DEFAULT_DECORATION_CLASSES = ActivityEntry::DEFAULT_DECORATION_CLASSES;
/**
* Make an ActivityEntry from the iCMDBChangeOp $oChangeOp
@@ -53,7 +56,8 @@ class CMDBChangeOpFactory
$sContent = $oChangeOp->GetDescription();
$oEntry = new ActivityEntry($oDateTime, $sAuthorFriendlyname, $sContent);
$oEntry->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
$oEntry->SetType(static::DEFAULT_TYPE)
->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
return $oEntry;
}

View File

@@ -36,6 +36,9 @@ class CaseLogEntry extends ActivityEntry
const BLOCK_CODE = 'ibo-caselog-entry';
const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/caselog-entry';
const DEFAULT_TYPE = 'caselog';
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-quote-left';
// Specific constants
public const DEFAULT_CASELOG_RANK = 0;

View File

@@ -39,7 +39,7 @@ class EditsEntry extends ActivityEntry
const BLOCK_CODE = 'ibo-edits-entry';
const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/edits-entry';
// Specific constants
const DEFAULT_TYPE = 'edits';
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-pen';
/** @var string $sObjectClass */

View File

@@ -36,7 +36,7 @@ class TransitionEntry extends ActivityEntry
const BLOCK_CODE = 'ibo-transition-entry';
const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/transition-entry';
// Specific constants
const DEFAULT_TYPE = 'transition';
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-map-signs';
/** @var string $sOriginStateCode Code of the state before the transition */

View File

@@ -1,9 +1,4 @@
{% extends 'layouts/activity-panel/activity-entry/layout.html.twig' %}
{% block iboActivityEntryExtraClasses %}ibo-caselog-entry ibo-caselog-entry--entry-for-caselog-{{ oUIBlock.GetCaseLogRank() }}{% endblock %}
{% block iboActivityEntryType %}caselog{% endblock %}
{% block iboActivityEntryExtraDataAttributes %}data-entry-caselog-attribute-code="{{ oUIBlock.GetAttCode() }}"{% endblock %}
{% block iboActivityEntryMainInformationIcon %}
<span class="fas fa-fw fa-quote-left"></span>
{% endblock %}
{% block iboActivityEntryExtraDataAttributes %}data-entry-caselog-attribute-code="{{ oUIBlock.GetAttCode() }}"{% endblock %}

View File

@@ -1,11 +1,6 @@
{% extends 'layouts/activity-panel/activity-entry/layout.html.twig' %}
{% block iboActivityEntryExtraClasses %}ibo-edits-entry{% endblock %}
{% block iboActivityEntryType %}edits{% endblock %}
{% block iboActivityEntryMainInformationIcon %}
<span class="fas fa-fw fa-pen"></span>
{% endblock %}
{% block iboActivityEntryMainInformationContent %}
{% if oUIBlock.GetAttributes()|length == 1 %}

View File

@@ -1,6 +1,6 @@
<div class="ibo-activity-entry {% if oUIBlock.IsFromCurrentUser() %}ibo-is-current-user{% endif %} {% block iboActivityEntryExtraClasses %}{% endblock %}"
data-role="ibo-activity-entry"
data-entry-type="{% block iboActivityEntryType %}generic{% endblock %}"
data-entry-type="{% block iboActivityEntryType %}{{ oUIBlock.GetType() }}{% endblock %}"
data-entry-datetime-raw="{{ oUIBlock.GetRawDateTime() }}"
data-entry-author-login="{{ oUIBlock.GetAuthorLogin() }}"
{% block iboActivityEntryExtraDataAttributes %}{% endblock %}>

View File

@@ -1,13 +1,8 @@
{% extends 'layouts/activity-panel/activity-entry/layout.html.twig' %}
{% block iboActivityEntryExtraClasses %}ibo-transition-entry{% endblock %}
{% block iboActivityEntryType %}transition{% endblock %}
{% block iboActivityEntryExtraDataAttributes %}data-original-state-code="{{ oUIBlock.GetOriginalStateCode() }}" data-target-state-code="{{ oUIBlock.GetTargetStateCode() }}"{% endblock %}
{% block iboActivityEntryMainInformationIcon %}
<span class="fas fa-fw fa-map-signs"></span>
{% endblock %}
{% block iboActivityEntryMainInformationContent %}
{% set sOriginalStateLabelAsHtml = '<span class="ibo-transition-entry--original-state-label">' ~ oUIBlock.GetOriginalStateLabel() ~ '</span>' %}
{% set sTargetStateLabelAsHtml = '<span class="ibo-transition-entry--target-state-label">' ~ oUIBlock.GetTargetStateLabel() ~ '</span>' %}