-
Notifications
You must be signed in to change notification settings - Fork 1
🎨 Palette: Context-safe loading feedback for browser controller action buttons #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
056718a
535e7d0
c88a4a7
9220e02
3d4f5ba
65e7de5
0d7e5c1
4870f28
5f46006
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1387,12 +1387,13 @@ | |
| <div class="browser-toolbar"> | ||
| <input class="browser-url" id="browser-url" type="url" | ||
| placeholder="https://…" autocomplete="off" aria-label="Browser URL" | ||
| onkeydown="if(event.key==='Enter'){event.preventDefault();browserNavigate();}"> | ||
| <button class="mini-btn interactive" type="button" onclick="browserNavigate()" | ||
| onkeydown="if(event.key==='Enter'){event.preventDefault();browserNavigate(document.getElementById('browser-go'));}"> | ||
| <button class="mini-btn interactive" type="button" id="browser-go" | ||
| onclick="browserNavigate(this)" | ||
| aria-label="Navigate">Go</button> | ||
| <button class="mini-btn interactive" type="button" onclick="browserReload()" | ||
| <button class="mini-btn interactive" type="button" onclick="browserReload(this)" | ||
| aria-label="Reload page">Reload</button> | ||
| <button class="mini-btn interactive" type="button" onclick="closeBrowserSession()" | ||
| <button class="mini-btn interactive" type="button" onclick="closeBrowserSession(this)" | ||
| aria-label="Close session">Close</button> | ||
| </div> | ||
| <div class="browser-stage" id="browser-stage"> | ||
|
|
@@ -3892,6 +3893,7 @@ class ApiError extends Error { | |
| let browserSelectedId = null; | ||
| let browserPollTimer = null; | ||
| let browserShotSeq = 0; | ||
| let browserNavigating = false; | ||
| const browserActionLog = new Map(); // session_id -> [{kind, ok, detail, ts}] | ||
|
|
||
| function stopBrowserPoll() { | ||
|
|
@@ -4078,9 +4080,14 @@ class ApiError extends Error { | |
| } | ||
| } | ||
|
|
||
| async function closeBrowserSession() { | ||
| async function closeBrowserSession(btn) { | ||
| if (!browserSelectedId) { toast('no session selected', 'error'); return; } | ||
| const id = browserSelectedId; | ||
| if (btn) { | ||
| btn.disabled = true; | ||
| btn.setAttribute('aria-busy', 'true'); | ||
| btn.textContent = 'Closing...'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Gebruik de vereiste ellipses in de laadlabels. De PR-doelstelling noemt Voorgestelde wijziging- btn.textContent = 'Closing...';
+ btn.textContent = 'Closing…';
- btn.textContent = 'Go...';
+ btn.textContent = 'Go…';
- btn.textContent = 'Reloading...';
+ btn.textContent = 'Reloading…';Also applies to: 4063-4063, 4093-4093 🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR description actually uses ASCII "Go...", "Reloading...", "Closing...", and the surrounding dashboard handlers use the same ASCII form ("Saving...", "Enabling...", "Merging..."), so switching only these three to U+2026 would break local consistency.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| try { | ||
| await apiDelete('/api/browser/sessions/' + encodeURIComponent(id)); | ||
| toast('session closed'); | ||
|
|
@@ -4091,14 +4098,27 @@ class ApiError extends Error { | |
| await loadBrowserView(); | ||
| } catch (e) { | ||
| toast('close: ' + (e.message || 'failed'), 'error'); | ||
| } finally { | ||
| if (btn) { | ||
| btn.disabled = false; | ||
| btn.removeAttribute('aria-busy'); | ||
| btn.textContent = 'Close'; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| async function browserNavigate() { | ||
| async function browserNavigate(btn) { | ||
| if (browserNavigating) return; | ||
| if (!browserSelectedId) { toast('no session selected', 'error'); return; } | ||
| const urlEl = document.getElementById('browser-url'); | ||
| const url = urlEl ? urlEl.value.trim() : ''; | ||
| if (!url) { toast('enter a URL', 'error'); return; } | ||
| browserNavigating = true; | ||
| if (btn) { | ||
| btn.disabled = true; | ||
| btn.setAttribute('aria-busy', 'true'); | ||
| btn.textContent = 'Go...'; | ||
| } | ||
| try { | ||
| const data = await apiPost( | ||
| '/api/browser/sessions/' + encodeURIComponent(browserSelectedId) + '/act', | ||
|
|
@@ -4113,11 +4133,23 @@ class ApiError extends Error { | |
| } catch (e) { | ||
| pushBrowserLog(browserSelectedId, { kind: 'navigate', ok: false, detail: e.message || 'failed' }); | ||
| toast('navigate: ' + (e.message || 'failed'), 'error'); | ||
| } finally { | ||
| browserNavigating = false; | ||
| if (btn) { | ||
| btn.disabled = false; | ||
| btn.removeAttribute('aria-busy'); | ||
| btn.textContent = 'Go'; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| async function browserReload() { | ||
| async function browserReload(btn) { | ||
| if (!browserSelectedId) { toast('no session selected', 'error'); return; } | ||
| if (btn) { | ||
| btn.disabled = true; | ||
| btn.setAttribute('aria-busy', 'true'); | ||
| btn.textContent = 'Reloading...'; | ||
| } | ||
| try { | ||
| const data = await apiPost( | ||
| '/api/browser/sessions/' + encodeURIComponent(browserSelectedId) + '/act', | ||
|
|
@@ -4131,6 +4163,12 @@ class ApiError extends Error { | |
| } catch (e) { | ||
| pushBrowserLog(browserSelectedId, { kind: 'reload', ok: false, detail: e.message || 'failed' }); | ||
| toast('reload: ' + (e.message || 'failed'), 'error'); | ||
| } finally { | ||
| if (btn) { | ||
| btn.disabled = false; | ||
| btn.removeAttribute('aria-busy'); | ||
| btn.textContent = 'Reload'; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Laat de nieuwe journal-entry aan de repositoryregels voldoen.
Schrijf de nieuwe sectie in het Nederlands. Voeg een lege regel toe na de heading op Line 32. Static analysis meldt hiervoor markdownlint MD022.
As per coding guidelines:
**/*: Communiceer in het Nederlands tenzij de gebruiker expliciet om Engels vraagt.🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 32-32: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below
(MD022, blanks-around-headings)
🤖 Prompt for AI Agents
Sources: Coding guidelines, Linters/SAST tools