-
Notifications
You must be signed in to change notification settings - Fork 1
🎨 Palette: Add Switch to Core profile recovery actions to empty views #190
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
478975b
8ba3121
e8fbd30
4cf445f
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 |
|---|---|---|
|
|
@@ -2246,7 +2246,25 @@ class ApiError extends Error { | |
| btn.onclick = resetRouteFilter; | ||
| empty.appendChild(btn); | ||
| } | ||
| } else { empty.textContent = 'No servers in this profile.'; } | ||
| if (activeProfile !== 'core') { | ||
| const btn = document.createElement('button'); | ||
| btn.type = 'button'; | ||
| btn.className = 'view-empty-link'; | ||
| btn.textContent = 'Switch profile to core'; | ||
| btn.onclick = () => switchProfile('core'); | ||
| empty.appendChild(btn); | ||
| } | ||
| } else { | ||
| empty.textContent = 'No servers in this profile.'; | ||
| if (activeProfile !== 'core') { | ||
| const btn = document.createElement('button'); | ||
| btn.type = 'button'; | ||
| btn.className = 'view-empty-link'; | ||
| btn.textContent = 'Switch profile to core'; | ||
| btn.onclick = () => switchProfile('core'); | ||
| empty.appendChild(btn); | ||
| } | ||
| } | ||
| el.appendChild(empty); | ||
| return; | ||
| } | ||
|
|
@@ -3455,14 +3473,26 @@ class ApiError extends Error { | |
| empty.textContent = 'No servers match "' + catalogQuery + '" in this status.'; | ||
| addLink('Clear search', clearCatalogSearch); | ||
| addLink('Switch filter to all', resetCatalogFilter); | ||
| if (activeProfile !== 'core') { | ||
| addLink('Switch profile to core', () => switchProfile('core')); | ||
| } | ||
| } else if (hasQuery) { | ||
| empty.textContent = 'No servers match "' + catalogQuery + '".'; | ||
| addLink('Clear search', clearCatalogSearch); | ||
| if (activeProfile !== 'core') { | ||
| addLink('Switch profile to core', () => switchProfile('core')); | ||
| } | ||
| } else if (hasFilter) { | ||
| empty.textContent = 'No servers in this status.'; | ||
| addLink('Switch filter to all', resetCatalogFilter); | ||
| if (activeProfile !== 'core') { | ||
| addLink('Switch profile to core', () => switchProfile('core')); | ||
| } | ||
| } else { | ||
| empty.textContent = 'No servers in this profile. Switch profiles in the top bar.'; | ||
| empty.textContent = 'No servers in this profile.'; | ||
| if (activeProfile !== 'core') { | ||
| addLink('Switch profile to core', () => switchProfile('core')); | ||
| } | ||
| } | ||
| grid.appendChild(empty); | ||
| return; | ||
|
|
@@ -4203,6 +4233,14 @@ class ApiError extends Error { | |
| const empty = document.createElement('div'); | ||
| empty.className = 'view-empty'; | ||
| empty.textContent = 'No capabilities discoverable for the current profile.'; | ||
| if (activeProfile !== 'core') { | ||
|
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. 🔥 The Roast: Another hand-built button where the Catalog already handed you the tool. This is the third time you've reinvented the same wheel in this PR — at this rate you'll have your own tire factory by the end of the week. 🩹 The Fix: Reuse the same helper pattern from the Catalog section (or extract one) so the Fabric view's empty-state button stays consistent with the rest of the codebase. 📏 Severity: suggestion Reply with |
||
| const btn = document.createElement('button'); | ||
| btn.type = 'button'; | ||
| btn.className = 'view-empty-link'; | ||
| btn.textContent = 'Switch profile to core'; | ||
| btn.onclick = () => switchProfile('core'); | ||
| empty.appendChild(btn); | ||
| } | ||
|
Comment on lines
+4236
to
+4243
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. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Geef het profiel door en laad Fabric opnieuw na de actie.
Daarnaast laadt Voorgestelde wijziging async function switchProfile(p) {
...
loadCatalog();
if (currentView === 'catalog') loadCatalogView();
+ if (currentView === 'fabric') loadFabricView();
}
async function loadFabricView() {
...
- api('/api/capabilities'),
+ api('/api/capabilities?profile=' + encodeURIComponent(activeProfile || 'core')),
}🤖 Prompt for AI Agents |
||
| capsEl.appendChild(empty); | ||
| } else { | ||
| for (const item of caps.slice(0, 50)) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,7 @@ def test_zero_result_states_have_recovery_actions(): | |
| # Labels shown in the empty state, plus the shared styling hook. | ||
| assert "Clear search" in html | ||
| assert "Switch filter to all" in html | ||
| assert "Switch profile to core" in html | ||
|
coderabbitai[bot] marked this conversation as resolved.
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. 🔥 The Roast: You're testing that the string "Switch profile to core" exists in the HTML, but since 🩹 The Fix: Either set 📏 Severity: suggestion Reply with 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. Already covered: a behavioral Node/DOM test (test_server_map_empty_state_recovery_buttons_behavior_node) was added in a prior commit that sets activeProfile to a non-core value, verifies the button renders, and verifies clicking it switches the profile to core. |
||
| assert "view-empty-link" in html | ||
| # Buttons are defensively typed so they never submit a surrounding form. | ||
| assert "type = 'button'" in html | ||
|
|
||
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.
🔥 The Roast: You're hand-crafting buttons here like it's 1995, but two blocks over the Catalog section already has an
addLinkhelper that does the exact same thing. This is like building a bicycle from scratch when there's a perfectly good car parked in the driveway.🩹 The Fix: Extract the button-creation pattern into a shared helper (or reuse the Catalog's
addLinkpattern) so all three views stay in sync when the button style evolves.📏 Severity: suggestion
Reply with
@kilocode-bot fix itto have Kilo Code address this issue.