Skip to content

Commit

Permalink
Merge branch 'master' into feat-injected-base-url
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVandivier committed Mar 25, 2024
2 parents 3327b05 + e666f1f commit 9c13030
Show file tree
Hide file tree
Showing 35 changed files with 1,746 additions and 1,576 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/rebuild-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'dhis2: rebuild developer docs'

on:
push:
branches:
- master
paths:
- 'docs/**'
- 'CHANGELOG.md'

concurrency:
group: ${{ github.workflow}}-${{ github.ref }}
cancel-in-progress: true

jobs:
rebuild-docs:
runs-on: ubuntu-latest
steps:
- run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_DEVELOPER_DOCS_TOKEN }}
114 changes: 114 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,117 @@
# [11.0.0](https://github.com/dhis2/app-platform/compare/v10.5.0...v11.0.0) (2024-03-05)


### chore

* **deps:** update shell to ui@9 ([#824](https://github.com/dhis2/app-platform/issues/824)) ([b6a12fa](https://github.com/dhis2/app-platform/commit/b6a12faee7e48764a341dfadc36c991fbab37ec2))


### BREAKING CHANGES

* **deps:** Updated major version of UI

# [10.5.0](https://github.com/dhis2/app-platform/compare/v10.4.1...v10.5.0) (2024-02-19)


### Features

* changes to support right-to-left ([#830](https://github.com/dhis2/app-platform/issues/830)) ([6d5433c](https://github.com/dhis2/app-platform/commit/6d5433c017f6c776c379e2397eba78731c96c8f1)), closes [#825](https://github.com/dhis2/app-platform/issues/825) [#826](https://github.com/dhis2/app-platform/issues/826)

## [10.4.1](https://github.com/dhis2/app-platform/compare/v10.4.0...v10.4.1) (2024-01-30)


### Bug Fixes

* use main app-runtime release ([#827](https://github.com/dhis2/app-platform/issues/827)) ([4c254e9](https://github.com/dhis2/app-platform/commit/4c254e98d8bb233a05c2d2de36cb6cc40e8cfb28))

# [10.4.0](https://github.com/dhis2/app-platform/compare/v10.3.11...v10.4.0) (2024-01-04)


### Features

* support plugin wrappers [LIBS-397] ([#823](https://github.com/dhis2/app-platform/issues/823)) ([f779e13](https://github.com/dhis2/app-platform/commit/f779e13a0e18808368782873fb350773a7191966))

# [10.4.0-alpha.6](https://github.com/dhis2/app-platform/compare/v10.4.0-alpha.5...v10.4.0-alpha.6) (2023-12-21)


### Bug Fixes

* don't open browser for plugins on start [LIBS-503] ([#821](https://github.com/dhis2/app-platform/issues/821)) ([7db7a69](https://github.com/dhis2/app-platform/commit/7db7a69b55d88f681e14e49d4b774e75d7289776))
* update alpha ([e66a8ea](https://github.com/dhis2/app-platform/commit/e66a8ea62c7b30c929f7b5cebab08df3fa4cbf62))
* update alpha [skip release] ([ec772f6](https://github.com/dhis2/app-platform/commit/ec772f655f3160446ab74f523e147d3e129b94a9))

## [10.3.11](https://github.com/dhis2/app-platform/compare/v10.3.10...v10.3.11) (2023-12-11)


### Bug Fixes

* don't open browser for plugins on start [LIBS-503] ([#821](https://github.com/dhis2/app-platform/issues/821)) ([7db7a69](https://github.com/dhis2/app-platform/commit/7db7a69b55d88f681e14e49d4b774e75d7289776))

# [10.4.0-alpha.5](https://github.com/dhis2/app-platform/compare/v10.4.0-alpha.4...v10.4.0-alpha.5) (2023-09-28)


### Bug Fixes

* auto width adjustment ([a80ea56](https://github.com/dhis2/app-platform/commit/a80ea56f1cd887e3458af8b6995f3136017fa9c2))
* clean up dependencies ([9863ae0](https://github.com/dhis2/app-platform/commit/9863ae09c72b65e11ce69ba03034ecd2737dacb3))
* use useRef for previous width ([f6c07cf](https://github.com/dhis2/app-platform/commit/f6c07cf222254379c5e7574087a9364507e9cdd1))


### Features

* auto resizing for height ([74bbe00](https://github.com/dhis2/app-platform/commit/74bbe00c0f64364b96b2b5b4fb68830b1d91a016))

# [10.4.0-alpha.4](https://github.com/dhis2/app-platform/compare/v10.4.0-alpha.3...v10.4.0-alpha.4) (2023-08-22)


### Bug Fixes

* support yarn.lock discovery on non-unix ([#811](https://github.com/dhis2/app-platform/issues/811)) ([22a6863](https://github.com/dhis2/app-platform/commit/22a6863c1b4a5d9c6c026c502a1b77dded318be7))

# [10.4.0-alpha.3](https://github.com/dhis2/app-platform/compare/v10.4.0-alpha.2...v10.4.0-alpha.3) (2023-08-10)


### Bug Fixes

* support yarn.lock discovery on non-unix ([#811](https://github.com/dhis2/app-platform/issues/811)) ([22a6863](https://github.com/dhis2/app-platform/commit/22a6863c1b4a5d9c6c026c502a1b77dded318be7))
* move precache route to reenable navigation handler on login redirects [LIBS-473] ([#809](https://github.com/dhis2/app-platform/issues/809)) ([1ff29b6](https://github.com/dhis2/app-platform/commit/1ff29b645ec07e0bcce76efedbc08f1b76014a42))
* **pwa:** avoid crashing when SW is not available [LIBS-499] ([#807](https://github.com/dhis2/app-platform/issues/807)) ([b681022](https://github.com/dhis2/app-platform/commit/b68102248fad98303dd2c01d954f4430b1934a25))
* omit `moment-locales` from precache ([#806](https://github.com/dhis2/app-platform/issues/806)) ([c8d5494](https://github.com/dhis2/app-platform/commit/c8d5494c5eaf6a2f021166d208a1cc289701a47a))
* **cli:** fix envs to fix plugins in dev ([#799](https://github.com/dhis2/app-platform/issues/799)) ([ba29cea](https://github.com/dhis2/app-platform/commit/ba29ceacfe5a25d42a406f80a9896ccbc7bc82f8))
* **plugins:** omit launch paths when unused [LIBS-477] ([#791](https://github.com/dhis2/app-platform/issues/791)) ([e49a51f](https://github.com/dhis2/app-platform/commit/e49a51fec39a323350c71d4e09caff836aab2262))
* **pwa:** bump ui version for headerbar connection status [LIBS-315] ([#797](https://github.com/dhis2/app-platform/issues/797)) ([61ff0a4](https://github.com/dhis2/app-platform/commit/61ff0a49e63189d892403db8df24c57e170dac0a))
* make loading placeholders transparent ([#795](https://github.com/dhis2/app-platform/issues/795)) ([6e64756](https://github.com/dhis2/app-platform/commit/6e64756325b366b413acbdce8dd0d6b70632d118))
* **plugins:** inject precache manifest correctly ([#792](https://github.com/dhis2/app-platform/issues/792)) ([c0d172e](https://github.com/dhis2/app-platform/commit/c0d172ec362182ce978e43b16e9c411ec61e5039))
* **pwa:** add config option to omit files from precache [LIBS-482] ([#793](https://github.com/dhis2/app-platform/issues/793)) ([d089dda](https://github.com/dhis2/app-platform/commit/d089dda25433ca52f84c42c9369fce95419e4f83))

## [10.3.9](https://github.com/dhis2/app-platform/compare/v10.3.8...v10.3.9) (2023-05-16)


### Bug Fixes

* move precache route to reenable navigation handler on login redirects [LIBS-473] ([#809](https://github.com/dhis2/app-platform/issues/809)) ([1ff29b6](https://github.com/dhis2/app-platform/commit/1ff29b645ec07e0bcce76efedbc08f1b76014a42))

## [10.3.8](https://github.com/dhis2/app-platform/compare/v10.3.7...v10.3.8) (2023-05-03)


### Bug Fixes

* **pwa:** avoid crashing when SW is not available [LIBS-499] ([#807](https://github.com/dhis2/app-platform/issues/807)) ([b681022](https://github.com/dhis2/app-platform/commit/b68102248fad98303dd2c01d954f4430b1934a25))

## [10.3.7](https://github.com/dhis2/app-platform/compare/v10.3.6...v10.3.7) (2023-04-27)


### Bug Fixes

* omit `moment-locales` from precache ([#806](https://github.com/dhis2/app-platform/issues/806)) ([c8d5494](https://github.com/dhis2/app-platform/commit/c8d5494c5eaf6a2f021166d208a1cc289701a47a))

## [10.3.6](https://github.com/dhis2/app-platform/compare/v10.3.5...v10.3.6) (2023-03-22)


### Bug Fixes

* **cli:** fix envs to fix plugins in dev ([#799](https://github.com/dhis2/app-platform/issues/799)) ([ba29cea](https://github.com/dhis2/app-platform/commit/ba29ceacfe5a25d42a406f80a9896ccbc7bc82f8))

## [10.3.5](https://github.com/dhis2/app-platform/compare/v10.3.4...v10.3.5) (2023-03-17)


Expand Down
10 changes: 5 additions & 5 deletions adapter/i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2022-09-22T19:11:17.660Z\n"
"PO-Revision-Date: 2022-09-22T19:11:17.660Z\n"
"POT-Creation-Date: 2023-02-08T14:36:41.461Z\n"
"PO-Revision-Date: 2023-02-08T14:36:41.461Z\n"

msgid "Save your data"
msgstr "Save your data"
Expand Down Expand Up @@ -39,12 +39,12 @@ msgstr "An error occurred in the DHIS2 application."
msgid "Technical details copied to clipboard"
msgstr "Technical details copied to clipboard"

msgid "Something went wrong"
msgstr "Something went wrong"

msgid "Try again"
msgstr "Try again"

msgid "Something went wrong"
msgstr "Something went wrong"

msgid "Hide technical details"
msgstr "Hide technical details"

Expand Down
11 changes: 6 additions & 5 deletions adapter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/app-adapter",
"version": "10.3.5",
"version": "11.0.0",
"repository": {
"type": "git",
"url": "https://github.com/amcgee/dhis2-app-platform",
Expand All @@ -21,12 +21,13 @@
"build"
],
"dependencies": {
"@dhis2/pwa": "10.3.5",
"@dhis2/pwa": "11.0.0",
"moment": "^2.24.0"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "10.3.5",
"@dhis2/cli-app-scripts": "11.0.0",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^8.0.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"react": "^16.8",
Expand All @@ -37,9 +38,9 @@
"test": "d2-app-scripts test"
},
"peerDependencies": {
"@dhis2/app-runtime": "^3.5",
"@dhis2/app-runtime": "^3.10.2",
"@dhis2/d2-i18n": "^1",
"@dhis2/ui": ">=8.5",
"@dhis2/ui": ">=9.2.0",
"classnames": "^2",
"moment": "^2",
"prop-types": "^15",
Expand Down
41 changes: 38 additions & 3 deletions adapter/src/components/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,48 @@ import { ErrorBoundary } from './ErrorBoundary.js'
import { LoadingMask } from './LoadingMask.js'
import { styles } from './styles/AppWrapper.style.js'

export const AppWrapper = ({ children, plugin }) => {
const { loading: localeLoading } = useCurrentUserLocale()
const AppWrapper = ({
children,
plugin,
onPluginError,
clearPluginError,
direction: configDirection,
}) => {
const { loading: localeLoading, direction: localeDirection } =
useCurrentUserLocale(configDirection)
const { loading: latestUserLoading } = useVerifyLatestUser()

if (localeLoading || latestUserLoading) {
return <LoadingMask />
}

if (plugin) {
return (
<div className="app-shell-adapter">
<style jsx>{styles}</style>
<div className="app-shell-app">
<ErrorBoundary
plugin={true}
onPluginError={onPluginError}
onRetry={() => {
clearPluginError()
window.location.reload()
}}
>
{children}
</ErrorBoundary>
</div>
<Alerts />
</div>
)
}

return (
<div className="app-shell-adapter">
<style jsx>{styles}</style>
{!plugin && <ConnectedHeaderBar />}
<div dir={localeDirection}>
<ConnectedHeaderBar />
</div>
<div className="app-shell-app">
<ErrorBoundary onRetry={() => window.location.reload()}>
{children}
Expand All @@ -32,5 +62,10 @@ export const AppWrapper = ({ children, plugin }) => {

AppWrapper.propTypes = {
children: PropTypes.node,
clearPluginError: PropTypes.func,
direction: PropTypes.oneOf(['ltr', 'rtl', 'auto']),
plugin: PropTypes.bool,
onPluginError: PropTypes.func,
}

export { AppWrapper }
25 changes: 25 additions & 0 deletions adapter/src/components/ErrorBoundary.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export class ErrorBoundary extends Component {
}

componentDidCatch(error, errorInfo) {
if (this.props.plugin) {
if (this.props.onPluginError) {
console.error(error)
this.props.onPluginError(error)
}
}
this.setState({
error,
errorInfo,
Expand All @@ -58,6 +64,23 @@ export class ErrorBoundary extends Component {
render() {
const { children, fullscreen, onRetry } = this.props
if (this.state.error) {
if (this.props.plugin) {
return (
<>
<style jsx>{styles}</style>
<div className="pluginBoundary">
<span>I am the default plugin boundary</span>
{onRetry && (
<div className="retry">
<UIButton onClick={onRetry}>
{i18n.t('Try again')}
</UIButton>
</div>
)}
</div>
</>
)
}
return (
<div className={cx('mask', { fullscreen })}>
<style jsx>{styles}</style>
Expand Down Expand Up @@ -119,5 +142,7 @@ export class ErrorBoundary extends Component {
ErrorBoundary.propTypes = {
children: PropTypes.node.isRequired,
fullscreen: PropTypes.bool,
plugin: PropTypes.bool,
onPluginError: PropTypes.func,
onRetry: PropTypes.func,
}
9 changes: 9 additions & 0 deletions adapter/src/components/ServerVersionProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export const ServerVersionProvider = ({
url, // url from env vars
apiVersion,
pwaEnabled,
plugin,
parentAlertsAdd,
showAlertsInPlugin,
children,
}) => {
const offlineInterface = useOfflineInterface()
Expand Down Expand Up @@ -160,6 +163,9 @@ export const ServerVersionProvider = ({
pwaEnabled,
}}
offlineInterface={offlineInterface}
plugin={plugin}
parentAlertsAdd={parentAlertsAdd}
showAlertsInPlugin={showAlertsInPlugin}
>
{children}
</Provider>
Expand All @@ -171,6 +177,9 @@ ServerVersionProvider.propTypes = {
appVersion: PropTypes.string.isRequired,
apiVersion: PropTypes.number,
children: PropTypes.element,
parentAlertsAdd: PropTypes.func,
plugin: PropTypes.bool,
pwaEnabled: PropTypes.bool,
showAlertsInPlugin: PropTypes.bool,
url: PropTypes.string,
}
11 changes: 10 additions & 1 deletion adapter/src/components/styles/ErrorBoundary.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const bgColor = '#F4F6F8',
primaryTextColor = '#000000',
secondaryTextColor = '#494949',
errorColor = '#D32F2F',
grey050 = '#FBFCFD'
grey050 = '#FBFCFD',
red200 = '#ffcdd2'

export default css`
.mask {
Expand Down Expand Up @@ -100,4 +101,12 @@ export default css`
color: ${errorColor};
font-family: Menlo, Courier, monospace !important;
}
.pluginBoundary {
background-color: ${red200};
}
.pluginBoundary span {
display: inline-block;
}
`
Loading

0 comments on commit 9c13030

Please sign in to comment.