Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<p align="center">
<a href="https://www.dexphp.com/documentation">Get Started</a>
<span>&nbsp;|&nbsp;</span>
<a href="https://example.com">Demo</a>
<a href="https://dex.profusionlabs.org">Demo</a>
<span>&nbsp;|&nbsp;</span>
<a href="CONTRIBUTING.md">Contributing</a>
</p>
Expand Down
6 changes: 5 additions & 1 deletion src/Controllers/Issues.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public function index(): string
$q = trim((string)$this->request->getGet('q'));
$page = max(1, (int) ($this->request->getGet('page') ?? 1));
$perPage = max(1, min(100, (int) ($this->request->getGet('per_page') ?? 25)));
$ciEnvironment = strtolower(trim((string) getenv('CI_ENVIRONMENT')));
$isDexRunningInProduction = $ciEnvironment === 'production';

try {
$data = $this->orchestrator->getIssuesData($status, $q, $page, $perPage);
Expand All @@ -43,6 +45,8 @@ public function index(): string
'title' => 'Issues',
'dataUrl' => site_url(dex_route_prefix() . '/issues/data'),
'detailBaseUrl' => site_url(dex_route_prefix() . '/issues'),
'isDexRunningInProduction' => $isDexRunningInProduction,
'ciEnvironment' => $ciEnvironment,
]));
} catch (DexException $e) {
return view('Dex\\dex/error', [
Expand Down Expand Up @@ -81,7 +85,7 @@ public function dialog(int $id): ResponseInterface|string
return view('Dex\\dex/issues_dialog_shell', array_merge($data, [
'dialogUrl' => site_url(dex_route_prefix() . '/issues/' . $id . '/dialog'),
'resolveUrl' => site_url(dex_route_prefix() . '/issues/' . $id . '/resolve'),
'ignoreUrl' => site_url(dex_route_prefix() . '/issues/' . $id . '/ignore'),
'ignoreUrl' => site_url(dex_route_prefix() . '/issues/' . $id . '/ignore')
]));
} catch (IssueNotFoundException) {
return $this->response->setStatusCode(404)->setBody('Issue not found');
Expand Down
27 changes: 27 additions & 0 deletions src/Views/dex/_js.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
searchTimer: null,
};

const dexIssuesDeepLinkState = (() => {
const params = new URLSearchParams(window.location.search || '');
const issueId = Number(params.get('issue_id') || 0);
return {
issueId: Number.isFinite(issueId) && issueId > 0 ? issueId : null,
opened: false,
};
})();

const dexIssueDialogState = {
issueId: null,
occurrenceId: null,
Expand Down Expand Up @@ -207,6 +216,8 @@ function dexIssuesRenderRows() {
return;
}

dexIssuesTryOpenDeepLinkedIssue();

if (!issues.length) {
tbody.innerHTML = '<tr class="empty-row"><td colspan="8">No issues match your filters.</td></tr>';
return;
Expand All @@ -215,6 +226,22 @@ function dexIssuesRenderRows() {
tbody.innerHTML = issues.map(dexIssuesBuildRow).join('');
}

function dexIssuesTryOpenDeepLinkedIssue() {
if (dexIssuesState.loading || dexIssuesDeepLinkState.opened || !dexIssuesDeepLinkState.issueId) {
return;
}

if (dexIssueDialogState.issueId) {
dexIssuesDeepLinkState.opened = true;
return;
}

const tbody = document.getElementById('issuesTbody');
const row = tbody?.querySelector(`tr[data-id="${dexIssuesDeepLinkState.issueId}"]`) || null;
dexIssuesDeepLinkState.opened = true;
dexIssuesOpenDialog(dexIssuesDeepLinkState.issueId, null, row);
}

function dexIssuesDialogOverlay() {
return document.getElementById('dexIssueOverlay');
}
Expand Down
1 change: 0 additions & 1 deletion src/Views/dex/issues_dialog_shell.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class="dex-action-menu__item"
</div>
</div>
</div>

<section class="dex-card mb-3" aria-label="Issue summary">
<div class="dex-issue-head">
<div class="dex-issue-title">
Expand Down
8 changes: 7 additions & 1 deletion src/Views/dex/issues_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
<div class="page-wrap">
<div class="mb-4">
<h1 class="page-title">Issues</h1>
<p class="page-subtitle">Unique exceptions grouped by fingerprint. Each issue aggregates all matching events.</p>
<p class="page-subtitle">
<?php if (($isDexRunningInProduction ?? false) === true) : ?>
<span class="badge bg-orange"></span> Production mode - <abbr class="text-muted" title="Protect DEX in production: require login or restrict IPs. Learn more in the docs.">Secure DEX</abbr>
<?php else : ?>
<span class="badge bg-green"></span> <?= esc(ucfirst((string)($ciEnvironment ?? 'unknown'))) ?> mode

Check failure on line 13 in src/Views/dex/issues_list.php

View workflow job for this annotation

GitHub Actions / phpstan

Ignored error pattern #^Function esc not found\.$# in path /home/runner/work/dex/dex/src/Views/dex/issues_list.php is expected to occur 15 times, but occurred 16 times.
<?php endif; ?>
</p>
</div>

<div class="d-flex gap-3 mb-4" id="statCards">
Expand Down Expand Up @@ -81,7 +87,7 @@
<div class="table-footer">
<span id="showingCount">Showing <?= esc((string)($pagination['from'] ?? 0)) ?>-<?= esc((string)($pagination['to'] ?? 0)) ?> of <?= esc((string)($pagination['total'] ?? 0)) ?> issues</span>
<div class="footer-actions">
<span id="pageInfo">Page <?= esc((string)($pagination['page'] ?? 1)) ?> of <?= esc((string)($pagination['pages'] ?? 1)) ?></span>

Check failure on line 90 in src/Views/dex/issues_list.php

View workflow job for this annotation

GitHub Actions / phpstan

Function esc not found.
<button class="btn btn-sm btn-outline-secondary" id="prevPage"<?= empty($pagination['hasPrev']) ? ' disabled' : '' ?>><i class="ti ti-chevron-left"></i></button>
<button class="btn btn-sm btn-outline-secondary" id="nextPage"<?= empty($pagination['hasNext']) ? ' disabled' : '' ?>><i class="ti ti-chevron-right"></i></button>
</div>
Expand Down
4 changes: 0 additions & 4 deletions src/Views/dex/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@
</div>

<div class="page">



<div class="page-wrapper">
<div class="container-xl">
<?= $this->renderSection('content') ?>
Expand All @@ -127,7 +124,6 @@
&nbsp;·&nbsp; Open-source issue tracking for CodeIgniter&nbsp;4
</span>
<span class="dex-footer__links">
<a href="https://www.dexphp.com" target="_blank" rel="noopener noreferrer">Website</a>
<a href="https://github.com/olajideolamide/dex" target="_blank" rel="noopener noreferrer">GitHub</a>
</span>
</div>
Expand Down
Loading