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

PanelPlugin: Allow hiding standard field config from defaults #70303

Merged
merged 1 commit into from
Jun 21, 2023

Conversation

dprokop
Copy link
Member

@dprokop dprokop commented Jun 19, 2023

Ref #70202

This PR allows standard field config configuration for the panel plugin to only be available as an override. It builds on top of standard options configuration API by extending it with hideFromDefaults property that's equivalent to the custom field config configuration [1]

Usage:

new PanelPlugin<Options>(SomePanel)
  .useFieldConfig({
    standardOptions: {
      [FieldConfigProperty.Min]: {
        hideFromDefaults: true,
      },
      [FieldConfigProperty.Max]: {
        hideFromDefaults: true,
      },
    },
  })

@leeoniya let me know if this will be sufficient for your needs.

[1]. Custom field config existing API, example in the wild: https://github.com/grafana/grafana/blob/field-config-hide-from-defaults/public/app/plugins/panel/heatmap/module.tsx#L38

useCustomConfig: (builder) => {
  builder.addCustomEditor<void, ScaleDistributionConfig>({
    ...,
    hideFromDefaults: true,
  })
}

@dprokop dprokop requested review from grafanabot and a team as code owners June 19, 2023 08:02
@dprokop dprokop requested review from joshhunt, eledobleefe and academo and removed request for a team June 19, 2023 08:02
@dprokop dprokop self-assigned this Jun 19, 2023
@dprokop dprokop requested review from mckn and leeoniya and removed request for joshhunt and eledobleefe June 19, 2023 08:02
@dprokop dprokop added this to the 10.0.x milestone Jun 19, 2023
@grafanabot
Copy link
Contributor

Hello @dprokop!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If the pull request modifies CI behaviour, please add the type/ci label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

Copy link
Contributor

@mckn mckn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dprokop dprokop modified the milestones: 10.0.x, 10.1.x Jun 19, 2023
@dprokop dprokop added no-backport Skip backport of PR and removed backport v10.0.x missing-labels labels Jun 19, 2023
Copy link
Contributor

@leeoniya leeoniya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, works as advertised :shipit:

thanks!

@leeoniya leeoniya merged commit 7039c39 into main Jun 21, 2023
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants