Skip to content

Commit 4d3bbd5

Browse files
committed
Add web interface support for Laravel Prompts
1 parent 287da83 commit 4d3bbd5

File tree

10 files changed

+1020
-40
lines changed

10 files changed

+1020
-40
lines changed

packages/prompts/config/prompts.php

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,37 @@
22

33
/*
44
|--------------------------------------------------------------------------
5-
| Moox Configuration
5+
| Prompts Configuration
66
|--------------------------------------------------------------------------
77
|
8-
| This configuration file uses translatable strings. If you want to
9-
| translate the strings, you can do so in the language files
10-
| published from moox_core. Example:
11-
|
12-
| 'trans//core::core.all',
13-
| loads from common.php
14-
| outputs 'All'
8+
| This configuration file defines which Artisan commands are allowed to be
9+
| executed through the web interface using prompts.
1510
|
1611
*/
17-
return [
18-
19-
'readonly' => false,
20-
21-
'resources' => [
22-
'item' => [
23-
'single' => 'trans//item::item.item',
24-
'plural' => 'trans//item::item.items',
25-
'tabs' => [
26-
'all' => [
27-
'label' => 'trans//core::core.all',
28-
'icon' => 'gmdi-filter-list',
29-
'query' => [
30-
[
31-
'field' => 'title',
32-
'operator' => '!=',
33-
'value' => null,
34-
],
35-
],
36-
],
37-
],
38-
],
39-
],
4012

41-
'relations' => [],
13+
return [
4214

4315
/*
4416
|--------------------------------------------------------------------------
45-
| Navigation
17+
| Allowed Commands
4618
|--------------------------------------------------------------------------
4719
|
48-
| The navigation group and sort of the Resource,
49-
| and if the panel is enabled.
20+
| List of Artisan command names that are allowed to be executed through
21+
| the web interface. Only commands listed here will be available in the
22+
| Command Runner page.
23+
|
24+
| Example:
25+
| 'allowed_commands' => [
26+
| 'prompts:test-flow',
27+
| 'prompts:test-web',
28+
| ],
5029
|
5130
*/
52-
'auth' => [
53-
'user' => 'Moox\\DevTools\\Models\\TestUser',
31+
32+
'allowed_commands' => [
33+
'prompts:test-flow',
34+
'prompts:publish-news-config',
35+
// Add more commands here as needed
5436
],
55-
'navigation_group' => 'DEV',
37+
5638
];
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<div>
2+
@if($error)
3+
<x-filament::section>
4+
<x-slot name="heading">
5+
Fehler
6+
</x-slot>
7+
<p style="color: #b91c1c;">{{ $error }}</p>
8+
</x-filament::section>
9+
@elseif($isComplete)
10+
<x-filament::section>
11+
<x-slot name="heading">
12+
Command erfolgreich abgeschlossen!
13+
</x-slot>
14+
@if($output)
15+
<pre
16+
style="background-color: #111827; color: #4ade80; padding: 1rem; border-radius: 0.25rem; overflow: auto; font-size: 0.875rem;">{{ $output }}</pre>
17+
@endif
18+
</x-filament::section>
19+
@elseif($currentPrompt)
20+
{{ $this->form }}
21+
<div style="margin-top: 1rem; display: flex; justify-content: flex-end;">
22+
<x-filament::button wire:click="submitPrompt" type="button" color="primary">
23+
Weiter
24+
</x-filament::button>
25+
</div>
26+
@else
27+
<x-filament::section>
28+
<x-slot name="heading">
29+
Command wird gestartet...
30+
</x-slot>
31+
<x-filament::loading-indicator />
32+
</x-filament::section>
33+
@endif
34+
</div>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<x-filament-panels::page>
2+
@if(!$started)
3+
<x-filament::section>
4+
<x-slot name="heading">
5+
Command auswählen
6+
</x-slot>
7+
8+
@if(empty($availableCommands))
9+
<p style="color: #6b7280;">Keine Commands verfügbar. Bitte konfigurieren Sie die erlaubten Commands in der Konfiguration.</p>
10+
@else
11+
<form wire:submit="startCommand">
12+
<x-filament::input.wrapper>
13+
<x-filament::input.select wire:model="selectedCommand" required>
14+
<option value="">-- Command auswählen --</option>
15+
@foreach($availableCommands as $commandName => $description)
16+
<option value="{{ $commandName }}">{{ $commandName }} - {{ $description }}</option>
17+
@endforeach
18+
</x-filament::input.select>
19+
</x-filament::input.wrapper>
20+
21+
<div style="margin-top: 1rem;">
22+
<x-filament::button type="submit" color="primary">
23+
Command starten
24+
</x-filament::button>
25+
</div>
26+
</form>
27+
@endif
28+
</x-filament::section>
29+
@else
30+
@livewire('moox-prompts.filament.components.run-command-component', [
31+
'command' => $selectedCommand,
32+
'commandInput' => []
33+
], key('run-command-' . $selectedCommand))
34+
35+
<div style="margin-top: 1rem;">
36+
<x-filament::button wire:click="resetCommand" color="gray">
37+
Zurück
38+
</x-filament::button>
39+
</div>
40+
@endif
41+
</x-filament-panels::page>

0 commit comments

Comments
 (0)