@@ -3,7 +3,7 @@ import { Location } from '@angular/common';
33import { OrganizationChartModule } from 'primeng/organizationchart' ;
44import { ApiService } from '../../shared/services/api.service' ;
55import { Router } from '@angular/router' ;
6- import { Edge , NgxGraphModule , NgxGraphZoomOptions } from '@swimlane/ngx-graph' ;
6+ // import { Edge, NgxGraphModule, NgxGraphZoomOptions } from '@swimlane/ngx-graph';
77import * as shape from 'd3-shape' ;
88import { Subject } from 'rxjs' ;
99import { ButtonModule } from 'primeng/button' ;
@@ -30,21 +30,21 @@ interface UnitNode {
3030
3131/**
3232 * * Unit Edge Interface
33- *
33+ *
3434 * An interface for the edges in the unit graph
3535 */
36- interface UnitEdge extends Edge {
37- data ?: {
38- type : 'prerequisite' | 'parent' ;
39- }
40- }
36+ // interface UnitEdge extends Edge {
37+ // data?: {
38+ // type: 'prerequisite' | 'parent';
39+ // }
40+ // }
4141
4242@Component ( {
4343 selector : 'app-unit-map' ,
4444 standalone : true ,
4545 imports : [
4646 OrganizationChartModule ,
47- NgxGraphModule ,
47+ // NgxGraphModule,
4848 ButtonModule ,
4949 ToolbarModule ,
5050 TooltipModule ,
@@ -58,13 +58,13 @@ interface UnitEdge extends Edge {
5858export class UnitMapComponent implements OnInit , OnDestroy {
5959 @ViewChild ( 'graphContainer' ) graphContainer ! : ElementRef ;
6060
61- nodes : UnitNode [ ] = [ ] ;
62- edges : UnitEdge [ ] = [ ] ;
61+ // nodes: UnitNode[] = [];
62+ // edges: UnitEdge[] = [];
6363 layout = 'dagre' ;
6464 curve = shape . curveBasis ;
6565
6666 center$ : Subject < boolean > = new Subject ( ) ;
67- zoomToFit$ : Subject < NgxGraphZoomOptions > = new Subject ( ) ;
67+ // zoomToFit$: Subject<NgxGraphZoomOptions> = new Subject();
6868
6969 isLoading : boolean = false ;
7070
@@ -142,7 +142,7 @@ export class UnitMapComponent implements OnInit, OnDestroy {
142142
143143 // Initalise arrays for prerequisites
144144 let prereqNodes : UnitNode [ ] = [ ] ;
145- let prereqEdges : UnitEdge [ ] = [ ] ;
145+ // let prereqEdges: UnitEdge[] = [];
146146
147147 // Only process prerequisites if they exist
148148 if ( unit . requisites ?. prerequisites && unit . requisites . prerequisites . length > 0 ) {
@@ -161,17 +161,17 @@ export class UnitMapComponent implements OnInit, OnDestroy {
161161 this . prerequisiteNumReq = unit . requisites . prerequisites [ 0 ] . NumReq ;
162162
163163 // Add prerequisite edges
164- prereqEdges = prereqNodes . map ( node => ( {
165- id : `${ node . id } -${ currentNode . id } ` ,
166- source : node . id ,
167- target : currentNode . id ,
168- data : { type : 'prerequisite' }
169- } ) ) ;
164+ // prereqEdges = prereqNodes.map(node => ({
165+ // id: `${node.id}-${currentNode.id}`,
166+ // source: node.id,
167+ // target: currentNode.id,
168+ // data: { type: 'prerequisite' }
169+ // }));
170170 }
171171
172172 // Set initial nodes and edges
173- this . nodes = [ currentNode , ...prereqNodes ] ;
174- this . edges = prereqEdges ;
173+ // this.nodes = [currentNode, ...prereqNodes];
174+ // this.edges = prereqEdges;
175175
176176
177177 // Fetch the units that are required by the current unit
@@ -197,7 +197,7 @@ export class UnitMapComponent implements OnInit, OnDestroy {
197197 // console.log('Parent nodes:', parentNodes);
198198
199199 // Add edges from current node to parent nodes
200- const parentEdges : UnitEdge [ ] = parentNodes . map ( node => ( {
200+ // const parentEdges: UnitEdge[] = parentNodes.map(node => ({
201201 id: `${ currentNode . id } -${ node . id } ` ,
202202 source : currentNode . id ,
203203 target : node . id ,
@@ -208,8 +208,8 @@ export class UnitMapComponent implements OnInit, OnDestroy {
208208 // console.log('Parent edges:', parentEdges);
209209
210210 // Add parent nodes and edges to the graph
211- this . nodes = [ ...this . nodes , ...parentNodes ] ;
212- this . edges = [ ...this . edges , ...parentEdges ] ;
211+ // this.nodes = [...this.nodes, ...parentNodes];
212+ // this.edges = [...this.edges, ...parentEdges];
213213
214214 // ? Debug log: Final graph state
215215 // console.log('Final graph state:', {
@@ -218,22 +218,22 @@ export class UnitMapComponent implements OnInit, OnDestroy {
218218 // });
219219
220220 // Center the graph
221- this . centerGraph ( ) ;
221+ // this.centerGraph();
222222 }
223223 } ) ;
224224 }
225225 } ) ;
226226
227227 // Zoom to fit
228- this . resetZoom ( ) ;
228+ // this.resetZoom();
229229 }
230230
231231 /**
232232 * * Centers the Graph
233233 */
234- centerGraph ( ) {
235- this . center$ . next ( true ) ;
236- }
234+ // centerGraph() {
235+ // this.center$.next(true);
236+ // }
237237
238238 /**
239239 * * Resets the Graph
@@ -246,16 +246,16 @@ export class UnitMapComponent implements OnInit, OnDestroy {
246246 /**
247247 * * Zoom to Fit
248248 */
249- resetZoom ( ) {
250- this . zoomToFit$ . next ( { force : true , autoCenter : true } ) ;
251- }
249+ // resetZoom() {
250+ // // this.zoomToFit$.next({ force: true, autoCenter: true });
251+ // }
252252
253253 /**
254254 * * Toggle Layout
255255 */
256- toggleLayout ( ) {
257- this . layout = this . layout === 'dagre' ? 'colaForceDirected' : 'dagre' ;
258- }
256+ // toggleLayout() {
257+ // this.layout = this.layout === 'dagre' ? 'colaForceDirected' : 'dagre';
258+ // }
259259
260260 /**
261261 * * Navigates back to the previous page
0 commit comments