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

Updated colourmapper to map colour in the new way for Grafana #175

Merged
merged 3 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added comment and docstring to colourmapper.py
Will-Cross1 committed May 2, 2024
commit 9c6151171b823335fa1dfba369afc1b128492872
6 changes: 6 additions & 0 deletions scripts/colourmapper.py
Original file line number Diff line number Diff line change
@@ -27,6 +27,10 @@


def create_override_dict(name, code):
"""
This function is called during a loop over all mappings in colourmapper.ini
This creates a long dictionary that will go into the "overrides" parts of the JSON files
"""
return {
"matcher": {
"id": "byName",
@@ -57,6 +61,8 @@ def main():
data = json.load(reader) # load file into data variable

for i in range(len(data['panels'])): # cycle through panels in JSON file
# uses two different methods of colour mapping (aliasColours and overrides)
# as grafana needs both on the JSON to display all colours
data['panels'][i]['aliasColors'] = alias_colors
try:
data['panels'][i]['fieldConfig']['overrides'] = override_list