Skip to content

Commit 4845635

Browse files
committed
feat: reload status after apply instead of showing done state
1 parent 2c317c4 commit 4845635

2 files changed

Lines changed: 4 additions & 63 deletions

File tree

src/webview/client/homescreen.ts

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -264,58 +264,11 @@ function handleAiToolsProgress(msg: AiToolsProgressMessage): void {
264264
row.appendChild(tick);
265265
}
266266

267-
function handleAiToolsResult(msg: AiToolsResultMessage): void {
268-
// Force a re-fetch next time the panel opens so installed state is fresh
267+
function handleAiToolsResult(_msg: AiToolsResultMessage): void {
269268
_dataFetched = false;
270269
_cachedData = null;
271-
272-
// Build done state: collect rows with ticks and show them
273-
const doneSkillsDiv = el("hs-ai-done-skills-list");
274-
const doneMcpDiv = el("hs-ai-done-mcp-list");
275-
276-
if (doneSkillsDiv) {
277-
const rows = document.querySelectorAll<HTMLElement>("#hs-ai-skills-list .hs-ai-item");
278-
doneSkillsDiv.innerHTML = "";
279-
rows.forEach((row) => {
280-
const tick = row.querySelector(".hs-ai-item-tick");
281-
if (!tick) { return; }
282-
const name = row.querySelector(".hs-ai-item-name")?.textContent ?? "";
283-
const isOk = tick.classList.contains("hs-ai-item-tick--ok");
284-
const statusClass = isOk ? "hs-ai-item-status--ok" : "hs-ai-item-status--none";
285-
const statusText = isOk ? "installed" : "error";
286-
doneSkillsDiv.insertAdjacentHTML(
287-
"beforeend",
288-
`<div class="hs-ai-item">
289-
<span class="hs-ai-item-tick hs-ai-item-tick--${isOk ? "ok" : "err"}">${isOk ? "✓" : "✕"}</span>
290-
<span class="hs-ai-item-name">${name}</span>
291-
<span class="hs-ai-item-status ${statusClass}">${statusText}</span>
292-
</div>`
293-
);
294-
});
295-
}
296-
297-
if (doneMcpDiv) {
298-
const rows = document.querySelectorAll<HTMLElement>("#hs-ai-mcp-list .hs-ai-item");
299-
doneMcpDiv.innerHTML = "";
300-
rows.forEach((row) => {
301-
const tick = row.querySelector(".hs-ai-item-tick");
302-
if (!tick) { return; }
303-
const name = row.querySelector(".hs-ai-item-name")?.textContent ?? "";
304-
const isOk = tick.classList.contains("hs-ai-item-tick--ok");
305-
const statusClass = isOk ? "hs-ai-item-status--ok" : "hs-ai-item-status--none";
306-
const statusText = isOk ? "configured" : "error";
307-
doneMcpDiv.insertAdjacentHTML(
308-
"beforeend",
309-
`<div class="hs-ai-item">
310-
<span class="hs-ai-item-tick hs-ai-item-tick--${isOk ? "ok" : "err"}">${isOk ? "✓" : "✕"}</span>
311-
<span class="hs-ai-item-name">${name}</span>
312-
<span class="hs-ai-item-status ${statusClass}">${statusText}</span>
313-
</div>`
314-
);
315-
});
316-
}
317-
318-
showPanelState("done");
270+
showPanelState("loading");
271+
getVSCode()?.postMessage({ command: "aiToolsExpanded" });
319272
}
320273

321274
// ── Init ──────────────────────────────────────────────────────────────────────
@@ -341,13 +294,6 @@ function init(): void {
341294
// Apply button
342295
el<HTMLButtonElement>("hs-ai-apply")?.addEventListener("click", handleApply);
343296

344-
// Apply again button (done state)
345-
el<HTMLButtonElement>("hs-ai-apply-again")?.addEventListener("click", () => {
346-
// Re-open: reset state and re-fetch
347-
_isOpen = false;
348-
toggleAccordion();
349-
});
350-
351297
// VS Code → webview messages
352298
window.addEventListener("message", (event: MessageEvent<InboundMessage>) => {
353299
const msg = event.data;

src/webview/homescreenView.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,7 @@ export class HomescreenViewProvider implements vscode.WebviewViewProvider {
732732
<button class="hs-ai-apply" id="hs-ai-apply" disabled>Apply</button>
733733
</div>
734734
735-
<!-- Done state -->
736-
<div class="hs-ai-panel-inner hidden" id="hs-ai-state-done">
737-
<div id="hs-ai-done-skills-list"></div>
738-
<div id="hs-ai-done-mcp-list"></div>
739-
<button class="hs-ai-apply" id="hs-ai-apply-again">Apply again</button>
740-
</div>
735+
741736
742737
<!-- Error state -->
743738
<div class="hs-ai-panel-inner hidden" id="hs-ai-state-error">

0 commit comments

Comments
 (0)