-
Notifications
You must be signed in to change notification settings - Fork 1
fix: correctly select and use user locale and application title text [DHIS2-8525] [DHIS2-8723] #399
Conversation
src/HeaderBar/Apps.js
Outdated
@@ -66,7 +69,7 @@ function Search({ value, onChange, onIconClick, contextPath }) { | |||
</span> | |||
|
|||
<span> | |||
<a href={`${contextPath}/dhis-web-menu-management`}> | |||
<a href={`${baseUrl}dhis-web-menu-management`}> |
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 would prefer to copy the joinPath
helper for now (until exposed by app-runtime).
This seems too brittle and could break instances.
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.
Agreed, will do
const baseUrl = useConfig().baseUrl | ||
return ( | ||
<a | ||
href={`${baseUrl}/dhis-web-user-profile/#/profile`} |
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.
Contrary to the Apps.js
, this one adds a slash. I think I've seen it in other files also.
We could just copye the joinPath
as mentioned above
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.
Good catch, this is incorrect
import '../common/index.js' | ||
import { Then } from 'cypress-cucumber-preprocessor/steps' | ||
import { baseUrl } from '../common/index.js' |
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 guess the import in line 3 should be enough and we can remove the one in line 1
## [2.1.1-alpha.1](v2.1.0...v2.1.1-alpha.1) (2020-05-15) ### Bug Fixes * correctly select and use user locale and application title text [DHIS2-8525] [DHIS2-8723] ([#399](#399)) ([a7cb026](a7cb026))
🎉 This PR is included in version 2.1.1-alpha.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
…[DHIS2-8525] [DHIS2-8723] (#399)
## [2.1.1-alpha.1](v2.1.0...v2.1.1-alpha.1) (2020-05-15) ### Bug Fixes * correctly select and use user locale and application title text [DHIS2-8525] [DHIS2-8723] ([#399](#399)) ([a7cb026](a7cb026))
…[DHIS2-8525] [DHIS2-8723] (#399)
This does a few things, all related to the two localization issues with the headerbar (DHIS2-8525 and DHIS2-8723
i18n.t
calls so that they are called at render time, not at module initializationsystemInfo
since it loads a bunch of security-sensitive information. It was only used for (a)contextPath
(which we can retrieve statically from the config context in app-runtime) and (b)systemName
which is untranslated and replaced withapplicationTitle
belowsystemSettings/applicationTitle
which is the user-localized title for display inheaderBar
useEffect
touseMemo
, to avoid needing a duplicate render (useEffect runs after first paint) and to avoid mutating the API response data (it should be treated as immutable)contextPath
throughout all components, instead loading the baseUrl from the config context in app-runtime wherever the baseUrl is actually needed. Note that this is slightly brittle as-written since it makes the assumption thatbaseUrl
ends in a/
character. We should probably change this tojoinPath(baseUrl, relativePath)
(a utility function we have in app-runtime but don't expose)default
, even if we end up with a different singleton than the app uses (app-shell does this, so it should be a no-op in that environment).I'd like to merge this to the
alpha
branch if it looks decent for testing in several apps, to avoid possible local dependency link issues.