Skip to content
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

Added the ability to copy triggers and variables #936

Merged
merged 11 commits into from
Nov 28, 2024
Merged

Conversation

snake14
Copy link
Contributor

@snake14 snake14 commented Nov 27, 2024

Description:

This PR adds the ability to copy triggers and variables in Matomo Tag Manager. If the trigger or variable references any variables, it will try to reuse any existing variables. If there aren't any matches in the destination container, it will copy the referenced variables as well.

Fixes: #914 #932

Review

@snake14 snake14 linked an issue Nov 27, 2024 that may be closed by this pull request
@snake14 snake14 marked this pull request as ready for review November 27, 2024 09:37
@AltamashShaikh AltamashShaikh changed the title Added the ability to copy triggers Added the ability to copy triggers and variables Nov 27, 2024
Copy link
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

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

@snake14 Found 1 edge case

  1. Copy a trigger
  2. It will display the success notification with the URL to navigate
  3. Now delete the new copied variable and you will see the notification still stays and it takes you to an empty edit trigger

image

image

Copy link
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

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

@snake14 Should we add a note here, explaining that for customVariables if its referring to any other customVariable, that will not be copied ?

image

Copy link
Contributor

@AltamashShaikh AltamashShaikh left a comment

Choose a reason for hiding this comment

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

@snake14 Looks good to me left 2 comments rest works as expected.

@snake14
Copy link
Contributor Author

snake14 commented Nov 27, 2024

@snake14 Should we add a note here, explaining that for customVariables if its referring to any other customVariable, that will not be copied ?

@AltamashShaikh I don't think that's necessary, because it does copy referenced variables, unless there's a similar one already existing. So, if you're copying to the same container, it reuses the referenced variables. If copying to a different container, it checks if any variables in that container match the referenced variable before making a copy. That's the behaviour for copying containers, tags, triggers, and variables.

Is that not the behaviour that you're seeing?

@snake14
Copy link
Contributor Author

snake14 commented Nov 27, 2024

@snake14 Found 1 edge case

  1. Copy a trigger
  2. It will display the success notification with the URL to navigate
  3. Now delete the new copied variable and you will see the notification still stays and it takes you to an empty edit trigger

Thank you for catching that @AltamashShaikh . I updated the view to hide the success notification when I trigger is deleted. I went ahead and applied the same change for containers, tags, and variables as well.

@AltamashShaikh
Copy link
Contributor

n't think that's necessary, because it does copy referenced variables, unless there's a similar one already existing. So, if you're copying to the same container, it reuses the referenced variables. If copying to a different container, it checks if any variables in that container match the referenced variable before making a copy. That's the behaviour for copying containers, tags, triggers, and variables.

Okay 👍

@snake14 snake14 merged commit 2d40232 into 5.x-dev Nov 28, 2024
5 checks passed
@snake14 snake14 deleted the PG-3961-copy-trigger branch November 28, 2024 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "duplicate variable" functionality Add "Duplicate trigger" functionality
2 participants