diff --git a/src/WebAppDIRAC/WebApp/handler/AccountingHandler.py b/src/WebAppDIRAC/WebApp/handler/AccountingHandler.py index 6c72c908e..5a10545eb 100644 --- a/src/WebAppDIRAC/WebApp/handler/AccountingHandler.py +++ b/src/WebAppDIRAC/WebApp/handler/AccountingHandler.py @@ -209,14 +209,14 @@ def web_generatePlot(self, typeName, plotName, timeSelector: int, grouping, **kw return {"success": True, "data": retVal["Value"]["plot"]} return {"success": False, "errors": retVal["Message"]} - def web_getPlotImg(self, file=None, **kwargs): + def web_getPlotImg(self, fileName=None, **kwargs): """Get plot image :param str file: file path :return: dict """ - plotImageFile = file + plotImageFile = fileName if not plotImageFile: return {"success": "false", "error": "Maybe you forgot the file?"} # Prevent directory traversal @@ -231,14 +231,14 @@ def web_getPlotImg(self, file=None, **kwargs): data = tempFile.read() return FileResponse(data, plotImageFile, "png") - def web_getPlotImgFromCache(self, file=None, **kwargs): + def web_getPlotImgFromCache(self, fileName=None, **kwargs): """Get plot image from cache. :param str file: file path :return: dict """ - plotImageFile = file + plotImageFile = fileName if not plotImageFile: return {"success": "false", "error": "Maybe you forgot the file?"} diff --git a/src/WebAppDIRAC/WebApp/handler/MonitoringHandler.py b/src/WebAppDIRAC/WebApp/handler/MonitoringHandler.py index 99b37929f..c069bec18 100644 --- a/src/WebAppDIRAC/WebApp/handler/MonitoringHandler.py +++ b/src/WebAppDIRAC/WebApp/handler/MonitoringHandler.py @@ -43,10 +43,11 @@ def __getUniqueKeyValues(self, typeName): MonitoringHandler.__keysCache.add(cacheKey, 300, data) return data - def web_getSelectionData(self, monitoringType): + def web_getSelectionData(self, type, **kwargs): + typeName = type callback = {} # Get unique key values - if not (retVal := self.__getUniqueKeyValues(monitoringType))["OK"]: + if not (retVal := self.__getUniqueKeyValues(typeName))["OK"]: return {"success": "false", "result": "", "error": retVal["Message"]} records = {} @@ -55,7 +56,7 @@ def web_getSelectionData(self, monitoringType): length = len(retVal["Value"][record]) if length > 10000: records[record] = retVal["Value"][record][length - 5000 :] - message = f"The {monitoringType} monitoring type contains too many rows: {record} -> {length}" + message = f"The {typeName} monitoring type contains too many rows: {record} -> {length}" message += " Note: Only 5000 rows are returned!" gLogger.warn(message) else: @@ -63,11 +64,11 @@ def web_getSelectionData(self, monitoringType): callback["selectionValues"] = records # Cache for plotsList? - if not (data := MonitoringHandler.__keysCache.get(f"reportsList:{monitoringType}")): - if not (retVal := MonitoringClient().listReports(monitoringType))["OK"]: + if not (data := MonitoringHandler.__keysCache.get(f"reportsList:{typeName}")): + if not (retVal := MonitoringClient().listReports(typeName))["OK"]: return {"success": "false", "result": "", "error": retVal["Message"]} data = retVal["Value"] - MonitoringHandler.__keysCache.add(f"reportsList:{monitoringType}", 300, data) + MonitoringHandler.__keysCache.add(f"reportsList:{typeName}", 300, data) callback["plotsList"] = data return {"success": "true", "result": callback} diff --git a/src/WebAppDIRAC/WebApp/static/DIRAC/SiteSummary/classes/OverviewPanel.js b/src/WebAppDIRAC/WebApp/static/DIRAC/SiteSummary/classes/OverviewPanel.js index 3b3b700b5..57b6f833b 100644 --- a/src/WebAppDIRAC/WebApp/static/DIRAC/SiteSummary/classes/OverviewPanel.js +++ b/src/WebAppDIRAC/WebApp/static/DIRAC/SiteSummary/classes/OverviewPanel.js @@ -569,7 +569,8 @@ Ext.define("DIRAC.SiteSummary.classes.OverviewPanel", { var width = 99 / 2; width = "." + Math.round(width); for (var i = 0; i < jsonData.result.length; i++) { - var src = GLOBAL.BASE_URL + jsonData.result[i].Type + "/getPlotImg?file=" + jsonData.result[i].src + "&nocache=" + new Date().getTime(); + var src = + GLOBAL.BASE_URL + jsonData.result[i].Type + "/getPlotImg?fileName=" + jsonData.result[i].src + "&nocache=" + new Date().getTime(); var img = me.plotPanel.items.getAt(i); img.setSrc(src); img.setLoading("Loading..."); diff --git a/src/WebAppDIRAC/WebApp/static/core/js/utils/PlotView.js b/src/WebAppDIRAC/WebApp/static/core/js/utils/PlotView.js index ffd196bd6..6d5383c6e 100755 --- a/src/WebAppDIRAC/WebApp/static/core/js/utils/PlotView.js +++ b/src/WebAppDIRAC/WebApp/static/core/js/utils/PlotView.js @@ -422,7 +422,7 @@ Ext.define("Ext.dirac.utils.PlotView", { var response = Ext.JSON.decode(response.responseText); if (response["success"]) { - var src = GLOBAL.BASE_URL + requestHandler + "/getPlotImg?file=" + response["data"]; + var src = GLOBAL.BASE_URL + requestHandler + "/getPlotImg?fileName=" + response["data"]; me.rightPanel.replaceImage(image, src, oParams); } else { GLOBAL.APP.CF.alert(response["errors"], "error"); @@ -505,7 +505,7 @@ Ext.define("Ext.dirac.utils.PlotView", { var response = Ext.JSON.decode(response.responseText); if (response["success"]) { - var src = GLOBAL.BASE_URL + me.scope.handlers[me.reportType] + "/getPlotImg?file=" + response["data"]; + var src = GLOBAL.BASE_URL + me.scope.handlers[me.reportType] + "/getPlotImg?fileName=" + response["data"]; me.setSrc(src); diff --git a/src/WebAppDIRAC/WebApp/static/core/js/utils/Presenter.js b/src/WebAppDIRAC/WebApp/static/core/js/utils/Presenter.js index a682b304f..03e88a6bf 100644 --- a/src/WebAppDIRAC/WebApp/static/core/js/utils/Presenter.js +++ b/src/WebAppDIRAC/WebApp/static/core/js/utils/Presenter.js @@ -451,7 +451,7 @@ Ext.define("Ext.dirac.utils.Presenter", { success: function (responseImg) { responseImg = Ext.JSON.decode(responseImg.responseText); if (responseImg["success"]) { - me.replaceImage(value, GLOBAL.BASE_URL + me.scope.handlers[value.reportType] + "/getPlotImg?file=" + responseImg["data"]); + me.replaceImage(value, GLOBAL.BASE_URL + me.scope.handlers[value.reportType] + "/getPlotImg?fileName=" + responseImg["data"]); } }, failure: function (response, opt) { @@ -478,7 +478,7 @@ Ext.define("Ext.dirac.utils.Presenter", { success: function (responseImg) { responseImg = Ext.JSON.decode(responseImg.responseText); if (responseImg["success"]) { - me.replaceImage(value, GLOBAL.BASE_URL + me.scope.handlers[value.reportType] + "/getPlotImg?file=" + responseImg["data"]); + me.replaceImage(value, GLOBAL.BASE_URL + me.scope.handlers[value.reportType] + "/getPlotImg?fileName=" + responseImg["data"]); } }, failure: function (response, opt) { @@ -519,7 +519,7 @@ Ext.define("Ext.dirac.utils.Presenter", { responseImg = Ext.JSON.decode(responseImg.responseText); if (responseImg["success"]) { - value.setSrc(GLOBAL.BASE_URL + me.scope.handlers[value.reportType] + "/getPlotImg?file=" + responseImg["data"]); + value.setSrc(GLOBAL.BASE_URL + me.scope.handlers[value.reportType] + "/getPlotImg?fileName=" + responseImg["data"]); } }, failure: function (response, opt) {