diff --git a/app/Http/Livewire/Project/New/GithubPrivateRepository.php b/app/Http/Livewire/Project/New/GithubPrivateRepository.php index 77b2b2dab..dec4e80e8 100644 --- a/app/Http/Livewire/Project/New/GithubPrivateRepository.php +++ b/app/Http/Livewire/Project/New/GithubPrivateRepository.php @@ -7,15 +7,19 @@ use App\Models\GithubApp; use App\Models\Project; use App\Models\StandaloneDocker; use App\Models\SwarmDocker; +use App\Traits\SaveFromRedirect; use Illuminate\Support\Facades\Http; use Livewire\Component; +use Route; class GithubPrivateRepository extends Component { + use SaveFromRedirect; public $current_step = 'github_apps'; public $github_apps; public GithubApp $github_app; public $parameters; + public $currentRoute; public $query; public $type; @@ -36,14 +40,30 @@ class GithubPrivateRepository extends Component public string|null $publish_directory = null; protected int $page = 1; + // public function saveFromRedirect(string $route, ?Collection $parameters = null){ + // session()->forget('from'); + // if (!$parameters || $parameters->count() === 0) { + // $parameters = $this->parameters; + // } + // $parameters = collect($parameters) ?? collect([]); + // $queries = collect($this->query) ?? collect([]); + // $parameters = $parameters->merge($queries); + // session(['from'=> [ + // 'back'=> $this->currentRoute, + // 'route' => $route, + // 'parameters' => $parameters + // ]]); + // return redirect()->route($route); + // } + public function mount() { + $this->currentRoute = Route::currentRouteName(); $this->parameters = get_route_parameters(); $this->query = request()->query(); $this->repositories = $this->branches = collect(); $this->github_apps = GithubApp::private(); } - public function loadRepositories($github_app_id) { $this->repositories = collect(); diff --git a/app/Http/Livewire/Source/Github/Change.php b/app/Http/Livewire/Source/Github/Change.php index f4ab49c1a..4012386ae 100644 --- a/app/Http/Livewire/Source/Github/Change.php +++ b/app/Http/Livewire/Source/Github/Change.php @@ -39,7 +39,6 @@ class Change extends Component { if (is_cloud() && !isDev()) { $this->webhook_endpoint = config('app.url'); - ray($this->webhook_endpoint); } else { $this->webhook_endpoint = $this->ipv4; $this->is_system_wide = $this->github_app->is_system_wide; diff --git a/app/Http/Livewire/Source/Github/Create.php b/app/Http/Livewire/Source/Github/Create.php index 4d6f8b26b..b5487bcc8 100644 --- a/app/Http/Livewire/Source/Github/Create.php +++ b/app/Http/Livewire/Source/Github/Create.php @@ -42,6 +42,9 @@ class Create extends Component 'is_system_wide' => $this->is_system_wide, 'team_id' => currentTeam()->id, ]); + if (session('from')) { + session(['from' => session('from') + ['source_id' => $github_app->id]]); + } redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]); } catch (\Exception $e) { return general_error_handler(err: $e, that: $this); diff --git a/app/Traits/SaveFromRedirect.php b/app/Traits/SaveFromRedirect.php new file mode 100644 index 000000000..83013a857 --- /dev/null +++ b/app/Traits/SaveFromRedirect.php @@ -0,0 +1,25 @@ +forget('from'); + if (!$parameters || $parameters->count() === 0) { + $parameters = $this->parameters; + } + $parameters = collect($parameters) ?? collect([]); + $queries = collect($this->query) ?? collect([]); + $parameters = $parameters->merge($queries); + session(['from' => [ + 'back' => $this->currentRoute, + 'route' => $route, + 'parameters' => $parameters + ]]); + return redirect()->route($route); + } +} diff --git a/app/View/Components/Forms/Button.php b/app/View/Components/Forms/Button.php index 2b67c6915..c9f4ebdc0 100644 --- a/app/View/Components/Forms/Button.php +++ b/app/View/Components/Forms/Button.php @@ -15,7 +15,7 @@ class Button extends Component public bool $disabled = false, public bool $isModal = false, public bool $noStyle = false, - public string|null $modalId = null, + public ?string $modalId = null, public string $defaultClass = "btn btn-primary btn-sm font-normal text-white normal-case no-animation rounded border-none" ) { if ($this->noStyle) { @@ -23,9 +23,6 @@ class Button extends Component } } - /** - * Get the view / contents that represent the component. - */ public function render(): View|Closure|string { return view('components.forms.button'); diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 378bfae47..da8eaebdf 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -7,6 +7,7 @@ use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException; use Illuminate\Database\QueryException; use Illuminate\Mail\Message; use Illuminate\Notifications\Messages\MailMessage; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Route; @@ -52,8 +53,7 @@ function showBoarding(): bool } function refreshSession(): void { - $team = currentTeam(); - session(['currentTeam' => $team]); + session(['currentTeam' => currentTeam()]); } function general_error_handler(Throwable | null $err = null, $that = null, $isJson = false, $customErrorMessage = null): mixed { @@ -259,3 +259,4 @@ function send_user_an_email(MailMessage $mail, string $email): void ->html((string) $mail->render()) ); } + diff --git a/resources/js/components/MagicBar.vue b/resources/js/components/MagicBar.vue index a0e8f762c..5719bc1d6 100644 --- a/resources/js/components/MagicBar.vue +++ b/resources/js/components/MagicBar.vue @@ -408,6 +408,12 @@ const magicActions = [{ name: 'Goto: Switch Teams', icon: 'goto', sequence: ['main', 'redirect'] +}, +{ + id: 23, + name: 'Goto: Boarding process', + icon: 'goto', + sequence: ['main', 'redirect'] } ] const initialState = { @@ -635,6 +641,9 @@ async function redirect() { case 22: targetUrl.pathname = `/team` break; + case 23: + targetUrl.pathname = `/boarding` + break; } window.location.href = targetUrl; } diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index d38aa0190..a62b0c705 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -5,8 +5,8 @@

Welcome to Coolify

Let me help you to set the basics.

-
Get Started -
+ Get Started +
@endif @@ -18,10 +18,10 @@ or on a ? -
Localhost -
-
Remote Server -
+ Localhost + + Remote Server +

Servers are the main building blocks, as they will host your applications, databases, @@ -42,10 +42,10 @@ Do you have your own SSH Private Key? -

Yes -
-
No (create one for me) -
+ Yes + + No (create one for me) + @if (count($privateKeys) > 0)
@@ -76,8 +76,8 @@ There are already servers available for your Team. Do you want to use one of them? -
No (create a new one) -
+ No (create one for me) +
@@ -182,9 +182,9 @@ Could not find Docker Engine on your server. Do you want me to install it for you? -
+ Let's do - it!
+ it!

This will install the latest Docker Engine on your server, configure a few things to be able @@ -233,7 +233,7 @@ @endif -

Let's create a new one!
+ Let's create a new one!
@if (count($projects) > 0)

Create a new Application

- - + Add New GitHub App - - + + + Add New GitHub App +
Deploy any public or private git repositories through a GitHub App.
@if ($github_apps->count() !== 0) @@ -25,7 +24,7 @@ {{ $ghapp->name }}
{{ $ghapp->http_url }}
-
@@ -39,7 +38,7 @@
{{ data_get($ghapp, 'html_url') }}
- Loading... diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php index 9cdfe515f..be76d5e66 100644 --- a/resources/views/livewire/project/new/select.blade.php +++ b/resources/views/livewire/project/new/select.blade.php @@ -70,7 +70,6 @@ - @endif @if ($current_step === 'servers') @@ -79,7 +78,7 @@
  • Select a Server
  • Select a Destination
  • -
    +
    @forelse($servers as $server)
    @@ -108,7 +107,7 @@
  • Select a Server
  • Select a Destination
  • -
    +
    @foreach ($standaloneDockers as $standaloneDocker)
    diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.php index 632791b9f..8f987db70 100644 --- a/resources/views/livewire/source/github/change.blade.php +++ b/resources/views/livewire/source/github/change.blade.php @@ -11,17 +11,15 @@ @if ($github_app->app_id) Save - - - @if ($github_app->installation_id) + @if (data_get($github_app, 'installation_id')) + + + Update Repositories - @else - Install Repositories - - @endif - - + + + @endif @else Save @endif @@ -30,8 +28,21 @@
    -
    Your Private GitHub App for private repositories.
    - @if ($github_app->app_id) +
    Your Private GitHub App for private repositories.
    + @if (data_get($github_app, 'app_id')) + @if (!data_get($github_app, 'installation_id')) +
    + + + + You must complete this step before you can use this source! +
    + + Install Repositories on GitHub + + @else
    + @endif + @else +
    + + + + You must complete this step before you can use this source! +
    -
    -

    Register a GitHub App

    - - Register a - GitHub - Application - -
    +

    Register a GitHub App

    You need to register a GitHub App before using this source.
    @if (!is_cloud() || isDev()) @@ -90,8 +103,20 @@ @if ($fqdn) @endif + @if (config('app.url')) + + @endif + + Register +
    + @else + + Register Now + @endif
    -
    - - -
    -
    - - -
    -
    - @if ($github_app->html_url === 'https://github.com') - - - @else - - - @endif -
    - @if (!is_cloud() || isDev()) - - @endif