Skip to content

Commit 6eadc93

Browse files
committed
Fix styling
1 parent c7534ed commit 6eadc93

File tree

8 files changed

+41
-47
lines changed

8 files changed

+41
-47
lines changed

packages/prompts/src/Filament/Components/RunCommandComponent.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ protected function runCommand(): void
112112
if (! $this->hasAccessToFlow($state)) {
113113
$this->error = __('moox-prompts::prompts.errors.flow_access_denied');
114114
$this->flowId = null;
115-
115+
116116
return;
117117
}
118-
118+
119119
// Security: Validate command is still allowed (config might have changed)
120120
if (! $this->isCommandAllowed($state->commandName)) {
121121
$this->error = __('moox-prompts::prompts.errors.command_not_allowed', ['command' => $state->commandName]);
122122
$this->flowId = null;
123-
123+
124124
return;
125125
}
126126
}
@@ -163,7 +163,7 @@ protected function runCommand(): void
163163
$this->answers = [];
164164
$this->data = [];
165165
$this->flowId = null;
166-
166+
167167
// Dispatch event to parent page - use window event so parent can listen
168168
$this->dispatch('command-completed');
169169

@@ -732,7 +732,7 @@ public function cancel(): void
732732
}
733733
$this->flowId = null;
734734
}
735-
735+
736736
$this->resetComponentState();
737737
}
738738

@@ -742,11 +742,11 @@ public function cancel(): void
742742
protected function isCommandAllowed(string $commandName): bool
743743
{
744744
$allowedCommands = config('prompts.allowed_commands', []);
745-
745+
746746
if (empty($allowedCommands)) {
747747
return false;
748748
}
749-
749+
750750
return in_array($commandName, $allowedCommands, true);
751751
}
752752

@@ -761,34 +761,34 @@ protected function hasAccessToFlow(\Moox\Prompts\Support\PromptFlowState $state)
761761
if (! class_exists(\Moox\Prompts\Models\CommandExecution::class)) {
762762
return true;
763763
}
764-
764+
765765
try {
766766
$execution = \Moox\Prompts\Models\CommandExecution::where('flow_id', $state->flowId)->first();
767-
767+
768768
// If no execution record exists, allow access (legacy flow or just started)
769769
if (! $execution) {
770770
return true;
771771
}
772-
772+
773773
// If execution has no creator, allow access (system/anonymous flow)
774774
if (! $execution->createdBy) {
775775
return true;
776776
}
777-
777+
778778
// Check if current user is the creator
779779
$user = \Illuminate\Support\Facades\Auth::user();
780780
if (! $user) {
781781
return false;
782782
}
783-
783+
784784
return $execution->createdBy->is($user);
785785
} catch (\Throwable $e) {
786786
// On error, deny access for security
787787
\Log::warning('Error checking flow access', [
788788
'flow_id' => $state->flowId,
789789
'error' => $e->getMessage(),
790790
]);
791-
791+
792792
return false;
793793
}
794794
}

packages/prompts/src/Filament/Pages/RunCommandPage.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ public static function getNavigationGroup(): ?string
3838
public array $availableCommands = [];
3939

4040
public bool $started = false;
41-
41+
4242
public bool $commandCompleted = false;
43-
43+
4444
protected $listeners = ['command-completed' => 'onCommandCompleted'];
4545

4646
public function mount(): void
4747
{
4848
$this->availableCommands = $this->getAvailableCommands();
4949
}
50-
50+
5151
public function onCommandCompleted(): void
5252
{
5353
$this->commandCompleted = true;
@@ -66,31 +66,31 @@ public function resetCommand(): void
6666
$this->selectedCommand = '';
6767
$this->commandCompleted = false;
6868
}
69-
69+
7070
public function getButtonText(): string
7171
{
7272
if ($this->commandCompleted) {
7373
return __('moox-prompts::prompts.ui.start_new_command');
7474
}
75-
75+
7676
return __('moox-prompts::prompts.ui.back_to_selection');
7777
}
78-
78+
7979
public function getButtonColor(): string
8080
{
8181
if ($this->commandCompleted) {
8282
return 'primary';
8383
}
84-
84+
8585
return 'warning';
8686
}
87-
87+
8888
public function getButtonKey(): string
8989
{
9090
if ($this->commandCompleted) {
9191
return 'new';
9292
}
93-
93+
9494
return 'back';
9595
}
9696

packages/prompts/src/Filament/Resources/CommandExecutionResource.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22

33
namespace Moox\Prompts\Filament\Resources;
44

