Files
rapid_dashboards/examples/fn_registry_apps.yaml
T
2026-04-06 00:57:13 +02:00

203 lines
5.1 KiB
YAML

settings:
title: "fn-registry Apps"
refresh: 30s
width: 1440
height: 900
columns: 12
theme: "emerald"
connections:
registry:
driver: sqlite
path: ../../registry.db
queries:
# --- KPIs ---
total_apps:
connection: registry
sql: "SELECT COUNT(*) AS value FROM apps"
apps_go:
connection: registry
sql: "SELECT COUNT(*) AS value FROM apps WHERE lang = 'go'"
apps_python:
connection: registry
sql: "SELECT COUNT(*) AS value FROM apps WHERE lang = 'py'"
domains_with_apps:
connection: registry
sql: "SELECT COUNT(DISTINCT domain) AS value FROM apps"
# --- Distribucion ---
apps_by_lang:
connection: registry
sql: "SELECT lang, COUNT(*) AS cantidad FROM apps GROUP BY lang ORDER BY cantidad DESC"
apps_by_domain:
connection: registry
sql: "SELECT domain, COUNT(*) AS cantidad FROM apps GROUP BY domain ORDER BY cantidad DESC"
apps_by_framework:
connection: registry
sql: |
SELECT
CASE WHEN framework = '' OR framework IS NULL THEN '(sin framework)' ELSE framework END AS framework,
COUNT(*) AS cantidad
FROM apps
GROUP BY framework
ORDER BY cantidad DESC
# --- Dependencias ---
apps_most_deps:
connection: registry
sql: |
SELECT
name || ' (' || lang || ')' AS app,
(LENGTH(uses_functions) - LENGTH(REPLACE(uses_functions, ',', ''))
+ CASE WHEN uses_functions != '[]' AND uses_functions != '' THEN 1 ELSE 0 END) AS dependencias
FROM apps
WHERE uses_functions != '[]' AND uses_functions != ''
ORDER BY dependencias DESC
LIMIT 15
functions_most_used_in_apps:
connection: registry
sql: |
WITH RECURSIVE split_uses(app_id, rest, val) AS (
SELECT id, uses_functions || ',', NULL
FROM apps
WHERE uses_functions != '[]' AND uses_functions != ''
UNION ALL
SELECT app_id,
SUBSTR(rest, INSTR(rest, ',') + 1),
TRIM(SUBSTR(rest, 1, INSTR(rest, ',') - 1), ' "[]')
FROM split_uses WHERE rest != ''
)
SELECT val AS funcion, COUNT(*) AS veces
FROM split_uses
WHERE val IS NOT NULL AND val != '' AND val != ']'
GROUP BY val
ORDER BY veces DESC
LIMIT 15
# --- Catalogo ---
apps_catalog:
connection: registry
sql: |
SELECT
id,
name,
lang,
domain,
CASE WHEN framework = '' THEN '-' ELSE framework END AS framework,
description,
entry_point,
updated_at
FROM apps
ORDER BY domain, name
filters: {}
sections:
# ---- KPIs ----
- id: kpis
title: "Overview"
columns: 4
widgets:
- id: total_apps
type: kpi
title: "Total Apps"
query: total_apps
mapping: { value: "value" }
span: 1
- id: apps_go
type: kpi
title: "Apps Go"
query: apps_go
mapping: { value: "value" }
span: 1
- id: apps_py
type: kpi
title: "Apps Python"
query: apps_python
mapping: { value: "value" }
span: 1
- id: domains
type: kpi
title: "Dominios"
query: domains_with_apps
mapping: { value: "value" }
span: 1
# ---- Distribucion ----
- id: distribution
title: "Distribucion"
columns: 3
widgets:
- id: by_lang
type: pie_chart
title: "Apps por Lenguaje"
query: apps_by_lang
mapping: { name: "lang", value: "cantidad" }
span: 1
- id: by_domain
type: pie_chart
title: "Apps por Dominio"
query: apps_by_domain
mapping: { name: "domain", value: "cantidad" }
span: 1
- id: by_framework
type: bar_chart
title: "Apps por Framework"
query: apps_by_framework
mapping: { x: "framework", y: "cantidad" }
span: 1
# ---- Dependencias ----
- id: dependencies
title: "Dependencias"
columns: 2
widgets:
- id: most_deps
type: bar_chart
title: "Apps con Mas Dependencias"
query: apps_most_deps
mapping: { x: "app", y: "dependencias" }
options: { horizontal: true, height: 350 }
span: 1
- id: most_used_fns
type: bar_chart
title: "Funciones Mas Usadas en Apps"
query: functions_most_used_in_apps
mapping: { x: "funcion", y: "veces" }
options: { horizontal: true, height: 350 }
span: 1
# ---- Catalogo ----
- id: catalog
title: "Catalogo de Apps"
widgets:
- id: catalog_table
type: table
title: "Todas las Apps"
query: apps_catalog
mapping:
columns:
- { key: "id", label: "ID" }
- { key: "name", label: "Nombre" }
- { key: "lang", label: "Lang" }
- { key: "domain", label: "Dominio" }
- { key: "framework", label: "Framework" }
- { key: "description", label: "Descripcion" }
- { key: "entry_point", label: "Entry Point" }
- { key: "updated_at", label: "Actualizado" }
span: 12