Skip to content

Commit 8d4b097

Browse files
committed
wip
1 parent 924bcba commit 8d4b097

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

app/Http/Controllers/DashboardController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public function showTwo(string $serverSlug, string $applicationSlug)
2929
return to_route('dashboard');
3030
}
3131

32-
if ($applicationSlug === 'settings') {
32+
if ($applicationSlug === 'settings-supervisor-help') {
33+
return $this->get("\$dispatch('show-server-settings-dialog', {serverId: $serverId, showSupervisorHelp: true});");
34+
} elseif ($applicationSlug === 'settings') {
3335
return $this->get("\$dispatch('show-server-settings-dialog', {serverId: $serverId});");
3436
} else {
3537
$applicationId = Application::where('slug', $applicationSlug)->where('server_id', $serverId)->value('id');

app/Livewire/ServerSettings.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ServerSettings extends Component
1717
public bool $supervisor_alert_enabled;
1818

1919
#[On('show-server-settings-dialog')]
20-
public function open(int $serverId)
20+
public function open(int $serverId, bool $showSupervisorHelp = false)
2121
{
2222
$this->serverId = $serverId;
2323

@@ -30,12 +30,18 @@ public function open(int $serverId)
3030

3131
$this->supervisor_alert_enabled = $preferences->supervisor_alert_enabled;
3232

33+
// You'll get an alert if you haven't added supervisor to visudo. This will most likely trigger
34+
// for almost everyone. This code allows a link that's in the alert to open up the help modal.
35+
$showSupervisorHelp = $showSupervisorHelp ? "showHelpDialog('supervisor-alert');" : '';
36+
3337
$this->js(<<<STRING
3438
document.getElementById('server-settings-dialog').showModal()
3539
3640
setCurrentServerUser('{$preferences->server->user}');
3741
3842
history.replaceState({}, '', '/{$preferences->server->slug}/settings');
43+
44+
$showSupervisorHelp
3945
STRING);
4046
}
4147

app/Models/PendingAlert.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public function toMessage(string $baseUrl): string
3737
<a href="$baseUrl/{$this->server->slug}/{$this->application->slug}/{$this->logFile->file_name}">{$this->logFile->file_name} has new entries</a>
3838
STRING,
3939
AlertType::application_debug_enabled => 'Has APP_DEBUG enabled',
40-
AlertType::server_cant_read_supervisor => 'Can\'t run "sudo supervisorctl status"',
40+
AlertType::server_cant_read_supervisor => <<<STRING
41+
Can't run "sudo supervisorctl status" (<a href="$baseUrl/{$this->server->slug}/settings-supervisor-help">help</a>)
42+
STRING,
4143
AlertType::server_supervisor_not_all_running => 'One or more supervisor processes are not running',
4244
};
4345
}

0 commit comments

Comments
 (0)