Skip to content

Commit b3da61f

Browse files
committed
updates to allow for proper searching and dark mode adjustments
1 parent 0c3cd25 commit b3da61f

File tree

5 files changed

+272
-157
lines changed

5 files changed

+272
-157
lines changed

dashboard/css/style.css

Lines changed: 89 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,127 @@
1414
}
1515

1616
[data-theme="dark"] {
17-
--bg-color: #212529;
18-
--text-color: #f8f9fa;
19-
--card-bg: #343a40;
20-
--card-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
21-
--header-bg: #2c3034;
22-
--badge-primary: #6ea8fe;
23-
--badge-success: #20c997;
24-
--badge-danger: #f27474;
25-
--badge-info: #6edff6;
26-
--badge-warning: #ffca2c;
27-
--border-color: #495057;
17+
--bg-color: #121212; /* Darker background for better contrast */
18+
--text-color: #e0e0e0; /* Lighter text for readability */
19+
--card-bg: #1e1e1e; /* Slightly lighter card background */
20+
--card-shadow: 0 4px 6px rgba(0, 0, 0, 0.5); /* Stronger shadow for depth */
21+
--header-bg: #1a1a1a; /* Consistent header background */
22+
--badge-primary: #4a90e2; /* Softer blue for badges */
23+
--badge-success: #28a745; /* Standard green for success */
24+
--badge-danger: #dc3545; /* Standard red for danger */
25+
--badge-info: #17a2b8; /* Standard cyan for info */
26+
--badge-warning: #ffc107; /* Standard yellow for warning */
27+
--border-color: #333333; /* Subtle border color */
2828
}
2929

3030
[data-theme="dark"] .card-header {
31-
color: var(--text-color);
31+
background-color: #2a2a2a; /* Slightly darker background for contrast */
32+
color: var(--text-color); /* Ensure text is readable */
33+
border-bottom: 1px solid var(--border-color); /* Add subtle border */
34+
font-weight: 600; /* Keep font weight consistent */
3235
}
3336

3437
[data-theme="dark"] .list-group-item {
3538
color: var(--text-color);
39+
background-color: var(--card-bg); /* Match card background */
3640
}
3741

3842
[data-theme="dark"] .card-body {
3943
color: var(--text-color);
44+
background-color: var(--card-bg); /* Match card background */
4045
}
4146

4247
[data-theme="dark"] .badge {
43-
color: #fff; /* Ensure badge text is always white for readability */
48+
color: #ffffff; /* Ensure badge text is always white */
49+
background-color: var(--badge-primary); /* Use primary badge color */
4450
}
4551

4652
[data-theme="dark"] .table {
47-
background-color: var(--card-bg); /* Match the card background */
53+
background-color: var(--card-bg); /* Match card background */
4854
color: var(--text-color);
4955
}
5056

5157
[data-theme="dark"] .table thead th, .table>:not(caption)>*>* {
52-
background-color: var(--header-bg); /* Match the header background */
58+
background-color: var(--header-bg); /* Match header background */
5359
color: var(--text-color);
54-
border-bottom: 2px solid #495057; /* Slightly lighter border for contrast */
60+
border-bottom: 2px solid var(--border-color); /* Subtle border for contrast */
5561
}
5662

