Skip to content

Commit 3dd571d

Browse files
committed
Marketplace: Show plugin installed status (up-to-date, outdated, not installed) on the marketplace listing page. Fixes #40.
1 parent 60d0e0a commit 3dd571d

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

htdocs/js/pages/admin/Marketplace.class.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
304304

305305
var grid_args = {
306306
resp: resp,
307-
cols: ['Title / Description', 'Author', 'License', 'Type', 'Modified', 'Version'],
307+
cols: ['Title / Description', 'Author', 'License', 'Type', 'Modified', 'Status'],
308308
data_type: 'product',
309309
offset: this.args.offset || 0,
310310
limit: this.args.limit,
@@ -329,13 +329,17 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
329329
combo += `<div class="product_desc ellip">${product.description}</div>`;
330330
combo += `</div>`;
331331

332+
var installed = self.findInstalledProduct(product);
333+
var nice_status = self.getNiceInstalledStatus(product, installed);
334+
332335
return [
333336
combo,
334337
self.getNiceProductAuthor( product.author ),
335338
self.getNiceProductLicense( product.license ),
336339
self.getNiceProductType( product ),
337340
self.getNiceProductDate( product.created ),
338-
self.getNiceProductVersion( product.versions[0] )
341+
nice_status
342+
// self.getNiceProductVersion( product.versions[0] )
339343
];
340344
} );
341345

@@ -458,7 +462,7 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
458462
// status (installed / not)
459463
html += '<div>';
460464
html += '<div class="info_label">Status</div>';
461-
html += '<div class="info_value">' + this.getNiceInstalledStatus() + '</div>';
465+
html += '<div class="info_value">' + this.getNiceInstalledStatus(product, installed) + '</div>';
462466
html += '</div>';
463467

464468
// installed version
@@ -554,17 +558,14 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
554558
} );
555559
}
556560

557-
getNiceInstalledStatus() {
558-
// (installed ? '<i class="mdi mdi-check-circle-outline">&nbsp;</i>Installed' : '<i class="mdi mdi-cancel">&nbsp;</i>Not Installed')
559-
var product = this.product;
560-
var installed = this.installed;
561-
561+
getNiceInstalledStatus(product, installed) {
562+
// up to date, outdated, not installed
562563
if (installed) {
563564
// check version
564-
if (installed.marketplace.version == product.versions[0]) return '<span style="color:var(--green)"><i class="mdi mdi-check-circle-outline">&nbsp;</i>Up to Date</span>'
565-
else return '<span style="color:var(--red)"><i class="mdi mdi-alert-rhombus">&nbsp;</i>Outdated</span>';
565+
if (installed.marketplace.version == product.versions[0]) return '<span style="color:var(--green); font-weight:bold;"><i class="mdi mdi-check-circle-outline">&nbsp;</i>Up to Date</span>'
566+
else return '<span style="color:var(--red); font-weight:bold;"><i class="mdi mdi-alert-rhombus">&nbsp;</i>Outdated</span>';
566567
}
567-
else return '<i class="mdi mdi-cancel">&nbsp;</i>Not Installed';
568+
else return '<span style="color:var(--gray)"><i class="mdi mdi-cancel">&nbsp;</i>Not Installed</span>';
568569
}
569570

570571
do_edit() {

0 commit comments

Comments
 (0)