ui: updates

This commit is contained in:
Andras Bacsai
2024-02-20 15:07:12 +01:00
parent a1d09ad574
commit f81b676abe
50 changed files with 662 additions and 238 deletions

View File

@@ -73,6 +73,10 @@ class ServicesGenerate extends Command
} else {
$slogan = str($file)->headline()->value();
}
$logo = collect(preg_grep('/^# logo:/', explode("\n", $content)))->values();
if ($logo->count() > 0) {
$logo = str($logo[0])->after('# logo:')->trim()->value();
}
$env_file = collect(preg_grep('/^# env_file:/', explode("\n", $content)))->values();
if ($env_file->count() > 0) {
$env_file = str($env_file[0])->after('# env_file:')->trim()->value();
@@ -96,6 +100,7 @@ class ServicesGenerate extends Command
'slogan' => $slogan,
'compose' => $yaml,
'tags' => $tags,
'logo' => $logo,
];
if ($env_file) {
$env_file_content = file_get_contents(base_path("templates/compose/$env_file"));

View File

@@ -71,10 +71,10 @@ class Select extends Component
// }
// }
public function loadServices()
public function loadServices(bool $force = false)
{
try {
if (count($this->allServices) > 0) {
if (count($this->allServices) > 0 && !$force) {
if (!$this->search) {
$this->services = $this->allServices;
return;
@@ -93,6 +93,7 @@ class Select extends Component
});;
$this->dispatch('success', 'Successfully loaded services.');
}
ray($this->services);
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {

View File

@@ -4,6 +4,7 @@ namespace App\Livewire\Source\Github;
use App\Models\GithubApp;
use App\Models\InstanceSettings;
use Illuminate\Support\Facades\Http;
use Livewire\Component;
class Change extends Component
@@ -36,6 +37,40 @@ class Change extends Component
'github_app.is_system_wide' => 'required|bool',
];
// public function check()
// {
// Need administration:read:write permission
// https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-a-repository
// $github_access_token = generate_github_installation_token($this->github_app);
// $repositories = Http::withToken($github_access_token)->get("{$this->github_app->api_url}/installation/repositories?per_page=100");
// $runners_by_repository = collect([]);
// $repositories = $repositories->json()['repositories'];
// foreach ($repositories as $repository) {
// $runners_downloads = Http::withToken($github_access_token)->get("{$this->github_app->api_url}/repos/{$repository['full_name']}/actions/runners/downloads");
// $runners = Http::withToken($github_access_token)->get("{$this->github_app->api_url}/repos/{$repository['full_name']}/actions/runners");
// $token = Http::withHeaders([
// 'Authorization' => "Bearer $github_access_token",
// 'Accept' => 'application/vnd.github+json'
// ])->withBody(null)->post("{$this->github_app->api_url}/repos/{$repository['full_name']}/actions/runners/registration-token");
// $token = $token->json();
// $remove_token = Http::withHeaders([
// 'Authorization' => "Bearer $github_access_token",
// 'Accept' => 'application/vnd.github+json'
// ])->withBody(null)->post("{$this->github_app->api_url}/repos/{$repository['full_name']}/actions/runners/remove-token");
// $remove_token = $remove_token->json();
// $runners_by_repository->put($repository['full_name'], [
// 'token' => $token,
// 'remove_token' => $remove_token,
// 'runners' => $runners->json(),
// 'runners_downloads' => $runners_downloads->json()
// ]);
// }
// ray($runners_by_repository);
// }
public function mount()
{
$github_app_uuid = request()->github_app_uuid;

View File

@@ -0,0 +1,30 @@
<?php
namespace App\View\Components;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class ResourceView extends Component
{
/**
* Create a new component instance.
*/
public function __construct(
public ?string $wire = null,
public ?string $logo = null,
public ?string $documentation = null,
)
{
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.resource-view');
}
}