Skip to content
Open
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
18 changes: 15 additions & 3 deletions app/Filament/Admin/Resources/PolydockAppInstanceResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,29 @@ public static function form(Form $form): Form
public static function table(Table $table): Table
{
return $table
->searchable()
->columns([
TextColumn::make('name')
->description(fn ($record) => $record->storeApp->store->name.' - '.$record->storeApp->name)
->searchable(),
->searchable()
->sortable(),
TextColumn::make('userGroup.name')
->label('User Group')
->searchable(),
TextColumn::make('status')
->badge()
->color(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getColor())
->icon(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getIcon())
->formatStateUsing(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getLabel()),
->formatStateUsing(fn ($state) => PolydockAppInstanceStatus::from($state->value)->getLabel())
->sortable(),
TextColumn::make('is_trial')
->state(fn ($record) => $record->is_trial ? 'Yes' : 'No')
->label('Trial'),
TextColumn::make('trial_ends_at')
->label('Trial Ends At')
->description(fn ($record) => $record->trial_completed ? 'Trial completed' : 'Trial active')
->dateTime(),
->dateTime()
->sortable(),
TextColumn::make('send_midtrial_email_at')
->label('Midtrial Email')
->description(fn ($record) => $record->midtrial_email_sent ? 'Sent' : 'Pending')
Expand All @@ -86,6 +90,14 @@ public static function table(Table $table): Table
->state(fn ($record) => $record->is_trial && $record->trial_complete_email_sent
? 'Sent'
: ($record->is_trial ? 'Pending' : '')),
TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
SelectFilter::make('status')
Expand Down
6 changes: 4 additions & 2 deletions app/Filament/Admin/Resources/PolydockStoreAppResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,12 @@ public static function table(Table $table): Table
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable(),
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('store.name')
->label('Store')
->searchable(),
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('status'),
Tables\Columns\IconColumn::make('available_for_trials')
->label('Trials')
Expand Down
4 changes: 3 additions & 1 deletion app/Filament/Admin/Resources/PolydockStoreResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ public static function form(Form $form): Form
public static function table(Table $table): Table
{
return $table
->searchable()
->columns([
Tables\Columns\TextColumn::make('name')
->searchable(),
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('status'),
Tables\Columns\IconColumn::make('listed_in_marketplace')
->label('Listed')
Expand Down
13 changes: 8 additions & 5 deletions app/Filament/Admin/Resources/UserGroupResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ public static function form(Form $form): Form
public static function table(Table $table): Table
{
return $table
->searchable()
->columns([
TextColumn::make('name'),
TextColumn::make('name')
->searchable()
->sortable(),
TextColumn::make('users_count')
->counts('users')
->label('Users'),
])
->filters([
//
->label('Users')
->sortable(),
TextColumn::make('created_at')->dateTime()
->sortable(),
])
->actions([
Tables\Actions\ViewAction::make(),
Expand Down
45 changes: 38 additions & 7 deletions app/Filament/Admin/Resources/UserRemoteRegistrationResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace App\Filament\Admin\Resources;

use App\Filament\Admin\Resources\UserRemoteRegistrationResource\Pages;
use App\Models\PolydockStore;
use App\Models\PolydockStoreApp;
use App\Models\UserRemoteRegistration;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
Expand Down Expand Up @@ -36,17 +39,30 @@ public static function form(Form $form): Form
public static function table(Table $table): Table
{
return $table
->searchable()
->columns([
TextColumn::make('type')
->badge()
->color(fn ($state): string => $state ? $state->getColor() : 'gray')
->icon(fn ($state): string => $state ? $state->getIcon() : '')
->sortable(),
TextColumn::make('email'),
TextColumn::make('user.name'),
TextColumn::make('userGroup.name'),
TextColumn::make('storeApp.store.name'),
TextColumn::make('storeApp.name'),
TextColumn::make('email')
->searchable()
->sortable(),
TextColumn::make('user.name')
->searchable()
->sortable(),
TextColumn::make('userGroup.name')
->searchable()
->sortable(),
TextColumn::make('storeApp.store.name')
->label('Store')
->searchable()
->sortable(),
TextColumn::make('storeApp.name')
->label('Store App')
->searchable()
->sortable(),
TextColumn::make('status')
->badge()
->color(fn ($state): string => match ($state->value) {
Expand All @@ -55,10 +71,25 @@ public static function table(Table $table): Table
'success' => 'success',
'failed' => 'danger',
default => 'gray',
})
->sortable(),
TextColumn::make('created_at')->dateTime()
->sortable(),
])
->filters([
Tables\Filters\SelectFilter::make('store_id')
->label('Store')
->options(fn () => PolydockStore::pluck('name', 'id'))
->query(function ($query, array $data) {
return $query->when($data['value'], fn ($query) => $query->whereHas('storeApp', fn ($q) => $q->where('polydock_store_id', $data['value'])));
}),
Tables\Filters\SelectFilter::make('store_app_id')
->label('Store App')
->options(fn () => PolydockStoreApp::pluck('name', 'id'))
->query(function ($query, array $data) {
return $query->when($data['value'], fn ($query) => $query->where('polydock_store_app_id', $data['value']));
}),
TextColumn::make('created_at')->dateTime(),
])
->filters([])
->actions([
Tables\Actions\ViewAction::make(),
])
Expand Down
30 changes: 24 additions & 6 deletions app/Filament/Admin/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,35 @@ public static function form(Form $form): Form
public static function table(Table $table): Table
{
return $table
->searchable()
->columns([
TextColumn::make('first_name'),
TextColumn::make('last_name'),
TextColumn::make('email'),
TextColumn::make('first_name')
->searchable()
->sortable(),
TextColumn::make('last_name')
->searchable()
->sortable(),
TextColumn::make('email')
->searchable()
->sortable(),
TextColumn::make('groups_count')
->counts('groups')
->label('Groups'),
TextColumn::make('created_at')->dateTime(),
->label('Groups')
->sortable(),
TextColumn::make('created_at')->dateTime()
->sortable(),
])
->filters([
//
Tables\Filters\Filter::make('created_from')
->form([
Forms\Components\DatePicker::make('created_from'),
])
->query(function ($query, array $data) {
return $query->when(
$data['created_from'],
fn ($query) => $query->where('created_at', '>=', $data['created_from']),
);
}),
])
->actions([
Tables\Actions\ViewAction::make(),
Expand Down
2 changes: 2 additions & 0 deletions app/Models/PolydockAppInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ protected static function boot()
'lagoon-project-name' => $model->name,
'amazee-ai-backend-region-id' => $storeApp->amazee_ai_backend_region_id_ext,
'available-for-trials' => $storeApp->available_for_trials,
'lagoon-auto-idle' => $storeApp->lagoon_auto_idle,
'lagoon-production-environment' => $storeApp->lagoon_production_environment,
'lagoon-generate-app-admin-username' => $model->generateUniqueUsername(),
'lagoon-generate-app-admin-password' => $model->generateUniquePassword(),
'polydock-app-instance-health-webhook-url' => str_replace(':status:', '', route('api.instance.health', [
Expand Down
18 changes: 18 additions & 0 deletions app/Models/PolydockStoreApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class PolydockStoreApp extends Model
'unallocated_instances_count',
'needs_more_unallocated_instances',
'lagoon_deploy_group_name',
'lagoon_auto_idle',
'lagoon_production_environment',
];

/**
Expand Down Expand Up @@ -218,4 +220,20 @@ public function getLagoonDeployGroupNameAttribute(): ?string
{
return $this->store->lagoon_deploy_group_name;
}

/**
* Get the Lagoon autoIdle setting from app_config
*/
public function getLagoonAutoIdleAttribute(): ?int
{
return $this->app_config['lagoon_auto_idle'] ?? 0;
}

/**
* Get the Lagoon production environment from app_config
*/
public function getLagoonProductionEnvironmentAttribute(): ?string
{
return $this->app_config['lagoon_production_environment'] ?? null;
}
}
15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"name": "amazeeio/polydock-engine",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"keywords": [
"laravel",
"framework"
],
"license": "MIT",
"require": {
"php": "^8.3",
"ext-curl": "*",
"amazeeio/lagoon-logs": "^0.0.5",
"amazeeio/polydock-app-amazeeio-privategpt": "^0.0.11",
"amazeeio/polydock-app-amazeeio-privategpt": "^0.0.13",
"evanschleret/lara-mjml": "^0.3.0",
"filament/filament": "^3.2",
"freedomtech-hosting/ft-lagoon-php": "^0.0.11",
"freedomtech-hosting/ft-lagoon-php": "^0.0.12",
"freedomtech-hosting/polydock-amazeeai-backend-client-php": "^0.0.6",
"freedomtech-hosting/polydock-app": "^0.0.30",
"freedomtech-hosting/polydock-app-amazeeio-generic": "^0.0.79",
"freedomtech-hosting/polydock-app": "^0.0.31",
"freedomtech-hosting/polydock-app-amazeeio-generic": "^0.0.80",
"laravel/framework": "^11.31",
"laravel/horizon": "^5.30",
"laravel/sanctum": "^4.0",
Expand Down
Loading