Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trend Metric appears outside of its card (and impossible to click on its filter) #6453

Closed
sysyl opened this issue Jul 6, 2024 · 2 comments
Closed
Labels
needs more info More information is required

Comments

@sysyl
Copy link

sysyl commented Jul 6, 2024

  • Laravel Version: 11.10
  • Nova Version: 4.34.3
  • PHP Version: 8.3
  • Database Driver & Version: PostgreSQL 16.3 (Debian 16.3-1.pgdg120+1)
  • Operating System and Version : MacOs Ventura 13.6.7 (locahost)
  • Browser type and version: Chrome

Description:

The trend below is displayed in a dashboard. As you can see, the trend is displayed outside of its card. The filter for this trend is blocked.
I tried clearing my application and browser caches but that doesn't change anything.

Capture d’écran 2024-07-06 à 18 52 50

Detailed steps to reproduce the issue on a fresh Nova installation:

CostsPerDay Metric

<?php

namespace App\Nova\Metrics;

use App\Models\Cost;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Metrics\Trend;

class CostsPerDay extends Trend
{
    public function name()
    {
        return 'Coûts par jour';
    }

    /**
     * Calculate the value of the metric.
     *
     * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
     * @return mixed
     */
    public function calculate(NovaRequest $request)
    {
        return $this->countByDays($request, Cost::class)->showLatestValue()
            ->format(function ($value) {
                return round($value, 2);
            });
    }

    /**
     * Get the ranges available for the metric.
     *
     * @return array
     */
    public function ranges()
    {
        return [
            30 => '30 Days',
            60 => '60 Days',
            90 => '90 Days',
        ];
    }

    /**
     * Get the URI key for the metric.
     *
     * @return string
     */
    public function uriKey()
    {
        return 'costs-per-day';
    }
}

My model "Cost"

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Cost extends Model
{
    use HasFactory;

    protected $table = 'accounting.cost';

    protected $fillable = [
        'category_id',
        'external_id',
        'external_table_name',
        'name',
        'cost',
    ];

    protected $dates = [
        'created_at',
        'updated_at',
        'deleted_at'
    ];

    public function costCategory()
    {
        return $this->belongsTo(CostCategory::class, 'category_id');
    }
}


@crynobone crynobone added the needs more info More information is required label Jul 7, 2024
@crynobone
Copy link
Member

Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

@crynobone
Copy link
Member

Hey there,

We're closing this issue because it's inactive, already solved, old, or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.

@crynobone crynobone closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info More information is required
Projects
None yet
Development

No branches or pull requests

2 participants