mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°2598 - When refreshing a list, loosing page and order - change of dashboard refresh mecanism
This commit is contained in:
@@ -30,6 +30,8 @@ class DashletBadge extends DashletContainer
|
||||
protected $sCreateActionUrl;
|
||||
/** @var string */
|
||||
protected $sCreateActionLabel;
|
||||
/** @var array */
|
||||
protected $aRefreshParams;
|
||||
|
||||
/**
|
||||
* DashletBadge constructor.
|
||||
@@ -41,7 +43,7 @@ class DashletBadge extends DashletContainer
|
||||
* @param string $sCreateActionUrl
|
||||
* @param string $sCreateActionLabel
|
||||
*/
|
||||
public function __construct(string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, string $sCreateActionUrl = '', string $sCreateActionLabel = '')
|
||||
public function __construct(string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, string $sCreateActionUrl = '', string $sCreateActionLabel = '', array $aRefreshParams)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -51,6 +53,7 @@ class DashletBadge extends DashletContainer
|
||||
$this->sClassLabel = $sClassLabel;
|
||||
$this->sCreateActionUrl = $sCreateActionUrl;
|
||||
$this->sCreateActionLabel = $sCreateActionLabel;
|
||||
$this->aRefreshParams = $aRefreshParams;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,8 +168,21 @@ class DashletBadge extends DashletContainer
|
||||
public function SetClassLabel(string $sClassLabel): DashletBadge
|
||||
{
|
||||
$this->sClassLabel = $sClassLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function GetJSRefresh(): string
|
||||
{
|
||||
return "$('#".$this->sId."').block();
|
||||
$.post('ajax.render.php?operation=refreshDashletCount&style=count',
|
||||
".json_encode($this->aRefreshParams).",
|
||||
function(data){
|
||||
$('#".$this->sId."').find('.ibo-dashlet-badge--action-list-count').html(data.count);
|
||||
$('#".$this->sId."').unblock();
|
||||
});
|
||||
|
||||
$('#".$this->sId."').unblock();";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,9 +9,11 @@ namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
|
||||
|
||||
class DashletContainer extends UIContentBlock
|
||||
{
|
||||
use tJSRefreshCallback;
|
||||
public const BLOCK_CODE = 'ibo-dashlet';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/content-block/layout';
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
class DashletFactory
|
||||
{
|
||||
public static function MakeForDashletBadge(string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, string $sCreateActionUrl = '', string $sCreateActionLabel = '')
|
||||
public static function MakeForDashletBadge(string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, string $sCreateActionUrl = '', string $sCreateActionLabel = '', array $aRefreshParams = [])
|
||||
{
|
||||
return new DashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, $sCreateActionUrl, $sCreateActionLabel);
|
||||
return new DashletBadge($sClassIconUrl, $sHyperlink, $iCount, $sClassLabel, $sCreateActionUrl, $sCreateActionLabel, $aRefreshParams);
|
||||
}
|
||||
|
||||
public static function MakeForDashletHeaderStatic(string $sTitle, string $sIconUrl)
|
||||
|
||||
Reference in New Issue
Block a user