Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.1.0] No install button after downloading new package #16672

Open
hugopeek opened this issue Jan 3, 2025 · 7 comments · May be fixed by #16675
Open

[3.1.0] No install button after downloading new package #16672

hugopeek opened this issue Jan 3, 2025 · 7 comments · May be fixed by #16675
Labels
bug The issue in the code or project, which should be addressed.

Comments

@hugopeek
Copy link
Contributor

hugopeek commented Jan 3, 2025

Bug report

Summary

I'm not seeing the install button appear in the Package Management grid, after downloading a new package in MODX 3.1.0.

Step to reproduce

  • Install MODX 3.1.0
  • Install any package from package manager

Observed behavior

image

Expected behavior

Green install button should be present for packages that have not yet been installed.

Environment

MODX 3.1.0
Nginx
PHP 8.2
MariaDB 11.4

Firefox / Chromium both have this issue. No errors in console.

All is well in 3.0.6.

@hugopeek hugopeek added the bug The issue in the code or project, which should be addressed. label Jan 3, 2025
@BobRay
Copy link
Contributor

BobRay commented Jan 5, 2025

This also happens if you uninstall just the current version. It shows as "not installed" but there's no "Install" button.

As far as I can tell, selecting "Reinstall" acts as if it's the "Install" button in all cases.

@halftrainedharry
Copy link
Contributor

It looks like this problem was introduced with #16604.
When an package was not installed, the processor used to return null for the field "installed". Now it returns the value (Not Installed) instead.

Quite some code expects the value to be null to show the correct UI:

var state = (rec.installed !== null) ? ' installed' : ' not-installed';
var values = { name: value, state: state, actions: null, message: null };
var h = [];
if(rec.installed !== null) {

$packageArray['iconaction'] = empty($packageArray['installed']) ? 'icon-install' : 'icon-uninstall';
$packageArray['textaction'] = empty($packageArray['installed']) ? $this->modx->lexicon('install') : $this->modx->lexicon('uninstall');


To fix the issue, the function formatPackageDate() should only be called here, if the value is not null:

$packageArray['installed'] = $this->formatter->formatPackageDate(
$packageArray['installed'],
'installed',
false
);

@smg6511
Copy link
Collaborator

smg6511 commented Jan 6, 2025

I'll take a look at this and post a fix later today. Surprised I didn't catch this while working on the referenced PR!

@smg6511
Copy link
Collaborator

smg6511 commented Jan 7, 2025

If you search locally for packages and install a package, then do the same with a newer version of the package, it's not recognized as an upgrade.

This will have to be addressed in a different PR. When you mention the newer version being available, are you meaning available locally or remotely? Or does the same problem occur in both scenarios?

@opengeek
Copy link
Member

opengeek commented Jan 7, 2025

Just locally. If you submit the new version to modx.com/extras and then download it, everything is fine. It only happens when you upload and search locally for the newer version.

Would you like me to file a second issue on it?

Please.

@BobRay
Copy link
Contributor

BobRay commented Jan 7, 2025

Done #16676

@BobRay
Copy link
Contributor

BobRay commented Jan 11, 2025

Closed #16676. Not an issue.

I tested this with a minimal package that has separate "Install" and "Update" sections in resolvers and validators. I can confirm that in 3.1.0, using "reinstall" works as it should with respect to resolvers and validators. For new packages, the "Install" section executes, for new versions that update the package, the "Update" section executes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants