Skip to content

Commit edb81a1

Browse files
committed
Fix: Adjust tool page button layout and fix CSS/HTML issues
1 parent 004ccbb commit edb81a1

File tree

6 files changed

+146
-14
lines changed

6 files changed

+146
-14
lines changed

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: "MCP Proxy Server"
2-
version: "0.1.9"
2+
version: "0.1.10"
33
slug: "mcp_proxy_server"
44
description: "A central hub for Model Context Protocol (MCP) servers. Manages multiple backend MCP servers (Stdio/SSE), exposing their combined tools and resources via a unified SSE interface or as a Stdio server. Features Web UI for server/tool management, real-time installation monitoring, and optional web terminal."
55
arch:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcp-proxy-server",
3-
"version": "0.1.9",
3+
"version": "0.1.10",
44
"author": "ptbsare",
55
"license": "MIT",
66
"description": "An MCP proxy server that aggregates and serves multiple MCP resource servers through a single interface with stdio/sse support",

public/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ <h2>Tool Configuration</h2>
6060
<p>Loading tools...</p>
6161
</div>
6262
<hr>
63-
<button id="save-tool-config-button">Save & Reload Tool Configuration</button>
63+
<div class="tool-actions-footer"> <!-- New wrapper div -->
64+
<button id="save-tool-config-button">Save & Reload Tool Configuration</button> <!-- Save button first for left alignment -->
65+
<button id="reset-all-tool-overrides-button" class="cleanup-button" title="Clear all tool-specific configurations (overrides and enabled/disabled states)">Reset All Tool Overrides</button>
66+
</div>
6467
<p id="save-tool-status" class="status-message"></p>
6568
</div>
6669

public/script.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ const handleLoginSuccess = async () => {
225225
if (typeof initializeToolSaveListener === 'function') {
226226
initializeToolSaveListener();
227227
} else { console.error("initializeToolSaveListener function not found."); }
228+
if (typeof window.initializeResetAllToolOverridesListener === 'function') { // Call the new initializer
229+
window.initializeResetAllToolOverridesListener();
230+
} else { console.error("initializeResetAllToolOverridesListener function not found on window."); }
228231
};
229232

