-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update cli-app-scripts to 5.6.0
- Loading branch information
Showing
6 changed files
with
152 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
.appIcon { | ||
display: flex; | ||
height: 72px; | ||
width: 72px; | ||
} | ||
|
||
.appIconFallback { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,87 @@ | ||
import { useDataQuery } from '@dhis2/app-runtime' | ||
import i18n from '@dhis2/d2-i18n' | ||
import React from 'react' | ||
import AppList from '../AppList' | ||
|
||
const CoreApps = () => <p>Core apps</p> | ||
const coreAppNames = [ | ||
'App Management', | ||
'Cache Cleaner', | ||
'Capture', | ||
'Dashboard', | ||
'Data Visualizer', | ||
'Datastore Management', | ||
'Import/Export', | ||
'Interpretations', | ||
'Maintenance', | ||
'Menu Management', | ||
'Messaging', | ||
'Reports', | ||
'SMS Configuration', | ||
'Scheduler', | ||
'Settings', | ||
'Translations', | ||
'User Management', | ||
] | ||
|
||
const query = { | ||
coreApps: { | ||
resource: 'apps', | ||
params: { | ||
bundled: true, | ||
}, | ||
}, | ||
appHub: { | ||
resource: 'appHub/v1/apps', | ||
}, | ||
} | ||
|
||
const CoreApps = () => { | ||
const { loading, error, data } = useDataQuery(query) | ||
|
||
const overridenCoreApps = data?.coreApps.filter(app => app.bundled) | ||
const apps = coreAppNames | ||
.map(coreAppName => { | ||
const overridenApp = overridenCoreApps?.find( | ||
a => a.name === coreAppName | ||
) | ||
if (overridenApp) { | ||
return overridenApp | ||
} | ||
return { | ||
name: coreAppName, | ||
short_name: coreAppName, | ||
developer: { | ||
company: 'DHIS2', | ||
}, | ||
icons: {}, | ||
} | ||
}) | ||
.map(app => { | ||
const appHubId = data?.appHub.find( | ||
({ name, developer }) => | ||
name === app.name && developer.organisation === 'DHIS2' | ||
)?.id | ||
return { | ||
...app, | ||
appHubId, | ||
} | ||
}) | ||
const appsWithUpdates = apps.filter(app => !app.version && app.appHubId) | ||
|
||
return ( | ||
<AppList | ||
error={error} | ||
loading={loading} | ||
apps={apps} | ||
appsWithUpdates={appsWithUpdates} | ||
errorLabel={i18n.t( | ||
'Something went wrong whilst loading your core apps' | ||
)} | ||
updatesAvailableLabel={i18n.t('Core apps with updates available')} | ||
allAppsLabel={i18n.t('All core apps')} | ||
searchLabel={i18n.t('Search core apps')} | ||
/> | ||
) | ||
} | ||
|
||
export default CoreApps |
Oops, something went wrong.