-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
SingleStat: add a gauge migration call to action button in the editor #18604
Conversation
|
||
// debugger; | ||
// const panel = this.panel as PanelModel; | ||
// importPanelPlugin('gauge').then( gauge => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not work... we need the DashboardPanel to call its update function
I'm not sure how to best get an event there
Made some progress. Figured out a way to trigger panel plugin type change from within an angular panel and made a start on the migration. But then I discovered that the migration handler is not executed on panel type change only on plugin load. So might have to change something in how the migration handler is executed or trigger it from the angular code before panel change. |
Excellent -- works great. I changed from using the
To:
And then needed to rework how the change hander gets triggered so that it passes angular properties along |
@@ -165,7 +165,7 @@ describe('PanelModel', () => { | |||
it('should call react onPanelTypeChanged', () => { | |||
expect(onPanelTypeChanged.mock.calls.length).toBe(1); | |||
expect(onPanelTypeChanged.mock.calls[0][1]).toBe('table'); | |||
expect(onPanelTypeChanged.mock.calls[0][2].fieldOptions).toBeDefined(); | |||
expect(onPanelTypeChanged.mock.calls[0][2].angular).toBeDefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the test to make sure an angular
object is passed to it.
I don't think the previous expectation is correct -- the old
properties when changing from an angular panel would never have fieldOptons
, but the setup (changed in the PR) applied defaults before asking the onPanelTypeChanged callback what it should do
// switch | ||
this.type = pluginId; | ||
this.plugin = newPlugin; | ||
this.applyPluginOptionDefaults(newPlugin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Biggest change here is that applyPluginOptionDefaults
is called after newPlugin.onPanelTypeChanged
This also passes the whole panel object in when switching from angular panels (the angular options are not really stored on oldOptions.options
, rather in oldOptions
directly)
… singlestat-to-gauge
…rame * grafana/master: SingleStat: add a gauge migration call to action button in the editor (grafana#18604) Build: update revive dependency (grafana#18585) LDAP: multildap + ldap integration (grafana#18588) Docker: switch docker image to alpine base with phantomjs support (grafana#18468) Backend: Adds support for HTTP/2 (grafana#18358) Explore: Fixes error when switching from prometheus to loki data sources (grafana#18599) TimePicker: Set time to to 23:59:59 when setting To time using calendar (grafana#18595) Prometheus: Return labels in query results (grafana#18535) Docs: Update changelog and docs for annotation region change (grafana#18593) Refactor: move KeyValue and deprecation warning to @grafana/data (grafana#18582) Annotations: use a single row to represent a region (grafana#17673) Docs: Update upgrading guide (grafana#18547) Docs: Adds tests requirement to bugs checklist (grafana#18576)
* grafana/master: SingleStat: add a gauge migration call to action button in the editor (grafana#18604) Build: update revive dependency (grafana#18585) LDAP: multildap + ldap integration (grafana#18588) Docker: switch docker image to alpine base with phantomjs support (grafana#18468) Backend: Adds support for HTTP/2 (grafana#18358)
* grafana/master: SingleStat: add a gauge migration call to action button in the editor (grafana#18604) Build: update revive dependency (grafana#18585) LDAP: multildap + ldap integration (grafana#18588)
* grafana/master: (202 commits) Azure Monitor and Log Analytics converted and separated into components (grafana#18259) Rewrite user profile edit to react (grafana#17917) Docs: remove codecov badge (grafana#18623) Prometheus: Prevents panel editor crash when switching to Prometheus datasource (grafana#18616) Chore: Rename Popper to Popover (grafana#18543) SingleStat: add a gauge migration call to action button in the editor (grafana#18604) Build: update revive dependency (grafana#18585) LDAP: multildap + ldap integration (grafana#18588) Docker: switch docker image to alpine base with phantomjs support (grafana#18468) Backend: Adds support for HTTP/2 (grafana#18358) Explore: Fixes error when switching from prometheus to loki data sources (grafana#18599) TimePicker: Set time to to 23:59:59 when setting To time using calendar (grafana#18595) Prometheus: Return labels in query results (grafana#18535) Docs: Update changelog and docs for annotation region change (grafana#18593) Refactor: move KeyValue and deprecation warning to @grafana/data (grafana#18582) Annotations: use a single row to represent a region (grafana#17673) Docs: Update upgrading guide (grafana#18547) Docs: Adds tests requirement to bugs checklist (grafana#18576) DataFrame: convert from row based to a columnar value format (grafana#18391) Packages: Temporarily skip canary releases if packages build fail (grafana#18577) ...
* grafana/master: SingleStat: use DataFrame results rather than TimeSeries/TableData (grafana#18580) TestData: attach labels to series results (grafana#18653) Singlestat: Disable new singlestat gauge usage (grafana#18610) Explore: Fixes query field layout in splitted view for Safari browsers (grafana#18654) MSI: new long file names are causing error building MSI (grafana#18646) Auth: change the error HTTP status codes (grafana#18584) Refactor: EmptyListCTA (grafana#18516) Build: Upgrade to go 1.12.9 (grafana#18638) Chore: Revert React 16.9.0 bump (grafana#18634) Azure Monitor and Log Analytics converted and separated into components (grafana#18259) Rewrite user profile edit to react (grafana#17917) Docs: remove codecov badge (grafana#18623) Prometheus: Prevents panel editor crash when switching to Prometheus datasource (grafana#18616) Chore: Rename Popper to Popover (grafana#18543) SingleStat: add a gauge migration call to action button in the editor (grafana#18604) Build: update revive dependency (grafana#18585) LDAP: multildap + ldap integration (grafana#18588)
* grafana/master: SingleStat2: save options to defaults not override (grafana#18666) Packages: Fix path import from grafana/data (grafana#18667) SingleStat: use DataFrame results rather than TimeSeries/TableData (grafana#18580) TestData: attach labels to series results (grafana#18653) Singlestat: Disable new singlestat gauge usage (grafana#18610) Explore: Fixes query field layout in splitted view for Safari browsers (grafana#18654) MSI: new long file names are causing error building MSI (grafana#18646) Auth: change the error HTTP status codes (grafana#18584) Refactor: EmptyListCTA (grafana#18516) Build: Upgrade to go 1.12.9 (grafana#18638) Chore: Revert React 16.9.0 bump (grafana#18634) Azure Monitor and Log Analytics converted and separated into components (grafana#18259) Rewrite user profile edit to react (grafana#17917) Docs: remove codecov badge (grafana#18623) Prometheus: Prevents panel editor crash when switching to Prometheus datasource (grafana#18616) Chore: Rename Popper to Popover (grafana#18543) SingleStat: add a gauge migration call to action button in the editor (grafana#18604) Build: update revive dependency (grafana#18585) LDAP: multildap + ldap integration (grafana#18588)
First step towards #14554
This adds a notice to the singlestat panel asking to be migrated to gauge:
TODO: Help wanted!