mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
[Feature] UI - Users: add Send Invitation Email toggle to Invite User modal
The Invite User flow was calling /user/new without send_invite_email, so the backend invitation-email hook (gated on send_invite_email is True) was silently skipped. Add a checkbox, default on, so admins can opt out when needed.
This commit is contained in:
parent
72a461ba4a
commit
3ce67bacad
1 changed files with 21 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ import { InfoCircleOutlined, UserAddOutlined } from "@ant-design/icons";
|
|||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useOrganizations } from "@/app/(dashboard)/hooks/organizations/useOrganizations";
|
||||
import { Accordion, AccordionBody, AccordionHeader, SelectItem, TextInput } from "@tremor/react";
|
||||
import { Alert, Button, Form, Input, Modal, Select, Select as Select2, Space, Tooltip, Typography } from "antd";
|
||||
import { Alert, Button, Checkbox, Form, Input, Modal, Select, Select as Select2, Space, Tooltip, Typography } from "antd";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import BulkCreateUsers from "./bulk_create_users_button";
|
||||
import TeamDropdown from "./common_components/team_dropdown";
|
||||
|
|
@ -113,6 +113,7 @@ export const CreateUserButton: React.FC<CreateuserProps> = ({
|
|||
user_role: string;
|
||||
organization_ids?: string[];
|
||||
organizations?: string[];
|
||||
send_invite_email?: boolean;
|
||||
}) => {
|
||||
try {
|
||||
NotificationsManager.info("Making API Call");
|
||||
|
|
@ -181,7 +182,7 @@ export const CreateUserButton: React.FC<CreateuserProps> = ({
|
|||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
labelAlign="left"
|
||||
initialValues={{ user_role: "internal_user_viewer" }}
|
||||
initialValues={{ user_role: "internal_user_viewer", send_invite_email: true }}
|
||||
>
|
||||
<Alert
|
||||
message="Email invitations"
|
||||
|
|
@ -224,6 +225,14 @@ export const CreateUserButton: React.FC<CreateuserProps> = ({
|
|||
<Input.TextArea rows={4} placeholder="Enter metadata as JSON" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="send_invite_email"
|
||||
valuePropName="checked"
|
||||
wrapperCol={{ offset: 8, span: 16 }}
|
||||
>
|
||||
<Checkbox>Send invitation email</Checkbox>
|
||||
</Form.Item>
|
||||
|
||||
<div style={{ textAlign: "right", marginTop: "10px" }}>
|
||||
<Button htmlType="submit">Create User</Button>
|
||||
</div>
|
||||
|
|
@ -270,7 +279,7 @@ export const CreateUserButton: React.FC<CreateuserProps> = ({
|
|||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}
|
||||
labelAlign="left"
|
||||
initialValues={{ user_role: "internal_user_viewer" }}
|
||||
initialValues={{ user_role: "internal_user_viewer", send_invite_email: true }}
|
||||
>
|
||||
<Form.Item label="User Email" name="user_email">
|
||||
<Input />
|
||||
|
|
@ -360,6 +369,15 @@ export const CreateUserButton: React.FC<CreateuserProps> = ({
|
|||
</Form.Item>
|
||||
</AccordionBody>
|
||||
</Accordion>
|
||||
|
||||
<Form.Item
|
||||
name="send_invite_email"
|
||||
valuePropName="checked"
|
||||
wrapperCol={{ offset: 8, span: 16 }}
|
||||
>
|
||||
<Checkbox>Send invitation email</Checkbox>
|
||||
</Form.Item>
|
||||
|
||||
<div style={{ textAlign: "right", marginTop: "10px" }}>
|
||||
<Button type="primary" icon={<UserAddOutlined />} htmlType="submit">
|
||||
Invite User
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue