Skip to content

Commit

Permalink
fix: plugins with updates disabled are still shown as updatable (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbender9 authored Aug 14, 2024
1 parent 7f79aef commit 54f3fa7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/server-admin-ui/src/views/appstore/Apps/Apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Apps = function (props) {
(allApps[app.name] = {
...app,
installed: true,
newVersion: app.installedVersion !== app.version ? app.version : null,
newVersion: updateAvailable(app, props.appStore) ? app.version : null,
})
)
props.appStore.installing.forEach(
Expand Down Expand Up @@ -70,7 +70,7 @@ const Apps = function (props) {
'Please restart the server after installing, updating or deleting a plugin'
}

const selectedViewFilter = selectedViewToFilter(view)
const selectedViewFilter = selectedViewToFilter(view, props.appStore)
const selectedCategoryFilter =
category === 'All' ? () => true : (app) => app.categories.includes(category)
const textSearchFilter =
Expand Down Expand Up @@ -176,14 +176,24 @@ const Apps = function (props) {
)
}

const selectedViewToFilter = (selectedView) => {
const selectedViewToFilter = (selectedView, appStore) => {
if (selectedView === 'Installed') {
return (app) => app.installing || app.installedVersion
} else if (selectedView === 'Updates') {
return (app) => app.installedVersion && app.version !== app.installedVersion
return (app) => updateAvailable(app, appStore)
}
return () => true
}

const updateAvailable = (app, appStore) => {
return (
app.installedVersion &&
app.version !== app.installedVersion &&
//Don't allow updates for plugins in the PLUGINS_WITH_UPDATE_DISABLED
//environment variable
appStore.updates.find((update) => update.name === app.name)
)
}

const mapStateToProps = ({ appStore }) => ({ appStore })
export default connect(mapStateToProps)(Apps)

0 comments on commit 54f3fa7

Please sign in to comment.