Code Monkey home page Code Monkey logo

Comments (6)

amotl avatar amotl commented on July 20, 2024

Hi again,

finally, I have been able to dedicate some time to this. I have been able to whip together a reproduction [1] which can be invoked idempotently and I am able to confirm that it happens with all of the most recent Grafana releases of 5.x, 6.x, 7.x.

With kind regards,
Andreas.

[1] https://gist.github.com/amotl/43bb89107227431802556b7bcb135578

from grafana_api.

amotl avatar amotl commented on July 20, 2024

The solution is to say:

def update_dashboard(self, dashboard):
    """

    :param dashboard:
    :return:
    """
    put_dashboard_path = "/dashboards/db"
    if "meta" in dashboard and "folderId" in dashboard["meta"]:
        dashboard = dashboard.copy()
        dashboard["folderId"] = dashboard["meta"]["folderId"]
    r = self.api.POST(put_dashboard_path, json=dashboard)
    return r

I will submit a corresponding pull request.

from grafana_api.

amotl avatar amotl commented on July 20, 2024

Dear Andrew,

I wish you a happy new year!

As we are currently preparing a new release of grafana-wtf, may I humbly ask you to take a look at #85, where we tried to mitigate this problem which manifests when roundtripping dashboard payloads through get_dashboard() and update_dashboard()?

I tried to supplement the mitigation with appropriate tests and will be happy about any advises from your end.

With kind regards,
Andreas.

from grafana_api.

JackNelson avatar JackNelson commented on July 20, 2024

+1
When can this get merged? Running into a use case for this where I would want to update/create a dashboard to a specific folder and not "General"

from grafana_api.

amotl avatar amotl commented on July 20, 2024

Dear Jack,

see #85 (comment) for a workaround.

With kind regards,
Andreas.

from grafana_api.

amotl avatar amotl commented on July 20, 2024

Hi again,

we integrated this patch into the grafana-client code base with grafana-toolbox/grafana-client#7.

With kind regards,
Andreas.

from grafana_api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.