From 2b2826c29f455c00c269b4990e2f4dcfbe8c9526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1nar=20Gen=C3=A7?= Date: Fri, 12 Jan 2024 17:09:47 +0300 Subject: [PATCH 1/2] [SER-1086] Chart tooltip injection --- .../javascripts/countly/vue/components/vis.js | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/frontend/express/public/javascripts/countly/vue/components/vis.js b/frontend/express/public/javascripts/countly/vue/components/vis.js index 60fd18c0d6e..6064c8dbbaf 100644 --- a/frontend/express/public/javascripts/countly/vue/components/vis.js +++ b/frontend/express/public/javascripts/countly/vue/components/vis.js @@ -446,6 +446,7 @@ returnObj.grid = {bottom: 40}; returnObj.xAxis.axisLabel.formatter = function(value) { + value = countlyCommon.encodeHtml(value); var ellipsis = "..."; var lengthToTruncate = (Math.floor(maxLen / Math.ceil(longestLabelTextW / labelW)) * 2); if (value.length > lengthToTruncate) { @@ -622,16 +623,16 @@ cap: "round" } }, - formatter: function(params) { + formatter: (params) => { var template = ""; let formatter = self.valFormatter; if (params.seriesType === 'pie') { template += '
\
\
\ -
' + params.seriesName + '
\ -
' + params.data.name + '
\ -
' + formatter(params.data.value) + '
\ +
' + countlyCommon.encodeHtml(params.seriesName) + '
\ +
' + countlyCommon.encodeHtml(params.data.name) + '
\ +
' + formatter(countlyCommon.encodeHtml(params.data.value)) + '
\
\
'; @@ -640,7 +641,7 @@ else { template = "
"; if (params.length > 0) { - template += "" + params[0].axisValueLabel + "
"; + template += "" + countlyCommon.encodeHtml(params[0].axisValueLabel) + "
"; } if (self.sortBy === "index") { @@ -669,10 +670,10 @@ template += '
\
\
\ - ' + params[i].seriesName + '\ + ' + countlyCommon.encodeHtml(params[i].seriesName) + '\
\
\ - ' + (typeof params[i].value === 'object' ? formatter((isNaN(params[i].value[1]) ? 0 : params[i].value[1]), params[i].value, i) : formatter((isNaN(params[i].value) ? 0 : params[i].value), null, i)) + '\ + ' + (typeof params[i].value === 'object' ? formatter((isNaN(countlyCommon.encodeHtml(params[i].value[1])) ? 0 : countlyCommon.encodeHtml(params[i].value[1])), countlyCommon.encodeHtml(params[i].value), i) : formatter((isNaN(params[i].value) ? 0 : countlyCommon.encodeHtml(params[i].value)), null, i)) + '\
\
'; } @@ -728,7 +729,7 @@ fontSize: 12, formatter: function(value) { if (typeof value === "number") { - return countlyCommon.getShortNumber(value); + return countlyCommon.getShortNumber(countlyCommon.encodeHtml(value)); } return value; } @@ -865,7 +866,7 @@ this.patchLegend(options); return options; - } + }, } }); @@ -1112,18 +1113,18 @@
\
'; } - template += '
\ -
#' + filteredNotes[i].indicator + '
\ + template += '
\ +
#' + countlyCommon.encodeHtml(filteredNotes[i].indicator) + '
\
\
\ -
' + filteredNotes[i].owner_name + '
\ +
' + countlyCommon.encodeHtml(filteredNotes[i].owner_name) + '
\
' + moment(filteredNotes[i].ts).format("MMM D, YYYY hh:mm A") + '
\
\
\ - ' + filteredNotes[i].noteType + '\ + ' + countlyCommon.encodeHtml(filteredNotes[i].noteType) + '\
\
\ -
' + filteredNotes[i].note + '
\ +
' + countlyCommon.encodeHtml(filteredNotes[i].note) + '
\
'; if (i === filteredNotes.length) { template = "
"; @@ -1131,20 +1132,19 @@ } } else { - template += '
\ + template += '
\
\
\ -
' + params.data.note.owner_name + '
\ +
' + countlyCommon.encodeHtml(params.data.note.owner_name) + '
\
' + moment(params.data.note.ts).format("MMM D, YYYY hh:mm A") + '
\
\
\ \ \ \ - ' + params.data.note.noteType + '\ + ' + countlyCommon.encodeHtml(params.data.note.noteType) + '\
\
\ -
' + params.data.note.note + '
\
'; } return template; From f8a8f61d04021beb10b4925193da212e9790932a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=B1nar=20Gen=C3=A7?= Date: Fri, 12 Jan 2024 17:10:47 +0300 Subject: [PATCH 2/2] [SER-1086] Chart tooltip injection --- .../express/public/javascripts/countly/vue/components/vis.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/express/public/javascripts/countly/vue/components/vis.js b/frontend/express/public/javascripts/countly/vue/components/vis.js index 6064c8dbbaf..9312f4ff8e5 100644 --- a/frontend/express/public/javascripts/countly/vue/components/vis.js +++ b/frontend/express/public/javascripts/countly/vue/components/vis.js @@ -1145,6 +1145,7 @@ ' + countlyCommon.encodeHtml(params.data.note.noteType) + '\
\
\ +
' + countlyCommon.encodeHtml(params.data.note.note) + '
\ '; } return template;