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

Canvas: Adhere editing state to dashboard editable state #87883

Merged
merged 1 commit into from
May 16, 2024

Conversation

nmarrs
Copy link
Contributor

@nmarrs nmarrs commented May 15, 2024

Adhere canvas editing state to dashboard's editable state. Before if the dashboard was read-only, users could still modify the canvas but would then have no way to save those changes.

Note: this approach will need to be updated for dashboard scene migration, but given as that is currently in public preview it makes sense to fix classic dashboards for the time being

See this follow up GitHub issue

Before

Screen.Recording.2024-05-07.at.15.27.59.mov

After

after.mov

Fixes #87446

@nmarrs nmarrs added area/panel/canvas Issues related to canvas panel no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels May 15, 2024
@nmarrs nmarrs self-assigned this May 15, 2024
@nmarrs nmarrs requested a review from a team as a code owner May 15, 2024 02:11
@nmarrs nmarrs requested review from Develer and adela-almasan and removed request for a team May 15, 2024 02:11
@grafana-delivery-bot grafana-delivery-bot bot added this to the 11.1.x milestone May 15, 2024
Comment on lines +67 to +69
const dashboard = getDashboardSrv().getCurrent();
const allowEditing = this.props.options.inlineEditing && dashboard?.editable;

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

but you could add a new property isEditing on DashboardModelCompatibilityWrapper if you want

Copy link
Contributor Author

@nmarrs nmarrs May 16, 2024

Choose a reason for hiding this comment

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

In its current form this PR addresses the legacy dashboard case which I think is still worth addressing as dashboard scenes is still in public preview

Created this follow up GitHub issue to address figuring this out for new dashboards based on scenes. I think for this to work as expected I think the dashboard scene will need to emit a state update (like editing is turned off / on) that a panel can listen to and respond to accordingly

@nmarrs nmarrs merged commit 431fdd4 into main May 16, 2024
25 checks passed
@nmarrs nmarrs deleted the disable-canvas-edit-when-dashboard-readonly branch May 16, 2024 00:17
@Hipska
Copy link
Contributor

Hipska commented May 16, 2024

Thanks for the quick fix! (I reported it to @leventebalogh on Slack)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend area/panel/canvas Issues related to canvas panel no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboards: Canvas panel inline-edit enabled for read-only dashboards
4 participants