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

Cannot overwrite a dashboard/folder #10735

Closed
marefr opened this issue Feb 2, 2018 · 3 comments
Closed

Cannot overwrite a dashboard/folder #10735

marefr opened this issue Feb 2, 2018 · 3 comments

Comments

@marefr
Copy link
Member

marefr commented Feb 2, 2018

This is a bug due to implementation of #10419

If you're importing a dashboard that have the same title as an existing folder or dashboard in the general folder and click on Import (Overwrite) it results in *Failed to import dashboard" error. Note that the dashboard json you're importing does not have a unique identifier (uid).

The same error occurs if you trying to save a dashboard with a title that already exists and you choose to overwrite.

Also, we need to make sure that saving a dashboard with a title that already exists on a folder is not possible, i.e. the conflict confirm modal Dashboard with the same name exists. should not be shown.

@bergquist
Copy link
Contributor

https://github.com/grafana/grafana/blob/master/public/app/features/dashboard/validation_srv.ts#L28

This have to handle the new uniqueness requirements.

@marefr
Copy link
Member Author

marefr commented Feb 7, 2018

Proposal for new logic when creating/updating a dashboard

In general, the new uid field are handled just like the id field, i.e. if a dashboard are found by uid that dashboard will be updated if current version are provided or overwrite flag are set to true.

Current logic

  • No id with an optional uid and a title that doesn't exist in folder creates a new dashboard.
  • Id allows update of existing dashboard if current version are provided or overwrite flag are set to true.
  • Id with an existing title in folder allows overwrite of dashboard and the overwritten dashboard will have the same id and uid as before.

New logic

  • No id and uid with a title that doesn't exist in folder creates a new dashboard.
  • Id without uid, allows update of existing dashboard/folder if current version are provided or overwrite flag are set to true.
  • Uid without id allows update of existing dashboard/folder if current version are provided or overwrite flag are set to true.
  • Id without uid, with an existing title in folder allows overwrite of dashboard and overwritten dashboard will have the same id and uid.
  • Uid without id, with an existing title in folder allows overwrite of dashboard and overwritten dashboard will have the provided uid and the same id as before.
  • Ensures that changing an existing folder to a dashboard yields error.
  • Ensures that changing an existing dashboard to a folder yields error.

@DBarthe
Copy link

DBarthe commented Feb 7, 2018

Hi,
I'm also facing this problem while trying to update a dashboard with "overwrite": true within automation script.
I got a "{\"message\":\"A dashboard with the same name in the folder already exists\",\"status\":\"name-exists\"}".
Actually I send the same id, but do not increment the version number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants