Skip to content

Commit 28dbba1

Browse files
committed
Feature: Improve UX around Marketplace Plugins
- Add floating button bar with Uninstall, Clone, Test, and History buttons. - Show "Installed" badge in floating button bar. - Change action links on Plugin list page for marketplace plugins to differientate them. - Show actual custom icon for Plugin in marketplace header if installed. - Hide UID/GID fields when editing a marketplace plugin (blocked at the server-level).
1 parent c51ae97 commit 28dbba1

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

htdocs/css/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,18 @@ body.dark .box_buttons.floater {
20492049
box-shadow: 0px -2px 8px var(--background-color);
20502050
}
20512051

2052+
.box_buttons_badge_left {
2053+
float: left;
2054+
text-align: left;
2055+
line-height: 30px;
2056+
color: var(--label-color);
2057+
font-weight: bold;
2058+
}
2059+
.box_buttons_badge_left i.mdi:before {
2060+
transform: scale(1.25);
2061+
padding-right: 5px;
2062+
}
2063+
20522064
/* Plugin Params */
20532065

20542066
.plugin_param_editor_cont {

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
423423
app.setWindowTitle( product.title );
424424
app.setHeaderNav([
425425
{ icon: 'cart-variant', loc: '#Marketplace?sub=search', title: 'Marketplace' },
426-
{ icon: type_def.icon, title: product.title }
426+
{ icon: (installed && installed.icon) ? installed.icon : type_def.icon, title: product.title }
427427
]);
428428

429429
var install_btn_text = installed ? `Upgrade...` : `Install ${ucfirst(product.type)}...`;
@@ -545,6 +545,18 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
545545

546546
html += '</div>'; // markdown-body
547547
html += '</div>'; // box_content
548+
549+
if (installed) {
550+
// buttons at bottom
551+
html += '<div class="box_buttons">';
552+
html += `<div class="box_buttons_badge_left mobile_hide" style="color:var(--green)"><i class="mdi mdi-check-circle-outline"></i>Installed</div>`;
553+
html += '<div class="button danger mobile_collapse" onClick="$P().do_delete_plugin()"><i class="mdi mdi-trash-can-outline">&nbsp;</i><span>Uninstall...</span></div>';
554+
html += '<div class="button secondary mobile_collapse" onClick="$P().do_clone_plugin()"><i class="mdi mdi-content-copy">&nbsp;</i><span>Clone...</span></div>';
555+
html += '<div class="button secondary mobile_collapse" onClick="$P().do_test_plugin()"><i class="mdi mdi-test-tube">&nbsp;</i><span>Test...</span></div>';
556+
html += '<div class="button secondary mobile_collapse" onClick="$P().go_plugin_history()"><i class="mdi mdi-history">&nbsp;</i><span>History...</span></div>';
557+
html += '</div>'; // box_buttons
558+
}
559+
548560
html += '</div>'; // box
549561

550562
this.div.html(html);
@@ -553,6 +565,25 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
553565
this.expandInlineImages();
554566
this.highlightCodeBlocks();
555567
this.fixMarketDocumentLinks();
568+
if (installed) this.setupBoxButtonFloater();
569+
}
570+
571+
do_delete_plugin() {
572+
// jump over to plugins page and popup the delete dialog
573+
var installed = this.installed;
574+
Nav.go( 'Plugins?sub=edit&id=' + installed.id + '&delete=1' );
575+
}
576+
577+
do_test_plugin() {
578+
// jump over to plugins page and popup the test dialog
579+
var installed = this.installed;
580+
Nav.go( 'Plugins?sub=edit&id=' + installed.id + '&test=1' );
581+
}
582+
583+
go_plugin_history() {
584+
// nav to installed plugin history
585+
var installed = this.installed;
586+
Nav.go( '#Plugins?sub=history&id=' + installed.id );
556587
}
557588

558589
go_vault() {
@@ -679,7 +710,7 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
679710
else return '<span style="color:var(--gray)"><i class="mdi mdi-cancel">&nbsp;</i>Not Installed</span>';
680711
}
681712

682-
do_clone() {
713+
do_clone_plugin() {
683714
// clone thing for editing
684715
var product = this.product;
685716
var installed = this.installed;
@@ -927,6 +958,7 @@ Page.Marketplace = class Marketplace extends Page.PageUtils {
927958

928959
onDeactivate() {
929960
// called when page is deactivated
961+
this.cleanupBoxButtonFloater();
930962
this.div.html('');
931963

932964
delete this.lastSearchResp;

htdocs/js/pages/admin/Plugins.class.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ Page.Plugins = class Plugins extends Page.PageUtils {
8181
var actions = [];
8282
if (item.marketplace && app.hasPrivilege('edit_plugins')) actions.push( `<button class="link" data-plugin="${item.id}" onClick="$P().view_mkt_plugin_from_list(this)"><b>View</b></button>` );
8383
else if (app.hasPrivilege('edit_plugins')) actions.push( `<button class="link" data-plugin="${item.id}" onClick="$P().edit_plugin_from_list(this)"><b>Edit</b></button>` );
84-
if (app.hasPrivilege('delete_plugins')) actions.push( `<button class="link danger" data-plugin="${item.id}" onClick="$P().delete_plugin_from_list(this)"><b>Delete</b></button>` );
84+
85+
if (item.marketplace && app.hasPrivilege('edit_plugins')) actions.push( `<button class="link danger" data-plugin="${item.id}" onClick="$P().delete_plugin_from_list(this)"><b>Uninstall</b></button>` );
86+
else if (app.hasPrivilege('delete_plugins')) actions.push( `<button class="link danger" data-plugin="${item.id}" onClick="$P().delete_plugin_from_list(this)"><b>Delete</b></button>` );
8587

8688
var tds = [
8789
'<b>' + self.getNicePlugin(item, app.hasPrivilege('edit_plugins')) + '</b>',
@@ -398,6 +400,13 @@ Page.Plugins = class Plugins extends Page.PageUtils {
398400
this.renderParamEditor();
399401
this.setupBoxButtonFloater();
400402
this.setupEditTriggers();
403+
404+
if (this.plugin.marketplace) {
405+
this.div.find('#d_ep_uid, #d_ep_gid').hide();
406+
}
407+
408+
if (this.args.delete) this.show_delete_plugin_dialog();
409+
else if (this.args.test) this.do_test();
401410
}
402411

403412
do_test() {
@@ -1197,6 +1206,7 @@ Page.Plugins = class Plugins extends Page.PageUtils {
11971206

11981207
// UID
11991208
html += this.getFormRow({
1209+
id: 'd_ep_uid',
12001210
label: 'Run as User:',
12011211
content: this.getFormText({
12021212
id: 'fe_ep_uid',
@@ -1209,6 +1219,7 @@ Page.Plugins = class Plugins extends Page.PageUtils {
12091219

12101220
// GID
12111221
html += this.getFormRow({
1222+
id: 'd_ep_gid',
12121223
label: 'Run as Group:',
12131224
content: this.getFormText({
12141225
id: 'fe_ep_gid',

0 commit comments

Comments
 (0)