I'm trying to adjust my geometry extension so it works with iTop 3.0.
While doing so, I implemented dictionary entries using the iBackofficeDictEntriesExtension.
Now, when for instance I edit a dashboard page and drag and drop any dashlet, I got a whole bunch of JavaScript being displayed instead. I tracked it down: ajax.render.php did not simply return the name of the ID of the dashlet. The response also contained a whole bunch of JavaScript for said dictionary entries extension.
I believe other AjaxPage elements will be affected as well. Since they're ajax, is it expected to have them return the back office dictionary entries? And if so: how to properly add dictionary entries to the frontend without having it happen in these kind of pages?
Sorry, version is of course 3.0.0
This might be desired behavior if AjaxPage is indeed returning HTML; but not in case of JSON data or in this case where just a simple string is expected.
Last edit: Jeffrey Bostoen 2022-02-07
Hello Jeffrey,
It depends, AjaxPage can return either pure data (some endpoints) or HTML + JS (modals, dashboard editor, ...), this is for compatibility reasons.
JsonPage on the other hand only returns JSON data, this page should be prefered when using data endpoints.
Are you using your own endpoint or one of iTop's?
That being said we had an issue with some endpoint using the wrong kind of page, in that case dictionary files where added. It has been fixed in 3.0.1 by Anne-Catherine
Cheers,
Guillaume
Thanks for the quick feedback!
The endpoint is currently the native ajax.render.php ; where a request is made to get the new dashlet ID (
operation=new_dashlet_id
) (which kind of feels like it should return JSON instead of simply a dashlet name in plain text form).Last edit: Jeffrey Bostoen 2022-02-07
I just checked the GitHub repo, I don't believe it's fixed in this case.
Hello,
Indeed this endpoint returns HTML (
Content-Type: text/html;charset=UTF-8
). But in the code it is an AjaxPage that is intanciated ?!?? (see https://github.com/Combodo/iTop/blob/17e8c53236cf1d2171734da524c99312403ba4b1/pages/ajax.render.php#L1056)Jeffrey you're saying that when adding some dict entries with a iBackofficeDictEntriesExtension impl, you're getting this endpoint to return also all the dict entries ? Can you share a snippet so we can reproduce ?
Correct. When I use that interface, it results in the endpoint returning not just an ID for the dashlet that I want to add to the overview; but it also returns (in HTML so definitely check the raw output and not just the visible stuff) an entire script.
But I'd already expect the call to return JSON instead of HTML, which is a strange implementation choice for this entire new_dashlet_id operation)
Did you manage to replicate this?
Hello,
Sorry for the late answer :/
I was able to reproduce the behavior really easily ! Many thanks for all the elements
I filled a new bug : N°4836
Should be fixed in 33ceab86