fix(dashboard): handle disabled action logs gracefully

- Check ComponentHelper::isEnabled('com_actionlogs') before rendering
  login chart, View Logs button, and recent logins table
- Show helpful warning when action logs disabled instead of raw
  COM_ACTIONLOGS_DISABLED language key
This commit is contained in:
Jonathan Miller
2026-06-23 08:12:20 -05:00
parent e4558c1642
commit cfc70ac712
@@ -34,6 +34,7 @@ foreach ($plugins as $plugin)
}
$categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
$actionLogsEnabled = Joomla\CMS\Component\ComponentHelper::isEnabled('com_actionlogs');
?>
<div id="mokosuiteclient-dashboard">
@@ -160,12 +161,14 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
Global Check-in
</a>
</div>
<?php if (Joomla\CMS\Component\ComponentHelper::isEnabled('com_actionlogs')): ?>
<div class="col-6 col-md-4 col-xl-3">
<a href="<?php echo Route::_('index.php?option=com_actionlogs'); ?>" class="btn btn-outline-secondary w-100 py-3">
<span class="icon-list d-block mb-1" aria-hidden="true" style="font-size:1.5rem"></span>
View Logs
</a>
</div>
<?php endif; ?>
<div class="col-6 col-md-4 col-xl-3">
<a href="<?php echo Route::_('index.php?option=com_scheduler'); ?>" class="btn btn-outline-secondary w-100 py-3">
<span class="icon-clock d-block mb-1" aria-hidden="true" style="font-size:1.5rem"></span>
@@ -271,6 +274,7 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
</div>
<!-- Login Activity Chart -->
<?php if ($actionLogsEnabled): ?>
<div class="card mb-3">
<div class="card-header">
<strong><span class="icon-user" aria-hidden="true"></span> Login Activity (14 days)</strong>
@@ -279,6 +283,7 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
<canvas id="mokosuiteclient-chart-logins" height="140"></canvas>
</div>
</div>
<?php endif; ?>
<!-- Pending Updates -->
<div class="card mb-3">
@@ -372,7 +377,11 @@ $categoryOrder = ['core', 'security', 'monitoring', 'content', 'tools', 'api'];
<div class="card-header">
<strong><span class="icon-user" aria-hidden="true"></span> Recent Logins</strong>
</div>
<?php if (!empty($recentLogins)): ?>
<?php if (!$actionLogsEnabled): ?>
<div class="card-body text-center text-muted py-3">
<span class="icon-warning text-warning"></span> Action Logs component is disabled. Enable it to track login activity.
</div>
<?php elseif (!empty($recentLogins)): ?>
<div class="table-responsive">
<table class="table table-sm table-striped mb-0">
<thead><tr><th>User</th><th>App</th><th>IP</th><th>Time</th></tr></thead>