Skip to content

Commit

Permalink
Make inactive supervisors visible (#1286)
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank authored Jun 22, 2023
1 parent 029cf34 commit ea1ff82
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion public/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=c6d58c1ba0a1e0ad976bd661884a1582",
"/app.js": "/app.js?id=7e1968acfd75b8dc843675097962e3ce",
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
Expand Down
3 changes: 3 additions & 0 deletions resources/js/screens/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@
<svg v-if="supervisor.status == 'paused'" class="fill-warning mr-1" viewBox="0 0 20 20" style="width: 1rem; height: 1rem;">
<path d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM7 6h2v8H7V6zm4 0h2v8h-2V6z"/>
</svg>
<svg v-if="supervisor.status == 'inactive'" class="fill-danger mr-1" viewBox="0 0 20 20" style=" width: 1rem; height: 1rem;">
<path d="M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm1.41-1.41A8 8 0 1 0 15.66 4.34 8 8 0 0 0 4.34 15.66zm9.9-8.49L11.41 10l2.83 2.83-1.41 1.41L10 11.41l-2.83 2.83-1.41-1.41L8.59 10 5.76 7.17l1.41-1.41L10 8.59l2.83-2.83 1.41 1.41z"/>
</svg>
{{ superVisorDisplayName(supervisor.name, worker.name) }}
</td>
<td class="text-muted">{{ supervisor.options.queue.replace(/,/g, ', ') }}</td>
Expand Down
20 changes: 19 additions & 1 deletion src/Http/Controllers/MasterSupervisorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\ProvisioningPlan;

class MasterSupervisorController extends Controller
{
Expand All @@ -22,7 +23,24 @@ public function index(MasterSupervisorRepository $masters,
$supervisors = collect($supervisors->all())->sortBy('name')->groupBy('master');

return $masters->each(function ($master, $name) use ($supervisors) {
$master->supervisors = $supervisors->get($name);
$master->supervisors = ($supervisors->get($name) ?? collect())
->merge(
collect(ProvisioningPlan::get($name)->plan[config('horizon.env') ?? config('app.env')] ?? [])
->map(function ($value, $key) use ($name) {
return (object) [
'name' => $name.':'.$key,
'master' => $name,
'status' => 'inactive',
'processes' => [],
'options' => [
'queue' => implode(',', $value['queue'] ?? []),
'balance' => $value['balance'] ?? null,
],
];
})
)
->unique('name')
->values();
});
}
}

0 comments on commit ea1ff82

Please sign in to comment.