Skip to content

Commit 92d1777

Browse files
committed
minor: consistantly show field error message before help
1 parent 5c4e8c4 commit 92d1777

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

client/src/features/ProjectPageV2/ProjectPageContent/DataConnectors/ProjectConnectDataConnectorsModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,6 @@ function ProjectLinkDataConnectorBodyAndFooter({
372372
pattern: /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+){0,2}$/,
373373
}}
374374
/>
375-
<div className="form-text">
376-
Paste a data connector identifier. You can find it on the the data
377-
connector&apos;s side panel
378-
</div>
379375
<div className="invalid-feedback">
380376
{errors.dataConnectorIdentifier == null
381377
? undefined
@@ -384,6 +380,10 @@ function ProjectLinkDataConnectorBodyAndFooter({
384380
? errors.dataConnectorIdentifier.message
385381
: "Please provide an identifier for the data connector"}
386382
</div>
383+
<div className="form-text">
384+
Paste a data connector identifier. You can find it on the the data
385+
connector&apos;s side panel
386+
</div>
387387
</div>
388388
{error != null && <RtkOrNotebooksError error={error} />}
389389
</ModalBody>
@@ -530,10 +530,10 @@ function ProjectDoiDataConnectorBodyAndFooter({
530530
required: true,
531531
}}
532532
/>
533+
<div className="invalid-feedback">Please provide a valid DOI</div>
533534
<div className="form-text">
534535
Paste a DOI, e.g. <code>10.5281/zenodo.3831980</code>.
535536
</div>
536-
<div className="invalid-feedback">Please provide a valid DOI</div>
537537
</div>
538538
{error !== null && <RtkOrNotebooksError error={error} />}
539539
</ModalBody>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ export default function DescriptionFormField<T extends FieldValues>({
5050
)}
5151
rules={{ maxLength: 500, required: false }}
5252
/>
53+
<div className="invalid-feedback">Please provide a description</div>
5354
<FormText id={`${entityName}DescriptionHelp`} className="input-hint">
5455
A brief (at most 500 character) description of the {entityName}.
5556
</FormText>
56-
<div className="invalid-feedback">Please provide a description</div>
5757
</div>
5858
);
5959
}

client/src/features/sessionsV2/components/SessionForm/AdvancedSettingsFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ function JsonField<T extends FieldValues>({
249249
/>
250250
)}
251251
/>
252-
<FormText tag="div">{helpText}</FormText>
253252
{errors?.[name] && (
254253
<div className="invalid-feedback mt-0 d-block">
255254
{errors[name]?.message?.toString()}
256255
</div>
257256
)}
257+
<FormText tag="div">{helpText}</FormText>
258258
</>
259259
);
260260
}

client/src/features/sessionsV2/components/SessionForm/LauncherDetailsFields.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,14 @@ export function LauncherDetailsFields({ control }: LauncherDetailsFieldsProps) {
184184
Gigabytes
185185
</UncontrolledTooltip>
186186
</InputGroup>
187-
<FormText>
188-
Default: {watchCurrentSessionClass.default_storage} GB, max:{" "}
189-
{watchCurrentSessionClass.max_storage} GB
190-
</FormText>
191187
<div className="invalid-feedback">
192188
{error?.message ||
193189
"Please provide a valid value for disk storage."}
194190
</div>
191+
<FormText>
192+
Default: {watchCurrentSessionClass.default_storage} GB, max:{" "}
193+
{watchCurrentSessionClass.max_storage} GB
194+
</FormText>
195195
</>
196196
)}
197197
rules={{

client/src/features/sessionsV2/components/SessionModals/ModifyResourcesLauncher.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ export function ModifyResourcesLauncherModal({
236236
Gigabytes
237237
</UncontrolledTooltip>
238238
</InputGroup>
239-
<FormText>
240-
Default: {watchCurrentSessionClass.default_storage} GB, max:{" "}
241-
{watchCurrentSessionClass.max_storage} GB
242-
</FormText>
243239
<div className="invalid-feedback">
244240
{error?.message ||
245241
"Please provide a valid value for disk storage."}
246242
</div>
243+
<FormText>
244+
Default: {watchCurrentSessionClass.default_storage} GB, max:{" "}
245+
{watchCurrentSessionClass.max_storage} GB
246+
</FormText>
247247
</>
248248
)}
249249
rules={{

client/src/features/sessionsV2/components/SessionModals/SelectResourceClass.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ export function SelectResourceClassModal({
219219
Gigabytes
220220
</UncontrolledTooltip>
221221
</InputGroup>
222-
<FormText>
223-
Default: {watchCurrentSessionClass.default_storage} GB, max:{" "}
224-
{watchCurrentSessionClass.max_storage} GB
225-
</FormText>
226222
<div className="invalid-feedback">
227223
{error?.message ||
228224
"Please provide a valid value for disk storage."}
229225
</div>
226+
<FormText>
227+
Default: {watchCurrentSessionClass.default_storage} GB, max:{" "}
228+
{watchCurrentSessionClass.max_storage} GB
229+
</FormText>
230230
</>
231231
)}
232232
rules={{

0 commit comments

Comments
 (0)