Skip to content

Single click copy button for code snippets #20915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 22, 2023
Merged

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Jun 21, 2023

Description:

This is backport of #20876

It adds a single click copy-to-clipboard button to the following code snippets:

  • Tracker code during installation.
  • All tracker code snippets on the site 'no data' screen, incl. Image tracking, GTM, MTM, React and Vue tabs.
  • Matomo Tag Manager install code function
  • User token creation (copy token after creation)
  • Privacy manager user opt out code
  • Campaign URL builder URLs
  • Custom dimensions shell commands
  • The UI demo at /index.php?module=Morpheus&action=demo

A new Vue directive CopyToClipboard adds the button to any <pre> element wrapped in blank div and decorated with <pre v-copy-to-clipboard>. For this 4.x PR an angular adapter is included (matomo-copy-to-clipboard) and is used in a few places for older templates which have been replaced with Vue components in 5.x

Review

@bx80 bx80 added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. BHAG-Tracking-OKR-Q2 labels Jun 21, 2023
@bx80 bx80 added this to the 4.15.0 milestone Jun 21, 2023
@bx80 bx80 self-assigned this Jun 21, 2023
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be reverted, before merging the PR. Targeting a branch for a submodule can break the checkout when the branch in the submodule gets deleted. This should only be commited if it's required for tests to pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately it is required for the tests, even though the UI test screenshots are not under the TagManager plugin. Thanks for the reminder to revert the submodule reference back to 4.x-dev once the TagManager PR has been merged, easy to miss 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't do it that way. If we merge the PR in core having the submodule pointing to the TagManager branch, this would break the checkout of submodules if the TagManager branch gets deleted. We can then for sure simply update it to 4.x-dev again, but that still means that we have a reference in the history that isn't valid anymore.
The changes in this PR should actually not require a submodule update. If some UI tests in core needs to updated when the TagManager changes, we should either investigate if it makes more sense to move that specific test to the TagManager, or keep the old results and update them together with the submodule once the TagManager PR has been merged.

bx80 and others added 2 commits June 22, 2023 10:23
@bx80 bx80 requested a review from sgiehl June 22, 2023 02:12
@sgiehl sgiehl merged commit f111a23 into 4.x-dev Jun 22, 2023
@sgiehl sgiehl deleted the cherrypick-single-click-copy branch June 22, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Development

Successfully merging this pull request may close these issues.

2 participants