diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-03-25 11:22:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-25 11:22:55 +0000 |
commit | 74eb5a74e243c737cf3c0bec9cf8ea021d70feda (patch) | |
tree | 392a561e26e3f3d9a111e3196f664a82d82980fc /gui-pdp-monitoring/src/webapp/js/MonitoringMain.js | |
parent | 08437c9b0e783ca9629f806df06053604c5ef43a (diff) | |
parent | fd5306f16f1e1f1bd07c706f073d57a700eff603 (diff) |
Merge "add coverage test for JS"
Diffstat (limited to 'gui-pdp-monitoring/src/webapp/js/MonitoringMain.js')
-rw-r--r-- | gui-pdp-monitoring/src/webapp/js/MonitoringMain.js | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js b/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js index 456f3a9..9198d63 100644 --- a/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js +++ b/gui-pdp-monitoring/src/webapp/js/MonitoringMain.js @@ -64,46 +64,48 @@ function servicesCallback(data){ /* * Called after the DOM is ready */ -$(document).ready( - function() { - window.restRootURL = location.protocol +function readyCallback() { + window.restRootURL = location.protocol + "//" + window.location.hostname + ':' + config.restPort + (location.pathname.endsWith("/monitoring/") ? location.pathname.substring(0, location.pathname.indexOf("monitoring/")) : location.pathname) + "papservices/monitoring/"; - // Initialize tooltip for the charts - initTooltip(); + // Initialize tooltip for the charts + initTooltip(); - // Set up the structure of the page - setUpPage(true); + // Set up the structure of the page + setUpPage(true); - // Check cookies for engine URL - getEngineURL(); + // Check cookies for engine URL + getEngineURL(); - // Add click event to config icon for clearing engine URL - $(".ebSystemBar-config").click( - function() { + // Add click event to config icon for clearing engine URL + $(".ebSystemBar-config").click( + function() { // Clear the engine URL clearEngineURL(true); // Request the engine URL getEngineURL(); - } - ); + } + ); - ['hashchange', 'load'].forEach(event => window.addEventListener(event, function() { - // Get ID from url - window.id = window.location.hash.replace('#', ''); - if (window.id !== ''){ - var arr = window.id.split("/"); - window.groupName = arr[0]; - window.subGroupName = arr[1]; - highlightSelected(window.id); - ajax_get_statistics(restRootURL + "statistics/", servicesCallback, - window.services.useHttps, window.services.hostname, window.services.port, - window.services.username, window.services.password, window.id); - } - })); - } -);
\ No newline at end of file + ['hashchange', 'load'].forEach(event => window.addEventListener(event, function () { + // Get ID from url + window.id = window.location.hash.replace('#', ''); + if (window.id !== '') { + var arr = window.id.split("/"); + window.groupName = arr[0]; + window.subGroupName = arr[1]; + highlightSelected(window.id); + ajax_get_statistics(restRootURL + "statistics/", servicesCallback, + window.services.useHttps, window.services.hostname, window.services.port, + window.services.username, window.services.password, window.id); + } + })); +} + +$(document).ready(readyCallback); +// Export for unit testing +export { readyCallback, servicesCallback };
\ No newline at end of file |