Skip to content
Snippets Groups Projects

Issue #3277750: Refactor Low Utilization block to speed up performance

Merged baldwinlouie requested to merge issue/cloud-3277750:3277750-refactor-low-utilization into 5.x
Files
5
@@ -636,6 +636,20 @@ class Instance extends CloudContentEntityBase implements InstanceInterface {
return floor((time() - $this->created()) / (24 * 60 * 60));
}
/**
* {@inheritdoc}
*/
public function getLowUtilization(): ?bool {
return $this->get('low_utilization')->value;
}
/**
* {@inheritdoc}
*/
public function setLowUtilization($low_utilization): InstanceInterface {
return $this->set('low_utilization', $low_utilization);
}
/**
* {@inheritdoc}
*/
@@ -1241,6 +1255,15 @@ class Instance extends CloudContentEntityBase implements InstanceInterface {
'weight' => -5,
]);
$fields['low_utilization'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Low utilization'))
->setDescription(t('Low utilization flag for this instance.'))
->setDisplayOptions('view', [
'label' => 'inline',
'type' => 'string',
'weight' => -5,
]);
$fields['tags'] = BaseFieldDefinition::create('key_value')
->setLabel(t('Tags'))
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
Loading