pi-sdk-web 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +4 -0
- package/dist/static/app.js +10 -1
- package/dist/static/style.css +11 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -399,6 +399,10 @@ export class PiWebServer {
|
|
|
399
399
|
case "get_stats":
|
|
400
400
|
this.broadcastStats();
|
|
401
401
|
break;
|
|
402
|
+
case "get_state":
|
|
403
|
+
// Used by the sidebar Tools refresh button
|
|
404
|
+
this.broadcastState();
|
|
405
|
+
break;
|
|
402
406
|
case "bash": {
|
|
403
407
|
const command = typeof data.command === "string" ? data.command : "";
|
|
404
408
|
if (!command)
|
package/dist/static/app.js
CHANGED
|
@@ -279,6 +279,15 @@ class PiWebClient {
|
|
|
279
279
|
const header = document.createElement('div');
|
|
280
280
|
header.className = 'resources-header';
|
|
281
281
|
header.textContent = 'Tools (click to expand)';
|
|
282
|
+
const refreshBtn = document.createElement('span');
|
|
283
|
+
refreshBtn.className = 'tools-refresh';
|
|
284
|
+
refreshBtn.title = 'Refresh tools list';
|
|
285
|
+
refreshBtn.textContent = '⟳';
|
|
286
|
+
refreshBtn.addEventListener('click', (e) => {
|
|
287
|
+
e.stopPropagation();
|
|
288
|
+
this.send({ type: 'get_state' });
|
|
289
|
+
});
|
|
290
|
+
header.appendChild(refreshBtn);
|
|
282
291
|
|
|
283
292
|
const body = document.createElement('div');
|
|
284
293
|
body.className = 'resources-body';
|
|
@@ -291,7 +300,7 @@ class PiWebClient {
|
|
|
291
300
|
const expanded = div.dataset.expanded === 'true';
|
|
292
301
|
div.dataset.expanded = expanded ? 'false' : 'true';
|
|
293
302
|
body.style.display = expanded ? 'none' : 'block';
|
|
294
|
-
header.textContent = expanded ? 'Tools (click to expand)' : 'Tools (click to collapse)';
|
|
303
|
+
header.firstChild.textContent = expanded ? 'Tools (click to expand)' : 'Tools (click to collapse)';
|
|
295
304
|
});
|
|
296
305
|
this.loadedResourcesEl.appendChild(div);
|
|
297
306
|
}
|
package/dist/static/style.css
CHANGED
|
@@ -171,6 +171,17 @@ body {
|
|
|
171
171
|
color: var(--dim);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
.tools-refresh {
|
|
175
|
+
float: right;
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
color: var(--accent);
|
|
178
|
+
padding: 0 4px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.tools-refresh:hover {
|
|
182
|
+
text-decoration: underline;
|
|
183
|
+
}
|
|
184
|
+
|
|
174
185
|
.resources-body {
|
|
175
186
|
margin-top: 6px;
|
|
176
187
|
color: var(--muted);
|