5-
use Filament\Forms;
6-
use Filament\Tables;
7-
use Filament\Tables\Table;
8-
use Filament\Schemas\Schema;
9-
use Filament\Actions\ViewAction;
10-
use Filament\Resources\Resource;
11-
use Filament\Actions\DeleteAction;
125
use Filament\Actions\BulkActionGroup;
13-
use Filament\Forms\Components\Select;
6+
use Filament\Actions\DeleteAction;
147
use Filament\Actions\DeleteBulkAction;
8+
use Filament\Actions\ViewAction;
9+
use Filament\Forms\Components\DateTimePicker;
1510
use Filament\Forms\Components\KeyValue;
11+
use Filament\Forms\Components\Select;
1612
use Filament\Forms\Components\Textarea;
17-
use Filament\Tables\Columns\TextColumn;
1813
use Filament\Forms\Components\TextInput;
14+
use Filament\Resources\Resource;
1915
use Filament\Schemas\Components\Section;
16+
use Filament\Schemas\Schema;
2017
use Filament\Tables\Columns\BadgeColumn;
18+
use Filament\Tables\Columns\TextColumn;
2119
use Filament\Tables\Filters\SelectFilter;
22-
use Moox\Prompts\Models\CommandExecution;
23-
use Filament\Forms\Components\DateTimePicker;
20+
use Filament\Tables\Table;
2421
use Moox\Prompts\Filament\Resources\CommandExecutionResource\Pages;
22+
use Moox\Prompts\Models\CommandExecution;
2523

2624
class CommandExecutionResource extends Resource
2725
{
@@ -192,4 +190,3 @@ public static function getPages(): array
192190
];
193191
}
194192
}
195-

packages/prompts/src/Filament/Resources/CommandExecutionResource/Pages/ListCommandExecutions.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ class ListCommandExecutions extends ListRecords
99
{
1010
protected static string $resource = CommandExecutionResource::class;
1111
}
12-

packages/prompts/src/Filament/Resources/CommandExecutionResource/Pages/ViewCommandExecution.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ protected function getHeaderActions(): array
1616
];
1717
}
1818
}
19-

packages/prompts/src/Models/CommandExecution.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@ public function createdBy()
4040
return $this->morphTo();
4141
}
4242
}
43-

packages/prompts/src/Support/PromptFlowRunner.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ protected function ensureExecutionExists(PromptFlowState $state, $command): void
151151
'step_outputs' => $state->stepOutputs ?? [],
152152
'context' => $state->context ?? [],
153153
]);
154-
154+
155155
if (Auth::check()) {
156156
$execution->createdBy()->associate(Auth::user());
157157
}
158-
158+
159159
$execution->save();
160160
}
161161
} catch (\Throwable $e) {
@@ -192,7 +192,7 @@ protected function updateExecutionCompleted(PromptFlowState $state): void
192192
try {
193193
$command = $this->resolveCommand($state->commandName);
194194
$this->ensureExecutionExists($state, $command);
195-
195+
196196
CommandExecution::where('flow_id', $state->flowId)->update([
197197
'status' => 'completed',
198198
'completed_at' => now(),
@@ -217,7 +217,7 @@ protected function updateExecutionFailed(PromptFlowState $state, string $errorMe
217217
try {
218218
$command = $this->resolveCommand($state->commandName);
219219
$this->ensureExecutionExists($state, $command);
220-
220+
221221
CommandExecution::where('flow_id', $state->flowId)->update([
222222
'status' => 'failed',
223223
'failed_at' => now(),

packages/prompts/src/Support/PromptFlowStateStore.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public function reset(string $flowId): void
3636
{
3737
// Get state BEFORE deleting it from cache
3838
$state = $this->get($flowId);
39-
39+
4040
// Delete from cache
4141
$this->cache->forget($this->key($flowId));
42-
42+
4343
// Mark execution as cancelled if it exists, or create one
4444
if (class_exists(\Moox\Prompts\Models\CommandExecution::class)) {
4545
try {
@@ -59,7 +59,7 @@ public function reset(string $flowId): void
5959
$cancelledAtStep = $state->steps[count($state->steps) - 1] ?? null;
6060
}
6161
}
62-
62+
6363
// Try to update existing record - only if it's not already completed or failed
6464
$updated = \Moox\Prompts\Models\CommandExecution::where('flow_id', $flowId)
6565
->whereNotIn('status', ['cancelled', 'completed', 'failed'])
@@ -70,7 +70,7 @@ public function reset(string $flowId): void
7070
'step_outputs' => $state->stepOutputs ?? [],
7171
'context' => $state->context ?? [],
7272
]);
73-
73+
7474
// If no record exists yet, create one with cancelled status
7575
if ($updated === 0 && $state) {
7676
$command = app(\Illuminate\Contracts\Console\Kernel::class)->all()[$state->commandName] ?? null;
@@ -87,11 +87,11 @@ public function reset(string $flowId): void
8787
'step_outputs' => $state->stepOutputs ?? [],
8888
'context' => $state->context ?? [],
8989
]);
90-
90+
9191
if (\Illuminate\Support\Facades\Auth::check()) {
9292
$execution->createdBy()->associate(\Illuminate\Support\Facades\Auth::user());
9393
}
94-
94+
9595
$execution->save();
9696
}
9797
}

0 commit comments

Comments
 (0)