From e9e7054e778ef3955874cc18fd41f7a8cfa82666 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 16 Sep 2025 07:15:55 +0000 Subject: [PATCH 1/3] Add status indicator dots to popup connection status Co-authored-by: cursor --- src/popup/popup.css | 4 ++++ src/popup/popup.js | 20 ++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/popup/popup.css b/src/popup/popup.css index 4fec1ba..f28d331 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -108,6 +108,10 @@ body { background: #28a745; } +.status-dot.unbound { + background: #6c757d; +} + .status-text { font-size: 12px; font-weight: 500; diff --git a/src/popup/popup.js b/src/popup/popup.js index e69ea79..9f7f93a 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -433,7 +433,10 @@ function updateConnectionStatus(connection) { if ((connection.mode === 'context') && connection.context) { console.log('Popup: Context mode, context:', connection.context); console.log('Popup: Context mode, workspace info:', connection.workspace); - contextId.textContent = `Bound to context ID: ${connection.context.id}`; + + // Create green dot indicator for bound state + const boundIndicator = ''; + contextId.innerHTML = `${boundIndicator}Bound to context ID: ${connection.context.id}`; // Get workspace name from context or use fallback const workspaceName = connection.context.workspaceName || connection.context.workspace || @@ -453,7 +456,10 @@ function updateConnectionStatus(connection) { } else if ((connection.mode === 'explorer') && connection.workspace) { const wsName = getWorkspaceName(connection.workspace); console.log('Popup: Explorer mode, workspace:', wsName); - contextId.textContent = `Current workspace: ${wsName}`; + + // Create green dot indicator for bound state (explorer mode is also considered "bound") + const boundIndicator = ''; + contextId.innerHTML = `${boundIndicator}Current workspace: ${wsName}`; // Format URL as workspace.name://path const workspacePath = currentWorkspacePath || '/'; @@ -461,7 +467,10 @@ function updateConnectionStatus(connection) { contextUrl.classList.add('clickable'); } else { console.log('Popup: No context or workspace selected'); - contextId.textContent = '-'; + + // Create gray button indicator for unbound state + const unboundIndicator = ''; + contextId.innerHTML = `${unboundIndicator}-`; contextUrl.textContent = 'Not bound'; contextUrl.classList.remove('clickable'); } @@ -469,7 +478,10 @@ function updateConnectionStatus(connection) { console.log('Popup: Setting status to DISCONNECTED'); connectionStatus.className = 'status-dot disconnected'; connectionText.textContent = 'Disconnected'; - contextId.textContent = '-'; + + // Create gray button indicator for unbound state when disconnected + const unboundIndicator = ''; + contextId.innerHTML = `${unboundIndicator}-`; contextUrl.textContent = 'No context'; contextUrl.classList.remove('clickable'); } From c0bc0655962ed0f90cf8681462323a0e7ed79854 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 16 Sep 2025 07:21:43 +0000 Subject: [PATCH 2/3] Fix: Show unbound indicator for explorer mode Co-authored-by: cursor --- src/popup/popup.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/popup/popup.js b/src/popup/popup.js index 9f7f93a..7ed3014 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -457,9 +457,9 @@ function updateConnectionStatus(connection) { const wsName = getWorkspaceName(connection.workspace); console.log('Popup: Explorer mode, workspace:', wsName); - // Create green dot indicator for bound state (explorer mode is also considered "bound") - const boundIndicator = ''; - contextId.innerHTML = `${boundIndicator}Current workspace: ${wsName}`; + // Create gray dot indicator for unbound state (explorer mode is not bound - no dynamic updates) + const unboundIndicator = ''; + contextId.innerHTML = `${unboundIndicator}Current workspace: ${wsName}`; // Format URL as workspace.name://path const workspacePath = currentWorkspacePath || '/'; From 3e5feba01f57d47ea0161458d0f498874f5af540 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 16 Sep 2025 07:32:14 +0000 Subject: [PATCH 3/3] Refactor status indicators to use secure DOM manipulation Co-authored-by: cursor --- src/popup/popup.js | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/popup/popup.js b/src/popup/popup.js index 7ed3014..c62a80f 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -435,8 +435,13 @@ function updateConnectionStatus(connection) { console.log('Popup: Context mode, workspace info:', connection.workspace); // Create green dot indicator for bound state - const boundIndicator = ''; - contextId.innerHTML = `${boundIndicator}Bound to context ID: ${connection.context.id}`; + contextId.textContent = ''; + const boundIndicator = createSecureElement('span', { + className: 'status-dot connected', + style: 'margin-right: 6px;' + }); + contextId.appendChild(boundIndicator); + contextId.appendChild(document.createTextNode(`Bound to context ID: ${escapeHtml(connection.context.id)}`)); // Get workspace name from context or use fallback const workspaceName = connection.context.workspaceName || connection.context.workspace || @@ -458,8 +463,13 @@ function updateConnectionStatus(connection) { console.log('Popup: Explorer mode, workspace:', wsName); // Create gray dot indicator for unbound state (explorer mode is not bound - no dynamic updates) - const unboundIndicator = ''; - contextId.innerHTML = `${unboundIndicator}Current workspace: ${wsName}`; + contextId.textContent = ''; + const unboundIndicator = createSecureElement('span', { + className: 'status-dot unbound', + style: 'margin-right: 6px;' + }); + contextId.appendChild(unboundIndicator); + contextId.appendChild(document.createTextNode(`Current workspace: ${escapeHtml(wsName)}`)); // Format URL as workspace.name://path const workspacePath = currentWorkspacePath || '/'; @@ -469,8 +479,13 @@ function updateConnectionStatus(connection) { console.log('Popup: No context or workspace selected'); // Create gray button indicator for unbound state - const unboundIndicator = ''; - contextId.innerHTML = `${unboundIndicator}-`; + contextId.textContent = ''; + const unboundIndicator = createSecureElement('span', { + className: 'status-dot unbound', + style: 'margin-right: 6px;' + }); + contextId.appendChild(unboundIndicator); + contextId.appendChild(document.createTextNode('-')); contextUrl.textContent = 'Not bound'; contextUrl.classList.remove('clickable'); } @@ -480,8 +495,13 @@ function updateConnectionStatus(connection) { connectionText.textContent = 'Disconnected'; // Create gray button indicator for unbound state when disconnected - const unboundIndicator = ''; - contextId.innerHTML = `${unboundIndicator}-`; + contextId.textContent = ''; + const unboundIndicator = createSecureElement('span', { + className: 'status-dot unbound', + style: 'margin-right: 6px;' + }); + contextId.appendChild(unboundIndicator); + contextId.appendChild(document.createTextNode('-')); contextUrl.textContent = 'No context'; contextUrl.classList.remove('clickable'); }