mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-19 13:01:19 +00:00
fix: display bandwidth limit on dashboard when set in .env
This commit is contained in:
parent
fa6bb2f492
commit
a2a87abf7c
@ -457,5 +457,10 @@ class App extends BaseConfig
|
||||
*/
|
||||
public ?int $storageLimit = null;
|
||||
|
||||
/**
|
||||
* Bandwidth limit (per month) in Gigabytes
|
||||
*/
|
||||
public ?int $bandwidthLimit = null;
|
||||
|
||||
public ?string $legalNoticeURL = null;
|
||||
}
|
||||
|
@ -10,15 +10,23 @@ class ChartsComponent extends Component
|
||||
{
|
||||
protected string $title = '';
|
||||
|
||||
protected string $subtitle = '';
|
||||
|
||||
protected string $dataUrl = '';
|
||||
|
||||
protected string $type = '';
|
||||
|
||||
public function render(): string
|
||||
{
|
||||
$subtitleBlock = '';
|
||||
if ($this->subtitle !== '') {
|
||||
$subtitleBlock = '<p class="px-6 -mt-4 text-sm text-skin-muted">' . $this->subtitle . '</p>';
|
||||
}
|
||||
|
||||
return <<<HTML
|
||||
<div class="bg-elevated border-3 rounded-xl border-subtle {$this->class}">
|
||||
<h2 class="px-6 py-4 text-xl">{$this->title}</h2>
|
||||
{$subtitleBlock}
|
||||
<div class="w-full h-[500px]" data-chart-type="{$this->type}" data-chart-url="{$this->dataUrl}"></div>
|
||||
</div>
|
||||
HTML;
|
||||
|
@ -70,10 +70,14 @@ class DashboardController extends BaseController
|
||||
->id;
|
||||
}
|
||||
|
||||
$bandwidthLimit = config('App')
|
||||
->bandwidthLimit;
|
||||
|
||||
$data = [
|
||||
'podcastsData' => $podcastsData,
|
||||
'episodesData' => $episodesData,
|
||||
'storageData' => $storageData,
|
||||
'bandwidthLimit' => $bandwidthLimit === null ? null : formatBytes($bandwidthLimit * 1000000000),
|
||||
'onlyPodcastId' => $onlyPodcastId,
|
||||
];
|
||||
|
||||
|
@ -37,4 +37,5 @@ return [
|
||||
'podcast_by_bandwidth' => 'Daily used bandwidth (in MB)',
|
||||
'total_storage_by_month' => 'Monthly storage (in MB)',
|
||||
'total_bandwidth_by_month' => 'Monthly used bandwidth (in MB)',
|
||||
'total_bandwidth_by_month_limit' => 'Limited to {totalBandwidth} per month',
|
||||
];
|
||||
|
@ -30,7 +30,9 @@
|
||||
'Podcast',
|
||||
'TotalStorageByMonth',
|
||||
) ?>" />
|
||||
<Charts.XY class="col-span-1" title="<?= lang('Charts.total_bandwidth_by_month') ?>" dataUrl="<?= route_to(
|
||||
<Charts.XY class="col-span-1" title="<?= lang('Charts.total_bandwidth_by_month') ?>" subtitle="<?= $bandwidthLimit !== null ? lang('Charts.total_bandwidth_by_month_limit', [
|
||||
'totalBandwidth' => $bandwidthLimit,
|
||||
]) : '' ?>" dataUrl="<?= route_to(
|
||||
'analytics-data-instance',
|
||||
'Podcast',
|
||||
'TotalBandwidthByMonth',
|
||||
|
Loading…
x
Reference in New Issue
Block a user