Skip to content
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 42 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
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 Jan 27, 2025
1eec16d
LF-4691 Add esci logo
SayakaOno Jan 27, 2025
bd8b92e
LF-4691 Add color codes to colors.scss
SayakaOno Jan 27, 2025
8136adb
LF-4691 Add Partners component
SayakaOno Jan 28, 2025
56207c1
LF-4691 Add Partners container
SayakaOno Jan 28, 2025
c105c85
LF-4691 Navigate to sensor connection flow on sensor menu click
SayakaOno Jan 28, 2025
d3cfdbc
LF-4691 Replace hard-coded post sensor URL with constant in Routes
SayakaOno Jan 28, 2025
a8b47be
LF-4691 Add showPreviousButton prop to WithStepperProgressBar
SayakaOno Jan 28, 2025
8889eef
LF-4691 Style organization ID input properly
SayakaOno Jan 28, 2025
25c69e4
LF-4691 Use Partners component in PostSensor
SayakaOno Jan 29, 2025
07b5e28
LF-4691 Impelment validation for ESCI organisation ID
SayakaOno Jan 30, 2025
f67034d
LF-4691 Update ContextForm to accept formMode prop
SayakaOno Jan 30, 2025
d5ef4a6
LF-4691 Add formMode prop to ContextForm in PostSensor
SayakaOno Jan 30, 2025
6c9cb8f
LF-4691 Correct organisation spelling
SayakaOno Jan 30, 2025
7a97ea8
LF-4691 Adjust property names
SayakaOno Jan 30, 2025
9e9864e
LF-4691 FarmAddon API setup for RTK query
SayakaOno Jan 30, 2025
49572a2
LF-4691 Add/modify translations
SayakaOno Jan 30, 2025
66d9fdc
LF-4691 Integrate API POST /farm_addon
SayakaOno Jan 30, 2025
2e1932c
LF-4691 Export useLazyGetSensorsQuery from apiSlice
SayakaOno Jan 30, 2025
c1a33bd
LF-4691 'LazyGetSensors' in PostSensor onSave
SayakaOno Jan 30, 2025
14897dd
LF-4691 Add type for Add sensor form
SayakaOno Jan 30, 2025
38de118
LF-4691 Use constants and types for Add sensors form
SayakaOno Jan 30, 2025
728c6bf
LF-4691 Remove background-color: white from formWrapper
SayakaOno Jan 31, 2025
7eedc50
LF-4691 Extract CSSLength type
SayakaOno Jan 31, 2025
aa18bc5
LF-4691 Fix translation
SayakaOno Jan 31, 2025
5536d2a
LF-4691 Update routes and PostSensor to send isCompactSideMenu
SayakaOno Jan 31, 2025
3ab9969
LF-4691 Make Loading component fixed relative to viewport
SayakaOno Jan 31, 2025
33aa699
LF-4691 Send isCompactSideMenu prop to Loading in WithStepperProgressBar
SayakaOno Jan 31, 2025
108d707
LF-4691 Delete unused files and code for bulk sensor upload
SayakaOno Feb 3, 2025
c53bdf2
LF-4691 Add style for mobile view
SayakaOno Feb 3, 2025
ba93820
LF-4691 Cleanup
SayakaOno Feb 3, 2025
b1d1182
Revert "LF-4691 Delete unused files and code for bulk sensor upload"
SayakaOno Feb 4, 2025
1e4695d
LF-4691 Add constant for ESCI partner ID
SayakaOno Feb 4, 2025
b6aba3a
LF-4691 Update WithStepperProgressBar
SayakaOno Feb 5, 2025
a559b2f
LF-4691 Add sensors page URL
SayakaOno Feb 5, 2025
c6be0fb
LF-4691 Adjust PostSensor
SayakaOno Feb 5, 2025
9e49b22
LF-4691 Update PARTNERS constant
SayakaOno Feb 5, 2025
8bf9d80
LF-4691 Fix capitalization in 'Ensemble Scientific'
SayakaOno Feb 5, 2025
18a70d5
Merge branch 'integration' into LF-4691/UI_to_connect_to_Ensemble
SayakaOno Feb 5, 2025
76856ed
LF-4691 Add classNames prop to PageTitle
SayakaOno Feb 6, 2025
4df2984
LF-4691 Set overflow-y to auto in FixedHeaderContainer
SayakaOno Feb 6, 2025
43754f2
LF-4691 Fix CSS for padding
SayakaOno Feb 6, 2025
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
Prev Previous commit
Next Next commit
LF-4691 Impelment validation for ESCI organisation ID
  • Loading branch information
SayakaOno committed Feb 1, 2025
commit 07b5e2876f5b8b486e56a32c8014974135708481
3 changes: 2 additions & 1 deletion packages/webapp/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1807,7 +1807,8 @@
"CURRENT_SUPPORT": "We currently only support sensors from \"Ensemble scientific \"",
"ENSEMBLE_ESID": "Ensemble ESID",
"ENTER_ID": "Enter you ensemble scientific ID",
"ORGANIZATION_ID": "ESCI organisation ID"
"ORGANIZATION_ID": "ESCI organisation ID",
"ORGANIZATION_ID_ERROR": "Invalid Organisation ID"
},
"EXTERNAL_IDENTIFIER": "External identifier",
"HOURS_AGO": "{{time}} hour(s) ago",
Expand Down
19 changes: 16 additions & 3 deletions packages/webapp/src/components/Sensor/v2/Partners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 }];
Copy link
Collaborator Author

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?

Copy link
Collaborator

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The 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 addon_partner table "scientific" is capitalized : 'Ensemble Scientific'


const Partner = ({ name, url, logoPath }: { name: string; url: string; logoPath: string }) => {
Expand All @@ -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}>
Expand All @@ -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>
Expand Down