Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Value transformation _n_ doesn't work #107

Open
valaz opened this issue Oct 25, 2019 · 9 comments
Open

[Bug] Value transformation _n_ doesn't work #107

valaz opened this issue Oct 25, 2019 · 9 comments
Labels
bug Something isn't working

Comments

@valaz
Copy link

valaz commented Oct 25, 2019

Describe the bug
_n_ transformation works great for Row Name and Col Name, but doesn't work for Value Template

Screenshots
image

Version Details:

  • Grafana version : 6.4.0
  • Plugin version : 1.3.0

Additional context

@valaz valaz added the bug Something isn't working label Oct 25, 2019
@yesoreyeram
Copy link
Owner

It does usually work. What does the debug mode says? How your metrics look like?

@valaz
Copy link
Author

valaz commented Oct 26, 2019

with debug
image

@valaz
Copy link
Author

valaz commented Oct 27, 2019

@yesoreyeram could you please take a look to debug screenshot?

@scorsair
Copy link

scorsair commented Dec 2, 2019

Agree. This is very annoying bug. Tested it with the latest plugin and 3.3, 3.4, 3.5 Grafana's.
bug

@cklos
Copy link

cklos commented Apr 21, 2020

Hi,
I downloaded the 1.3 version from https://grafana.com/api/plugins/yesoreyeram-boomtable-panel/versions/1.3.0/download

replacing in the file dist/app/boom/BoomSeries.js the lines:

                BoomSeries.prototype.replaceTokens = function (templateSrv, scopedVars, series) {
                    var _this = this;
                    this.link = this.seriesName.split(this.pattern.delimiter || ".").reduce(function (r, it, i) {
                        return r.replace(new RegExp(_this.row_col_wrapper + i + _this.row_col_wrapper, "g"), it);
                    }, this.link);
                    this.row_name = this.template_row_name.replace(new RegExp("_series_", "g"), this.seriesName.toString());
                    this.col_name = this.template_col_name.replace(new RegExp("_series_", "g"), this.seriesName.toString());
                    this.link = this.link.replace(new RegExp("_series_", "g"), this.seriesName.toString().trim());
                    this.tooltip = this.tooltip.replace(new RegExp("_series_", "g"), this.seriesName.toString().trim());
                    this.display_value = this.template_value.replace(new RegExp("_series_", "g"), this.seriesName.toString());

with

                BoomSeries.prototype.replaceTokens = function (templateSrv, scopedVars, series) {
                    var _this = this;
                    this.link = this.seriesName.split(this.pattern.delimiter || ".").reduce(function (r, it, i) {
                        return r.replace(new RegExp(_this.row_col_wrapper + i + _this.row_col_wrapper, "g"), it);
                    }, this.link);
                    this.display_value = this.seriesName.split(this.pattern.delimiter || ".").reduce(function (r, it, i) {
                        return r.replace(new RegExp(_this.row_col_wrapper + i + _this.row_col_wrapper, "g"), it);
                    }, this.template_value);
                    this.row_name = this.template_row_name.replace(new RegExp("_series_", "g"), this.seriesName.toString());
                    this.col_name = this.template_col_name.replace(new RegExp("_series_", "g"), this.seriesName.toString());
                    this.link = this.link.replace(new RegExp("_series_", "g"), this.seriesName.toString().trim());
                    this.tooltip = this.tooltip.replace(new RegExp("_series_", "g"), this.seriesName.toString().trim());
                    this.display_value = this.display_value.replace(new RegExp("_series_", "g"), this.seriesName.toString());

solved the problem for me. In the current repo state the files are completely different so that I wasn't able to fix that (if it's still a problem) and create a pull request.

I hope this helps. I attached a zipped version of the modified file.
BoomSeries.zip

If it will not work, try modifying the lines in the src/app/boom/BoomSeries.ts file accordingly (I just tested modifying both files, but I'm sure its enough to modify the dist version).

@yesoreyeram
Copy link
Owner

Guys. Sorry bit busy in other day to day stuff. If you can send PR, happy to approve.

@valaz
Copy link
Author

valaz commented Apr 27, 2020

I confirm thath fix from @cklos works perfectly.
@cklos your PR may help to other users

@cklos
Copy link

cklos commented Apr 27, 2020

Hi, the current code in the master has a different structure where I was not able to find the right place to fix the problem. I'll try to find some time to fix also the current version of the code.

@xVytis
Copy link

xVytis commented Dec 18, 2020

I found this condition. After enabling value override with empty transformation string everything should work fine.

Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants