-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LF-4691: UI to connect to ensemble #3675
Merged
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
e63c9ef
LF-4691 Add translations
SayakaOno 1eec16d
LF-4691 Add esci logo
SayakaOno bd8b92e
LF-4691 Add color codes to colors.scss
SayakaOno 8136adb
LF-4691 Add Partners component
SayakaOno 56207c1
LF-4691 Add Partners container
SayakaOno c105c85
LF-4691 Navigate to sensor connection flow on sensor menu click
SayakaOno d3cfdbc
LF-4691 Replace hard-coded post sensor URL with constant in Routes
SayakaOno a8b47be
LF-4691 Add showPreviousButton prop to WithStepperProgressBar
SayakaOno 8889eef
LF-4691 Style organization ID input properly
SayakaOno 25c69e4
LF-4691 Use Partners component in PostSensor
SayakaOno 07b5e28
LF-4691 Impelment validation for ESCI organisation ID
SayakaOno f67034d
LF-4691 Update ContextForm to accept formMode prop
SayakaOno d5ef4a6
LF-4691 Add formMode prop to ContextForm in PostSensor
SayakaOno 6c9cb8f
LF-4691 Correct organisation spelling
SayakaOno 7a97ea8
LF-4691 Adjust property names
SayakaOno 9e9864e
LF-4691 FarmAddon API setup for RTK query
SayakaOno 49572a2
LF-4691 Add/modify translations
SayakaOno 66d9fdc
LF-4691 Integrate API POST /farm_addon
SayakaOno 2e1932c
LF-4691 Export useLazyGetSensorsQuery from apiSlice
SayakaOno c1a33bd
LF-4691 'LazyGetSensors' in PostSensor onSave
SayakaOno 14897dd
LF-4691 Add type for Add sensor form
SayakaOno 38de118
LF-4691 Use constants and types for Add sensors form
SayakaOno 728c6bf
LF-4691 Remove background-color: white from formWrapper
SayakaOno 7eedc50
LF-4691 Extract CSSLength type
SayakaOno aa18bc5
LF-4691 Fix translation
SayakaOno 5536d2a
LF-4691 Update routes and PostSensor to send isCompactSideMenu
SayakaOno 3ab9969
LF-4691 Make Loading component fixed relative to viewport
SayakaOno 33aa699
LF-4691 Send isCompactSideMenu prop to Loading in WithStepperProgressBar
SayakaOno 108d707
LF-4691 Delete unused files and code for bulk sensor upload
SayakaOno c53bdf2
LF-4691 Add style for mobile view
SayakaOno ba93820
LF-4691 Cleanup
SayakaOno b1d1182
Revert "LF-4691 Delete unused files and code for bulk sensor upload"
SayakaOno 1e4695d
LF-4691 Add constant for ESCI partner ID
SayakaOno b6aba3a
LF-4691 Update WithStepperProgressBar
SayakaOno a559b2f
LF-4691 Add sensors page URL
SayakaOno c6be0fb
LF-4691 Adjust PostSensor
SayakaOno 9e49b22
LF-4691 Update PARTNERS constant
SayakaOno 8bf9d80
LF-4691 Fix capitalization in 'Ensemble Scientific'
SayakaOno 18a70d5
Merge branch 'integration' into LF-4691/UI_to_connect_to_Ensemble
SayakaOno 76856ed
LF-4691 Add classNames prop to PageTitle
SayakaOno 4df2984
LF-4691 Set overflow-y to auto in FixedHeaderContainer
SayakaOno 43754f2
LF-4691 Fix CSS for padding
SayakaOno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
LF-4691 Impelment validation for ESCI organisation ID
- Loading branch information
commit 07b5e2876f5b8b486e56a32c8014974135708481
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,8 @@ | |
|
||
import { useFormContext } from 'react-hook-form'; | ||
import { useTranslation } from 'react-i18next'; | ||
import Input from '../../Form/Input'; | ||
import { validate as uuidValidate } from 'uuid'; | ||
import Input, { getInputErrors } from '../../Form/Input'; | ||
import InputBaseLabel from '../../Form/InputBase/InputBaseLabel'; | ||
import { Main } from '../../Typography'; | ||
import EsciLogo from '../../../assets/images/partners/esci_logo.png'; | ||
|
@@ -27,6 +28,10 @@ type PartnersProps = { | |
}; | ||
}; | ||
|
||
const validateUuidFormat = (value: string, errorMessage: string) => { | ||
return uuidValidate(value) || errorMessage; | ||
}; | ||
|
||
const PARTNERS = [{ name: 'Ensemble scientific', url: 'www.esci.io', logoPath: EsciLogo }]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this go in new constants file with the partner id in this object? in |
||
|
||
const Partner = ({ name, url, logoPath }: { name: string; url: string; logoPath: string }) => { | ||
|
@@ -47,7 +52,10 @@ const Partner = ({ name, url, logoPath }: { name: string; url: string; logoPath: | |
|
||
const Partners = ({ hasActiveConnection }: PartnersProps) => { | ||
const { t } = useTranslation(); | ||
const { register } = useFormContext(); | ||
const { | ||
register, | ||
formState: { errors }, | ||
} = useFormContext(); | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
|
@@ -66,7 +74,12 @@ const Partners = ({ hasActiveConnection }: PartnersProps) => { | |
<Input | ||
placeholder={t('SENSOR.ESCI.ORGANIZATION_ID')} | ||
type="text" | ||
hookFormRegister={register('partner.organization_uuid', { required: true })} | ||
hookFormRegister={register('partner.organization_uuid', { | ||
required: true, | ||
validate: (value) => | ||
validateUuidFormat(value, t('SENSOR.ESCI.ORGANIZATION_ID_ERROR')), | ||
})} | ||
errors={getInputErrors(errors, 'partner.organization_uuid')} | ||
/> | ||
</div> | ||
</div> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need 'Ensemble scientific' to be translated? I would find it strange, but considering Hannah's name was translated, should this be too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. Companies normally decide their own brand translation in other languages, but maybe for phonetic translations? If we do maybe we should change name to translation key in backend?