Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/app/settings/_components/ibm-cos-settings-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export default function IBMCOSSettingsDialog({
toast.success("IBM Cloud Object Storage configured", {
description:
selectedBuckets.length > 0
? `Will ingest from: ${selectedBuckets.join(", ")}`
: "Will auto-discover and ingest all accessible buckets.",
? `Filtered to: ${selectedBuckets.join(", ")}`
: "All accessible buckets are included.",
icon: <IBMCOSIcon className="w-4 h-4" />,
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/settings/_components/ibm-cos-settings-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ export function IBMCOSSettingsForm({
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label className="text-sm font-medium">
Select Buckets to Ingest
Restrict to Specific Buckets
<span className="ml-1 text-muted-foreground font-normal">
(leave all unchecked to ingest everything)
(leave all unchecked to include all)
</span>
</Label>
{buckets.length > 1 && (
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/settings/_components/s3-settings-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ export default function S3SettingsDialog({
toast.success("Amazon S3 configured", {
description:
selectedBuckets.length > 0
? `Will ingest from: ${selectedBuckets.join(", ")}`
: "Will auto-discover and ingest all accessible buckets.",
? `Filtered to: ${selectedBuckets.join(", ")}`
: "All accessible buckets are included.",
icon: <AwsLogo className="w-4 h-4" />,
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/settings/_components/s3-settings-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ export function S3SettingsForm({
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label className="text-sm font-medium">
Select Buckets to Ingest
Restrict to Specific Buckets
<span className="ml-1 text-muted-foreground font-normal">
(leave all unchecked to ingest everything)
(leave all unchecked to include all)
</span>
</Label>
{buckets.length > 1 && (
Expand Down
37 changes: 36 additions & 1 deletion frontend/app/upload/[provider]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
RefreshCw,
} from "lucide-react";
import { useParams, useRouter } from "next/navigation";
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { toast } from "sonner";
import { useSyncConnector } from "@/app/api/mutations/useSyncConnector";
import { useGetConnectorsQuery } from "@/app/api/queries/useGetConnectorsQuery";
import { useGetConnectorTokenQuery } from "@/app/api/queries/useGetConnectorTokenQuery";
import { useIBMCOSBucketStatusQuery } from "@/app/api/queries/useIBMCOSBucketStatusQuery";
import { useIBMCOSDefaultsQuery } from "@/app/api/queries/useIBMCOSDefaultsQuery";
import { useS3BucketStatusQuery } from "@/app/api/queries/useS3BucketStatusQuery";
import { useS3DefaultsQuery } from "@/app/api/queries/useS3DefaultsQuery";
import { type CloudFile, UnifiedCloudPicker } from "@/components/cloud-picker";
import { IngestSettings } from "@/components/cloud-picker/ingest-settings";
import { getIngestChunkSettingsError } from "@/components/cloud-picker/types";
Expand Down Expand Up @@ -49,6 +51,7 @@ function BucketView({
addTask,
onBack,
onDone,
initialSelectedBuckets,
}: {
connector: any;
buckets: Array<{ name: string; ingested_count: number }> | undefined;
Expand All @@ -60,17 +63,37 @@ function BucketView({
addTask: (id: string) => void;
onBack: () => void;
onDone: () => void;
initialSelectedBuckets?: string[];
}) {
const queryClient = useQueryClient();
const [selectedBuckets, setSelectedBuckets] = useState<Set<string>>(
new Set(),
);
const hasAppliedInitial = useRef(false);
const [ingestSettings, setIngestSettings] = useSessionIngestSettings();
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
const [browseDialogBucket, setBrowseDialogBucket] = useState<string | null>(
null,
);

useEffect(() => {
if (
!hasAppliedInitial.current &&
buckets?.length &&
initialSelectedBuckets?.length
) {
hasAppliedInitial.current = true;
if (selectedBuckets.size === 0) {
const valid = initialSelectedBuckets.filter((name) =>
buckets.some((b) => b.name === name),
);
if (valid.length) {
setSelectedBuckets(new Set(valid));
}
}
}
}, [buckets, initialSelectedBuckets]); // eslint-disable-line react-hooks/exhaustive-deps

const invalidate = () => {
queryClient.invalidateQueries({ queryKey: invalidateQueryKey });
};
Expand Down Expand Up @@ -318,6 +341,7 @@ function IBMCOSBucketView({
isLoading,
refetch,
} = useIBMCOSBucketStatusQuery(connector.connectionId, { enabled: true });
const { data: defaults } = useIBMCOSDefaultsQuery({ enabled: true });
return (
<BucketView
connector={connector}
Expand All @@ -329,6 +353,11 @@ function IBMCOSBucketView({
addTask={addTask}
onBack={onBack}
onDone={onDone}
initialSelectedBuckets={
defaults?.connection_id === connector.connectionId
? defaults?.bucket_names
: undefined
}
/>
);
}
Expand Down Expand Up @@ -356,6 +385,7 @@ function S3BucketView({
error: bucketsError,
refetch,
} = useS3BucketStatusQuery(connector.connectionId, { enabled: true });
const { data: defaults } = useS3DefaultsQuery({ enabled: true });
return (
<BucketView
connector={connector}
Expand All @@ -368,6 +398,11 @@ function S3BucketView({
addTask={addTask}
onBack={onBack}
onDone={onDone}
initialSelectedBuckets={
defaults?.connection_id === connector.connectionId
? defaults?.bucket_names
: undefined
}
/>
);
}
Expand Down
Loading