230233
const handleLogoutSuccess = () => {

public/style.css

Lines changed: 101 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ button:disabled, .add-button:disabled {
219219
display: flex;
220220
align-items: center; /* Key for vertical alignment of items in the row */
221221
margin-bottom: 1rem;
222-
/* justify-content: flex-start; /* Let items flow and use margins/flex-grow for spacing */
222+
/* justify-content: flex-start; Let items flow and use margins/flex-grow for spacing */
223223
}
224224

225225
.server-entry .server-header h3, .tool-entry .tool-header h3 {
@@ -256,7 +256,7 @@ button:disabled, .add-button:disabled {
256256
color: #6c757d;
257257
margin-left: 0.5rem; /* Space after H3 */
258258
white-space: normal; /* Allow long text to wrap */
259-
/* margin-right: auto; /* Remove this, as there's no element to push to the far right anymore */
259+
/* margin-right: auto; Remove this, as there's no element to push to the far right anymore */
260260
/* Adding a small flex-shrink to allow it to shrink if needed, but h3 should grow more */
261261
flex-shrink: 1;
262262
}
@@ -284,12 +284,6 @@ button:disabled, .add-button:disabled {
284284
}
285285

286286

287-
/* Styles for server header (mostly covered by shared now) */
288-
.server-entry .server-header {
289-
/* display: flex; align-items: center; are shared */
290-
/* justify-content: flex-start; /* Let items flow */
291-
}
292-
293287
/* Delete button specific styling if needed, assuming it's the last element */
294288
.server-entry .server-header .delete-button {
295289
margin-left: auto; /* Push delete button to the far right */
@@ -391,16 +385,113 @@ button:disabled, .add-button:disabled {
391385
background-color: #e67312;
392386
border-color: #d96c10;
393387
}
394-
.reload-button:disabled {
395-
background-color: #ffc99c;
388+
.reload-button:disabled {
389+
background-color: #ffc99c;
396390
border-color: #ffc99c;
397391
}
398392

393+
.cleanup-button { /* Styles for Reset All Tool Overrides and similar buttons */
394+
background-color: #ffc107; /* Yellow/Orange for warning/cleanup actions */
395+
border-color: #ffc107;
396+
color: #212529; /* Dark text for better contrast on yellow */
397+
}
398+
.cleanup-button:hover {
399+
background-color: #e0a800;
400+
border-color: #d39e00;
401+
color: #212529;
402+
}
403+
.cleanup-button:focus {
404+
outline: 0;
405+
box-shadow: 0 0 0 0.2rem rgba(224, 168, 0, 0.5); /* Adjusted shadow color */
406+
}
407+
408+
399409
hr {
400410
margin: 20px 0;
401411
border: 0;
402412
border-top: 1px solid #eee;
403413
}
414+
415+
/* Styles for the footer button container in Tools section */
416+
.tool-actions-footer {
417+
display: flex;
418+
justify-content: space-between; /* Pushes first item (save) to left, last item (reset) to right */
419+
align-items: center;
420+
margin-top: 1rem; /* Space above the button row */
421+
flex-wrap: wrap; /* Allow buttons to wrap on very narrow screens if needed, before media query kicks in */
422+
}
423+
424+
.tool-actions-footer button {
425+
margin-top: 0.5rem; /* Keep consistent top margin for buttons */
426+
/* margin-right: 0; Remove default right margin from generic button if it interferes with space-between */
427+
/* The default button style has margin-right: 0.5rem. For space-between, this is usually fine. */
428+
/* If only two buttons, the space-between will handle it. If more, this might need adjustment. */
429+
}
430+
431+
/* Ensure the cleanup button (Reset All) doesn't have excessive left margin from generic button style if it's the rightmost */
432+
/* Note: Specific styles for .cleanup-button within .tool-actions-footer were previously here but removed as they were empty or handled by parent layout. */
433+
434+
/* Ensure the save button (first child) doesn't have excessive right margin from generic button style */
435+
436+
437+
/* Responsive adjustments for Tool Header on narrow screens */
438+
@media screen and (max-width: 768px) {
439+
.tool-entry .tool-header {
440+
flex-direction: column; /* Stack items vertically */
441+
align-items: flex-start; /* Align items to the left */
442+
}
443+
444+
.tool-entry .tool-header .tool-enable-label,
445+
.tool-entry .tool-header h3,
446+
.tool-entry .tool-header .tool-exposed-name,
447+
.tool-entry .tool-header .reset-tool-overrides-button { /* Added reset button here */
448+
width: 100%; /* Make each item take full width in column layout */
449+
margin-left: 0;
450+
margin-right: 0;
451+
padding-right: 0; /* Reset padding that was for row layout */
452+
box-sizing: border-box; /* Ensure padding/border don't add to width */
453+
}
454+
455+
.tool-entry .tool-header .tool-enable-label {
456+
margin-bottom: 0.5rem; /* Space below checkbox label */
457+
}
458+
459+
.tool-entry .tool-header h3 {
460+
margin-bottom: 0.25rem; /* Space below H3 */
461+
/* flex-grow: 0; Not strictly necessary in column, but good for clarity */
462+
}
463+
464+
.tool-entry .tool-header .tool-exposed-name {
465+
margin-bottom: 0.5rem; /* Space below "Exposed As" text before reset button */
466+
/* font-size can remain as is or be adjusted if needed */
467+
/* margin-left was reset above */
468+
}
469+
470+
.tool-entry .tool-header .reset-tool-overrides-button {
471+
/* width: auto; Allow button to size to its content, but still be left-aligned due to align-items: flex-start on parent */
472+
/* align-self: flex-start; Explicitly align left if width is auto */
473+
/* No margin-bottom needed if it's the last item in the stacked header before details */
474+
margin-top: 0.25rem; /* Add a little space if it stacks below exposed-name */
475+
}
476+
477+
/* Responsive adjustments for the new .tool-actions-footer */
478+
.tool-actions-footer {
479+
flex-direction: column;
480+
align-items: stretch; /* Make buttons full width */
481+
}
482+
.tool-actions-footer button {
483+
width: 100%;
484+
margin-right: 0; /* Remove right margin when stacked */
485+
}
486+
.tool-actions-footer button:not(:last-child) {
487+
margin-bottom: 1.5rem; /* Increased bottom margin for better spacing when stacked */
488+
}
489+
}
490+
491+
492+
footer p {
493+
margin: 0.25rem 0;
494+
}
404495
.env-vars-container {
405496
margin-top: 5px;
406497
margin-bottom: 10px;

public/tools.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,39 @@ window.renderTools = renderTools; // Might not be needed globally
302302
window.renderToolEntry = renderToolEntry; // Might not be needed globally
303303
window.initializeToolSaveListener = initializeToolSaveListener; // To be called from main script
304304

305-
console.log("tools.js loaded");
305+
console.log("tools.js loaded");
306+
// --- Logic for Reset All Tool Overrides button ---
307+
function initializeResetAllToolOverridesListener() {
308+
const resetButton = document.getElementById('reset-all-tool-overrides-button');
309+
// Ensure saveToolStatus is available, it's declared in script.js and expected to be global or on window
310+
const localSaveToolStatus = window.saveToolStatus || document.getElementById('save-tool-status');
311+
312+
if (!resetButton) {
313+
console.warn("Reset All Tool Overrides button not found in DOM.");
314+
return;
315+
}
316+
317+
resetButton.addEventListener('click', async () => {
318+
if (confirm("Are you sure you want to reset ALL tool overrides?\nThis will clear any custom names, descriptions, and enabled/disabled states for all tools, reverting them to their defaults. You will need to click 'Save & Reload Tool Configuration' to make this permanent.")) {
319+
if (window.currentToolConfig) {
320+
window.currentToolConfig.tools = {}; // Clear all tool-specific configurations
321+
console.log("All tool overrides marked for deletion.");
322+
323+
renderTools(); // Re-render the tools list to reflect the reset state
324+
325+
if (localSaveToolStatus) {
326+
localSaveToolStatus.textContent = 'All tool overrides have been reset. Click "Save & Reload" to apply.';
327+
localSaveToolStatus.style.color = 'orange';
328+
setTimeout(() => { if (localSaveToolStatus) localSaveToolStatus.textContent = ''; }, 7000);
329+
}
330+
// Consider adding a global dirty flag if not already handled by the main save logic
331+
// e.g., window.isToolConfigDirty = true;
332+
} else {
333+
alert("Tool configuration not loaded yet. Please wait or try reloading.");
334+
}
335+
}
336+
});
337+
}
338+
339+
// Expose the new initializer to be called from script.js
340+
window.initializeResetAllToolOverridesListener = initializeResetAllToolOverridesListener;

0 commit comments

Comments
 (0)