-
Notifications
You must be signed in to change notification settings - Fork 77
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
OOB translations in admin UI #4718
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Passing run #6736 ↗︎
Details:
Review all test suite changes for PR #4718 ↗︎ |
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.
Couple comments, but not a full review since I had to run!
clients/admin-ui/src/features/privacy-experience/PrivacyExperienceTranslationForm.tsx
Outdated
Show resolved
Hide resolved
clients/admin-ui/src/features/privacy-experience/PrivacyExperienceTranslationForm.tsx
Show resolved
Hide resolved
clients/admin-ui/src/features/privacy-experience/ConfigurePrivacyExperience.tsx
Outdated
Show resolved
Hide resolved
clients/admin-ui/src/features/privacy-experience/ConfigurePrivacyExperience.tsx
Outdated
Show resolved
Hide resolved
@@ -136,13 +138,36 @@ const ConfigurePrivacyExperience = ({ | |||
TranslationWithLanguageName | undefined | |||
>(undefined); | |||
|
|||
const handleNewTranslationSelected = (translation: ExperienceTranslation) => { | |||
const [translationIsOOB, setTranslationIsOOB] = useState<boolean>(false); |
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.
Can you put the translationIsOOB
into the same state for setTranslateToEdit(...)
to me...? This feels like tricky state to manage independently.
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.
@NevilleS That was the original approach that I tried taking, where I modified the type of translationToEdit
to bundle an isOOB
bool with the translation, but it ended up causing some headaches.
We want to only consider an OOB translation to be an OOB translation (for the purposes of submit behavior and showing the notice) when it's being created for the first time. So when we're setting translationToEdit
, we need to be able to tell whether we're creating a new translation and populating with OOB values or editing a saved translation that happens to have all the same values as an OOB translation.
This means we'd need to be able to pass that isOOB
value on creating a new translation, which is where the main problem is: handleCreateNewTranslation
is ultimately called from the translations' ScrollableList component, which is typed to expect specifically an ExperienceTranslation and won't like extra fields. It would have required a lot of modifications to the ScrollableList to allow it to handle other types and conditionally pass optional properties, so it was much cleaner to implement this way.
Maybe a better variable name would help here to communicate that this state isn't really a property of the translation itself, but rather of what the user is currently doing. Do you think something like isUsingOOBValues
would be better?
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.
yes that rename makes sense to me
@@ -160,12 +185,14 @@ const ConfigurePrivacyExperience = ({ | |||
{translationToEdit ? ( | |||
<PrivacyExperienceTranslationForm | |||
translation={translationToEdit} | |||
onReturnToMainForm={() => setTranslationToEdit(undefined)} | |||
isOOB={translationIsOOB} |
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.
note: if you include the "isOOB" state in the translation
object, this'll be easier to manage 😄
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.
The rename is a nice to have. Please add a followup jira ticket to add tests!
Closes PROD-1801
Description Of Changes
When adding a new translation to an existing experience config or privacy notice that matches a template, out-of-the-box translations are now supplied to the user when available and treated as the default for the privacy notice and experience translation forms.
Code Changes
/available-translations
endpointsSteps to Confirm
The endpoints require the experience or notice to be based on a template, and in the test environment (at least for me) they're all pre-stocked with the OOB translations, but you can get equivalent behavior by just deleting a translation and then re-adding it.
Running fidesplus backend with the following in
.fides/fides.toml
:Navigate to
/consent/privacy-experience
:Navigate to
/consent/privacy-notice
:Pre-Merge Checklist
CHANGELOG.md