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

EES-5419 import new data set version #5152

Merged
merged 4 commits into from
Aug 20, 2024
Merged

EES-5419 import new data set version #5152

merged 4 commits into from
Aug 20, 2024

Conversation

amyb-hiveit
Copy link
Collaborator

Adds the ability to import a new API data set version once the mappings have been completed. The notification banner goes through the following stages:

Before import:
Screenshot 2024-08-15 163939

While importing:
Screenshot 2024-08-15 163101

On successful import - changes to green and has `role="alert":
Screenshot 2024-08-15 162408

Coming back to the page after import - back to blue and no alert as it's not the result of an action you've just taken:
Screenshot 2024-08-15 162327

After discussion with Cam I've removed the button to re-import the version and updated the wording.

(dataSet?.draftVersion?.status === 'Draft' ||
dataSet?.draftVersion?.status === 'Mapping');

const getImportBanner = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would split out a separate component to wrap up all these different banner states

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved this to its own component now.

return (
<NotificationBanner
fullWidthContent
heading="This new API data set version has been mapped and is ready to be imported"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would suggest changing this to 'Draft API data set version is ready to be finalised'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to 'finalise' consistently throughout now.

Comment on lines 45 to 47
const [importingStatus, setImportingStatus] = useState<
'importing' | 'imported' | undefined
>(undefined);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a bunch of things that involve 'importing', so it's maybe a bit confusing to reference it like this. Additionally, the backend references it as 'completing' a data set version.

Would suggest changing this to at least completingStatus, but as I mention a bit later, 'finalise' (i.e finalisingStatus) might also do.

return (
<NotificationBanner
fullWidthContent
heading="Import in progress..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be more explicit here about it relating to the draft version.

If we go with my other comment's suggestion to reference 'import' as 'finalise', then we could reword this to 'Finalising draft API data set version'. Otherwise, 'Importing draft API data set version' would do.

heading="Import in progress..."
title="Importing"
>
<p>This process can take a few minutes</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but would add a full stop.

notes and also preview this API data set version.
</p>
<p className="govuk-!-margin-bottom-6">
<strong>Please note</strong> you will not be able to make further
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to say 'Please note' - see GOV.UK content writing guidance on Tone.

remove this API data set version up until the release publication.
</p>
<p>
<strong>Please note</strong> these changes will not be made in the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to say 'Please note' - see GOV.UK content writing guidance on Tone.

Comment on lines 264 to 271
<ErrorSummary
errors={[
{
id: 'draft-version-summary',
message: 'Data set version import failed',
},
]}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to use error summary for this? We're not on a form, so it's a bit weird and inconsistent given we've already been using the notification banner for the other states.

Could just add an error variant of NotificationBanner?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to use NotificationBanner now.

@@ -396,10 +399,209 @@ describe('ReleaseApiDataSetDetailsPage', () => {
).not.toBeInTheDocument();
});

describe('importing', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we go with the 'finalise' terminology, would make any relevant text changes to this test suite here and below.

<NotificationBanner
fullWidthContent
heading="This new API data set version has now been mapped and imported ready for final publication"
role={importingStatus === 'imported' ? 'alert' : undefined}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure, but changing the alert role like this might not trigger the banner to be read out. Think the alert only works if the browser is aware of the element (with role="alert") before its text is updated. From the Mozilla docs:

As with all other live regions, alerts will only be announced when the content of the element with role="alert" is updated. Make sure that the element with the role is present in the page's markup first - this will "prime" the browser and screen reader to keep watching the element for changes. After this, any changes to the content will be announced. Do not try to dynamically add/generate an element with role="alert" that is already populated with the alert message you want announced - this generally does not lead to an announcement, as it is not a content change.

I'm not sure if the notification banner element ends up being unmounted from the DOM at any point, so the browser may not detect the element's contents change changing.

Probably worth testing with a screen reader.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work here because the role isn't changed dynamically - it only has the role alert when the import process has just finished (finalisingStatus === 'finalised'), when you visit the page again there isn't a finalisingStatus so the role isn't applied.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, will trust that you're right about this!

@amyb-hiveit amyb-hiveit merged commit 2b3c48c into dev Aug 20, 2024
7 checks passed
@amyb-hiveit amyb-hiveit deleted the EES-5419 branch August 20, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants