Skip to content

Commit 5d62c66

Browse files
committed
minor: fix spacing before and after the SlugPreviewFormField
1 parent 939727a commit 5d62c66

File tree

9 files changed

+73
-28
lines changed

9 files changed

+73
-28
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,6 @@ export function DataConnectorMount({
400400
<div className="invalid-feedback">
401401
{errors.name?.message?.toString()}
402402
</div>
403-
</div>
404-
405-
<div className="mb-3">
406403
<SlugPreviewFormField
407404
compact={true}
408405
control={control}

client/src/features/groupsV2/new/GroupNew.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,13 @@ function GroupV2CreationDetails() {
174174
>
175175
<FormGroup className="d-inline" disabled={result.isLoading}>
176176
<div className={cx("d-flex", "flex-column", "gap-3")}>
177-
<div>
178-
<div className="mb-1">
179-
<NameFormField
180-
control={control}
181-
entityName="group"
182-
errors={errors}
183-
name="name"
184-
/>
185-
</div>
177+
<div className="mb-1">
178+
<NameFormField
179+
control={control}
180+
entityName="group"
181+
errors={errors}
182+
name="name"
183+
/>
186184

187185
<SlugPreviewFormField
188186
compact={true}

client/src/features/project/components/projectMigration/ProjectMigrationFormInputs.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ export default function ProjectMigrationFormInputs({
112112
errors={errors}
113113
name="namespace"
114114
/>
115-
</div>
116-
<div>
117115
<SlugPreviewFormField
118116
compact={true}
119117
control={control}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.slugPreviewGroup {
2+
margin-top: 1px;
3+
}
4+
5+
.slugPreviewButton {
6+
margin-top: -1px;
7+
}

client/src/features/projectsV2/fields/SlugPreviewFormField.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import AppContext from "../../../utils/context/appContext.ts";
2626
import { SlugPreviewFormFieldProps } from "./formField.types.ts";
2727
import SlugFormField from "./SlugFormField";
2828

29+
import styles from "./SlugPreviewFormField.module.scss";
30+
2931
export default function SlugPreviewFormField<T extends FieldValues>({
3032
compact = false,
3133
control,
@@ -53,7 +55,13 @@ export default function SlugPreviewFormField<T extends FieldValues>({
5355
</span>
5456
</FormText>
5557
<button
56-
className={cx("btn", "btn-link", "p-0", "mb-1", "text-decoration-none")}
58+
className={cx(
59+
"btn",
60+
"btn-link",
61+
"p-0",
62+
"text-decoration-none",
63+
styles.slugPreviewButton
64+
)}
5765
data-cy={`${entityName}-slug-toggle`}
5866
onClick={toggleCollapse}
5967
type="button"
@@ -65,9 +73,8 @@ export default function SlugPreviewFormField<T extends FieldValues>({
6573
);
6674

6775
return (
68-
<div>
76+
<div className={cx(styles.slugPreviewGroup)}>
6977
{slugPreview}
70-
7178
{isCollapseOpen && (
7279
<>
7380
<div

client/src/features/projectsV2/new/ProjectV2New.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,15 @@ function ProjectV2CreationDetails() {
199199
formId={formId}
200200
name="name"
201201
/>
202-
<div>
203-
<div className="mb-1">
204-
<ProjectNamespaceFormField
205-
control={control}
206-
ensureNamespace={defaultNamespace}
207-
entityName={`${formId}-project`}
208-
errors={errors}
209-
name="namespace"
210-
/>
211-
</div>
212202

203+
<div className="mb-1">
204+
<ProjectNamespaceFormField
205+
control={control}
206+
ensureNamespace={defaultNamespace}
207+
entityName={`${formId}-project`}
208+
errors={errors}
209+
name="namespace"
210+
/>
213211
<SlugPreviewFormField
214212
compact={true}
215213
control={control}

tests/cypress/e2e/projectV2setup.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ describe("Set up data connectors", () => {
207207
namespace: "user1-uuid/test-2-v2-project",
208208
visibility: "public",
209209
})
210-
.postDataConnectorProjectLink({ dataConnectorId: "ULID-5" });
210+
.postDataConnectorProjectLink({ dataConnectorId: "ULID-5" })
211+
.readProjectV2Namespace();
211212
cy.visit("/p/user1-uuid/test-2-v2-project");
212213
cy.wait("@readProjectV2WithoutDocumentation");
213214
cy.wait("@listProjectDataConnectors");
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"id": "namespace-id",
3+
"name": "test-2-v2-project",
4+
"slug": "test-2-v2-project",
5+
"path": "user1-uuid/test-2-v2-project",
6+
"creation_date": "2023-11-15T09:55:59Z",
7+
"created_by": "user-id",
8+
"namespace_kind": "project"
9+
}

tests/cypress/support/renkulab-fixtures/namespaceV2.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ interface ListManyNamespacesArgs extends NameOnlyFixture {
5353
numberOfNamespaces?: number;
5454
}
5555

56+
interface ProjectV2Args extends SimpleFixture {
57+
projectNamespace?: string;
58+
projectSlug?: string;
59+
}
60+
5661
interface UserNamespaceV2Args extends SimpleFixture {
5762
username?: string;
5863
}
@@ -308,6 +313,31 @@ export function NamespaceV2<T extends FixturesConstructor>(Parent: T) {
308313
return this;
309314
}
310315

316+
readProjectV2Namespace(args?: ProjectV2Args) {
317+
const {
318+
fixture = "projectV2/read-projectV2-namespace.json",
319+
name = "readProjectV2Namespace",
320+
projectNamespace = "user1-uuid",
321+
projectSlug = "test-2-v2-project",
322+
} = args ?? {};
323+
cy.fixture(fixture).then((namespace_) => {
324+
const namespace = {
325+
...namespace_,
326+
name: projectSlug,
327+
slug: projectSlug,
328+
path: `${projectNamespace}/${projectSlug}`,
329+
};
330+
cy.intercept(
331+
"GET",
332+
`/api/data/namespaces/${projectNamespace}/${projectSlug}`,
333+
{
334+
body: namespace,
335+
}
336+
).as(name);
337+
});
338+
return this;
339+
}
340+
311341
readUserV2Namespace(args?: UserNamespaceV2Args) {
312342
const {
313343
fixture = "namespaceV2/namespaceV2-user1.json",

0 commit comments

Comments
 (0)