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

missing ValueMappingsEditor and ThresholdsEditor export #26554

Closed
vankop opened this issue Jul 23, 2020 · 3 comments
Closed

missing ValueMappingsEditor and ThresholdsEditor export #26554

vankop opened this issue Jul 23, 2020 · 3 comments

Comments

@vankop
Copy link
Contributor

vankop commented Jul 23, 2020

What happened:

in @grafana/ui@6.7 there is export ValueMappingsEditor and ThresholdsEditor from @grafana/ui/components. in @grafana/ui@7 this exports are missing.
I have checked that code exists in bundle 7.0.x and 7.1.0, but exports is missing.

What you expected to happen:

export ValueMappingsEditor and ThresholdsEditor

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Will be pleased if storybook will be plugin developers friendly and ccomponents will be exports starting from @grafana/ui specifier.
Снимок экрана 2020-07-23 в 20 27 28

This actually solves problem above since story will not work as expected (export is missing)

Tip: enhance webpack storybook config with

{
    resolve: {
            alias: {
                  "@grafana/ui": path.resolve(__dirname, "<relative path to grafana-ui dir>")
            }
    }
}

with webpack@5 you could define exports field and use self-referencing by default

Environment:

  • Grafana version: 7
  • Data source type & version:
  • OS Grafana is installed on:
  • User OS & Browser:
  • Grafana plugins:
  • Others:
@vankop
Copy link
Contributor Author

vankop commented Jul 23, 2020

I will send a fix..

@torkelo
Copy link
Member

torkelo commented Jul 24, 2020

These are not designed to be used directly but via the field config system.

export const plugin = new PanelPlugin<StatPanelOptions>(StatPanel)
  .useFieldConfig()

useFieldConfig allows you to add thresholds (part of standard field config options). same with value mappings

@torkelo torkelo closed this as completed Jul 24, 2020
@CrashLaker
Copy link

CrashLaker commented Jan 26, 2021

Hi @torkelo ,

Could you elaborate more on this?
I'm trying to add ThresholdsEditor inside .setPanelOptions builder.
I don't get it why they weren't designed to be imported directly.

edit:
ok i got it now.
simply calling .useFieldConfig() a bunch of additional config Field Overrides magically shows up
awesome

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

Successfully merging a pull request may close this issue.

3 participants