Compare commits

..

No commits in common. "main" and "1.0" have entirely different histories.
main ... 1.0

1 changed files with 7 additions and 7 deletions

View File

@ -48,7 +48,7 @@ abstract class Metric extends Widget
{
$filter = collect($filters)->firstWhere('value', $this->data['filter'] ?? null) ?? collect($filters)->first();
$computed = is_array($filter) ? $filter['callback']() : [];
$computed = is_array($filter) ? $filter['callback']($this->data) : [];
return [
'filter' => $filter['value'],
@ -74,18 +74,19 @@ abstract class Metric extends Widget
public function progress($current, $target)
{
return [
return $this->output([
'type' => 'progress',
'value' => $current,
'target' => $target,
];
]);
}
public function trend($values)
public function trend($value, $previous = null)
{
return [
'type' => 'trend',
'values' => $values,
'value' => $value,
'previous' => $previous,
];
}
@ -97,12 +98,11 @@ abstract class Metric extends Widget
];
}
public function value($value, $previous = null)
public function value($value)
{
return [
'type' => 'value',
'value' => $value,
'previous' => $previous,
];
}