Fix prettier complaints
This commit is contained in:
@@ -128,7 +128,9 @@ const App = () => {
|
|||||||
const [selectedResource, setSelectedResource] = useState<Resource | null>(
|
const [selectedResource, setSelectedResource] = useState<Resource | null>(
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
const [resourceSubscriptions, setResourceSubscriptions] = useState<Set<string>>(new Set<string>());
|
const [resourceSubscriptions, setResourceSubscriptions] = useState<
|
||||||
|
Set<string>
|
||||||
|
>(new Set<string>());
|
||||||
|
|
||||||
const [selectedPrompt, setSelectedPrompt] = useState<Prompt | null>(null);
|
const [selectedPrompt, setSelectedPrompt] = useState<Prompt | null>(null);
|
||||||
const [selectedTool, setSelectedTool] = useState<Tool | null>(null);
|
const [selectedTool, setSelectedTool] = useState<Tool | null>(null);
|
||||||
@@ -311,7 +313,6 @@ const App = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const subscribeToResource = async (uri: string) => {
|
const subscribeToResource = async (uri: string) => {
|
||||||
|
|
||||||
if (!resourceSubscriptions.has(uri)) {
|
if (!resourceSubscriptions.has(uri)) {
|
||||||
await makeRequest(
|
await makeRequest(
|
||||||
{
|
{
|
||||||
@@ -325,11 +326,9 @@ const App = () => {
|
|||||||
clone.add(uri);
|
clone.add(uri);
|
||||||
setResourceSubscriptions(clone);
|
setResourceSubscriptions(clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsubscribeFromResource = async (uri: string) => {
|
const unsubscribeFromResource = async (uri: string) => {
|
||||||
|
|
||||||
if (resourceSubscriptions.has(uri)) {
|
if (resourceSubscriptions.has(uri)) {
|
||||||
await makeRequest(
|
await makeRequest(
|
||||||
{
|
{
|
||||||
@@ -345,7 +344,6 @@ const App = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const listPrompts = async () => {
|
const listPrompts = async () => {
|
||||||
const response = await makeRequest(
|
const response = await makeRequest(
|
||||||
{
|
{
|
||||||
@@ -523,7 +521,9 @@ const App = () => {
|
|||||||
clearError("resources");
|
clearError("resources");
|
||||||
setSelectedResource(resource);
|
setSelectedResource(resource);
|
||||||
}}
|
}}
|
||||||
resourceSubscriptionsSupported={serverCapabilities?.resources?.subscribe || false}
|
resourceSubscriptionsSupported={
|
||||||
|
serverCapabilities?.resources?.subscribe || false
|
||||||
|
}
|
||||||
resourceSubscriptions={resourceSubscriptions}
|
resourceSubscriptions={resourceSubscriptions}
|
||||||
subscribeToResource={(uri) => {
|
subscribeToResource={(uri) => {
|
||||||
clearError("resources");
|
clearError("resources");
|
||||||
|
|||||||
@@ -173,23 +173,28 @@ const ResourcesTab = ({
|
|||||||
</h3>
|
</h3>
|
||||||
{selectedResource && (
|
{selectedResource && (
|
||||||
<div className="flex row-auto gap-1 justify-end w-2/5">
|
<div className="flex row-auto gap-1 justify-end w-2/5">
|
||||||
{ resourceSubscriptionsSupported && !resourceSubscriptions.has(selectedResource.uri) && <Button
|
{resourceSubscriptionsSupported &&
|
||||||
variant="outline"
|
!resourceSubscriptions.has(selectedResource.uri) && (
|
||||||
size="sm"
|
<Button
|
||||||
onClick={() => subscribeToResource(selectedResource.uri)}
|
variant="outline"
|
||||||
>
|
size="sm"
|
||||||
Subscribe
|
onClick={() => subscribeToResource(selectedResource.uri)}
|
||||||
</Button>
|
>
|
||||||
}
|
Subscribe
|
||||||
{ resourceSubscriptionsSupported && resourceSubscriptions.has(selectedResource.uri) &&
|
</Button>
|
||||||
<Button
|
)}
|
||||||
variant="outline"
|
{resourceSubscriptionsSupported &&
|
||||||
size="sm"
|
resourceSubscriptions.has(selectedResource.uri) && (
|
||||||
onClick={() => unsubscribeFromResource(selectedResource.uri)}
|
<Button
|
||||||
>
|
variant="outline"
|
||||||
Unsubscribe
|
size="sm"
|
||||||
</Button>
|
onClick={() =>
|
||||||
}
|
unsubscribeFromResource(selectedResource.uri)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Unsubscribe
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ export const StdErrNotificationSchema = BaseNotificationSchema.extend({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const NotificationSchema = ClientNotificationSchema
|
export const NotificationSchema = ClientNotificationSchema.or(
|
||||||
.or(StdErrNotificationSchema)
|
StdErrNotificationSchema,
|
||||||
.or(ServerNotificationSchema);
|
).or(ServerNotificationSchema);
|
||||||
|
|
||||||
export type StdErrNotification = z.infer<typeof StdErrNotificationSchema>;
|
export type StdErrNotification = z.infer<typeof StdErrNotificationSchema>;
|
||||||
export type Notification = z.infer<typeof NotificationSchema>;
|
export type Notification = z.infer<typeof NotificationSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user