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;
|
public ?int $storageLimit = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bandwidth limit (per month) in Gigabytes
|
||||||
|
*/
|
||||||
|
public ?int $bandwidthLimit = null;
|
||||||
|
|
||||||
public ?string $legalNoticeURL = null;
|
public ?string $legalNoticeURL = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,15 +10,23 @@ class ChartsComponent extends Component
|
||||||
{
|
{
|
||||||
protected string $title = '';
|
protected string $title = '';
|
||||||
|
|
||||||
|
protected string $subtitle = '';
|
||||||
|
|
||||||
protected string $dataUrl = '';
|
protected string $dataUrl = '';
|
||||||
|
|
||||||
protected string $type = '';
|
protected string $type = '';
|
||||||
|
|
||||||
public function render(): string
|
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
|
return <<<HTML
|
||||||
<div class="bg-elevated border-3 rounded-xl border-subtle {$this->class}">
|
<div class="bg-elevated border-3 rounded-xl border-subtle {$this->class}">
|
||||||
<h2 class="px-6 py-4 text-xl">{$this->title}</h2>
|
<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 class="w-full h-[500px]" data-chart-type="{$this->type}" data-chart-url="{$this->dataUrl}"></div>
|
||||||
</div>
|
</div>
|
||||||
HTML;
|
HTML;
|
||||||
|
|
|
@ -70,10 +70,14 @@ class DashboardController extends BaseController
|
||||||
->id;
|
->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bandwidthLimit = config('App')
|
||||||
|
->bandwidthLimit;
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'podcastsData' => $podcastsData,
|
'podcastsData' => $podcastsData,
|
||||||
'episodesData' => $episodesData,
|
'episodesData' => $episodesData,
|
||||||
'storageData' => $storageData,
|
'storageData' => $storageData,
|
||||||
|
'bandwidthLimit' => $bandwidthLimit === null ? null : formatBytes($bandwidthLimit * 1000000000),
|
||||||
'onlyPodcastId' => $onlyPodcastId,
|
'onlyPodcastId' => $onlyPodcastId,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -37,4 +37,5 @@ return [
|
||||||
'podcast_by_bandwidth' => 'Daily used bandwidth (in MB)',
|
'podcast_by_bandwidth' => 'Daily used bandwidth (in MB)',
|
||||||
'total_storage_by_month' => 'Monthly storage (in MB)',
|
'total_storage_by_month' => 'Monthly storage (in MB)',
|
||||||
'total_bandwidth_by_month' => 'Monthly used bandwidth (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',
|
'Podcast',
|
||||||
'TotalStorageByMonth',
|
'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',
|
'analytics-data-instance',
|
||||||
'Podcast',
|
'Podcast',
|
||||||
'TotalBandwidthByMonth',
|
'TotalBandwidthByMonth',
|
||||||
|
|
Loading…
Reference in New Issue