Skip to content

Commit 92721fd

Browse files
authored
fix: register team modal actions with Admin namespace (#4728)
Fixes #4727 Keep create-team modal registrations guarded, avoid duplicate team handler registrations already present on main, and migrate remaining team modal callbacks to delegated data-action handlers. Signed-off-by: Vishu Bhatnagar <vishu.bhatnagar@ibm.com>
1 parent c1b6a83 commit 92721fd

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

mcpgateway/admin.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5786,7 +5786,7 @@ async def admin_view_team_members(
57865786
<h3 class="text-lg font-medium text-gray-900 dark:text-white">
57875787
Team Members: {safe_team_name}
57885788
</h3>
5789-
<button onclick="document.getElementById('team-edit-modal').classList.add('hidden')"
5789+
<button data-action-click="hideElement" data-arg0="team-edit-modal"
57905790
class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
57915791
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
57925792
<path stroke-linecap="round" stroke-linejoin="round"
@@ -5942,10 +5942,10 @@ async def admin_add_team_members_view(
59425942
<div class="flex justify-between items-center mb-4">
59435943
<h3 class="text-lg font-medium text-gray-900 dark:text-white">Add Members to: {safe_team_name}</h3>
59445944
<div class="flex items-center space-x-2">
5945-
<button onclick="loadTeamMembersView('{team.id}')" class="px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">
5945+
<button data-action-click="loadTeamMembersView" data-arg0="{team.id}" class="px-3 py-1 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700">
59465946
← Back to Members
59475947
</button>
5948-
<button onclick="document.getElementById('team-edit-modal').classList.add('hidden')" class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
5948+
<button data-action-click="hideElement" data-arg0="team-edit-modal" class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300">
59495949
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
59505950
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
59515951
</svg>
@@ -7007,11 +7007,11 @@ async def admin_list_join_requests(
70077007
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300">{safe_status}</span>
70087008
</div>
70097009
<div class="flex gap-2">
7010-
<button onclick="approveJoinRequest('{team_id}', '{req.id}')"
7010+
<button data-action-click="approveJoinRequest" data-arg0="{team_id}" data-arg1="{req.id}"
70117011
class="px-3 py-1 text-sm font-medium text-green-600 dark:text-green-400 hover:text-green-800 dark:hover:text-green-300 border border-green-300 dark:border-green-600 hover:border-green-500 dark:hover:border-green-400 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500">
70127012
Approve
70137013
</button>
7014-
<button onclick="rejectJoinRequest('{team_id}', '{req.id}')"
7014+
<button data-action-click="rejectJoinRequest" data-arg0="{team_id}" data-arg1="{req.id}"
70157015
class="px-3 py-1 text-sm font-medium text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 border border-red-300 dark:border-red-600 hover:border-red-500 dark:hover:border-red-400 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500">
70167016
Reject
70177017
</button>

mcpgateway/templates/admin.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15072,6 +15072,9 @@ <h3 class="text-lg font-medium text-gray-900 dark:text-white mb-4">
1507215072
if (typeof downloadSampleJSON !== 'undefined') window.Admin.downloadSampleJSON = downloadSampleJSON;
1507315073
if (typeof openCreateTeamModal !== 'undefined') window.Admin.openCreateTeamModal = openCreateTeamModal;
1507415074
if (typeof closeCreateTeamModal !== 'undefined') window.Admin.closeCreateTeamModal = closeCreateTeamModal;
15075+
if (typeof loadTeamMembersView !== 'undefined') window.Admin.loadTeamMembersView = loadTeamMembersView;
15076+
if (typeof approveJoinRequest !== 'undefined') window.Admin.approveJoinRequest = approveJoinRequest;
15077+
if (typeof rejectJoinRequest !== 'undefined') window.Admin.rejectJoinRequest = rejectJoinRequest;
1507515078
</script>
1507615079
</main>
1507715080
</div>

0 commit comments

Comments
 (0)