Some additional curator polish (#2253)

This commit is contained in:
hagen-danswer 2024-08-27 19:44:24 -07:00 committed by GitHub
parent 8afa53c6bf
commit e4e67c61ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 27 deletions

View File

@ -69,7 +69,7 @@ logger = setup_logger()
def validate_curator_request(groups: list | None, is_public: bool) -> None:
if is_public:
detail = "User does not have permission to create public credentials"
detail = "Curators cannot create public objects"
logger.error(detail)
raise HTTPException(
status_code=401,

View File

@ -486,27 +486,10 @@ export default function AddConnector({
/>
{isPaidEnterpriseFeaturesEnabled && (
<>
<Divider className="my-0 py-0" />
{formikProps.values.groups.length > 0 ? (
<IsPublicGroupSelector
formikProps={formikProps}
objectName="Connector"
/>
) : (
<AdminBooleanFormField
subtext={`If set, then documents indexed by this connector will be visible to all users. If turned off, then only users who explicitly have been given access to the documents (e.g. through a User Group) will have access`}
checked={formikProps.values.is_public}
onChange={(e) => {
const value = e.target.checked;
formikProps.setFieldValue("is_public", value);
if (value) {
formikProps.setFieldValue("groups", []);
}
}}
label={"Documents are Public?"}
name={"is_public"}
/>
)}
<IsPublicGroupSelector
formikProps={formikProps}
objectName="Connector"
/>
</>
)}
</div>

View File

@ -74,11 +74,13 @@ export const UserGroupsTable = ({
<TableRow key={userGroup.id}>
<TableCell>
<Link
className="whitespace-normal break-all flex cursor-pointer p-2 rounded hover:bg-hover w-fit"
className="whitespace-nowrap overflow-hidden text-ellipsis inline-flex items-center cursor-pointer p-2 rounded hover:bg-hover max-w-full"
href={`/admin/groups/${userGroup.id}`}
>
<FiEdit2 className="my-auto mr-2" />
<p className="text font-medium">{userGroup.name}</p>
<FiEdit2 className="mr-2 flex-shrink-0" />
<span className="font-medium truncate">
{userGroup.name}
</span>
</Link>
</TableCell>
<TableCell>

View File

@ -392,7 +392,7 @@ export const GroupDisplay = ({
<Divider />
<h2 className="text-xl font-bold mt-8 mb-2">Personas</h2>
<h2 className="text-xl font-bold mt-8 mb-2">Assistants</h2>
<div>
{userGroup.document_sets.length > 0 ? (
@ -410,7 +410,7 @@ export const GroupDisplay = ({
</div>
) : (
<>
<Text>No Personas in this group...</Text>
<Text>No Assistants in this group...</Text>
</>
)}
</div>

View File

@ -28,6 +28,9 @@ export const IsPublicGroupSelector = <T extends IsPublicGroupSelectorFormType>({
useEffect(() => {
if (user && userGroups) {
const isUserAdmin = user.role === UserRole.ADMIN;
if (!isUserAdmin) {
formikProps.setFieldValue("is_public", false);
}
if (userGroups.length === 1 && !isUserAdmin) {
formikProps.setFieldValue("groups", [userGroups[0].id]);
setShouldHideContent(true);