N°3882 - Fix null status color when class has no style defined

This commit is contained in:
Molkobain
2021-09-24 14:49:18 +02:00
parent 814038f5fd
commit 6d8a36e061
3 changed files with 9 additions and 4 deletions

View File

@@ -37,7 +37,7 @@ class PillFactory
if ($oStyle !== null) {
$oPill->SetCSSColorClass($oStyle->GetStyleClass());
} else {
$oPill->SetSemanticColor(UIHelper::GetColorFromStatusCode($sStateCode));
$oPill->SetSemanticColor(UIHelper::GetColorNameFromStatusCode($sStateCode));
}
return $oPill;

View File

@@ -63,7 +63,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
protected $sStatusCode;
/** @var string Label of the current value of the attribute carrying the state for $sClassName */
protected $sStatusLabel;
/** @var string */
/** @var string Color value (eg. #ABCDEF, var(--foo-color), ...) */
protected $sStatusColor;
/**
@@ -240,6 +240,11 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
if ($oStyle !== null) {
$this->sStatusColor = $oStyle->GetMainColor();
}
// If no style defined, fallback on a default color
else {
$sColorName = UIHelper::GetColorNameFromStatusCode($this->sStatusCode);
$this->sStatusColor = "var(--ibo-lifecycle-$sColorName-state-primary-color)";
}
}
}