Skip to content

Commit 1f7ebdb

Browse files
rakduttakevalmahajan
authored andcommitted
resource enabled
Signed-off-by: rakdutta <rakhibiswas@yahoo.com>
1 parent 2696ea5 commit 1f7ebdb

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

mcpgateway/admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6160,7 +6160,7 @@ async def admin_resources_partial_html(
61606160
except Exception as e:
61616161
LOGGER.warning(f"Failed to convert resource {getattr(r, 'id', '<unknown>')} to schema: {e}")
61626162
continue
6163-
6163+
LOGGER.info(f"resources_data partial::{resources_data}")
61646164
data = jsonable_encoder(resources_data)
61656165

61666166
# Build pagination metadata
@@ -12187,7 +12187,7 @@ async def get_resources_section(
1218712187
"description": resource.description,
1218812188
"uri": resource.uri,
1218912189
"tags": resource.tags or [],
12190-
"isActive": resource.is_active,
12190+
"isActive": resource.enabled,
1219112191
"team_id": getattr(resource, "team_id", None),
1219212192
"visibility": getattr(resource, "visibility", "private"),
1219312193
}

mcpgateway/schemas.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,6 @@ class ResourceRead(BaseModelWithConfigDict):
17801780
size: Optional[int]
17811781
created_at: datetime
17821782
updated_at: datetime
1783-
#is_active: bool
17841783
enabled: bool
17851784
metrics: ResourceMetrics
17861785
tags: List[Dict[str, str]] = Field(default_factory=list, description="Tags for categorizing the resource")

mcpgateway/templates/resources_partial.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
<td class="px-6 py-4 whitespace-nowrap">{% if resource.ownerEmail %}<span class="text-sm text-gray-900 dark:text-gray-100">{{ resource.ownerEmail }}</span>{% else %}<span class="text-gray-500 dark:text-gray-300 text-xs">N/A</span>{% endif %}</td>
2828
<td class="px-2 py-4 whitespace-nowrap">{% if resource.team %}<span class="text-sm text-gray-900 dark:text-gray-100">{{ resource.team.replace(' ', '<br />')|safe }}</span>{% else %}<span class="text-gray-500 dark:text-gray-300 text-xs">N/A</span>{% endif %}</td>
2929
<td class="px-6 py-4 whitespace-nowrap">{% if resource.visibility == 'private' %}<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-red-100 text-red-800">Private</span>{% elif resource.visibility == 'team' %}<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">Team</span>{% elif resource.visibility == 'public' %}<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">Public</span>{% else %}<span class="text-gray-500 dark:text-gray-300 text-xs">N/A</span>{% endif %}</td>
30-
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {% if resource.isActive %}bg-green-100 text-green-800{% else %}bg-red-100 text-red-800{% endif %}">{{ 'Active' if resource.isActive else 'Inactive' }}</span></td>
30+
<td class="px-6 py-4 whitespace-nowrap"><span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {% if resource.enabled %}bg-green-100 text-green-800{% else %}bg-red-100 text-red-800{% endif %}">{{ 'Active' if resource.enabled else 'Inactive' }}</span></td>
3131
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
3232
<div class="grid grid-cols-2 gap-x-2 gap-y-1 max-w-48">
3333
<button onclick="viewResource('{{ resource.id }}')" class="flex items-center justify-center px-2 py-1 text-xs font-medium rounded-md text-indigo-600 hover:text-indigo-900 hover:bg-indigo-50 dark:text-indigo-400 dark:hover:bg-indigo-900/20 transition-colors">View</button>
3434
<button onclick="editResource('{{ resource.id }}')" class="flex items-center justify-center px-2 py-1 text-xs font-medium rounded-md text-green-600 hover:text-green-900 hover:bg-green-50 dark:text-green-400 dark:hover:bg-green-900/20 transition-colors">Edit</button>
3535
<div class="col-span-2 flex flex-col space-y-1">
36-
{% if resource.isActive %}
36+
{% if resource.enabled %}
3737
<form method="POST" action="{{ root_path }}/admin/resources/{{ resource.id }}/toggle" class="contents" onsubmit="return handleToggleSubmit(event, 'resources')">
3838
<input type="hidden" name="activate" value="false" />
3939
<button type="submit" class="flex items-center justify-center px-2 py-1 text-xs font-medium rounded-md text-yellow-600 hover:text-yellow-900 hover:bg-yellow-50 dark:text-yellow-400 dark:hover:bg-yellow-900/20 transition-colors">Deactivate</button>

0 commit comments

Comments
 (0)