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

Fixes #24563: JS error when opening directive form more than once #5505

Conversation

clarktsiory
Copy link
Contributor

@clarktsiory clarktsiory requested a review from fanf March 21, 2024 15:47
@clarktsiory clarktsiory marked this pull request as draft March 21, 2024 15:47
downloadsUrl: apiPath,
dir: "/",
hasWriteRights : hasWriteRights,
initRun : true;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a syntax error so the app was not even functioning in the Directives page...
I removed the whole script to keep the same behavior, it looks like it does nothing at all in this page

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

Comment on lines +10 to +12
<script type="text/javascript" data-lift="with-cached-resource" src="/javascript/rudder/elm/rudder-filemanager.js"></script>
<script type="text/javascript" data-lift="with-cached-resource" src="/javascript/rudder/elm/rudder-tags.js"></script>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those two lines were moved up here from a nested container for each directive

Comment on lines 35 to +55
<div data-lift="configuration.DirectiveManagement.userLibrary" ></div>
<script>
var main = document.getElementById("filters-app")
var initValues = {
contextPath : contextPath,
objectType : "directive"
};
filterApp = Elm.Filters.init({node: main, flags: initValues});
filterApp.ports.toggleTree.subscribe(function(result) {
toggleTree('#activeTechniquesTree', this);
});
filterApp.ports.searchTree.subscribe(function(filters) {
$("#activeTechniquesTree").jstree("searchtag", filters.filter, filters.tags, {"key":false , "value":false});
});
filterApp.ports.sendFilterTags.subscribe(function(tags) {
if (typeof tagsApp === "undefined") return false;
tagsApp.ports.getFilterTags.send(tags);
});
$(".bsTooltip").bsTooltip({container: "#boxDirectiveTree" })
</script>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The script was within the configuration.DirectiveManagement.userLibrary template which updates (destroys) itself after a directive is created, so we also need to move it up here

@clarktsiory clarktsiory requested review from RaphaelGauthier and removed request for fanf March 21, 2024 16:23
@clarktsiory clarktsiory force-pushed the bug_24563/js_error_when_opening_directive_form_more_than_once branch from b1cde4e to 6ae13a6 Compare March 21, 2024 16:25
@clarktsiory
Copy link
Contributor Author

PR rebased

@clarktsiory clarktsiory marked this pull request as ready for review March 21, 2024 16:26
@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/5505
-- Your faithful QA
Kant merge: "Thoughts without content are empty, intuitions without concepts are blind."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/82018/console)

@clarktsiory
Copy link
Contributor Author

OK, squash merging this PR

@clarktsiory clarktsiory force-pushed the bug_24563/js_error_when_opening_directive_form_more_than_once branch from 4db95d9 to 52a353b Compare March 25, 2024 08:49
@clarktsiory
Copy link
Contributor Author

OK, merging this PR

@clarktsiory clarktsiory merged commit 52a353b into Normation:branches/rudder/8.0 Mar 25, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants