Skip to content

Commit

Permalink
STCOR-773 list UI apps under apps/modules/interfaces column
Browse files Browse the repository at this point in the history
Follow-up to the original PR (#1385). There were at least two gotchas
there:
1. The attribute key in the response changed from `ui-modules` to
   `uiModules`
2. Since frontend and backend applications are stored under separate
   keys, the discovery reducer needed to grab values from both keys.

Refs STCOR-773
  • Loading branch information
zburke committed Jun 10, 2024
1 parent 13001bf commit 6ab1a0e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Idle-session timeout and "Keep working?" modal. Refs STCOR-776.
* Use keycloak URLs in place of users-bl for tenant-switch. Refs US1153537.
* Fix 404 error page when logging in after changing password in Eureka. Refs STCOR-845.
* List UI apps in "Applications/modules/interfaces" column. STCOR-773

## [10.1.1](https://github.com/folio-org/stripes-core/tree/v10.1.1) (2024-03-25)
[Full Changelog](https://github.com/folio-org/stripes-core/compare/v10.1.0...v10.1.1)
Expand Down
1 change: 1 addition & 0 deletions src/components/About/AboutApplicationVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const AboutApplicationVersions = ({ message, applications }) => {
</Headline>
<Headline>{message}</Headline>
{Object.values(applications)
.sort((a, b) => a.name.localeCompare(b.name))
.map((app) => {
return (
<ul key={app.name}>
Expand Down
4 changes: 4 additions & 0 deletions src/components/About/AboutModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import css from './About.css';


const AboutInterfaces = ({ list }) => {
list.sort((a, b) => a.name.localeCompare(b.name));
return (
<List
listStyle="bullets"
listClass={css.paddingLeftOfListItems}
items={list}
itemFormatter={(item) => <li key={item.name}>{item.name}</li>}
Expand All @@ -22,6 +24,8 @@ AboutInterfaces.propTypes = {
};

const AboutModules = ({ list }) => {
list.sort((a, b) => a.name.localeCompare(b.name));

return (
<List
listStyle="bullets"
Expand Down
33 changes: 22 additions & 11 deletions src/discoverServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function parseApplicationDescriptor(store, descriptor) {
list.push(...descriptor.moduleDescriptors?.map((i) => dispatchDescriptor(i)));
}

if (descriptor['ui-modules']) {
list.push(...descriptor['ui-modules']?.map((i) => dispatchDescriptor(i)));
if (descriptor.uiModules) {
list.push(...descriptor.uiModules?.map((i) => dispatchDescriptor(i)));
}

list.push(dispatchApplication(descriptor));
Expand Down Expand Up @@ -76,7 +76,7 @@ function parseApplicationDescriptor(store, descriptor) {
{ "id": "mod-users-18.2.0", "name": "mod-users", "version": "18.2.0" },
...
],
"ui-modules": [
"uiModules": [
{ "name": "folio_stripes-core", "version": "8.1.2" },
...
],
Expand Down Expand Up @@ -246,14 +246,25 @@ export function discoveryReducer(state = {}, action) {
...state.applications,
[action.data.id]: {
name: action.data.id,
modules: action.data.moduleDescriptors.map((d) => {
return {
name: d.id,
interfaces: d.provides?.map((i) => {
return { name: i.id + ' ' + i.version };
}) || [],
};
}),
modules: [
...action.data.moduleDescriptors.map((d) => {
return {
name: d.id,
interfaces: d.provides?.map((i) => {
return { name: i.id + ' ' + i.version };
}) || [],
};
}),
...action.data.uiModules.map((d) => {
return {
name: d.id,
interfaces: d.provides?.map((i) => {
return { name: i.id + ' ' + i.version };
}) || [],
};
})

],
},
},
};
Expand Down

0 comments on commit 6ab1a0e

Please sign in to comment.