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

Panel overrides can sometimes be duplicated with autofix enabled #223

Open
bderrly opened this issue Feb 3, 2025 · 0 comments · May be fixed by #224
Open

Panel overrides can sometimes be duplicated with autofix enabled #223

bderrly opened this issue Feb 3, 2025 · 0 comments · May be fixed by #224

Comments

@bderrly
Copy link

bderrly commented Feb 3, 2025

Given a (truncated) panel overrides seen below (fig 1), running autofix on the panel will result in some of the JSON object being duplicated (fig 2). This is caused by the unmarshaling of the JSON panel into Go objects during the lint phase. When the modified dashboard is marshaled to JSON and used within the conflate library only the properties section of the overrides has been preserved in the modified version. Conflate then sees the full version in the original dashboard panel and thinks, rightly, that there are two distinct objects (one in the original and one in the modified version).

fig. 1, this is extracted from a panel object

"overrides": [
  {
    "__systemRef": "hideSeriesFrom",
    "matcher": {
      "id": "byNames",
      "options": {
        "mode": "exclude",
        "names": ["foo"],
        "prefix": "All except:",
        "readOnly": true
      }
    },
    "properties": [
      {
        "id": "custom.hideFrom",
        "value": {
          "legend": false,
          "tooltip": false,
          "viz": true
        }
      }
    ]
  }
]

fig. 2, the overrides after running lint with autofix enabled

"overrides": [
  {
    "__systemRef": "hideSeriesFrom",
    "matcher": {
      "id": "byNames",
      "options": {
        "mode": "exclude",
        "names": ["foo"],
        "prefix": "All except:",
        "readOnly": true
      }
    },
    "properties": [
      {
        "id": "custom.hideFrom",
        "value": {
          "legend": false,
          "tooltip": false,
          "viz": true
        }
      }
    ]
  },
  {
    "properties": [
      {
        "id": "custom.hideFrom",
        "value": {
          "legend": false,
          "tooltip": false,
          "viz": true
        }
      }
    ]
  }
]
@bderrly bderrly linked a pull request Feb 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant