change size of delete

This commit is contained in:
larssand
2026-07-06 23:02:07 +02:00
parent d027645af7
commit 469b2f14b4
2 changed files with 7 additions and 3 deletions

View File

@@ -110,6 +110,9 @@ HTML = """<!doctype html>
.stream-row label { min-width: 0; display: flex; align-items: center; gap: 7px; }
.stream-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stream-row button, .stream-tools button { border: 1px solid #39709a; background: #0b2944; color: #d9e8f7; padding: 5px 8px; cursor: pointer; white-space: nowrap; }
.stream-actions, .profile-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }
.small-action { padding: 3px 6px !important; font-size: 12px; line-height: 1.2; }
.danger-action { border-color: #7f3c48 !important; color: #ffb4bf !important; background: #2a1720 !important; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 12px; color: #91abc4; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; }
.summary-card { border: 1px solid #163b59; background: #061a2e; padding: 10px; margin-bottom: 8px; border-radius: 6px; }
@@ -669,7 +672,7 @@ async function refresh() {
{label:'Common denominators', render:r => esc((r.common_fields || []).slice(0,5).map(item => `${item.field} ${(item.coverage*100).toFixed(0)}%`).join(', ') || '-')},
{label:'Shared fields', render:r => esc((r.shared_fields || []).slice(0,4).map(sharedFieldLabel).join(', ') || '-')},
{label:'Discovery', render:r => profileDiscoveryDetails(r)},
{label:'Action', render:r => `<button type="button" class="apply-suggested-profile" data-stream-id="${esc(r.stream_id)}">${r.profile_exists ? 'Update profile' : 'Apply profile'}</button>${r.profile_exists ? ` <button type="button" class="delete-stream-profile" data-stream-id="${esc(r.stream_id)}" data-stream-name="${esc(r.stream_name || r.stream_id)}">Delete profile</button>` : ''}`}
{label:'Action', render:r => `<span class="profile-actions"><button type="button" class="apply-suggested-profile small-action" data-stream-id="${esc(r.stream_id)}">${r.profile_exists ? 'Update' : 'Apply'}</button>${r.profile_exists ? ` <button type="button" class="delete-stream-profile small-action danger-action" title="Delete profile" data-stream-id="${esc(r.stream_id)}" data-stream-name="${esc(r.stream_name || r.stream_id)}">Remove</button>` : ''}</span>`}
], 'profile-suggestions') : '<p class="muted">No missing stream profiles. Enable "show existing profiles" to inspect already configured profiles.</p>';
const llmText = llm.text ? esc(llm.text).replace(/\\n/g, '<br>') : esc(llm.error || 'LLM assessment disabled or waiting for first run.');
document.getElementById('llmAssessment').innerHTML = `<div class="ai-box"><details><summary>Status: ${esc(llm.status || (llmEnabled ? 'starting' : 'disabled'))}</summary><p>${llmText}</p></details></div>`;
@@ -945,7 +948,7 @@ function renderStreamPicker(errorText='') {
<div class="stream-list">${streams.map(stream => {
const selected = window.streamSelection[stream.id] || {id:stream.id, title:stream.title, enabled:false};
const hasProfile = (window.streamProfiles || []).some(profile => String(profile.stream_id) === String(stream.id));
return `<div class="stream-row" data-stream-row="${esc(stream.id)}"><label title="${esc(stream.title || stream.id)}"><input type="checkbox" class="graylog-stream" data-id="${esc(stream.id)}" data-title="${esc(stream.title)}" ${selected.enabled ? 'checked' : ''}> <span class="stream-title">${esc(stream.title || stream.id)}</span></label><button type="button" class="edit-profile" data-id="${esc(stream.id)}" data-title="${esc(stream.title)}">Edit profile</button>${hasProfile ? `<button type="button" class="delete-stream-profile" data-stream-id="${esc(stream.id)}" data-stream-name="${esc(stream.title || stream.id)}">Delete profile</button>` : ''}</div>`;
return `<div class="stream-row" data-stream-row="${esc(stream.id)}"><label title="${esc(stream.title || stream.id)}"><input type="checkbox" class="graylog-stream" data-id="${esc(stream.id)}" data-title="${esc(stream.title)}" ${selected.enabled ? 'checked' : ''}> <span class="stream-title">${esc(stream.title || stream.id)}</span></label><span class="stream-actions"><button type="button" class="edit-profile small-action" data-id="${esc(stream.id)}" data-title="${esc(stream.title)}">Edit</button>${hasProfile ? `<button type="button" class="delete-stream-profile small-action danger-action" title="Delete profile" data-stream-id="${esc(stream.id)}" data-stream-name="${esc(stream.title || stream.id)}">Remove</button>` : ''}</span></div>`;
}).join('')}</div>`;
document.getElementById('streamFilter').addEventListener('input', () => renderStreamPicker());
document.getElementById('streamEnabledOnly').addEventListener('change', () => renderStreamPicker());

View File

@@ -35,9 +35,10 @@ class DashboardTests(unittest.TestCase):
self.assertIn("function mergeProfile", HTML)
def test_dashboard_can_delete_stream_profiles(self):
self.assertIn("Delete profile", HTML)
self.assertIn("Remove", HTML)
self.assertIn("function deleteStreamProfile", HTML)
self.assertIn("delete-stream-profile", HTML)
self.assertIn("danger-action", HTML)
def test_dashboard_has_direct_stream_selection_save(self):
self.assertIn("Save streams", HTML)