Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31,310 changes: 0 additions & 31,310 deletions mcpgateway/static/admin.js

This file was deleted.

13 changes: 13 additions & 0 deletions mcpgateway/static/js/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const Admin = window.Admin = window.Admin || {};

import('./constants.js');
import('./utils.js');
import('./security.js');
import('./appState.js');
import('./modals.js');
import('./metrics.js');
import('./mcpController.js')
import('./tabs.js')
import('./auth.js')
import('./app.js');
import('./events.js');
23,453 changes: 23,453 additions & 0 deletions mcpgateway/static/js/app.js

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions mcpgateway/static/js/appState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
((Admin) => {
// ===================================================================
// ENHANCED GLOBAL STATE MANAGEMENT
// ===================================================================
Admin.AppState = {
parameterCount: 0,
currentTestTool: null,
toolTestResultEditor: null,
isInitialized: false,
pendingRequests: new Set(),
editors: {
gateway: {
headers: null,
body: null,
formHandler: null,
closeHandler: null,
},
},

// Track active modals to prevent multiple opens
activeModals: new Set(),

// Safe method to reset state
reset() {
this.parameterCount = 0;
this.currentTestTool = null;
this.toolTestResultEditor = null;
this.activeModals.clear();

// Cancel pending requests
this.pendingRequests.forEach((controller) => {
try {
controller.abort();
} catch (error) {
console.warn("Error aborting request:", error);
}
});
this.pendingRequests.clear();

// Clean up editors
Object.keys(this.editors.gateway).forEach((key) => {
this.editors.gateway[key] = null;
});

// ADD THIS LINE: Clean up tool test state
if (typeof Admin.cleanupToolTestState === "function") {
Admin.cleanupToolTestState();
}

console.log("βœ“ Application state reset");
},

// Track requests for cleanup
addPendingRequest(controller) {
this.pendingRequests.add(controller);
},

removePendingRequest(controller) {
this.pendingRequests.delete(controller);
},

// Safe parameter count management
getParameterCount() {
return this.parameterCount;
},

incrementParameterCount() {
return ++this.parameterCount;
},

decrementParameterCount() {
if (this.parameterCount > 0) {
return --this.parameterCount;
}
return 0;
},

// Modal management
isModalActive(modalId) {
return this.activeModals.has(modalId);
},

setModalActive(modalId) {
this.activeModals.add(modalId);
},

setModalInactive(modalId) {
this.activeModals.delete(modalId);
},
};
})(window.Admin);
Loading
Loading