mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
95% JSON config principle applied: - SuperGodPanel: mock tenants/users/metrics/transfers → config/*.json (806→588) - WorkflowEditor: mock workflows → config/workflow-mock-data.json - FrontPage: levels/tech/services/creds → config/frontpage-data.json - App.qml: seed users/views → config/app-config.json CWorkflowCanvas (384→182): CCanvasGrid, CCanvasZoomOverlay, CWorkflowNodeDelegate extracted Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
.pragma library
|
|
|
|
// Synchronous JSON loader for Qt resource files
|
|
function loadJson(path) {
|
|
var xhr = new XMLHttpRequest()
|
|
xhr.open("GET", path, false) // synchronous
|
|
xhr.send()
|
|
if (xhr.status === 200 || xhr.status === 0) { // status 0 for local/qrc files
|
|
return JSON.parse(xhr.responseText)
|
|
}
|
|
console.warn("GodPanelConfig: failed to load", path, "status:", xhr.status)
|
|
return []
|
|
}
|
|
|
|
function loadTabs() {
|
|
return loadJson("qrc:/qt/qml/DBALObservatory/config/god-panel-tabs.json")
|
|
}
|
|
|
|
function loadLevels() {
|
|
return loadJson("qrc:/qt/qml/DBALObservatory/config/god-panel-levels.json")
|
|
}
|
|
|
|
function loadConfigStats() {
|
|
return loadJson("qrc:/qt/qml/DBALObservatory/config/god-panel-config-stats.json")
|
|
}
|
|
|
|
// Map accent name strings to actual color values
|
|
function resolveAccentColor(name, palette) {
|
|
var map = {
|
|
"blue": palette.accentBlue,
|
|
"cyan": palette.accentCyan,
|
|
"violet": palette.accentViolet,
|
|
"amber": palette.accentAmber,
|
|
"rose": palette.accentRose
|
|
}
|
|
return map[name] || palette.accentBlue
|
|
}
|
|
|
|
// Build resolved config stat data from JSON + live counts + palette
|
|
function resolveConfigStats(rawStats, configCounts, palette) {
|
|
var result = []
|
|
for (var i = 0; i < rawStats.length; i++) {
|
|
var s = rawStats[i]
|
|
var val = configCounts[s.valueKey]
|
|
result.push({
|
|
label: s.label,
|
|
value: (val !== undefined ? val : 0).toString(),
|
|
accent: resolveAccentColor(s.accentName, palette)
|
|
})
|
|
}
|
|
return result
|
|
}
|