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 @@
Let me help you to set the basics.
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?