Skip to content

Commit 024ce44

Browse files
committed
split form when edit data connector in two options, one to edit mount properties and the other to edit the connection info
1 parent 3c9b093 commit 024ce44

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

client/src/features/dataConnectorsV2/components/DataConnectorActions.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ function DataConnectorActionsInner({
367367
toggleView,
368368
}: DataConnectorActionsProps) {
369369
const { id: dataConnectorId } = dataConnector;
370+
const [initialStep, setInitialStep] = useState(2);
370371
const { permissions } = useDataConnectorPermissions({ dataConnectorId });
371372

372373
const { project_id: projectId } = dataConnectorLink ?? {};
@@ -409,6 +410,11 @@ function DataConnectorActionsInner({
409410
setIsDeleteOpen((open) => !open);
410411
}, []);
411412
const toggleEdit = useCallback(() => {
413+
setInitialStep(3);
414+
setIsEditOpen((open) => !open);
415+
}, []);
416+
const toggleEditConnection = useCallback(() => {
417+
setInitialStep(2);
412418
setIsEditOpen((open) => !open);
413419
}, []);
414420
const toggleUnlink = useCallback(() => {
@@ -424,7 +430,17 @@ function DataConnectorActionsInner({
424430
content: (
425431
<>
426432
<Pencil className={cx("bi", "me-1")} />
427-
Edit
433+
Edit properties
434+
</>
435+
),
436+
},
437+
{
438+
key: "data-connector-edit-connection",
439+
onClick: toggleEditConnection,
440+
content: (
441+
<>
442+
<Pencil className={cx("bi", "me-1")} />
443+
Edit Connection Information
428444
</>
429445
),
430446
},
@@ -519,6 +535,7 @@ function DataConnectorActionsInner({
519535
isOpen={isEditOpen}
520536
namespace={dataConnector.namespace}
521537
toggle={toggleEdit}
538+
initialStep={initialStep}
522539
/>
523540
<DataConnectorCredentialsModal
524541
dataConnector={dataConnector}

client/src/features/dataConnectorsV2/components/DataConnectorModal/DataConnectorModalBody.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ export default function DataConnectorModalBody({
7575
if (schemata.length < 1) return <Loader />;
7676
return (
7777
<>
78-
{!flatDataConnector.dataConnectorId && (
79-
<p className="text-body-secondary">
80-
Add published datasets from data repositories for use in your project.
81-
Or, connect to cloud storage to read and write custom data.
82-
</p>
83-
)}
8478
<AddOrEditDataConnector
8579
storageSecrets={storageSecrets}
8680
project={project}
@@ -127,6 +121,12 @@ function AddOrEditDataConnector({
127121
if (CloudStorageContentByStep)
128122
return (
129123
<>
124+
{!flatDataConnector.dataConnectorId && cloudStorageState.step <= 1 && (
125+
<p className="text-body-secondary">
126+
Add published datasets from data repositories for use in your
127+
project. Or, connect to cloud storage to read and write custom data.
128+
</p>
129+
)}
130130
<div className={cx("d-flex", "justify-content-end")}>
131131
<AddStorageAdvancedToggle
132132
state={cloudStorageState}
@@ -290,7 +290,7 @@ export function DataConnectorMount() {
290290

291291
return (
292292
<form className="form-rk-green" data-cy="data-connector-edit-mount">
293-
<h5>Final details</h5>
293+
<h5>Mount Properties</h5>
294294
<p>We need a few more details to mount your data properly.</p>
295295

296296
<div className="mb-3">

client/src/features/dataConnectorsV2/components/DataConnectorModal/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export function DataConnectorModalBodyAndFooter({
5353
namespace,
5454
project,
5555
toggle,
56+
initialStep,
5657
}: DataConnectorModalProps) {
5758
const dataConnectorId = dataConnector?.id ?? null;
5859
// Fetch available schema when users open the modal
@@ -80,7 +81,7 @@ export function DataConnectorModalBodyAndFooter({
8081
dataConnector != null
8182
? {
8283
...EMPTY_CLOUD_STORAGE_STATE,
83-
step: 2,
84+
step: initialStep ?? 2,
8485
completedSteps: CLOUD_STORAGE_TOTAL_STEPS,
8586
}
8687
: EMPTY_CLOUD_STORAGE_STATE;
@@ -91,7 +92,7 @@ export function DataConnectorModalBodyAndFooter({
9192
schemata: schemata ?? [],
9293
})
9394
);
94-
}, [dataConnector, dispatch, namespace, project, schemata]);
95+
}, [dataConnector, dispatch, namespace, project, schemata, initialStep]);
9596

9697
// Visual elements
9798
return (
@@ -145,13 +146,15 @@ interface DataConnectorModalProps {
145146
namespace?: string;
146147
project?: Project;
147148
toggle: () => void;
149+
initialStep?: number;
148150
}
149151
export default function DataConnectorModal({
150152
dataConnector = null,
151153
isOpen,
152154
namespace,
153155
project,
154156
toggle: originalToggle,
157+
initialStep,
155158
}: DataConnectorModalProps) {
156159
const dataConnectorId = dataConnector?.id ?? null;
157160
const { permissions, isLoading: isLoadingPermissions } =
@@ -191,6 +194,7 @@ export default function DataConnectorModal({
191194
namespace,
192195
project,
193196
toggle,
197+
initialStep,
194198
}}
195199
/>
196200
}

client/src/features/project/components/cloudStorage/AddOrEditCloudStorage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ export function AddStorageOptions({
10081008

10091009
return (
10101010
<form className="form-rk-green" data-cy="cloud-storage-edit-options">
1011-
<h5>Options</h5>
1011+
<h5>Connection information</h5>
10121012
<p>
10131013
Please fill in all the options required to connect to your storage. Mind
10141014
that the specific fields required depend on your storage configuration.

client/src/features/project/components/cloudStorage/AddStorageBreadcrumbNavbar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export default function AddStorageBreadcrumbNavbar({
4848
return (
4949
<BreadcrumbItem active={active} key={stepNumber}>
5050
{active ? (
51-
<>{mapStepToName[stepNumber]}</>
51+
<span className={active && "fw-bold"}>
52+
{mapStepToName[stepNumber]}
53+
</span>
5254
) : (
5355
<>
5456
<Button
@@ -80,6 +82,6 @@ export default function AddStorageBreadcrumbNavbar({
8082
const mapStepToName: { [key: number]: string } = {
8183
0: "Advanced configuration",
8284
1: "Storage",
83-
2: "Options",
85+
2: "Connection",
8486
3: "Mount",
8587
};

tests/cypress/e2e/projectV2setup.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ describe("Set up data connectors", () => {
360360
cy.getDataCy("project-data-controller-mode-link").click();
361361
cy.get("#data-connector-identifier").type("user1-uuid/example-storage");
362362
cy.getDataCy("link-data-connector-button").click();
363-
cy.wait("@getDataConnectorByNamespaceAndSlugNotFound");
364363
cy.contains(
365364
"Data connector with identifier 'user1-uuid/example-storage' does not exist or you do not have access to it."
366365
).should("be.visible");

0 commit comments

Comments
 (0)