Agregar grafo interactivo de previas en planificador y menú#980
Agregar grafo interactivo de previas en planificador y menú#980RenzoMinelli wants to merge 5 commits intomasterfrom
Conversation
66537c9 to
5431ec8
Compare
| pin "cytoscape", to: "https://esm.sh/cytoscape@3.30.4" | ||
| pin "cytoscape-dagre", to: "https://esm.sh/cytoscape-dagre@2.5.0?deps=cytoscape@3.30.4" |
There was a problem hiding this comment.
Mejor utilizar bin/importmap pin para que lo guarde en vendor/javascript
There was a problem hiding this comment.
Lo hice en 890c6a8, ejecute:
bin/importmap pin cytoscape
bin/importmap pin cytoscape-dagre
There was a problem hiding this comment.
Tuve que revertir los cambios porque ya no funcionaba el renderizado. Charlando con claude me dijo esto:
The vendored dagre.js has relative imports to internal chunk files that don't exist:
- dagre.js line 3: import{_ as o,a as r,b as a,c as t}from"./_/1113443d.js"
- graphlib.js line 3: import{_ as e,a as r}from"./_/75cd5a64.js" and import a from"./lib/index.js" and import o from"./lib/alg/index.js"
These are internal jspm chunk files that were not downloaded by bin/importmap pin. The vendor/javascript/_/ and vendor/javascript/lib/ directories don't exist. So the browser fails to resolve these imports,
the dagre layout never registers with cytoscape, and nodes aren't rendered (cytoscape can't lay them out).
Phase 2: Pattern Analysis - The previous approach using esm.sh CDN worked because esm.sh bundles all dependencies together. The bin/importmap pin approach downloads from jspm.io, which splits packages into
chunks with relative imports that importmap-rails can't resolve.
This is a known limitation of bin/importmap pin with complex packages that have deep dependency trees. The dagre/graphlib ecosystem has too many internal modules for importmap to handle cleanly.
Y es verdad, en los archivos que se generaron en vendor hay dependencias a archivos que no se instalaron
There was a problem hiding this comment.
Termine sacando la dependencia a dagre asi que podemos usar importmaps, lo actualice en 6d4bb60
| <%= link_to subject_plans_path, class: "text-gray-500 hover:text-primary flex items-center gap-1 text-sm" do %> | ||
| <%= material_icon("arrow_back", "text-base") %> | ||
| Volver al planificador | ||
| <% end %> |
There was a problem hiding this comment.
Siento que este botón no encaja con el resto de la app, no tenemos botones de navegación por lo general :\
There was a problem hiding this comment.
Decis que mejor lo saco nomas?
| <%= link_to root_path, class: "text-gray-500 hover:text-primary flex items-center gap-1 text-sm" do %> | ||
| <%= material_icon("arrow_back", "text-base") %> | ||
| Volver | ||
| <% end %> |
There was a problem hiding this comment.
Creo que estaría bueno aclarar que es el grafo de la curricula sugerida
dc3dd5d to
6d4bb60
Compare
Pin cytoscape@3.33.1 via importmaps for rendering subject dependency graphs with interactive nodes and edges. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- SubjectGraphComponent builds nodes (with availability/completion status), edges (from prerequisite trees), and semester labels - Planner::GraphsController shows planned subjects grouped by user-defined semesters - Subjects::GraphsController shows curriculum subjects filtered by category - Add routes: planner/graph and subjects/graph Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Stimulus controller renders subject dependency graphs using Cytoscape.js with semester-grouped columns (desktop) or 2-column grid (mobile). Interactions: - Click a subject to highlight its prerequisite chain (amber) and dependents (violet), dimming unrelated nodes - Click again to navigate to the subject detail page - Hover (desktop) shows subtle border and connected edges - Click background to deselect - Tooltip with "Ver detalles" link appears on selection - Debounced resize handler rebuilds layout on breakpoint change Visual: - Three-state nodes: unavailable (gray), available (blue), completed (green) - Animated transitions on node/edge state changes - Semester headers that reposition on pan/zoom - Legend with state colors and highlight indicators Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add "Grafo de Dependencias" to the drawer menu (first 9 semesters) - Add graph icon link in the planner header Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Component specs (11): - Node data serialization (id, code, name, url, availability) - Edge extraction from prerequisites (subject, logical/AND, external) - Semester label generation (curriculum categories, planner map) - Empty state handling System specs - Planner Graph (6): - Graph rendering with planned subjects and edges - Empty state with link to add subjects - Legend with highlight indicators (Previa, Dependiente) - Interaction instructions text - Available subject marking System specs - Subjects Graph (7): - Category filtering (single, multiple) - Edge rendering within filtered subjects - Empty state when no categories - Full legend display (all 5 indicators) - Interaction instructions text - Available subjects based on user approvals Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6d4bb60 to
b580d92
Compare


Qué se hizo?
Se agregó una visualización interactiva de grafos de dependencias de materias usando Cytoscape.js, accesible desde dos lugares:
Funcionalidad
Interacciones:
Visual:
Responsive:
Arquitectura
SubjectGraphComponent(ViewComponent): construye nodos, aristas y labels desde el modelo de datossubject_graph_controller.js(Stimulus): renderiza el grafo con Cytoscape.jsPlanner::GraphsController: materias planificadas del usuarioSubjects::GraphsController: materias de la malla curricular filtradas por categoríaapplication.cssTests (24 specs)
Por qué?
Visualizar las previas como un grafo interactivo es una forma más intuitiva de entender las cadenas de dependencias entre materias. El click para resaltar la cadena completa de previas y dependientes facilita la planificación de la carrera.
Fix incluido
current_degree→current_degree_planenSubjects::GraphsController(método no existía)