-
Notifications
You must be signed in to change notification settings - Fork 11.6k
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
Conversation
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 |
924c4a1
to
109ac70
Compare
react panel updated, |
return ( | ||
dashboard.meta.canEdit && | ||
dashboard.meta.focusPanelId && | ||
!dashboard.panels.find(e => e.id === dashboard.meta.focusPanelId)?.repeatPanelId |
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.
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
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.
apologize for be unfamiliar with code.
I have added two method canEditPanel
and canEditPanelById
in DashboardModel.
and use them in all branch
cf7ea05
to
968f696
Compare
968f696
to
420e881
Compare
can we merge this pr? |
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.
Looks great! Thanks for a bunch for this! ❤️
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 |
conflict resolved |
* 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)
* 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) ...
What this PR does / why we need it:
avoid incorrect modify repeated panel
Which issue(s) this PR fixes:
Partially
resolve
#21142Special notes for your reviewer: