From cddcdba3c9be7e32454d0c54efd1d60e7cef7518 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:21:35 +0200 Subject: Adding upstream version 1.2.4. Signed-off-by: Daniel Baumann --- public/js/module.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'public/js') diff --git a/public/js/module.js b/public/js/module.js index a2a32f2..89c1a54 100644 --- a/public/js/module.js +++ b/public/js/module.js @@ -79,7 +79,15 @@ container.querySelectorAll('img.graphiteImg[data-actualimageurl]').forEach(img => { let params = { ...this.colorParams }; // Theming ftw! params.r = (new Date()).getTime(); // To bypass the browser cache - params.width = img.scrollWidth; // It's either fixed or dependent on parent width + params.width = img.scrollWidth; + if ('width' in img.dataset) { + // If the width is defined in the data attributes, it has been explicitly defined in a template and + // therefore must be handled specially. In detail areas the image must not be scaled to 100% and + // in the other views it must not exceed the width of the parent container. + // Note the `+str` which will convert str to number. + params.width = Math.min(+img.dataset.width, img.parentElement.clientWidth); + img.style.width = params.width + 'px'; + } img.src = this.icinga.utils.addUrlParams(img.dataset.actualimageurl, params); }); -- cgit v1.2.3