Skip to content

Commit

Permalink
Fix missing package install button
Browse files Browse the repository at this point in the history
Create explicit 'isInstalled' prop separate from the 'installed' date field to more reliably and clearly indicate a packages installable state
  • Loading branch information
smg6511 committed Jan 7, 2025
1 parent 336bc55 commit f891015
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions core/src/Revolution/Processors/Workspace/Packages/GetList.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ public function getSortClassKey()
*/
public function prepareRow(xPDOObject $object)
{
if ($object->get('installed') === '0000-00-00 00:00:00') {
$object->set('installed', null);
}
$packageArray = $object->toArray();

$isInstalled = !$this->formatter->isEmpty($packageArray['installed']);
$packageArray['isInstalled'] = $isInstalled;
$packageArray = $this->getVersionInfo($packageArray);
$packageArray = $this->formatDates($packageArray);
$packageArray['iconaction'] = empty($packageArray['installed']) ? 'icon-install' : 'icon-uninstall';
$packageArray['textaction'] = empty($packageArray['installed']) ? $this->modx->lexicon('install') : $this->modx->lexicon('uninstall');
$packageArray['iconaction'] = !$isInstalled ? 'icon-install' : 'icon-uninstall';
$packageArray['textaction'] = !$isInstalled ? $this->modx->lexicon('install') : $this->modx->lexicon('uninstall');
$packageArray = $this->getPackageMeta($object, $packageArray);
$packageArray = $this->checkForUpdates($object, $packageArray);

Expand Down
5 changes: 3 additions & 2 deletions manager/assets/modext/workspace/package.grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ MODx.grid.Package = function(config = {}) {
'created',
'updated',
'installed',
'isInstalled',
'state',
'workspace',
'provider',
Expand Down Expand Up @@ -212,7 +213,7 @@ Ext.extend(MODx.grid.Package, MODx.grid.Grid, {
mainColumnRenderer: function(value, metaData, record, rowIndex, colIndex, store) {
const
{ data } = record,
state = (data.installed !== null) ? ' installed' : ' not-installed',
state = data.isInstalled ? ' installed' : ' not-installed',
values = {
name: value,
state: state,
Expand All @@ -221,7 +222,7 @@ Ext.extend(MODx.grid.Package, MODx.grid.Grid, {
},
actions = []
;
if (data.installed !== null) {
if (data.isInstalled) {
actions.push({ className: 'uninstall', text: data.textaction });
actions.push({ className: 'reinstall', text: _('package_reinstall_action_button') });
} else {
Expand Down

0 comments on commit f891015

Please sign in to comment.