Merge pull request #9 from modelcontextprotocol/ashwin/resourcerefresh

resource refreshing
This commit is contained in:
ashwin-ant
2024-10-09 09:04:52 -07:00
committed by GitHub

View File

@@ -1,4 +1,10 @@
import { FileText, PlayCircle, ChevronRight, AlertCircle } from "lucide-react"; import {
FileText,
PlayCircle,
ChevronRight,
AlertCircle,
RefreshCw,
} from "lucide-react";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { TabsContent } from "@/components/ui/tabs"; import { TabsContent } from "@/components/ui/tabs";
@@ -58,10 +64,20 @@ const ResourcesTab = ({
</div> </div>
<div className="bg-white rounded-lg shadow"> <div className="bg-white rounded-lg shadow">
<div className="p-4 border-b border-gray-200"> <div className="p-4 border-b border-gray-200 flex justify-between items-center">
<h3 className="font-semibold"> <h3 className="font-semibold">
{selectedResource ? selectedResource.uri : "Select a resource"} {selectedResource ? selectedResource.uri : "Select a resource"}
</h3> </h3>
{selectedResource && (
<Button
variant="outline"
size="sm"
onClick={() => readResource(selectedResource.uri)}
>
<RefreshCw className="w-4 h-4 mr-2" />
Refresh
</Button>
)}
</div> </div>
<div className="p-4"> <div className="p-4">
{error ? ( {error ? (
@@ -71,7 +87,7 @@ const ResourcesTab = ({
<AlertDescription>{error}</AlertDescription> <AlertDescription>{error}</AlertDescription>
</Alert> </Alert>
) : selectedResource ? ( ) : selectedResource ? (
<pre className="bg-gray-50 p-4 rounded text-sm overflow-auto max-h-96"> <pre className="bg-gray-50 p-4 rounded text-sm overflow-auto max-h-96 whitespace-pre-wrap break-words">
{resourceContent} {resourceContent}
</pre> </pre>
) : ( ) : (