remove non-EE public connector options

This commit is contained in:
pablodanswer 2024-08-05 10:56:42 -07:00 committed by Chris Weaver
parent a3ea217f40
commit cd22cca4e8
4 changed files with 50 additions and 33 deletions

View File

@ -94,7 +94,7 @@ export default function AddConnector({
const [refreshFreq, setRefreshFreq] = useState<number>(defaultRefresh || 0);
const [pruneFreq, setPruneFreq] = useState<number>(defaultPrune);
const [indexingStart, setIndexingStart] = useState<Date | null>(null);
const [isPublic, setIsPublic] = useState(false);
const [isPublic, setIsPublic] = useState(true);
const [createConnectorToggle, setCreateConnectorToggle] = useState(false);
const formRef = useRef<FormikProps<any>>(null);
const [advancedFormPageState, setAdvancedFormPageState] = useState(true);

View File

@ -9,6 +9,7 @@ import { TrashIcon } from "@/components/icons/icons";
import { FileUpload } from "@/components/admin/connectors/FileUpload";
import { ConnectionConfiguration } from "@/lib/connectors/connectors";
import { useFormContext } from "@/components/context/FormContext";
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
export interface DynamicConnectionFormProps {
config: ConnectionConfiguration;
@ -54,7 +55,10 @@ const DynamicConnectionForm: React.FC<DynamicConnectionFormProps> = ({
{} as Record<string, any>
)),
};
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
const { setAllowAdvanced } = useFormContext();
const validationSchema = Yup.object().shape({
name: Yup.string().required("Connector Name is required"),
...config.values.reduce(
@ -274,20 +278,23 @@ const DynamicConnectionForm: React.FC<DynamicConnectionFormProps> = ({
);
}
})}
{isPaidEnterpriseFeaturesEnabled && (
<>
<Divider />
<Divider />
<EditingValue
description={`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`}
optional
setFieldValue={(field: string, value: boolean) =>
setIsPublic(value)
}
type={"checkbox"}
label={"Documents are Public?"}
name={"public"}
currentValue={isPublic}
/>
<EditingValue
description={`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`}
optional
setFieldValue={(field: string, value: boolean) =>
setIsPublic(value)
}
type={"checkbox"}
label={"Documents are Public?"}
name={"public"}
currentValue={isPublic}
/>
</>
)}
</Form>
);
}}

View File

@ -31,6 +31,7 @@ import { CustomTooltip } from "@/components/tooltip/CustomTooltip";
import { Warning } from "@phosphor-icons/react";
import Cookies from "js-cookie";
import { TOGGLED_CONNECTORS_COOKIE_NAME } from "@/lib/constants";
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
const columnWidths = {
first: "20%",
@ -54,6 +55,7 @@ function SummaryRow({
onToggle: () => void;
}) {
const activePercentage = (summary.active / summary.count) * 100;
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
return (
<TableRow
@ -98,12 +100,14 @@ function SummaryRow({
</Tooltip>
</TableCell>
<TableCell className={`py-4 w-[${columnWidths.fourth}]`}>
<div className="text-sm text-gray-500">Public Connectors</div>
<p className="flex text-xl mx-auto font-semibold items-center text-lg mt-1">
{summary.public}/{summary.count}
</p>
</TableCell>
{isPaidEnterpriseFeaturesEnabled && (
<TableCell className={`py-4 w-[${columnWidths.fourth}]`}>
<div className="text-sm text-gray-500">Public Connectors</div>
<p className="flex text-xl mx-auto font-semibold items-center text-lg mt-1">
{summary.public}/{summary.count}
</p>
</TableCell>
)}
<TableCell className={`py-4 w-[${columnWidths.fifth}]`}>
<div className="text-sm text-gray-500">Total Docs Indexed</div>
@ -134,6 +138,7 @@ function ConnectorRow({
invisible?: boolean;
}) {
const router = useRouter();
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
const handleManageClick = (e: any) => {
e.stopPropagation();
@ -227,13 +232,15 @@ function ConnectorRow({
<TableCell className={`w-[${columnWidths.third}]`}>
{getActivityBadge()}
</TableCell>
<TableCell className={`w-[${columnWidths.fourth}]`}>
{ccPairsIndexingStatus.public_doc ? (
<FiCheck className="my-auto text-emerald-600" size="18" />
) : (
<FiXCircle className="my-auto text-red-600" />
)}
</TableCell>
{isPaidEnterpriseFeaturesEnabled && (
<TableCell className={`w-[${columnWidths.fourth}]`}>
{ccPairsIndexingStatus.public_doc ? (
<FiCheck className="my-auto text-emerald-600" size="18" />
) : (
<FiXCircle className="my-auto text-red-600" />
)}
</TableCell>
)}
<TableCell className={`w-[${columnWidths.sixth}]`}>
{ccPairsIndexingStatus.docs_indexed}
</TableCell>
@ -261,6 +268,7 @@ export function CCPairIndexingStatusTable({
const [searchTerm, setSearchTerm] = useState("");
const searchInputRef = useRef<HTMLInputElement>(null);
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
useEffect(() => {
if (searchInputRef.current) {
@ -449,11 +457,13 @@ export function CCPairIndexingStatusTable({
>
Activity
</TableHeaderCell>
<TableHeaderCell
className={`w-[${columnWidths.fourth}]`}
>
Public
</TableHeaderCell>
{isPaidEnterpriseFeaturesEnabled && (
<TableHeaderCell
className={`w-[${columnWidths.fourth}]`}
>
Public
</TableHeaderCell>
)}
<TableHeaderCell
className={`w-[${columnWidths.sixth}]`}
>

View File

@ -42,6 +42,7 @@ import { PagesTab } from "./PagesTab";
import { Tooltip } from "@/components/tooltip/Tooltip";
import KeyboardSymbol from "@/lib/browserUtilities";
import { pageType } from "./types";
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
interface HistorySidebarProps {
page: pageType;
@ -199,7 +200,6 @@ export const HistorySidebar = forwardRef<HTMLDivElement, HistorySidebarProps>(
</div>
)}
<div className="border-b border-border pb-4 mx-3" />
<PagesTab
closeSidebar={removeToggle}
page={page}