mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
feat(ui): assign logging exporters on the org/team create forms
Wires the LoggingExportersSelect field into the New Organization modal and the Create Team form's Logging Settings accordion. The handlers merge values.logging_exporters into metadata before POSTing, matching the edit-form behavior. Removes the "create then edit to assign" two-step.
This commit is contained in:
parent
e0658b821b
commit
1c6a3b2e64
2 changed files with 45 additions and 0 deletions
|
|
@ -76,6 +76,7 @@ interface EditTeamModalProps {
|
|||
|
||||
import { updateExistingKeys } from "@/utils/dataUtils";
|
||||
import DeleteResourceModal from "./common_components/DeleteResourceModal";
|
||||
import LoggingExportersSelect from "./logging_credentials/LoggingExportersSelect";
|
||||
import { Member, teamCreateCall } from "./networking";
|
||||
import { ModelSelect } from "./ModelSelect/ModelSelect";
|
||||
|
||||
|
|
@ -468,6 +469,22 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
|
|||
formValues.metadata = JSON.stringify(metadata);
|
||||
}
|
||||
|
||||
// Merge admin-owned logging_exporters into metadata at create time so the
|
||||
// user can assign destinations from the new-team form (instead of create-then-edit).
|
||||
if (Array.isArray(formValues.logging_exporters) && formValues.logging_exporters.length > 0) {
|
||||
let metadata: Record<string, unknown> = {};
|
||||
if (typeof formValues.metadata === "string" && formValues.metadata.trim().length > 0) {
|
||||
try {
|
||||
metadata = JSON.parse(formValues.metadata);
|
||||
} catch (e) {
|
||||
console.warn("Invalid JSON in metadata field, starting with empty object");
|
||||
}
|
||||
}
|
||||
metadata = { ...metadata, logging_exporters: formValues.logging_exporters };
|
||||
formValues.metadata = JSON.stringify(metadata);
|
||||
}
|
||||
delete formValues.logging_exporters;
|
||||
|
||||
if (formValues.secret_manager_settings) {
|
||||
if (typeof formValues.secret_manager_settings === "string") {
|
||||
if (formValues.secret_manager_settings.trim() === "") {
|
||||
|
|
@ -1568,6 +1585,14 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
|
|||
<b>Logging Settings</b>
|
||||
</AccordionHeader>
|
||||
<AccordionBody>
|
||||
<Form.Item
|
||||
label="Logging Exporters"
|
||||
name="logging_exporters"
|
||||
tooltip="Admin-owned trace destinations this team exports to. Resolved server-side and fanned out (added to the key's and org's). Manage destinations under Settings -> Logging Callbacks."
|
||||
className="mt-4"
|
||||
>
|
||||
<LoggingExportersSelect />
|
||||
</Form.Item>
|
||||
<div className="mt-4">
|
||||
<PremiumLoggingSettings
|
||||
value={loggingSettings}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
|||
import React, { useState } from "react";
|
||||
import { formatNumberWithCommas } from "../utils/dataUtils";
|
||||
import DeleteResourceModal from "./common_components/DeleteResourceModal";
|
||||
import LoggingExportersSelect from "./logging_credentials/LoggingExportersSelect";
|
||||
import TableIconActionButton from "./common_components/IconActionButton/TableIconActionButtons/TableIconActionButton";
|
||||
import { getModelDisplayName } from "./key_team_helpers/fetch_available_models_team_key";
|
||||
import MCPServerSelector from "./mcp_server_management/MCPServerSelector";
|
||||
|
|
@ -158,6 +159,17 @@ const OrganizationsTable: React.FC<OrganizationsTableProps> = ({
|
|||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(values.logging_exporters) && values.logging_exporters.length > 0) {
|
||||
let existingMetadata: Record<string, unknown> = {};
|
||||
if (typeof values.metadata === "string" && values.metadata.trim().length > 0) {
|
||||
existingMetadata = JSON.parse(values.metadata);
|
||||
} else if (values.metadata && typeof values.metadata === "object") {
|
||||
existingMetadata = values.metadata;
|
||||
}
|
||||
values.metadata = { ...existingMetadata, logging_exporters: values.logging_exporters };
|
||||
}
|
||||
delete values.logging_exporters;
|
||||
|
||||
await organizationCreateCall(accessToken, values);
|
||||
NotificationsManager.success("Organization created successfully");
|
||||
setIsOrgModalVisible(false);
|
||||
|
|
@ -513,6 +525,14 @@ const OrganizationsTable: React.FC<OrganizationsTableProps> = ({
|
|||
/>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="Logging Exporters"
|
||||
name="logging_exporters"
|
||||
tooltip="Admin-owned trace destinations this org exports to. Resolved server-side and fanned out to every team and key under it. Manage destinations under Settings -> Logging Callbacks."
|
||||
>
|
||||
<LoggingExportersSelect />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label="Metadata" name="metadata">
|
||||
<Input.TextArea rows={4} />
|
||||
</Form.Item>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue