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

Status Panel breaks with Grafana 6.7.0 #159

Closed
hseffler opened this issue Mar 20, 2020 · 29 comments
Closed

Status Panel breaks with Grafana 6.7.0 #159

hseffler opened this issue Mar 20, 2020 · 29 comments

Comments

@hseffler
Copy link

Works up to 6.6.2, breaks in 6.7.0 released yesterday.

Panel rendering error
Cannot read property 'slice' of undefined

@fabian-milea
Copy link

I got the same problem, even with 6.7.1

@simonscheib
Copy link

Yep, exactly the same Problem. After Upgrading to 6.7.1 its broken.
After Downgrad to 6.6.2 it's working again

@MefhigosetH
Copy link
Contributor

MefhigosetH commented Mar 30, 2020

Me too

statusPanel-Grafana67

@MefhigosetH
Copy link
Contributor

MefhigosetH commented Mar 30, 2020

Seems that the problem is in src/status_ctrl.js:L171:

setTextMaxWidth() {
  let tail = ' …';
  let panelWidth = this.$panelContainer.innerWidth();

    if (isNaN(panelWidth))
      panelWidth = parseInt(panelWidth.slice(0, -2), 10) / 12;
    panelWidth = panelWidth - 20;
    this.maxWidth = panelWidth;
}

@sbrandtb
Copy link

I know it is not a satisfying thing to say, but this project looks dead and given that there are backwards-incompatibility issues with panels in Grafana at least once a year, using built-in panels is a much safer bet. Grafana has a new Stat panel, which is less powerful than multistat since it cannot set colors, thresholds and units for time series separately, but might be sufficient in most use cases.

@simonscheib
Copy link

Most likely, one of our internal customers got also some sort of JS errors:
Panel rendering error, panelWidth is undefined

@torkelo
Copy link

torkelo commented Mar 31, 2020

The panel-container class is not accessible like it is here:
https://github.com/Vonage/Grafana_Status_panel/blob/master/src/status_ctrl.js#L637

But if you change it to:
elem.closest('.panel-container');

the panel should start working again. But the way this panel works by accessing core classes outside it's scope (panel-container & panel-header) is very fragile and will break again as these are classes Grafana will change in the future.

@ashoktmw
Copy link

ashoktmw commented Apr 7, 2020

I updated Grafana 6.5 to 6.7 , from that on status panel not working .
I tried to do some changes in the status panel config and it says
“Panel rendering error
Cannot read property ‘slice’ of undefined”

I see already some actions taken here, just posting

@sgolubevCY
Copy link

It seems I've found the solution.
Change this line:
https://github.com/Vonage/Grafana_Status_panel/blob/master/src/status_ctrl.js#L637
like this:
this.$panelContainer = elem;

The elem parameter of method link receives the following DOM subtree:

<grafana-panel ctrl="ctrl" class="panel-height-helper ng-isolate-scope">
  <ng-transclude class="panel-height-helper"><div class="status-panel ng-scope">
    <div ng-show="ctrl.duplicates">...

If I not mistakes, this is a container of the plugin which previously was retrieved by calling elem.find() method.
Anyway, this subtree does not contains object of class 'panel-container'.

@ftasso
Copy link

ftasso commented Apr 7, 2020

Yes, it works!
I'm not sure but there is a small graphic difference, after your suggestion only the internal rectangle color is changing and not the full rectangle containing the status.

Thank you,
Fabrizio

@sgolubevCY
Copy link

Yes, it works!
I'm not sure but there is a small graphic difference, after your suggestion only the internal rectangle color is changing and not the full rectangle containing the status.

Thank you,
Fabrizio

Probably, It was a quick fix. In our case it was OK.

@ftasso
Copy link

ftasso commented Apr 7, 2020

Yes, It's OK also for me simply adding the trasparency to the panel,

@MefhigosetH
Copy link
Contributor

Dear @sgolubevCY , Thanks for share your solution.

Sory, but i'm a JS newbie. After fix the source file, what other command o task need I execute?

I've made the change you suggested on src/status_ctrl.js, and restart Grafana, but my pannels keep blank with no info.

Thanks in advance!

@ftasso
Copy link

ftasso commented Apr 11, 2020

Hello,
You must change also the file in "dist" directory, not only in "src".

Bye

@sgolubevCY
Copy link

sgolubevCY commented Apr 11, 2020

Hi @MefhigosetH,

As @ftasso suggested, you have to change this line in the same file into "dist" folder.

@MefhigosetH
Copy link
Contributor

@ftasso @sgolubevCY Oh, thanks! This 'detail' was the solution.

Now, I can see my pannels :-D

@abadyan-vonage
Copy link
Contributor

Hey everyone.
Unfortunately, we currently don't have the resources to work on this panel.
I think issue is specifically important for continued use. If someone can create a PR to fix this, we'll try to validate and push this in soon.
Thanks and apologies for the inconvenience.

@ktibi
Copy link

ktibi commented Apr 16, 2020

Hey,

your fix solved first issue. But If I try to use two metrics, I have this error :

image

@xkilian
Copy link

xkilian commented Apr 20, 2020

@ktibi This might be related to the issue where if you click on the "Duplicate Query" icon instead of the "Add Query" button. Duplicate Query will break the panel. It seems to copy some internal ID that Status panel references. It is not documented other than in an issue, but that is the way to add more than one metric! Hope this helps. The status plugin works for me with the fix and displays multiple metrics.
Would be great to have a group officially take over this plugin or that the functionality be folded into the official single-stat plugin.

@ktibi
Copy link

ktibi commented Apr 21, 2020

@xkilian Thx your explanation. Add new query instead of duplicate resolve the issue.

@MefhigosetH
Copy link
Contributor

Yes, yes. With the patch sugested by @sgolubevCY , the panel on my dashboards, worked fine again:

multipanel

I hope, the project can merge my PR.

@luciferYu
Copy link

my grafana version is 6.7.2
i have the same problem
image

@freedomwarrior
Copy link

Grafana 6.7.2

Cannot read property 'slice' of undefined
angular.js:14800 TypeError: Cannot read property 'slice' of undefined
    at StatusPluginCtrl.setTextMaxWidth (status_ctrl.js:175)
    at StatusPluginCtrl.onRender (status_ctrl.js:216)
    at u.emit (index.js:150)
    at e.value (emitter.ts:27)
    at StatusPluginCtrl.value (panel_ctrl.ts:102)
    at panel_directive.ts:64
    at angular.js:20566
    at p (angular.js:6428)
    at angular.js:6707 "Possibly unhandled rejection: {}"

@MefhigosetH
Copy link
Contributor

Dear @freedomwarrior , @luciferYu

The issue was fixed with the @sgolubevCY change, on prev messages here.

Or you can review muy PullRequest 161 for known where to apply the neccesary changes.

Cheers

@freedomwarrior
Copy link

Dear @freedomwarrior , @luciferYu

The issue was fixed with the @sgolubevCY change, on prev messages here.

Or you can review muy PullRequest 161 for known where to apply the neccesary changes.

Cheers

Worked!

@rga-madhu
Copy link

i see the issue is fixed but the panel display is not elegant as it used to be as @MefhigosetH mentioned. This needs to fixed too along with the other things.

vkalladath added a commit to vkalladath/Grafana_Status_panel that referenced this issue Jul 6, 2020
@jmorcar
Copy link

jmorcar commented Jul 27, 2020

When could is fixed this issue ? I see workaround applied by @vkalladath in a fork repo , bug the original repo have not a merge with the fix yet.

@pschwippert
Copy link

I would like this to be fixed in the main repository too

@p1bhandari
Copy link

Yes, yes. With the patch sugested by @sgolubevCY , the panel on my dashboards, worked fine again:

multipanel

I hope, the project can merge my PR.

hi can you share the JSON format of the dashboard?

guyellen added a commit to guyellen/Grafana_Status_panel that referenced this issue May 24, 2021
Fixed to support Grafana 7 according to this issue: Vonage#159
guyellen added a commit to guyellen/Grafana_Status_panel that referenced this issue May 24, 2021
Updated according to this issue: Vonage#159
guyellen added a commit to guyellen/Grafana_Status_panel that referenced this issue May 24, 2021
Updated according to this issue: Vonage#159
guyellen added a commit to guyellen/Grafana_Status_panel that referenced this issue May 24, 2021
Updated according to this issue: Vonage#159
guyellen added a commit to guyellen/Grafana_Status_panel that referenced this issue May 24, 2021
Fixed to support Grafana 7 according to this issue: Vonage#159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests