feat(plugins): soporte de tooltipFields y desacoplamiento total en PluginService (v1.24.5)
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details
oggui-debian-package/pipeline/head This commit looks good Details
oggui-debian-package/pipeline/tag This commit looks good Details

main
Juan Manuel Bardallo 2026-10-30 20:34:12 +01:00
parent 5257e9e63e
commit 8073408560
2 changed files with 23 additions and 11 deletions

View File

@ -2,9 +2,14 @@
## [1.24.5] - 2026-10-30 ## [1.24.5] - 2026-10-30
### Added
- **Soporte Genérico de Tooltips Dinámicos (`PluginBadgeRule.tooltipFields`)**:
- Incorporada la especificación declarativa `tooltipFields` en `PluginBadgeRule`, permitiendo a cualquier plugin declarar en su propio manifiesto qué campos de metadatos deben anexarse al tooltip (con `prefix` y `suffix` opcionales).
### Removed ### Removed
- **Eliminación Total de Sondeo Periódico (`GroupsComponent`)**: - **Desacoplamiento Total de Plugins en `PluginService`**:
- Retirado el temporizador `interval(30000)` en `GroupsComponent`. La arquitectura se mantiene 100% reactiva exclusivamente mediante los eventos push de Mercure (SSE), evitando cualquier sobrecarga innecesaria en el servidor. - Eliminado todo código ad-hoc y variables específicas de dominio (`dni`, `remaining_minutes`, `student`, `user`, etc.) del motor genérico de `PluginService`. `oggui` pasa a ser 100% agnóstico e independiente de los plugins instalados.
- Retirado el temporizador `interval(30000)` en `GroupsComponent`. La arquitectura se mantiene 100% reactiva exclusivamente mediante los eventos push de Mercure (SSE).
## [1.24.4] - 2026-10-30 ## [1.24.4] - 2026-10-30

View File

@ -37,6 +37,12 @@ export interface RoleDefinition {
shortCode?: string;// Código corto usado en frontend (ej: 'super-admin') shortCode?: string;// Código corto usado en frontend (ej: 'super-admin')
} }
export interface PluginBadgeField {
key: string;
prefix?: string;
suffix?: string;
}
export interface PluginBadgeRule { export interface PluginBadgeRule {
status: string; status: string;
type: string; type: string;
@ -45,6 +51,7 @@ export interface PluginBadgeRule {
labelKey?: string; labelKey?: string;
tooltip: string; tooltip: string;
tooltipKey?: string; tooltipKey?: string;
tooltipFields?: PluginBadgeField[];
} }
export interface PluginBadge { export interface PluginBadge {
@ -716,19 +723,19 @@ export class PluginService {
} }
} }
// Enriquecer tooltip con metadatos contextuales si están disponibles (p. ej. DNI del alumno, tiempo restante) // Enriquecer tooltip con metadatos contextuales si el badge declara tooltipFields
const meta = (idKey ? this.getPluginMetadata(plugin.name, idKey) : null) const meta = (idKey ? this.getPluginMetadata(plugin.name, idKey) : null)
|| (uuidKey ? this.getPluginMetadata(plugin.name, uuidKey) : null); || (uuidKey ? this.getPluginMetadata(plugin.name, uuidKey) : null);
if (meta) { if (matchingBadge.tooltipFields && matchingBadge.tooltipFields.length > 0 && meta) {
const dni = meta.dni || meta.user || meta.student;
const mins = meta.remaining_minutes ?? meta.remainingMinutes;
const infoParts: string[] = []; const infoParts: string[] = [];
if (dni) { for (const field of matchingBadge.tooltipFields) {
infoParts.push(`DNI: ${dni}`); const val = meta[field.key];
} if (val !== undefined && val !== null && val !== '') {
if (mins !== undefined && mins !== null && mins !== '') { const prefix = field.prefix || '';
infoParts.push(`${mins} min`); const suffix = field.suffix || '';
infoParts.push(`${prefix}${val}${suffix}`);
}
} }
if (infoParts.length > 0) { if (infoParts.length > 0) {
const detailStr = infoParts.join(' · '); const detailStr = infoParts.join(' · ');