Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions app/Filament/Admin/Resources/PolydockStoreAppResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,111 @@ public static function form(Form $form): Form
->required()
->maxLength(255)
->default('main'),
Section::make('Lagoon Script Configuration')
->description('Optional scripts run during app lifecycle stages.')
->schema([
Section::make('Post Deploy')
->schema([
Forms\Components\Textarea::make('lagoon_post_deploy_script')
->label('Script')
->rows(3),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_post_deploy_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_post_deploy_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
Section::make('Pre Upgrade')
->schema([
Forms\Components\Textarea::make('lagoon_pre_upgrade_script')
->label('Script')
->rows(3),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_pre_upgrade_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_pre_upgrade_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
Section::make('Upgrade')
->schema([
Forms\Components\Textarea::make('lagoon_upgrade_script')
->label('Script')
->rows(3),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_upgrade_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_upgrade_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
Section::make('Post Upgrade')
->schema([
Forms\Components\Textarea::make('lagoon_post_upgrade_script')
->label('Script')
->rows(3),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_post_upgrade_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_post_upgrade_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
Section::make('Claim')
->schema([
Forms\Components\Textarea::make('lagoon_claim_script')
->label('Script')
->rows(3)
->helperText('When set, command output must be a valid URL and becomes app URL.'),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_claim_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_claim_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
Section::make('Pre Remove')
->schema([
Forms\Components\Textarea::make('lagoon_pre_remove_script')
->label('Script')
->rows(3),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_pre_remove_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_pre_remove_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
Section::make('Remove')
->schema([
Forms\Components\Textarea::make('lagoon_remove_script')
->label('Script')
->rows(3),
Grid::make(2)->schema([
Forms\Components\TextInput::make('lagoon_remove_service')
->maxLength(255)
->placeholder('cli'),
Forms\Components\TextInput::make('lagoon_remove_container')
->maxLength(255)
->placeholder('cli'),
]),
]),
])
->collapsible()
->collapsed(),
Forms\Components\Select::make('status')
->options(PolydockStoreAppStatusEnum::class)
->required(),
Expand Down
11 changes: 10 additions & 1 deletion app/Http/Controllers/Api/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function showRegister(string $uuid): JsonResponse
try {
$registration = UserRemoteRegistration::where('uuid', $uuid)->firstOrFail();
Log::info('Showing user remote registration', ['registration' => $registration->toArray()]);
$responseResultData = $registration->result_data ?? [];

if ($registration->appInstance) {
$appInstance = $registration->appInstance;
Expand All @@ -65,12 +66,20 @@ public function showRegister(string $uuid): JsonResponse
$registration->setResultValue('result_type', 'registration_failed');
$registration->save();
}

if ($appInstance->getKeyValue('lagoon-project-id')) {
$responseResultData['lagoon-project-id'] = $appInstance->getKeyValue('lagoon-project-id');
}

if ($appInstance->getKeyValue('lagoon-deploy-branch')) {
$responseResultData['lagoon-deploy-branch'] = $appInstance->getKeyValue('lagoon-deploy-branch');
}
}

return response()->json([
'status' => $registration->status->value,
'email' => $registration->email,
'result_data' => $registration->result_data,
'result_data' => $responseResultData,
'created_at' => $registration->created_at,
'updated_at' => $registration->updated_at,
]);
Expand Down