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

StatPanel: Fix stat panel display name not showing when explicitly set #26616

Merged
merged 3 commits into from
Jul 28, 2020

Conversation

torkelo
Copy link
Member

@torkelo torkelo commented Jul 27, 2020

Fixes #26583

A bit conflicted on how to solve this or if it should be solved. with Text mode set to Auto should stat panel show display name if set via Field tab default? what about via override? I started on a fix like that, to check in StatPanel.tsx if fieldConfig.defaults.displayName was set and then switch text mode to value and name (passed to BigValue). But not sure, maybe Auto should just be if count === 1 then do not show name, if you want to show name if count === 1 you have to change display name. and to fix broken old dashboards instead of adding logic in StatPanel.tsx we can do a migration that for panels with default displayName set we change textMode. Only downside with that users will try to change Display name and it won't have any effect when text mode set to Auto.

@torkelo torkelo requested review from a team, hugohaggmark, peterholmberg and ryantxu and removed request for a team, hugohaggmark and peterholmberg July 27, 2020 07:56
@torkelo torkelo changed the title StatPanel: Fix stat panel display name now showing when explicitly set StatPanel: Fix stat panel display name not showing when explicitly set Jul 27, 2020
@ryantxu
Copy link
Member

ryantxu commented Jul 27, 2020

This approach seems OK. We may also want to check if the panel title is set? In the example on #26583, the missing panel title makes the auto behavior less than great

@ryantxu
Copy link
Member

ryantxu commented Jul 27, 2020

what about via override?

I don't think so -- this feels a little better and should avoid most weird cases

@torkelo
Copy link
Member Author

torkelo commented Jul 27, 2020

@ryantxu added panel title to PanelProps so the auto logic can also take that into consideration

@torkelo torkelo merged commit cbe1d7b into master Jul 28, 2020
@torkelo torkelo deleted the fix-stat-panel-display-name branch July 28, 2020 05:28
@torkelo torkelo added this to the 7.1.2 milestone Aug 2, 2020
hugohaggmark pushed a commit that referenced this pull request Aug 5, 2020
#26616)

* StatPanel: Fix stat panel display name now showing when explicitly set

* StatPanel: Updarted auto mode to also take panel title into consideration

* fixed test

(cherry picked from commit cbe1d7b)
hugohaggmark pushed a commit that referenced this pull request Aug 5, 2020
#26616)

* StatPanel: Fix stat panel display name now showing when explicitly set

* StatPanel: Updarted auto mode to also take panel title into consideration

* fixed test

(cherry picked from commit cbe1d7b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stat Panel: display name not showing when text mode set to Auto and explicitly set in field config
3 participants