mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°8641 - Dashboard editor front-end first commit for Form SDK integration.
* No dashlet edition * Dashboard are not persisted * Unable to load a dashboard from an endpoint (refresh) * Grid library need proper npm integration
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2025 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\Dashboard;
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletWrapper;
|
||||
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
class DashboardGrid extends UIBlock
|
||||
{
|
||||
use tJSRefreshCallback;
|
||||
|
||||
public const BLOCK_CODE = 'ibo-dashboard-grid';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/dashboard/grid/layout';
|
||||
|
||||
public const DEFAULT_JS_FILES_REL_PATH = [
|
||||
'js/layouts/dashboard/dashboard-grid.js',
|
||||
];
|
||||
|
||||
/** @var DashboardGridSlot[] */
|
||||
protected $aSlots;
|
||||
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->aSlots = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DashboardGridSlot[]
|
||||
*/
|
||||
public function GetSlots(): array
|
||||
{
|
||||
return $this->aSlots;
|
||||
}
|
||||
|
||||
public function SetSlots(array $aSlots): DashboardGrid
|
||||
{
|
||||
$this->aSlots = $aSlots;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function AddSlot(DashboardGridSlot $oSlot): DashboardGrid
|
||||
{
|
||||
$this->aSlots[] = $oSlot;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function AddDashlet(UIBlock $oDashlet, ?string $sDashletId = null, ?string $sDashletClass = null): DashboardGrid {
|
||||
$oWrapper = new DashletWrapper($oDashlet, $sDashletId, $sDashletClass);
|
||||
$oSlot = new DashboardGridSlot(null, $oWrapper);
|
||||
$this->AddSlot($oSlot);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user