![]({{ asset('ghygen-title.png') }})
+ {{ $title }} +
++ {{ $description }} +
+ +diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ac14dd..a85cd40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## 0.2.1 - 2021-02-26 +### Add +- Add API for listing configurations +- Add Dashboard for showing some infos from configurations ## 0.2.0 - 2021-02-15 ### Add diff --git a/app/Http/Controllers/ConfiguratorController.php b/app/Http/Controllers/ConfiguratorController.php index 79ff4c2..be7fe46 100644 --- a/app/Http/Controllers/ConfiguratorController.php +++ b/app/Http/Controllers/ConfiguratorController.php @@ -2,12 +2,15 @@ namespace App\Http\Controllers; -use Illuminate\Http\Request; - class ConfiguratorController extends Controller { public function index() { - return view('configurator.index'); + $data = []; + $data["title"] = "Ghygen is a GitHub Actions configurator for your Laravel Application."; + $data["description"] = "Setup Database Service, use multiple PHP version, + use multiple Laravel versions, build frontend, cache packages, + execute Browser, Functional, and Unit tests…"; + return view('configurator.index', $data); } } diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php new file mode 100644 index 0000000..e3d338c --- /dev/null +++ b/app/Http/Controllers/DashboardController.php @@ -0,0 +1,16 @@ +code != "") { $confModel = Configuration::getByCode($this->code); if ($confModel) { - $j = json_decode($confModel->configuration); + //$j = json_decode($confModel->configuration); + $j = $confModel->configuration; Log::debug(__METHOD__ . ' Name : ' . $j->name); $this->name = $j->name; $this->onPush = $j->on_push; @@ -293,7 +294,7 @@ public function submitForm() $json = json_encode($array); //$compressed = gzdeflate($json, 9); $hashCode = md5($json); - Configuration::saveConfiguration($hashCode, json_encode($data)); + Configuration::saveConfiguration($hashCode, $data); $this->code = $hashCode; $seconds = 60 * 60 * 6; // 6 hours $schema = Cache::remember('cache-schema-yaml', $seconds, function () { diff --git a/app/Http/Livewire/Dashboard/Latest.php b/app/Http/Livewire/Dashboard/Latest.php new file mode 100644 index 0000000..b11786b --- /dev/null +++ b/app/Http/Livewire/Dashboard/Latest.php @@ -0,0 +1,21 @@ +latest = Configuration::latest()->take(5)->get(); + } + public function render() + { + + return view('livewire.dashboard.latest'); + } +} diff --git a/app/Http/Livewire/Dashboard/Metrics.php b/app/Http/Livewire/Dashboard/Metrics.php new file mode 100644 index 0000000..677750f --- /dev/null +++ b/app/Http/Livewire/Dashboard/Metrics.php @@ -0,0 +1,42 @@ +count = Configuration::count(); + $this->total = Configuration::sum('counts'); + $this->last4hours = Configuration::where( + 'updated_at', + '>', + Carbon::now()->subHours(3)->toDateTimeString() + )->count(); + $this->last24hours = Configuration::where( + 'updated_at', + '>', + Carbon::now()->subHours(24)->toDateTimeString() + )->count(); + $this->last3days = Configuration::where( + 'updated_at', + '>', + Carbon::now()->subHours(24 * 3)->toDateTimeString() + )->count(); + } + + public function render() + { + return view('livewire.dashboard.metrics'); + } +} diff --git a/app/Http/Livewire/Dashboard/Top.php b/app/Http/Livewire/Dashboard/Top.php new file mode 100644 index 0000000..540f31a --- /dev/null +++ b/app/Http/Livewire/Dashboard/Top.php @@ -0,0 +1,20 @@ +top = Configuration::orderBy("counts", "DESC")->take(5)->get(); + } + public function render() + { + return view('livewire.dashboard.top'); + } +} diff --git a/app/Http/Resources/ConfigurationCollection.php b/app/Http/Resources/ConfigurationCollection.php new file mode 100644 index 0000000..9de4d34 --- /dev/null +++ b/app/Http/Resources/ConfigurationCollection.php @@ -0,0 +1,19 @@ + $this->code, + 'counts' => $this->counts, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]; + } +} diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index b77e523..3a8e998 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -9,6 +9,10 @@ class Configuration extends Model { use HasFactory; + protected $casts = [ + 'configuration' => 'object', + ]; + public static function getByCode($code) { return self::firstWhere('code', $code); diff --git a/exclude-list.txt b/exclude-list.txt index b6c37fe..320dd8d 100644 --- a/exclude-list.txt +++ b/exclude-list.txt @@ -103,3 +103,5 @@ public/files public/chunks public/storage bootstrap/cache/config.php + +.phpunit.result.cache diff --git a/resources/views/components/table/link.blade.php b/resources/views/components/table/link.blade.php new file mode 100644 index 0000000..ab6bd73 --- /dev/null +++ b/resources/views/components/table/link.blade.php @@ -0,0 +1,5 @@ +@props([ +'url' => '#', +] +) +{{ $slot }} diff --git a/resources/views/components/table/td.blade.php b/resources/views/components/table/td.blade.php new file mode 100644 index 0000000..1bc95a2 --- /dev/null +++ b/resources/views/components/table/td.blade.php @@ -0,0 +1,7 @@ +@props([ +'align' => 'center', +] +) +
+ {{ $slot }} +
diff --git a/resources/views/configurator/index.blade.php b/resources/views/configurator/index.blade.php index 6f25f31..adb9f9a 100644 --- a/resources/views/configurator/index.blade.php +++ b/resources/views/configurator/index.blade.php @@ -3,18 +3,18 @@ -+ {{ $description }} +
++ {{ $description }} +
+ +