feat: show MCP section but with a disabled message if org policy disables MCP servers
This commit is contained in:
parent
8d6eed6b86
commit
6598711354
2 changed files with 12 additions and 7 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import { useAppSelector } from "../../../../redux/hooks";
|
||||
import { selectCurrentOrg } from "../../../../redux/slices/profilesSlice";
|
||||
import { useLump } from "../LumpContext";
|
||||
import { ContextSection } from "./ContextSection";
|
||||
import { ErrorSection } from "./errors/ErrorSection";
|
||||
|
|
@ -14,8 +12,6 @@ import { ToolPoliciesSection } from "./tool-policies/ToolPoliciesSection";
|
|||
*/
|
||||
export function SelectedSection() {
|
||||
const { displayedSection } = useLump();
|
||||
const currentOrg = useAppSelector(selectCurrentOrg);
|
||||
const hideMcp = currentOrg?.policy?.allowMcpServers === false;
|
||||
|
||||
switch (displayedSection) {
|
||||
case "models":
|
||||
|
|
@ -29,9 +25,6 @@ export function SelectedSection() {
|
|||
case "tools":
|
||||
return <ToolPoliciesSection />;
|
||||
case "mcp":
|
||||
if (hideMcp) {
|
||||
return null;
|
||||
}
|
||||
return <MCPSection />;
|
||||
case "error":
|
||||
return <ErrorSection />;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { useAuth } from "../../../../../context/Auth";
|
|||
import { IdeMessengerContext } from "../../../../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../../../../redux/hooks";
|
||||
import { updateConfig } from "../../../../../redux/slices/configSlice";
|
||||
import { selectCurrentOrg } from "../../../../../redux/slices/profilesSlice";
|
||||
import { fontSize } from "../../../../../util";
|
||||
import { ToolTip } from "../../../../gui/Tooltip";
|
||||
import { Button } from "../../../../ui";
|
||||
|
|
@ -235,10 +236,12 @@ function MCPServerPreview({ server, serverFromYaml }: MCPServerStatusProps) {
|
|||
}
|
||||
|
||||
function MCPSection() {
|
||||
const currentOrg = useAppSelector(selectCurrentOrg);
|
||||
const servers = useAppSelector(
|
||||
(store) => store.config.config.mcpServerStatuses,
|
||||
);
|
||||
const { selectedProfile } = useAuth();
|
||||
const disableMcp = currentOrg?.policy?.allowMcpServers === false;
|
||||
|
||||
const mergedBlocks = useMemo(() => {
|
||||
const parsed = selectedProfile?.rawYaml
|
||||
|
|
@ -250,6 +253,15 @@ function MCPSection() {
|
|||
}));
|
||||
}, [servers, selectedProfile]);
|
||||
|
||||
if (true) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center p-2">
|
||||
<span className="text-description">
|
||||
MCP Servers are disabled in your organization.
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex max-h-[170px] flex-col gap-1 overflow-y-auto overflow-x-hidden pr-2">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue