mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 20:38:32 +02:00
Cleanup connector form (#2849)
* move "advanced options" to the bottom of the form and cleanup curator frontend * troll
This commit is contained in:
@@ -431,10 +431,8 @@ export default function AddConnector({
|
|||||||
config={configuration}
|
config={configuration}
|
||||||
setSelectedFiles={setSelectedFiles}
|
setSelectedFiles={setSelectedFiles}
|
||||||
selectedFiles={selectedFiles}
|
selectedFiles={selectedFiles}
|
||||||
|
connector={connector}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<AccessTypeForm connector={connector} />
|
|
||||||
<AccessTypeGroupSelector />
|
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -10,12 +10,16 @@ import { TextFormField } from "@/components/admin/connectors/Field";
|
|||||||
import ListInput from "./ConnectorInput/ListInput";
|
import ListInput from "./ConnectorInput/ListInput";
|
||||||
import FileInput from "./ConnectorInput/FileInput";
|
import FileInput from "./ConnectorInput/FileInput";
|
||||||
import { AdvancedOptionsToggle } from "@/components/AdvancedOptionsToggle";
|
import { AdvancedOptionsToggle } from "@/components/AdvancedOptionsToggle";
|
||||||
|
import { AccessTypeForm } from "@/components/admin/connectors/AccessTypeForm";
|
||||||
|
import { AccessTypeGroupSelector } from "@/components/admin/connectors/AccessTypeGroupSelector";
|
||||||
|
import { ConfigurableSources } from "@/lib/types";
|
||||||
|
|
||||||
export interface DynamicConnectionFormProps {
|
export interface DynamicConnectionFormProps {
|
||||||
config: ConnectionConfiguration;
|
config: ConnectionConfiguration;
|
||||||
selectedFiles: File[];
|
selectedFiles: File[];
|
||||||
setSelectedFiles: Dispatch<SetStateAction<File[]>>;
|
setSelectedFiles: Dispatch<SetStateAction<File[]>>;
|
||||||
values: any;
|
values: any;
|
||||||
|
connector: ConfigurableSources;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DynamicConnectionForm: FC<DynamicConnectionFormProps> = ({
|
const DynamicConnectionForm: FC<DynamicConnectionFormProps> = ({
|
||||||
@@ -23,6 +27,7 @@ const DynamicConnectionForm: FC<DynamicConnectionFormProps> = ({
|
|||||||
selectedFiles,
|
selectedFiles,
|
||||||
setSelectedFiles,
|
setSelectedFiles,
|
||||||
values,
|
values,
|
||||||
|
connector,
|
||||||
}) => {
|
}) => {
|
||||||
const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);
|
const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);
|
||||||
|
|
||||||
@@ -96,6 +101,9 @@ const DynamicConnectionForm: FC<DynamicConnectionFormProps> = ({
|
|||||||
|
|
||||||
{config.values.map((field) => !field.hidden && renderField(field))}
|
{config.values.map((field) => !field.hidden && renderField(field))}
|
||||||
|
|
||||||
|
<AccessTypeForm connector={connector} />
|
||||||
|
<AccessTypeGroupSelector />
|
||||||
|
|
||||||
{config.advanced_values.length > 0 && (
|
{config.advanced_values.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<AdvancedOptionsToggle
|
<AdvancedOptionsToggle
|
||||||
|
@@ -57,39 +57,30 @@ export function AccessTypeForm({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isPaidEnterpriseEnabled && (
|
{isPaidEnterpriseEnabled && isAdmin && (
|
||||||
<>
|
<>
|
||||||
<div>
|
<div className="flex gap-x-2 items-center">
|
||||||
<div className="flex gap-x-2 items-center">
|
<label className="text-text-950 font-medium">Document Access</label>
|
||||||
<label className="text-text-950 font-medium">
|
|
||||||
Document Access
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<p className="text-sm text-text-500 mb-2">
|
|
||||||
Control who has access to the documents indexed by this connector.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{isAdmin && (
|
|
||||||
<>
|
|
||||||
<DefaultDropdown
|
|
||||||
options={options}
|
|
||||||
selected={access_type.value}
|
|
||||||
onSelect={(selected) =>
|
|
||||||
access_type_helpers.setValue(selected as AccessType)
|
|
||||||
}
|
|
||||||
includeDefault={false}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{access_type.value === "sync" && isAutoSyncSupported && (
|
|
||||||
<div>
|
|
||||||
<AutoSyncOptions
|
|
||||||
connectorType={connector as ValidAutoSyncSources}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
<p className="text-sm text-text-500 mb-2">
|
||||||
|
Control who has access to the documents indexed by this connector.
|
||||||
|
</p>
|
||||||
|
<DefaultDropdown
|
||||||
|
options={options}
|
||||||
|
selected={access_type.value}
|
||||||
|
onSelect={(selected) =>
|
||||||
|
access_type_helpers.setValue(selected as AccessType)
|
||||||
|
}
|
||||||
|
includeDefault={false}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{access_type.value === "sync" && isAutoSyncSupported && (
|
||||||
|
<div>
|
||||||
|
<AutoSyncOptions
|
||||||
|
connectorType={connector as ValidAutoSyncSources}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
Reference in New Issue
Block a user