Skip to content

Commit b45f7ad

Browse files
committed
chore: change log
1 parent f985a3c commit b45f7ad

2 files changed

Lines changed: 38 additions & 102 deletions

File tree

executors/browser/panel.html

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
display: flex;
3737
align-items: center;
3838
gap: 8px;
39-
padding: 8px 12px;
39+
padding: 12px 16px;
4040
background: #16213e;
4141
border-radius: 8px;
4242
margin-bottom: 16px;
4343
}
4444

4545
.status-dot {
46-
width: 10px;
47-
height: 10px;
46+
width: 12px;
47+
height: 12px;
4848
border-radius: 50%;
4949
background: #ff4757;
5050
transition: background 0.3s;
@@ -56,7 +56,7 @@
5656

5757
.status-text {
5858
flex: 1;
59-
font-size: 13px;
59+
font-size: 14px;
6060
}
6161

6262
.reconnect-btn {
@@ -105,45 +105,13 @@
105105

106106
.info-value {
107107
color: #eee;
108-
max-width: 200px;
109-
overflow: hidden;
110-
text-overflow: ellipsis;
111-
white-space: nowrap;
112-
}
113-
114-
.log-container {
115-
max-height: 300px;
116-
overflow-y: auto;
117-
}
118-
119-
.log-entry {
120-
padding: 6px 8px;
121-
margin-bottom: 4px;
122-
background: #0f0f23;
123-
border-radius: 4px;
124-
font-family: 'Monaco', 'Menlo', monospace;
125-
font-size: 11px;
126-
word-break: break-all;
127-
}
128-
129-
.log-entry.success {
130-
border-left: 3px solid #2ed573;
131108
}
132109

133-
.log-entry.error {
134-
border-left: 3px solid #ff4757;
135-
}
136-
137-
.log-entry .time {
110+
.hint {
138111
color: #666;
139-
margin-right: 8px;
140-
}
141-
142-
.empty-state {
112+
font-size: 12px;
143113
text-align: center;
144-
color: #666;
145-
padding: 20px;
146-
font-size: 13px;
114+
margin-top: 20px;
147115
}
148116
</style>
149117
</head>
@@ -167,12 +135,15 @@ <h1>Wire Agent</h1>
167135
</div>
168136

169137
<div class="section">
170-
<div class="section-title">Activity Log</div>
171-
<div class="log-container" id="logContainer">
172-
<div class="empty-state">Waiting for commands...</div>
138+
<div class="section-title">Executors</div>
139+
<div class="info-row">
140+
<span class="info-label">Tabs</span>
141+
<span class="info-value" id="tabCount">0</span>
173142
</div>
174143
</div>
175144

145+
<p class="hint">Activity logs are in DevTools Console (F12)</p>
146+
176147
<script src="panel.js"></script>
177148
</body>
178149
</html>

executors/browser/panel.js

Lines changed: 25 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
const statusDot = document.getElementById("statusDot");
44
const statusText = document.getElementById("statusText");
55
const reconnectBtn = document.getElementById("reconnectBtn");
6-
const logContainer = document.getElementById("logContainer");
7-
8-
let logs = [];
9-
const MAX_LOGS = 50;
6+
const tabCountEl = document.getElementById("tabCount");
107

118
// ============================================================
129
// Status Updates
@@ -24,44 +21,11 @@ function updateStatus(connected) {
2421
}
2522
}
2623

27-
// ============================================================
28-
// Logging
29-
// ============================================================
30-
31-
function addLog(message, success = true) {
32-
const now = new Date();
33-
const time = now.toLocaleTimeString("en-US", { hour12: false });
34-
35-
logs.unshift({ time, message, success });
36-
if (logs.length > MAX_LOGS) {
37-
logs = logs.slice(0, MAX_LOGS);
38-
}
39-
40-
renderLogs();
41-
}
42-
43-
function renderLogs() {
44-
if (logs.length === 0) {
45-
logContainer.innerHTML = '<div class="empty-state">Waiting for commands...</div>';
46-
return;
47-
}
48-
49-
logContainer.innerHTML = logs
50-
.map(
51-
(log) => `
52-
<div class="log-entry ${log.success ? "success" : "error"}">
53-
<span class="time">${log.time}</span>
54-
${escapeHtml(log.message)}
55-
</div>
56-
`
57-
)
58-
.join("");
59-
}
60-
61-
function escapeHtml(text) {
62-
const div = document.createElement("div");
63-
div.textContent = text;
64-
return div.innerHTML;
24+
function updateTabCount() {
25+
chrome.tabs.query({}, (tabs) => {
26+
const count = tabs.filter(t => t.url && !t.url.startsWith("chrome://")).length;
27+
tabCountEl.textContent = count;
28+
});
6529
}
6630

6731
// ============================================================
@@ -70,39 +34,40 @@ function escapeHtml(text) {
7034

7135
reconnectBtn.addEventListener("click", () => {
7236
reconnectBtn.disabled = true;
73-
chrome.runtime.sendMessage({ type: "RECONNECT" }, (response) => {
74-
addLog("Reconnecting...");
75-
setTimeout(() => {
76-
chrome.runtime.sendMessage({ type: "GET_STATUS" }, (res) => {
77-
updateStatus(res?.connected || false);
78-
});
79-
}, 1000);
37+
chrome.runtime.sendMessage({ type: "RECONNECT" }, () => {
38+
console.log("[WireAgent] Reconnecting...");
39+
setTimeout(refreshStatus, 1000);
8040
});
8141
});
8242

8343
// ============================================================
8444
// Message Listener
8545
// ============================================================
8646

87-
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
47+
chrome.runtime.onMessage.addListener((message) => {
8848
if (message.type === "CONNECTION_STATUS") {
8949
updateStatus(message.connected);
90-
addLog(message.connected ? "Connected" : "Disconnected", message.connected);
50+
console.log("[WireAgent]", message.connected ? "Connected" : "Disconnected");
9151
}
92-
93-
if (message.type === "COMMAND_EXECUTED") {
94-
addLog(`${message.action}: ${message.result}`, message.success);
95-
}
96-
9752
return false;
9853
});
9954

10055
// ============================================================
10156
// Initialize
10257
// ============================================================
10358

104-
chrome.runtime.sendMessage({ type: "GET_STATUS" }, (response) => {
105-
updateStatus(response?.connected || false);
106-
});
59+
function refreshStatus() {
60+
chrome.runtime.sendMessage({ type: "GET_STATUS" }, (response) => {
61+
updateStatus(response?.connected || false);
62+
});
63+
}
64+
65+
// Initial status check
66+
refreshStatus();
67+
updateTabCount();
68+
69+
// Poll status every 3 seconds
70+
setInterval(refreshStatus, 3000);
71+
setInterval(updateTabCount, 5000);
10772

108-
console.log("[WireAgent] Panel initialized");
73+
console.log("[WireAgent] Panel initialized - Activity logs will appear here");

0 commit comments

Comments
 (0)