network-weathermap: Editor on Cacti not working (PHP Weathermap version 1.0.0dev)
Hello. Editor not work correctly. When I open editor, browser console have next error:
ncaught SyntaxError: Unexpected token <
jquery.min.js:2 jQuery.Deferred exception: fromplug is not defined ReferenceError: fromplug is not defined
at attach_click_events (http://noc/cacti/plugins/weathermap/editor-resources/editor.js:83:5)
at HTMLDocument.initJS (http://noc/cacti/plugins/weathermap/editor-resources/editor.js:59:9)
at j (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:29999)
at k (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:30313) undefined
r.Deferred.exceptionHook @ jquery.min.js:2
jquery.min.js:2 jQuery.Deferred exception: imlist is not defined ReferenceError: imlist is not defined
at HTMLDocument.initJS16 (http://noc/cacti/plugins/weathermap/editor-resources/editor16.js:13:17)
at j (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:29999)
at k (http://noc/cacti/plugins/weathermap/vendor/jquery/dist/jquery.min.js:2:30313) undefined
r.Deferred.exceptionHook @ jquery.min.js:2
jquery.min.js:2 Uncaught ReferenceError: fromplug is not defined
at attach_click_events (editor.js:83)
at HTMLDocument.initJS (editor.js:59)
at j (jquery.min.js:2)
at k (jquery.min.js:2)
jquery.min.js:2 Uncaught ReferenceError: imlist is not defined
at HTMLDocument.initJS16 (editor16.js:13)
at j (jquery.min.js:2)
at k (jquery.min.js:2)
and on cacti log:
2018/01/31 10:02:35 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/weathermap/weathermap-cacti10-plugin-editor.php: 25 require_once)(/plugins/weathermap/editor.php: 34 main)(/plugins/weathermap/lib/Weathermap/Editor/EditorUI.php: 932 showMainPage)(/plugins/weathermap/lib/Weathermap/Editor/EditorUI.php: 1123 fetch)(/plugins/weathermap/lib/Weathermap/UI/SimpleTemplate.php: 48 include)(/plugins/weathermap/editor-resources/templates/main-oldstyle.php: 28 CactiErrorHandler)(/lib/functions.php: 4516 cacti_debug_backtrace)
--
2018/01/31 10:02:35 - ERROR PHP NOTICE in Plugin 'weathermap': Use of undefined constant host_url - assumed 'host_url' in file: /var/www/data/cacti/plugins/weathermap/editor-resources/templates/main-oldstyle.php on line: 28
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 35 (32 by maintainers)
Commits related to this issue
- Host URL and details are passed through to editor correctly (#126) — committed to howardjones/network-weathermap by howardjones 6 years ago
- Move javascript cleanup for editor (#126) — committed to howardjones/network-weathermap by howardjones 6 years ago
- Editor shows picker when coming from cacti (not reversed). Picker doesn't crash. Mgmt app shows editor links. (#126) — committed to howardjones/network-weathermap by howardjones 6 years ago
- Adding links works (#126). Map properties is populated (but still doesn't update) (#126) Translation correction in mgmt app. — committed to howardjones/network-weathermap by howardjones 6 years ago
- Map Style dialog actually works (#126) — committed to howardjones/network-weathermap by howardjones 6 years ago
- Took out 'todo' notes from bottom of editor. Editor might actually be complete? (#126) — committed to howardjones/network-weathermap by howardjones 6 years ago
- Fixed 'target' error in picker. Also implemented the dsstats checkbox, and fixed some issues with checkboxes not keeping their settings (#126) — committed to howardjones/network-weathermap by howardjones 6 years ago
@howardjones You’re getting things closer so people’s expectations are raising 😉
Ok, now I have link for choose data source and it’s work.
But I have many device name on Cyrillic (russian) my database have utf8mb4 collection and it’s dafault charset for cacti:
Agreed (re: error reporting).
Also, a bug in your fix 😉 The value for host_url is a string, so the actual change is:
(with the quotes)
Just testing a slightly wider patch that actually sets the value though 😉
The second can be fixed by editing
editor-resources/templates/main-oldstyle.phpat line 28 and changing it to:However, do note that
$host_urlor the$tpl->set("host_url");isn’t actually primed with the correct URL yet (or I’ve missed how it was set).