Skip to content

Commit

Permalink
fix: show 'update to latest version' button for bundled apps
Browse files Browse the repository at this point in the history
  • Loading branch information
mediremi committed Feb 22, 2021
1 parent ac42639 commit 1692911
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/CoreApps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const CoreApps = () => {
appHubId,
}
})
// TODO: Also compare app.version to latest AppHub version
const appsWithUpdates = apps.filter(app => !app.version && app.appHubId)

return (
Expand Down
8 changes: 7 additions & 1 deletion src/components/CustomAppDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ const ManageInstalledVersion = ({ installedApp, versions, reloadPage }) => {
maxDhisVersion: max,
}) => {
if (min && max) {
if (min === max) {
return `${min}`
}
return `${min}${max}`
} else if (min && !max) {
return i18n.t('{{minDhisVersion}} and above', {
Expand Down Expand Up @@ -224,14 +227,17 @@ const CustomAppDetails = ({ match }) => {

const { app, installedApps } = data
const screenshots = app.images.filter(i => !i.logo).map(i => i.imageUrl)
const installedApp = installedApps.find(
let installedApp = installedApps.find(
a =>
a.name === app.name &&
a.developer &&
(app.developer.organisation ===
(a.developer.company || a.developer.name) ||
app.developer.name === a.developer.name)
)
if (!installedApp && app.developer.organisation === 'DHIS2') {
installedApp = { version: null }
}

return (
<Card className={styles.appCard}>
Expand Down

0 comments on commit 1692911

Please sign in to comment.