N°2847 - Work on the ActivityPanel and PopoverMenu features

- Deprecate cmdbAbstractObject::DisplayBareHistory() as history will be replace by ActivityPanel
- Rename illustrations to original filenames to find source more easily
- Remove unused "max_history_case_log_entry_length" config. parameter
- Activity panel: Introduce iCMDBChangeOp and iCMDBChangeOpSetAttribute interface for better dependency injection
- Activity panel: Add placeholder when no entry
- Activity panel: Fix tab toolbar icons color
- Activity panel: Add history entries (entries after the first 50 are not loaded yet)
- Popover menu: Fix no border-radius on first/last entries hover
This commit is contained in:
Molkobain
2020-08-17 11:53:39 +02:00
parent e39947f72c
commit 2ce1c2efec
40 changed files with 1145 additions and 45 deletions

View File

@@ -0,0 +1,32 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
/**
* Class CMDBChangeOpAttachmentAddedFactory
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp
*/
class CMDBChangeOpAttachmentAddedFactory extends CMDBChangeOpFactory
{
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-paperclip';
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
use iCMDBChangeOp;
/**
* Class CMDBChangeOpAttachmentRemovedFactory
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp
*/
class CMDBChangeOpAttachmentRemovedFactory extends CMDBChangeOpFactory
{
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-unlink';
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
use iCMDBChangeOp;
/**
* Class CMDBChangeOpCreateFactory
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp
*/
class CMDBChangeOpCreateFactory extends CMDBChangeOpFactory
{
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-unlink';
/**
* @inheritDoc
*/
public static function MakeFromCmdbChangeOp(iCMDBChangeOp $oChangeOp)
{
$oEntry = parent::MakeFromCmdbChangeOp($oChangeOp);
$oEntry->SetDecorationClasses('fas fa-fw fa-seedling');
return $oEntry;
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
use iCMDBChangeOp;
/**
* Class CMDBChangeOpDeleteFactory
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp
*/
class CMDBChangeOpDeleteFactory extends CMDBChangeOpFactory
{
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-unlink';
/**
* @inheritDoc
*/
public static function MakeFromCmdbChangeOp(iCMDBChangeOp $oChangeOp)
{
$oEntry = parent::MakeFromCmdbChangeOp($oChangeOp);
$oEntry->SetDecorationClasses('fas fa-fw fa-trash');
return $oEntry;
}
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
use AttributeDateTime;
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\ActivityEntry;
use DateTime;
use iCMDBChangeOp;
/**
* Class CMDBChangeOpFactory
*
* Default factory for CMDBChangeOp change ops
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp
*/
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';
/**
* Make an ActivityEntry from the iCMDBChangeOp $oChangeOp
*
* @param \iCMDBChangeOp $oChangeOp
*
* @return \Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\ActivityEntry
* @throws \OQLException
*/
public static function MakeFromCmdbChangeOp(iCMDBChangeOp $oChangeOp)
{
$oDateTime = DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oChangeOp->Get('date'));
$sAuthorFriendlyname = $oChangeOp->Get('userinfo');
$sContent = $oChangeOp->GetDescription();
$oEntry = new ActivityEntry($oDateTime, $sAuthorFriendlyname, $sContent);
$oEntry->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
return $oEntry;
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
use AttributeDateTime;
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\EditsEntry;
use DateTime;
use iCMDBChangeOpSetAttribute;
/**
* Class CMDBChangeOpSetAttributeFactory
*
* Default factory for CMDBChangeOpSetAttribute change ops
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp
*/
class CMDBChangeOpSetAttributeFactory
{
/**
* Make an EditsEntry from the iCMDBChangeOpSetAttribute $oChangeOp
*
* @param \iCMDBChangeOpSetAttribute $oChangeOp
*
* @return \Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\EditsEntry
* @throws \OQLException
*/
public static function MakeFromCmdbChangeOp(iCMDBChangeOpSetAttribute $oChangeOp)
{
$sHostObjectClass = $oChangeOp->Get('objclass');
$sAttCode = $oChangeOp->Get('attcode');
$oDateTime = DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oChangeOp->Get('date'));
$sAuthorFriendlyname = $oChangeOp->Get('userinfo');
$oEntry = new EditsEntry($oDateTime, $sAuthorFriendlyname, $sHostObjectClass);
$oEntry->AddAttribute($sAttCode, $oChangeOp->GetDescription());
return $oEntry;
}
}

View File

@@ -0,0 +1,65 @@
<?php
/**
* Copyright (C) 2013-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
use AttributeDateTime;
use iCMDBChangeOpSetAttribute;
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\TransitionEntry;
use DateTime;
use MetaModel;
/**
* Class CMDBChangeOpSetAttributeScalarFactory
*
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp\Factory
* @since 2.8.0
*/
class CMDBChangeOpSetAttributeScalarFactory extends CMDBChangeOpSetAttributeFactory
{
/**
* @inheritDoc
* @throws \CoreException
*/
public static function MakeFromCmdbChangeOp(iCMDBChangeOpSetAttribute $oChangeOp)
{
$sHostObjectClass = $oChangeOp->Get('objclass');
$sAttCode = $oChangeOp->Get('attcode');
// Specific ActivityEntry for transition, otherwise just a regular EditsEntry
if($sAttCode === MetaModel::GetStateAttributeCode($sHostObjectClass))
{
$oDateTime = DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $oChangeOp->Get('date'));
$sAuthorFriendlyname = $oChangeOp->Get('userinfo');
$sOriginStateLabel = MetaModel::GetStateLabel($sHostObjectClass, $oChangeOp->Get('oldvalue'));
$sTargetStateLabel = MetaModel::GetStateLabel($sHostObjectClass, $oChangeOp->Get('newvalue'));
$oEntry = new TransitionEntry($oDateTime, $sAuthorFriendlyname, $sHostObjectClass, $sOriginStateLabel, $sTargetStateLabel);
}
else
{
$oEntry = parent::MakeFromCmdbChangeOp($oChangeOp);
}
return $oEntry;
}
}