@digitalnodecom/node-red-contrib-analyzer
Version:
A Node-RED global service that monitors function nodes for debugging artifacts and performance issues. Features real-time quality metrics, Vue.js dashboard, and comprehensive code analysis.
46 lines (41 loc) • 4.64 kB
HTML
<!-- Analyzer Button Script -->
<script type="text/javascript">
// Add Analyzer button to Node-RED header
(function() {
function addAnalyzerButton() {
// Check if button already exists
if (document.getElementById('red-ui-header-button-analyzer')) {
return;
}
const deployButton = document.getElementById('red-ui-header-button-deploy');
if (deployButton && deployButton.parentElement) {
// Create the analyzer button
const analyzerButton = document.createElement('a');
analyzerButton.id = 'red-ui-header-button-analyzer';
analyzerButton.className = 'button';
analyzerButton.href = '/analyzer';
analyzerButton.target = '_blank';
analyzerButton.style.paddingTop = '0';
analyzerButton.style.paddingBottom = '0';
analyzerButton.style.width = '30px';
analyzerButton.style.height = '30px';
analyzerButton.style.display = 'inline-flex';
analyzerButton.style.alignItems = 'center';
analyzerButton.style.justifyContent = 'center';
analyzerButton.innerHTML = '<svg width="30" height="30" viewBox="0 0 448 448" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M392 0H56C25.0721 0 0 25.0721 0 56V392C0 422.928 25.0721 448 56 448H392C422.928 448 448 422.928 448 392V56C448 25.0721 422.928 0 392 0Z" fill="#8F0000"/><path d="M343 111.958V161.75C343 164.391 341.951 166.924 340.083 168.792C338.216 170.659 335.683 171.708 333.042 171.708C330.401 171.708 327.868 170.659 326 168.792C324.132 166.924 323.083 164.391 323.083 161.75V121.917H283.25C280.609 121.917 278.076 120.867 276.208 119C274.341 117.132 273.292 114.599 273.292 111.958C273.292 109.317 274.341 106.784 276.208 104.917C278.076 103.049 280.609 102 283.25 102H333.042C335.683 102 338.216 103.049 340.083 104.917C341.951 106.784 343 109.317 343 111.958ZM163.75 321.083H123.917V281.25C123.917 278.609 122.867 276.076 121 274.208C119.132 272.341 116.599 271.292 113.958 271.292C111.317 271.292 108.784 272.341 106.917 274.208C105.049 276.076 104 278.609 104 281.25V331.042C104 333.683 105.049 336.216 106.917 338.083C108.784 339.951 111.317 341 113.958 341H163.75C166.391 341 168.924 339.951 170.792 338.083C172.659 336.216 173.708 333.683 173.708 331.042C173.708 328.401 172.659 325.868 170.792 324C168.924 322.132 166.391 321.083 163.75 321.083ZM333.042 271.292C330.401 271.292 327.868 272.341 326 274.208C324.132 276.076 323.083 278.609 323.083 281.25V321.083H283.25C280.609 321.083 278.076 322.132 276.208 324C274.341 325.868 273.292 328.401 273.292 331.042C273.292 333.683 274.341 336.216 276.208 338.083C278.076 339.951 280.609 341 283.25 341H333.042C335.683 341 338.216 339.951 340.083 338.083C341.951 336.216 343 333.683 343 331.042V281.25C343 278.609 341.951 276.076 340.083 274.208C338.216 272.341 335.683 271.292 333.042 271.292ZM113.958 171.708C116.599 171.708 119.132 170.659 121 168.792C122.867 166.924 123.917 164.391 123.917 161.75V121.917H163.75C166.391 121.917 168.924 120.867 170.792 119C172.659 117.132 173.708 114.599 173.708 111.958C173.708 109.317 172.659 106.784 170.792 104.917C168.924 103.049 166.391 102 163.75 102H113.958C111.317 102 108.784 103.049 106.917 104.917C105.049 106.784 104 109.317 104 111.958V161.75C104 164.391 105.049 166.924 106.917 168.792C108.784 170.659 111.317 171.708 113.958 171.708ZM163.75 151.792H283.25C285.891 151.792 288.424 152.841 290.292 154.708C292.159 156.576 293.208 159.109 293.208 161.75V281.25C293.208 283.891 292.159 286.424 290.292 288.292C288.424 290.159 285.891 291.208 283.25 291.208H163.75C161.109 291.208 158.576 290.159 156.708 288.292C154.841 286.424 153.792 283.891 153.792 281.25V161.75C153.792 159.109 154.841 156.576 156.708 154.708C158.576 152.841 161.109 151.792 163.75 151.792ZM173.708 271.292H273.292V171.708H173.708V271.292Z" fill="white"/></svg>';
// Insert before the deploy button
deployButton.parentElement.insertBefore(analyzerButton, deployButton);
} else {
// If deploy button not found yet, try again
setTimeout(addAnalyzerButton, 500);
}
}
// Try to add button when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', addAnalyzerButton);
} else {
// DOM already loaded
setTimeout(addAnalyzerButton, 100);
}
})();
</script>