-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show install all plugins button on Manage Plugins and License key sec…
…tion (#22615) * Add code to show install all plugins button on Manage Plugins and License key section, #PG-3698 * Applied PR feedbacks and added UI tests * Fixes for UI test * Fixes failing UI test and handles some permission issue * Updated method visibility to private * Fixes for UI test * Fixes for UI test * Fixes for UI test * Fixes UI test error * UI test fix * Updated UI test and UI screenshot * Updated UI test * Increased timeout * Added reload * UI test URL updated * UI test fix: * Updated UI screenshot * Applied PR feedbacks * Removed unwanted code * some code cleanup --------- Co-authored-by: sgiehl <[email protected]>
- Loading branch information
1 parent
6379040
commit d616dba
Showing
21 changed files
with
391 additions
and
275 deletions.
There are no files selected for viewing
147 changes: 135 additions & 12 deletions
147
plugins/CorePluginsAdmin/vue/dist/CorePluginsAdmin.umd.js
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
plugins/CorePluginsAdmin/vue/dist/CorePluginsAdmin.umd.min.js
Large diffs are not rendered by default.
Oops, something went wrong.
120 changes: 120 additions & 0 deletions
120
plugins/CorePluginsAdmin/vue/src/InstallAllPaidPluginsButton/InstallAllPaidPluginsButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<!-- | ||
Matomo - free/libre analytics platform | ||
@link https://matomo.org | ||
@license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
--> | ||
|
||
<template> | ||
<div v-if="paidPluginsToInstallAtOnce.length"> | ||
<button | ||
class="btn installAllPaidPluginsAtOnceButton" | ||
@click.prevent="onInstallAllPaidPlugins()" | ||
:disabled="disabled || loading" | ||
> | ||
<MatomoLoader v-if="loading"/> | ||
{{ translate('Marketplace_InstallPurchasedPlugins') }} | ||
</button> | ||
<div | ||
class="ui-confirm" | ||
id="installAllPaidPluginsAtOnce" | ||
ref="installAllPaidPluginsAtOnce" | ||
> | ||
<h2>{{ translate('Marketplace_InstallAllPurchasedPlugins') }}</h2> | ||
<p> | ||
{{ translate('Marketplace_InstallThesePlugins') }} | ||
</p> | ||
<ul> | ||
<li v-for="pluginDisplayName in paidPluginsToInstallAtOnce" :key="pluginDisplayName"> | ||
{{ pluginDisplayName }} | ||
</li> | ||
</ul> | ||
<p> | ||
<input | ||
role="install" | ||
type="button" | ||
:data-href="installAllPaidPluginsLink" | ||
:value="translate( | ||
'Marketplace_InstallAllPurchasedPluginsAction', | ||
paidPluginsToInstallAtOnce.length, | ||
)" | ||
/> | ||
<input | ||
role="cancel" | ||
type="button" | ||
:value="translate('General_Cancel')" | ||
/> | ||
</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
import { | ||
Matomo, MatomoUrl, MatomoLoader, AjaxHelper, | ||
} from 'CoreHome'; | ||
interface installAllPaidPluginsButton { | ||
paidPluginsToInstallAtOnce: Array<string>; | ||
installNonce: string; | ||
loading: boolean; | ||
} | ||
export default defineComponent({ | ||
components: { MatomoLoader }, | ||
props: { | ||
disabled: { | ||
type: Boolean, | ||
required: false, | ||
default: false, | ||
}, | ||
}, | ||
data(): installAllPaidPluginsButton { | ||
return { | ||
paidPluginsToInstallAtOnce: ([]) as Array<string>, | ||
installNonce: '', | ||
loading: false, | ||
}; | ||
}, | ||
created() { | ||
this.fetchPluginsToInstallAtOnce(); | ||
}, | ||
watch: { | ||
disabled(newValue: boolean, oldValue: boolean) { | ||
if (newValue === false && oldValue === true) { | ||
this.fetchPluginsToInstallAtOnce(); | ||
} | ||
}, | ||
}, | ||
methods: { | ||
onInstallAllPaidPlugins() { | ||
Matomo.helper.modalConfirm(this.$refs.installAllPaidPluginsAtOnce as HTMLElement); | ||
}, | ||
fetchPluginsToInstallAtOnce() { | ||
this.loading = true; | ||
if (Matomo.hasSuperUserAccess) { | ||
AjaxHelper.fetch({ | ||
module: 'Marketplace', | ||
action: 'getPaidPluginsToInstallAtOnceParams', | ||
}).then((response) => { | ||
if (response) { | ||
this.paidPluginsToInstallAtOnce = response.paidPluginsToInstallAtOnce ?? []; | ||
this.installNonce = response.installAllPluginsNonce ?? ''; | ||
} | ||
this.loading = false; | ||
}); | ||
} | ||
}, | ||
}, | ||
computed: { | ||
installAllPaidPluginsLink() { | ||
return `?${MatomoUrl.stringify({ | ||
...MatomoUrl.urlParsed.value, | ||
module: 'Marketplace', | ||
action: 'installAllPaidPlugins', | ||
nonce: this.installNonce, | ||
})}`; | ||
}, | ||
}, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
plugins/Marketplace/tests/UI/expected-screenshots/ManageLicense_valid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...s/Marketplace_install_purchased_plugins_modal_manageLicenseKeyUrl_superuser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...hots/Marketplace_install_purchased_plugins_modal_managePluginsUrl_superuser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...nshots/Marketplace_install_purchased_plugins_modal_paidPluginsUrl_superuser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...enshots/Marketplace_paid_plugins_with_license_manageLicenseKeyUrl_superuser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...creenshots/Marketplace_paid_plugins_with_license_managePluginsUrl_superuser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...-screenshots/Marketplace_paid_plugins_with_license_paidPluginsUrl_superuser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.