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

feat: disable edit/duplicate entry for repeat panel #21257

Merged
merged 2 commits into from
Jan 3, 2020

Conversation

okhowang
Copy link
Contributor

@okhowang okhowang commented Dec 25, 2019

What this PR does / why we need it:

avoid incorrect modify repeated panel

Which issue(s) this PR fixes:

Partially resolve #21142

Special notes for your reviewer:

@torkelo
Copy link
Member

torkelo commented Dec 26, 2019

This code is sadly duplicated for react panels, so needs to be updated here as well: https://github.com/grafana/grafana/blob/master/public/app/features/dashboard/utils/getPanelMenu.ts#L110

@okhowang
Copy link
Contributor Author

react panel updated,
I also add keyboard shortcut checking

return (
dashboard.meta.canEdit &&
dashboard.meta.focusPanelId &&
!dashboard.panels.find(e => e.id === dashboard.meta.focusPanelId)?.repeatPanelId
Copy link
Member

Choose a reason for hiding this comment

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

can you use getPanelById on daashboard model? and not use the ? makes it a bit hard to read. Mabe this should be a function on the the DashboardModel itself, canEditPanel(panelId) can be reused from all locations then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

apologize for be unfamiliar with code.
I have added two method canEditPanel and canEditPanelById in DashboardModel.
and use them in all branch

@okhowang okhowang force-pushed the disable-repeat-edit branch 2 times, most recently from cf7ea05 to 968f696 Compare December 26, 2019 16:11
@okhowang
Copy link
Contributor Author

okhowang commented Jan 3, 2020

can we merge this pr?
any problem else?

Copy link
Member

@torkelo torkelo left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for a bunch for this! ❤️

@torkelo
Copy link
Member

torkelo commented Jan 3, 2020

Looks like there is a conflict in one file so can’t merge, if you can please try to merge with master and fix conflict otherwise I can do that next week

@okhowang
Copy link
Contributor Author

okhowang commented Jan 3, 2020

conflict resolved

@torkelo torkelo merged commit 512a42d into grafana:master Jan 3, 2020
ryantxu added a commit that referenced this pull request Jan 4, 2020
* origin/master:
  NewsPanel: update default feed url (#21342)
  docs: fix influxdb templated dashboard link (#21336)
  Docs: Update Windows.md (#21333)
  Arrow: don't export arrow... breaking phantomjs e2e test (#21331)
  DataFrame: round trip metadata to arrow Table (#21277)
  Prometheus: user metrics metadata to inform query hints (#21304)
  Panel: disable edit/duplicate/delete entry for repeat panel (#21257)
  Prometheus: Disable suggestions at beginning of value (#21302)
  grafana/ui: Do not build in strict mode as grafana/ui depends on non-strict libs (#21319)
@okhowang okhowang deleted the disable-repeat-edit branch January 6, 2020 02:02
ryantxu added a commit that referenced this pull request Jan 6, 2020
* origin/master: (43 commits)
  Docs: Use https scheme for Grafana playground links (#21360)
  fix docs links (#21359)
  AddDatasourcePage: Refactoring & more Phantom plugins (#21261)
  Chore: Remove empty flot.pie file (#21356)
  Docs: Fix link (#21358)
  Docs: Fix InfluxDB templated dashboard link (#21343)
  Rendering: Fix panel PNG rendering when using sub url & serve_from_sub_path = true (#21306)
  NewsPanel: update default feed url (#21342)
  docs: fix influxdb templated dashboard link (#21336)
  Docs: Update Windows.md (#21333)
  Arrow: don't export arrow... breaking phantomjs e2e test (#21331)
  DataFrame: round trip metadata to arrow Table (#21277)
  Prometheus: user metrics metadata to inform query hints (#21304)
  Panel: disable edit/duplicate/delete entry for repeat panel (#21257)
  Prometheus: Disable suggestions at beginning of value (#21302)
  grafana/ui: Do not build in strict mode as grafana/ui depends on non-strict libs (#21319)
  Docs: Update security.md (#20981)
  @grafana/data: use timeZone parameter rather than isUtc (#21276)
  Units: support dynamic count and currency units (#21279)
  Docs: Added sudo and removed $ where inconsistent. (#21314)
  ...
@ying-jeanne ying-jeanne added the pr/external This PR is from external contributor label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/external This PR is from external contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants