Initial commit, 90% there
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#!/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 1: Update chart destroy calls to use correct names
|
||||
template = template.replace(
|
||||
"if (scope._charts.production) scope._charts.production.destroy();",
|
||||
"if (scope._charts.oee) scope._charts.oee.destroy();"
|
||||
)
|
||||
template = template.replace(
|
||||
"if (scope._charts.scrap) scope._charts.scrap.destroy();",
|
||||
"if (scope._charts.availability) scope._charts.availability.destroy();"
|
||||
)
|
||||
template = template.replace(
|
||||
"if (scope._charts.efficiency) scope._charts.efficiency.destroy();",
|
||||
"if (scope._charts.performance) scope._charts.performance.destroy();"
|
||||
)
|
||||
|
||||
# Fix 2: Update chart data references - OEE chart
|
||||
template = template.replace(
|
||||
"label: 'Good Parts',\n data: goodData.data,",
|
||||
"label: 'OEE %',\n data: oeeData.data,"
|
||||
)
|
||||
|
||||
# Fix 3: Update chart data references - Availability chart
|
||||
template = template.replace(
|
||||
"label: 'Scrap Parts',\n data: scrapData.data,",
|
||||
"label: 'Availability %',\n data: availData.data,"
|
||||
)
|
||||
|
||||
# Fix 4: Update chart data references - Performance chart
|
||||
template = template.replace(
|
||||
"label: 'Efficiency %',\n data: effData.data,",
|
||||
"label: 'Performance %',\n data: perfData.data,"
|
||||
)
|
||||
|
||||
node['format'] = template
|
||||
print("✓ Fixed Graphs Template chart creation code")
|
||||
print(" - Updated chart destroy calls")
|
||||
print(" - Fixed undefined variable references (goodData → oeeData, etc.)")
|
||||
print(" - Updated dataset labels")
|
||||
break
|
||||
|
||||
with open('/home/mdares/.node-red/flows.json', 'w') as f:
|
||||
json.dump(flows, f, indent=4)
|
||||
|
||||
print("✓ flows.json updated")
|
||||
Reference in New Issue
Block a user