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

feat: [DHIS2-17770] Org unit contextualization in self contained widgets #3720

Conversation

henrikmv
Copy link
Contributor

@henrikmv henrikmv commented Jul 19, 2024

DHIS2-17770

  • Adds a dotted line under the organization unit name where a tooltip is shown when hovering.
  • Updates cache and all functions in OrgUnitName.js to include ancestors.
  • New structure for cache, example:
    DiszpKrYNg8: Object { displayName: "Ngelehun CHC", ancestor: "YuQRtpLP10I" }.
    ancestor contains the id to the parent orgUnit in the orgUnit tree. With this structure for the cache, we are storing information about an orgUnit only once.
  • use recursion to build the ancestor when cached

Please see the comment on Jira for more information about the cache structure.

Note: Wrong issue number on branch. The correct number is DHIS2-17770

@henrikmv henrikmv force-pushed the hv/feat/DHIS2-17771_OrgUnitContextualizationInSelfContainedWidgets branch from 5f24da6 to 25a3c5a Compare July 19, 2024 16:00
…_OrgUnitContextualizationInSelfContainedWidgets
@henrikmv henrikmv marked this pull request as ready for review July 28, 2024 16:31
@henrikmv henrikmv requested a review from a team as a code owner July 28, 2024 16:31
Copy link
Contributor

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

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

Hey @henrikmv,
I didn't see any changes to the organizational unit in the stages&events widget as mentioned in the Jira ticket. The places where I saw the tooltip with the ancestors were the enrollment and profile widget. Did the scope of the feature change?
I also added a few comments and questions throughout the code.
Thanks!

interpolation: { escapeValue: false },
})}
<span>
{i18n.t('Started at ')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to keep the orgUnitName as part of the translatable string? In other languages, the order of the words can be different than in English. One suggestion is to pass an optional prop to TooltipOrgUnit and to display it instead of {orgUnitName}. Something like this:

<TooltipOrgUnit
    orgUnitName={orgUnitName}
    ancestors={ancestors}
    tooltip={i18n.t('Started at {{orgUnitName}}', {
            orgUnitName,
             interpolation: { escapeValue: false },
     })}
 />

// inside TooltipOrgUnit.component.js

 <Tooltip content={orgUnitNameFullPath} openDelay={400}>
     <span style={{ textDecoration: 'underline dotted' }}>
            {tooltip ? tooltip : orgUnitName}
     </span>
</Tooltip>

This change will apply the dotted line to the whole label. WYDT? Thanks!

Copy link
Member

@JoakimSM JoakimSM Aug 30, 2024

Choose a reason for hiding this comment

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

Talked to Henrik about this one. I agree it's important to be conscious about this problem, but in this case I suggest we simplify as you could really think of the string as two columns ("started at" and then the org unit name).

EDIT: Let's add a colon to be 100% sure (Started at: Ngelehun CHC)

src/core_modules/capture-ui/FlatList/FlatList.component.js Outdated Show resolved Hide resolved
@henrikmv henrikmv changed the title feat: [DHIS2-17771] Org unit context in Stages and Events widget feat: [DHIS2-17770] Org unit contextualization in self contained widgets Jul 29, 2024
@henrikmv henrikmv changed the title feat: [DHIS2-17770] Org unit contextualization in self contained widgets feat: [DHIS2-17771] Org unit contextualization in self contained widgets Jul 30, 2024
@henrikmv henrikmv changed the title feat: [DHIS2-17771] Org unit contextualization in self contained widgets feat: [DHIS2-17770] Org unit contextualization in self contained widgets Jul 30, 2024
@henrikmv henrikmv requested review from simonadomnisoru and removed request for simonadomnisoru July 31, 2024 12:27
@henrikmv henrikmv marked this pull request as draft July 31, 2024 12:52
@henrikmv henrikmv added e2e record Apply this label to a pull request to trigger recording of E2E tests on Cypress Cloud e2e-tests and removed e2e-tests e2e record Apply this label to a pull request to trigger recording of E2E tests on Cypress Cloud labels Jul 31, 2024
@henrikmv henrikmv added e2e-tests and removed e2e-tests e2e record Apply this label to a pull request to trigger recording of E2E tests on Cypress Cloud labels Aug 2, 2024
@henrikmv henrikmv marked this pull request as ready for review August 26, 2024 10:54
Copy link
Contributor

@superskip superskip left a comment

Choose a reason for hiding this comment

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

Looks very close to done now 👍

@henrikmv henrikmv requested a review from superskip September 2, 2024 11:51
Copy link
Contributor

@superskip superskip left a comment

Choose a reason for hiding this comment

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

Great work! 🎉

@simonadomnisoru simonadomnisoru self-requested a review September 10, 2024 12:15
Copy link
Contributor

@eirikhaugstulen eirikhaugstulen left a comment

Choose a reason for hiding this comment

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

Well done, @henrikmv! 🎉

Copy link

@geethaalwan geethaalwan left a comment

Choose a reason for hiding this comment

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

Tested successfully on 2.42,2.41.2,2.40.6,2.39.7 versions

…/feat/DHIS2-17771_OrgUnitContextualizationInSelfContainedWidgets
@henrikmv henrikmv merged commit 562b03a into master Sep 24, 2024
39 checks passed
@henrikmv henrikmv deleted the hv/feat/DHIS2-17771_OrgUnitContextualizationInSelfContainedWidgets branch September 24, 2024 07:51
dhis2-bot added a commit that referenced this pull request Sep 24, 2024
# [101.5.0](v101.4.1...v101.5.0) (2024-09-24)

### Features

* [DHIS2-17770] Org unit contextualization in self contained widgets ([#3720](#3720)) ([562b03a](562b03a))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 101.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants