MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ToolkitDetailView

Function ToolkitDetailView

packages/plugins/toolkits/src/page.tsx:1283–1369  ·  view source on GitHub ↗
(props: {
  toolkit: ToolkitResponse;
  showOwnerLabels: boolean;
  tools: readonly ToolRow[];
  integrations: readonly Integration[];
  integrationPlugins: readonly IntegrationPlugin[];
  orgSlug?: string;
  onBack: () => void;
  onRemoveToolkit: (toolkit: ToolkitResponse) => void;
})

Source from the content-addressed store, hash-verified

1281}
1282
1283function ToolkitDetailView(props: {
1284 toolkit: ToolkitResponse;
1285 showOwnerLabels: boolean;
1286 tools: readonly ToolRow[];
1287 integrations: readonly Integration[];
1288 integrationPlugins: readonly IntegrationPlugin[];
1289 orgSlug?: string;
1290 onBack: () => void;
1291 onRemoveToolkit: (toolkit: ToolkitResponse) => void;
1292}) {
1293 const policies = useAtomValue(toolkitPoliciesAtom(props.toolkit.id));
1294 const connections = useAtomValue(toolkitConnectionsAtom(props.toolkit.id));
1295 const doCreatePolicy = useAtomSet(createToolkitPolicy, { mode: "promiseExit" });
1296 const doUpdatePolicy = useAtomSet(updateToolkitPolicy, { mode: "promiseExit" });
1297 const doRemovePolicy = useAtomSet(removeToolkitPolicy, { mode: "promiseExit" });
1298 const doCreateConnection = useAtomSet(createToolkitConnection, { mode: "promiseExit" });
1299 const doRemoveConnection = useAtomSet(removeToolkitConnection, { mode: "promiseExit" });
1300 const policyRows = AsyncResult.isSuccess(policies) ? policies.value.policies : [];
1301 const connectionRows = AsyncResult.isSuccess(connections) ? connections.value.connections : [];
1302
1303 const setPolicyHandler = async (pattern: string, action: ToolPolicyAction) => {
1304 const existing = policyRows.find((policy) => policy.pattern === pattern);
1305 if (existing) {
1306 await doUpdatePolicy({
1307 params: { toolkitId: props.toolkit.id, policyId: existing.id },
1308 payload: { action },
1309 reactivityKeys: toolkitWriteKeys,
1310 });
1311 return;
1312 }
1313 await doCreatePolicy({
1314 params: { toolkitId: props.toolkit.id },
1315 payload: { pattern, action },
1316 reactivityKeys: toolkitWriteKeys,
1317 });
1318 };
1319
1320 const addConnectionHandler = async (pattern: string) => {
1321 await doCreateConnection({
1322 params: { toolkitId: props.toolkit.id },
1323 payload: { pattern },
1324 reactivityKeys: toolkitWriteKeys,
1325 });
1326 };
1327
1328 const removeConnectionHandler = async (connectionId: string) => {
1329 await doRemoveConnection({
1330 params: { toolkitId: props.toolkit.id, connectionId },
1331 reactivityKeys: toolkitWriteKeys,
1332 });
1333 };
1334
1335 const clearPolicyHandler = async (pattern: string) => {
1336 const existing = policyRows.find((policy) => policy.pattern === pattern);
1337 if (!existing) return;
1338 await doRemovePolicy({
1339 params: { toolkitId: props.toolkit.id, policyId: existing.id },
1340 reactivityKeys: toolkitWriteKeys,

Callers

nothing calls this directly

Calls 1

toolkitUrlForFunction · 0.85

Tested by

no test coverage detected