Skip to content

Commit

Permalink
remove some number of unnecessary lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Sep 10, 2024
1 parent 2323105 commit f559353
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 50 deletions.
2 changes: 1 addition & 1 deletion backend/danswer/configs/app_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
os.environ.get("POSTGRES_PASSWORD") or "password"
)
POSTGRES_HOST = os.environ.get("POSTGRES_HOST") or "localhost"
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5433"
POSTGRES_PORT = os.environ.get("POSTGRES_PORT") or "5432"
POSTGRES_DB = os.environ.get("POSTGRES_DB") or "postgres"

# defaults to False
Expand Down
2 changes: 1 addition & 1 deletion deployment/docker_compose/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5433:5432"
- "5432:5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
2 changes: 1 addition & 1 deletion deployment/docker_compose/docker-compose.gpu-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5433:5432"
- "5432:5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ services:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-password}
ports:
- "5433"
- "5432"
volumes:
- db_volume:/var/lib/postgresql/data

Expand Down
24 changes: 10 additions & 14 deletions web/src/app/admin/assistants/AssistantEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1184,20 +1184,16 @@ export function AssistantEditor({
/>
</div>

{isPaidEnterpriseFeaturesEnabled &&
userGroups &&
userGroups.length > 0 && (
<IsPublicGroupSelector
formikProps={{
values,
isSubmitting,
setFieldValue,
...formikProps,
}}
objectName="assistant"
enforceGroupSelection={false}
/>
)}
<IsPublicGroupSelector
formikProps={{
values,
isSubmitting,
setFieldValue,
...formikProps,
}}
objectName="assistant"
enforceGroupSelection={false}
/>
</>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,27 +420,12 @@ export function CustomLLMProviderUpdateForm({
/>

{showAdvancedOptions && (
<>
{isPaidEnterpriseFeaturesEnabled && userGroups && (
<>
<BooleanFormField
small
removeIndent
alignTop
name="is_public"
label="Is Public?"
subtext="If set, this LLM Provider will be available to all users. If not, only the specified User Groups will be able to use it."
/>

<IsPublicGroupSelector
formikProps={formikProps}
objectName="LLM Provider"
publicToWhom="all users"
enforceGroupSelection={true}
/>
</>
)}
</>
<IsPublicGroupSelector
formikProps={formikProps}
objectName="LLM Provider"
publicToWhom="all users"
enforceGroupSelection={true}
/>
)}

<div>
Expand Down
16 changes: 7 additions & 9 deletions web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,13 @@ export default function AddConnector({
</Card>
)}

{!(formStep == 0 && connector == "google_drive") && (
<NavigationRow
activatedCredential={credentialActivated != null}
isValid={formikProps.isValid}
onSubmit={formikProps.handleSubmit}
noCredentials={noCredentials}
noAdvanced={connector !== "file"}
/>
)}
<NavigationRow
activatedCredential={credentialActivated != null}
isValid={formikProps.isValid}
onSubmit={formikProps.handleSubmit}
noCredentials={noCredentials}
noAdvanced={connector !== "file"}
/>
</div>
);
}}
Expand Down
7 changes: 6 additions & 1 deletion web/src/components/IsPublicGroupSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
import React, { useState, useEffect } from "react";
import { FormikProps, FieldArray, ArrayHelpers, ErrorMessage } from "formik";
import { Text, Divider } from "@tremor/react";
Expand Down Expand Up @@ -27,10 +28,11 @@ export const IsPublicGroupSelector = <T extends IsPublicGroupSelectorFormType>({
}) => {
const { data: userGroups, isLoading: userGroupsIsLoading } = useUserGroups();
const { isAdmin, user, isLoadingUser, isCurator } = useUser();
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
const [shouldHideContent, setShouldHideContent] = useState(false);

useEffect(() => {
if (user && userGroups) {
if (user && userGroups && isPaidEnterpriseFeaturesEnabled) {
const isUserAdmin = user.role === UserRole.ADMIN;
if (!isUserAdmin) {
formikProps.setFieldValue("is_public", false);
Expand All @@ -55,6 +57,9 @@ export const IsPublicGroupSelector = <T extends IsPublicGroupSelectorFormType>({
if (isLoadingUser || userGroupsIsLoading) {
return <div>Loading...</div>;
}
if (!isPaidEnterpriseFeaturesEnabled) {
return null;
}

if (shouldHideContent && enforceGroupSelection) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default function CreateCredential({
initialValues={
{
name: "",
is_public: isAdmin,
is_public: isAdmin || !isPaidEnterpriseFeaturesEnabled,
groups: [],
} as formType
}
Expand Down

0 comments on commit f559353

Please sign in to comment.