Skip to content

Commit

Permalink
Adds code to hide install and update button when enable_plugins_admin…
Browse files Browse the repository at this point in the history
…=0 is set, #PG-3693 (#22521)

* Adds code to hide install and update button when enable_plugins_admin=0 set, #PG-3693

* UI test fix

* UI screenshots updated

* Added code to show more details button instead of blank

* Updated screenshot
  • Loading branch information
AltamashShaikh authored Aug 28, 2024
1 parent f7b8630 commit 52feda6
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 41 deletions.
13 changes: 13 additions & 0 deletions plugins/Marketplace/tests/UI/Marketplace_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,19 @@ describe("Marketplace", function () {
await captureMarketplace('themes_with_valid_license_' + mode);
});

it('should show themes page without install button when enable_plugins_admin=0', async function () {
setEnvironment(mode, validLicense);
testEnvironment.overrideConfig('General', 'enable_plugins_admin', '0');
testEnvironment.save();

await page.goto('about:blank');
await page.goto(themesUrl);

await captureMarketplace('themes_with_valid_license_disabled_' + mode);
testEnvironment.overrideConfig('General', 'enable_plugins_admin', '1');
testEnvironment.save();
});

it('should show free plugin details', async function() {
setEnvironment(mode, noLicense);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 46 additions & 37 deletions plugins/Marketplace/vue/dist/Marketplace.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugins/Marketplace/vue/dist/Marketplace.umd.min.js

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions plugins/Marketplace/vue/src/PluginList/CTAContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<template
v-else-if="plugin.canBeUpdated && 0 == plugin.missingRequirements.length"
>
<a v-if="isAutoUpdatePossible"
<a v-if="isAutoUpdatePossible && isPluginsAdminEnabled"
tabindex="7"
class="btn btn-block"
:href="linkToUpdate(plugin.name)"
Expand Down Expand Up @@ -83,7 +83,7 @@
</template>
</div>

<div v-else-if="plugin.isEligibleForFreeTrial && !inModal"
<div v-else-if="plugin.isEligibleForFreeTrial && !inModal && isPluginsAdminEnabled"
class="btn btn-block purchaseable"
:title="translate('Marketplace_StartFreeTrial')"
>{{ translate('Marketplace_StartFreeTrial') }}</div>
Expand Down Expand Up @@ -125,13 +125,22 @@
/>)</span>
</div>

<a v-else
<a v-else-if="isPluginsAdminEnabled"
tabindex="7"
:href="linkToInstall(plugin.name)"
class="btn btn-block"
>
{{ translate('Marketplace_ActionInstall') }}
</a>

<template v-else>
<MoreDetailsAction
v-if="!inModal"
:show-as-button="true"
:label="translate('General_MoreDetails')"
@action="$emit('openDetailsModal')"
/>
</template>
</template>

<a v-else-if="plugin.isTrialRequested"
Expand Down

0 comments on commit 52feda6

Please sign in to comment.