Object details: Fix icon / color lost since 27e68404

This commit is contained in:
Molkobain
2021-06-28 17:33:04 +02:00
parent 65e3ef32ed
commit 84dae0fb37

View File

@@ -66,16 +66,13 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
// Note: We get the raw name as only the front-end consumer knows when and how to encode it.
$this->sObjectMode = $sMode;
if ($this->sObjectMode == "create") {
$this->sObjectName = Dict::Format('UI:CreationTitle_Class', $this->sClassLabel);
} else {
$this->sObjectName = $oObject->GetRawName();
$this->ComputeObjectName($oObject);
$this->SetColorFromClass($this->sClassName);
$this->ComputeIconUrl($oObject);
$this->ComputeState($oObject);
}
parent::__construct($this->sObjectName, [], static::DEFAULT_COLOR, $sId);
$this->SetColorFromClass($this->sClassName);
$this->ComputeIconUrl($oObject);
$this->ComputeState($oObject);
}
/**
@@ -207,6 +204,21 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
$this->sStatusColor = UIHelper::GetColorFromStatus($this->sClassName, $this->sStatusCode);
}
}
/**
* @param \DBObject $oObject
* @see static::$oObject
*
* @throws \CoreException
*/
protected function ComputeObjectName(DBObject $oObject): void
{
if ($this->sObjectMode === cmdbAbstractObject::ENUM_OBJECT_MODE_CREATE) {
$this->sObjectName = Dict::Format('UI:CreationTitle_Class', $this->sClassLabel);
} else {
$this->sObjectName = $oObject->GetRawName();
}
}
public static function GetShortcutKeys(): array
{