File tree Expand file tree Collapse file tree 3 files changed +0
-81
lines changed
Expand file tree Collapse file tree 3 files changed +0
-81
lines changed Original file line number Diff line number Diff line change 44
55use App \Enums \ResultStatus ;
66use App \Models \Result ;
7- use App \Services \DataUsageCalculator ;
8- use Carbon \Carbon ;
9- use Cron \CronExpression ;
107use Illuminate \Support \Number ;
118use Livewire \Attributes \Computed ;
129use Livewire \Component ;
@@ -19,19 +16,11 @@ public function platformStats(): array
1916 $ totalResults = Result::count ();
2017 $ completedResults = Result::where ('status ' , ResultStatus::Completed)->count ();
2118 $ failedResults = Result::where ('status ' , ResultStatus::Failed)->count ();
22- $ bandwidthLimit = null ;
23- $ bandwidthUsed = DataUsageCalculator::calculate (now ()->startOfMonth (), now ());
2419
2520 return [
2621 'total ' => Number::format ($ totalResults ),
2722 'completed ' => Number::format ($ completedResults ),
2823 'failed ' => Number::format ($ failedResults ),
29- 'bandwidth_limit ' => $ bandwidthLimit ,
30- 'bandwidth_used ' => [
31- 'download_bytes ' => $ bandwidthUsed ['download_bytes ' ],
32- 'upload_bytes ' => $ bandwidthUsed ['upload_bytes ' ],
33- 'total_bytes ' => $ bandwidthUsed ['total_bytes ' ],
34- ],
3524 ];
3625 }
3726
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2828
2929 <p class =" text-xl font-semibold tracking-tight text-zinc-900 dark:text-zinc-100" >{{ $this -> platformStats [' failed' ] } } </p >
3030 </x-filament::section >
31-
32- <x-filament::section class =" col-span-full" icon =" tabler-chart-pie" icon-size =" md" >
33- <x-slot name =" heading" >
34- Bandwidth Quota
35- </x-slot >
36-
37- <x-slot name =" description" >
38- Resets on {{ today ()-> addMonth ()-> startOfMonth ()-> format (' M. jS, Y' ) } }
39- </x-slot >
40-
41- @auth
42- <x-slot name =" afterHeader" >
43- <x-filament::button
44- href =" #"
45- tag =" a"
46- size =" sm"
47- >
48- {{ __ (' general.edit' ) } }
49- </x-filament::button >
50- </x-slot >
51- @endauth
52-
53- <div >
54- <div class =" flex justify-between mb-1" >
55- <span class =" text-sm font-medium text-body" >Usage</span >
56- <span class =" text-sm font-medium text-body" >{{ Number:: fileSize ($this -> platformStats [' bandwidth_used' ][' total_bytes' ] ?? 0 , 2 ) } } of {{ $this -> platformStats [' bandwidth_limit' ] ?? ' Unlimited' } } </span >
57- </div >
58-
59- @php
60- $used = 0 ;
61-
62- if (isset ($this -> platformStats [' bandwidth_used' ][' total_bytes' ]) && isset ($this -> platformStats [' bandwidth_limit' ])) {
63- $used = round ($this -> platformStats [' bandwidth_used' ][' total_bytes' ] / (\App \Helpers \FileSize:: toBytes ($this -> platformStats [' bandwidth_limit' ]) ?: 1 ) * 100 );
64- }
65- @endphp
66-
67- <div class =" w-full bg-zinc-200 rounded-full h-2" >
68- <div class =" bg-amber-500 h-2 rounded-full" style =" width : {{ min ($used , 100 ) }}%" title =" {{ number_format ($used ) } } %" ></div >
69- </div >
70- </div >
71- </x-filament::section >
7231 </div >
7332</div >
You can’t perform that action at this time.
0 commit comments