Skip to content

Commit

Permalink
Merge branch 'alpha' into alpha-update
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp committed Aug 22, 2023
2 parents 06cee57 + 5a7cd50 commit 6733572
Show file tree
Hide file tree
Showing 19 changed files with 494 additions and 1,062 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
## [10.3.10](https://github.com/dhis2/app-platform/compare/v10.3.9...v10.3.10) (2023-08-21)
# [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)

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
10 changes: 8 additions & 2 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.10",
"version": "10.4.0-alpha.3",
"repository": {
"type": "git",
"url": "https://github.com/amcgee/dhis2-app-platform",
Expand All @@ -26,6 +26,12 @@
},
"devDependencies": {
"@dhis2/cli-app-scripts": "10.3.10",
"@dhis2/pwa": "10.4.0-alpha.3",
"moment": "^2.24.0",
"post-robot": "^10.0.46"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "10.4.0-alpha.3",
"@testing-library/react": "^12.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
Expand All @@ -37,7 +43,7 @@
"test": "d2-app-scripts test"
},
"peerDependencies": {
"@dhis2/app-runtime": "^3.5",
"@dhis2/app-runtime": "^3.10.0-alpha.2",
"@dhis2/d2-i18n": "^1",
"@dhis2/ui": ">=8.5",
"classnames": "^2",
Expand Down
29 changes: 27 additions & 2 deletions adapter/src/components/AppWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,39 @@ import { ErrorBoundary } from './ErrorBoundary.js'
import { LoadingMask } from './LoadingMask.js'
import { styles } from './styles/AppWrapper.style.js'

export const AppWrapper = ({ children, plugin }) => {
const AppWrapper = ({ children, plugin, onPluginError, clearPluginError }) => {
const { loading: localeLoading } = useCurrentUserLocale()
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 />}
<ConnectedHeaderBar />
<div className="app-shell-app">
<ErrorBoundary onRetry={() => window.location.reload()}>
{children}
Expand All @@ -32,5 +53,9 @@ export const AppWrapper = ({ children, plugin }) => {

AppWrapper.propTypes = {
children: PropTypes.node,
clearPluginError: PropTypes.func,
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;
}
`
25 changes: 23 additions & 2 deletions adapter/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ const AppAdapter = ({
apiVersion,
pwaEnabled,
plugin,
parentAlertsAdd,
showAlertsInPlugin,
onPluginError,
clearPluginError,
children,
}) => (
<ErrorBoundary fullscreen onRetry={checkForSWUpdateAndReload}>
<ErrorBoundary
plugin={plugin}
fullscreen
onRetry={checkForSWUpdateAndReload}
>
<OfflineInterfaceProvider>
<PWALoadingBoundary>
<ServerVersionProvider
Expand All @@ -25,8 +33,17 @@ const AppAdapter = ({
url={url}
apiVersion={apiVersion}
pwaEnabled={pwaEnabled}
plugin={plugin}
parentAlertsAdd={parentAlertsAdd}
showAlertsInPlugin={showAlertsInPlugin}
>
<AppWrapper plugin={plugin}>{children}</AppWrapper>
<AppWrapper
plugin={plugin}
onPluginError={onPluginError}
clearPluginError={clearPluginError}
>
{children}
</AppWrapper>
</ServerVersionProvider>
</PWALoadingBoundary>
</OfflineInterfaceProvider>
Expand All @@ -38,9 +55,13 @@ AppAdapter.propTypes = {
appVersion: PropTypes.string.isRequired,
apiVersion: PropTypes.number,
children: PropTypes.element,
clearPluginError: PropTypes.func,
parentAlertsAdd: PropTypes.func,
plugin: PropTypes.bool,
pwaEnabled: PropTypes.bool,
showAlertsInPlugin: PropTypes.func,
url: PropTypes.string,
onPluginError: PropTypes.func,
}

export default AppAdapter
1 change: 1 addition & 0 deletions cli/config/plugin.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = ({ env: webpackEnv, config, paths }) => {

const shellEnv = getShellEnv({
plugin: 'true',
requiredProps: config.requiredProps ? config.requiredProps.join() : '',
name: config.title,
...getPWAEnvVars(config),
})
Expand Down
4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/cli-app-scripts",
"version": "10.3.10",
"version": "10.4.0-alpha.3",
"engines": {
"node": ">=14"
},
Expand Down Expand Up @@ -28,7 +28,7 @@
"@babel/preset-env": "^7.14.7",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.6.0",
"@dhis2/app-shell": "10.3.10",
"@dhis2/app-shell": "10.4.0-alpha.3",
"@dhis2/cli-helpers-engine": "^3.2.0",
"@jest/core": "^27.0.6",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.4",
Expand Down
4 changes: 2 additions & 2 deletions examples/pwa-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pwa-app",
"version": "10.3.10",
"version": "10.4.0-alpha.3",
"description": "",
"license": "BSD-3-Clause",
"private": true,
Expand All @@ -13,7 +13,7 @@
"demo": "yarn build --force --standalone --debug && yarn serve"
},
"peerDependencies": {
"@dhis2/app-runtime": "*",
"@dhis2/app-runtime": "^3.10.0-alpha.2",
"@dhis2/d2-i18n": "*",
"react": "^16.8",
"react-dom": "^16.8"
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-app",
"version": "10.3.10",
"version": "10.4.0-alpha.3",
"repository": "https://github.com/amcgee/dhis2-app-platform",
"author": "Austin McGee <austin@dhis2.org>",
"license": "BSD-3-Clause",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "10.3.10",
"version": "10.4.0-alpha.3",
"private": true,
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions pwa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/pwa",
"version": "10.3.10",
"version": "10.4.0-alpha.3",
"description": "",
"license": "BSD-3-Clause",
"publishConfig": {
Expand All @@ -13,7 +13,7 @@
"deploy": "d2-app-scripts deploy"
},
"devDependencies": {
"@dhis2/cli-app-scripts": "10.3.10"
"@dhis2/cli-app-scripts": "10.4.0-alpha.3"
},
"dependencies": {
"idb": "^6.0.0",
Expand Down
9 changes: 5 additions & 4 deletions shell/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/app-shell",
"version": "10.3.10",
"version": "10.4.0-alpha.3",
"engines": {
"node": ">=14"
},
Expand All @@ -15,13 +15,14 @@
"access": "public"
},
"dependencies": {
"@dhis2/app-adapter": "10.3.10",
"@dhis2/app-runtime": "^3.9.0",
"@dhis2/app-adapter": "10.4.0-alpha.3",
"@dhis2/app-runtime": "^3.10.0-alpha.2",
"@dhis2/d2-i18n": "^1.1.1",
"@dhis2/pwa": "10.3.10",
"@dhis2/pwa": "10.4.0-alpha.3",
"@dhis2/ui": "^8.12.3",
"classnames": "^2.2.6",
"moment": "^2.29.1",
"post-robot": "^10.0.46",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Expand Down
Loading

0 comments on commit 6733572

Please sign in to comment.