57-
[data-theme="dark"] .table tbody tr, .table>:not(caption)>*>* {
58-
background-color: var(--card-bg);
59-
border-bottom: 1px solid #495057; /* Subtle border between rows */
63+
[data-theme="dark"] .table tbody tr {
64+
background-color: var(--card-bg); /* Match card background */
65+
border-bottom: 1px solid var(--border-color); /* Subtle border between rows */
6066
}
6167

6268
[data-theme="dark"] .table-hover tbody tr:hover {
63-
background-color: rgba(255, 255, 255, 0.1); /* Keep the hover effect */
69+
background-color: rgba(255, 255, 255, 0.1); /* Slight hover effect */
6470
}
6571

6672
[data-theme="dark"] .form-control {
67-
background-color: #495057;
73+
background-color: #2a2a2a; /* Slightly lighter input background */
6874
color: var(--text-color);
69-
border-color: #6c757d;
75+
border-color: var(--border-color);
7076
}
7177

7278
[data-theme="dark"] .form-control::placeholder {
73-
color: #ced4da; /* Lighter gray for better visibility */
79+
color: #b0b0b0; /* Lighter gray for better visibility */
7480
opacity: 1; /* Ensure full opacity for readability */
7581
}
7682

83+
[data-theme="dark"] .json-container {
84+
background-color: #1e1e1e; /* Match card background */
85+
color: var(--text-color);
86+
border: 1px solid var(--border-color); /* Add subtle border */
87+
}
88+
89+
[data-theme="dark"] .json-key {
90+
color: #82aaff; /* Brighter blue for keys */
91+
}
92+
93+
[data-theme="dark"] .json-string {
94+
color: #c3e88d; /* Brighter green for strings */
95+
}
96+
97+
[data-theme="dark"] .json-number {
98+
color: #f78c6c; /* Brighter orange for numbers */
99+
}
100+
101+
[data-theme="dark"] .json-boolean {
102+
color: #ffcb6b; /* Brighter yellow for booleans */
103+
}
104+
105+
[data-theme="dark"] .json-null {
106+
color: #d4d4d4; /* Neutral gray for null */
107+
}
108+
109+
[data-theme="dark"] .form-select {
110+
background-color: #2a2a2a; /* Match input background */
111+
color: var(--text-color);
112+
border-color: var(--border-color);
113+
}
114+
115+
[data-theme="dark"] .form-select:focus {
116+
background-color: #2a2a2a; /* Keep consistent on focus */
117+
color: var(--text-color);
118+
border-color: var(--badge-primary); /* Highlight border on focus */
119+
box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25); /* Subtle focus shadow */
120+
}
121+
122+
[data-theme="dark"] .card-header.bg-light {
123+
background-color: var(--header-bg); /* Match header background */
124+
color: var(--text-color); /* Ensure text is readable */
125+
border-bottom: 1px solid var(--border-color); /* Add subtle border */
126+
}
127+
128+
[data-theme="dark"] .btn-outline-primary {
129+
color: var(--badge-primary); /* Match primary badge color */
130+
border-color: var(--badge-primary);
131+
}
132+
133+
[data-theme="dark"] .btn-outline-primary:hover {
134+
background-color: var(--badge-primary);
135+
color: #ffffff; /* Ensure text is readable */
136+
}
137+
77138
body {
78139
background-color: var(--bg-color);
79140
color: var(--text-color);
@@ -283,23 +344,23 @@ body {
283344
}
284345

285346
[data-theme="dark"] .json-key {
286-
color: #bb86fc;
347+
color: #82aaff; /* Brighter blue for keys */
287348
}
288349

289350
[data-theme="dark"] .json-string {
290-
color: #81c784;
351+
color: #c3e88d; /* Brighter green for strings */
291352
}
292353

293354
[data-theme="dark"] .json-number {
294-
color: #64b5f6;
355+
color: #f78c6c; /* Brighter orange for numbers */
295356
}
296357

297358
[data-theme="dark"] .json-boolean {
298-
color: #ffb74d;
359+
color: #ffcb6b; /* Brighter yellow for booleans */
299360
}
300361

301362
[data-theme="dark"] .json-null {
302-
color: #bdbdbd;
363+
color: #d4d4d4; /* Neutral gray for null */
303364
}
304365

305366
/* Adjust table styles */

dashboard/js/script.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,8 @@ function setupFilterHandlers() {
699699

700700
// Define operators directly instead of loading them
701701
const availableOperators = [
702-
{ id: 'contains', name: 'Contains', desc: 'Value contains the text (case-insensitive)' },
703702
{ id: 'exact', name: 'Equals', desc: 'Value exactly matches the text' },
703+
{ id: 'contains', name: 'Contains', desc: 'Value contains the text (case-insensitive)' },
704704
{ id: 'starts_with', name: 'Starts with', desc: 'Value starts with the text' },
705705
{ id: 'ends_with', name: 'Ends with', desc: 'Value ends with the text' },
706706
{ id: 'greater_than', name: '>', desc: 'Value is greater than (numeric comparison)' },
@@ -754,7 +754,7 @@ function setupFilterHandlers() {
754754
// Update all operator dropdowns (now uses hardcoded values)
755755
function updateOperatorDropdowns() {
756756
document.querySelectorAll('.event-operator-select').forEach(select => {
757-
const currentValue = select.value || 'contains';
757+
const currentValue = select.value || 'exact';
758758

759759
// Clear existing options
760760
select.innerHTML = '';
@@ -774,41 +774,40 @@ function setupFilterHandlers() {
774774
}
775775

776776
// Create a new event filter row
777-
function addEventFilterRow(keyValue = '', operator = 'contains', valueValue = '') {
777+
function addEventFilterRow(keyValue = '', operator = 'exact', valueValue = '') {
778778
// Hide the "no filters" message
779779
noEventFiltersMsg.style.display = 'none';
780-
780+
781781
// Clone the template
782782
const clone = document.importNode(eventFilterTemplate.content, true);
783783
const row = clone.querySelector('.event-filter-row');
784-
784+
785+
// Append to container first to ensure DOM is updated
786+
eventFiltersContainer.appendChild(row);
787+
788+
// Populate dropdowns after appending to the DOM
789+
updateEventKeyDropdowns();
790+
updateOperatorDropdowns();
791+
785792
// Set initial values if provided
786793
const keySelect = row.querySelector('.event-key-select');
787794
const operatorSelect = row.querySelector('.event-operator-select');
788795
const valueInput = row.querySelector('.event-value-input');
789-
790-
// Populate dropdowns
791-
updateEventKeyDropdowns();
792-
updateOperatorDropdowns();
793-
794-
// Set values
796+
795797
if (keyValue) keySelect.value = keyValue;
796798
if (operator) operatorSelect.value = operator;
797799
if (valueValue) valueInput.value = valueValue;
798-
800+
799801
// Add remove handler
800802
row.querySelector('.remove-event-filter').addEventListener('click', function() {
801803
row.remove();
802-
804+
803805
// Show message if no filters remain
804806
if (eventFiltersContainer.querySelectorAll('.event-filter-row').length === 0) {
805807
noEventFiltersMsg.style.display = 'block';
806808
}
807809
});
808-
809-
// Append to container
810-
eventFiltersContainer.appendChild(row);
811-
810+
812811
return row;
813812
}
814813

dashboard/views/dashboard.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@
188188
<!-- Replace existing Event Key/Value filters with this new section -->
189189
<div class="col-12">
190190
<div class="card border-light">
191-
<div class="card-header d-flex justify-content-between align-items-center bg-light">
192-
<span>Event Data Filters</span>
191+
<div class="card-header d-flex justify-content-between align-items-center">
192+
<span>Custom Event Filters</span>
193193
<button type="button" class="btn btn-sm btn-outline-primary" id="add-event-filter">
194194
<i class="bi bi-plus-circle"></i> Add Filter
195195
</button>
@@ -364,6 +364,6 @@
364364
<!-- Chart.js -->
365365
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
366366
<!-- Dashboard Logic -->
367-
<script src="/js/script.js?ver=2"></script>
367+
<script src="/js/script.js?ver=3"></script>
368368
</body>
369369
</html>

src/apm/migration/sqlite/0004-custom-events.sql

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
2-
-- Add a deprecated comment to the apm_custom_events.event_data column
3-
ALTER TABLE apm_custom_events
4-
CHANGE COLUMN event_data event_data TEXT COMMENT 'Deprecated: Use apm_custom_event_data instead.';
5-
1+
-- Note: SQLite doesn't support column comments or CHANGE COLUMN syntax
2+
-- Keeping event_data column as is, but it will be considered deprecated
63

74
-- Create a new table for custom event key-value data
85
CREATE TABLE IF NOT EXISTS apm_custom_event_data (
@@ -22,10 +19,10 @@ CREATE INDEX IF NOT EXISTS idx_apm_custom_event_data_key ON apm_custom_event_dat
2219
-- Migrate existing event_data JSON into the new apm_custom_event_data table
2320
INSERT INTO apm_custom_event_data (custom_event_id, request_id, json_key, json_value)
2421
SELECT
25-
id AS custom_event_id,
26-
request_id,
27-
json_each.json_key AS json_key,
28-
json_each.json_value AS json_value
22+
apm_custom_events.id AS custom_event_id,
23+
apm_custom_events.request_id,
24+
json_each.key AS json_key,
25+
json_each.value AS json_value
2926
FROM
3027
apm_custom_events,
3128
json_each(apm_custom_events.event_data);

0 commit comments

Comments
 (0)