25 lines
794 B
Python
25 lines
794 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
|
|
with open('/home/mdares/.node-red/flows.json', 'r') as f:
|
|
flows = json.load(f)
|
|
|
|
for node in flows:
|
|
if node.get('id') == 'f3a4b5c6d7e8f9a0' and node.get('name') == 'Graphs Template':
|
|
template = node.get('format', '')
|
|
|
|
# Fix: Make variable name consistent - use selectedRange everywhere
|
|
template = template.replace(
|
|
"var currentFilter = scope.currentFilter || '24h';",
|
|
"var currentFilter = scope.selectedRange || '24h';"
|
|
)
|
|
|
|
node['format'] = template
|
|
print("✓ Fixed Graphs Template variable consistency (currentFilter → selectedRange)")
|
|
break
|
|
|
|
with open('/home/mdares/.node-red/flows.json', 'w') as f:
|
|
json.dump(flows, f, indent=4)
|
|
|
|
print("✓ flows.json updated")
|