Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
some files weren't committed/pushed
- Loading branch information
Showing
9 changed files
with
86 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h3 class="ml-2">Please select a model: </h3> | ||
|
||
<ng-container *ngIf="selectedXA == ''"> | ||
<p class="ml-2"></p> | ||
</ng-container> | ||
|
||
<select class="ml-2" ng-model="selectedXA" (change)="selectOptionHandler($event)"> | ||
<option *ngFor="let model of xaList" ngValue="model.value">{{model.name}}</option> | ||
</select> | ||
|
||
<ng-container *ngIf="selectedXA == 'Test'"> | ||
<p class="ml-2">No information is available for selected model</p> | ||
</ng-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DropdownComponent } from './dropdown.component'; | ||
|
||
describe('DropdownComponent', () => { | ||
let component: DropdownComponent; | ||
let fixture: ComponentFixture<DropdownComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DropdownComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DropdownComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { XAService } from 'src/app/services/XAService.service'; | ||
|
||
@Component({ | ||
selector: 'app-dropdown', | ||
templateUrl: './dropdown.component.html', | ||
styleUrls: ['./dropdown.component.css'] | ||
}) | ||
export class DropdownComponent implements OnInit { | ||
constructor(private xaService: XAService) { } | ||
|
||
xaList = [{ name: null, value: null }, { name: 'UConn', value: 1 }, { name: 'Test', value: 2 }]; | ||
|
||
selectedXA = ''; | ||
|
||
selectOptionHandler(event: any) { | ||
this.selectedXA = event.target.value; | ||
this.xaService.changeXA(this.selectedXA); | ||
} | ||
|
||
ngOnInit() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
<h2 class="ml-2">Select XA: </h2> | ||
|
||
<ng-container *ngIf="selectedXA == ''"> | ||
<h4 class="ml-2">Please select a model</h4> | ||
</ng-container> | ||
|
||
<select class="ml-2" ng-model="selectedXA" (change)="selectOptionHandler($event)"> | ||
<option value="">none</option> | ||
<option value="uconn">UConn</option> | ||
<option value="test">Test</option> | ||
</select> | ||
|
||
<ng-container *ngIf="selectedXA == 'test'"> | ||
<p class="ml-2">No information is available for selected model</p> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="selectedXA == 'uconn'"> | ||
<ng-container *ngIf="currentXA != null; else noXA"> | ||
<p-tree [value]="filesTree" selectionMode="single" (onNodeSelect)="nodeSelect($event)"> | ||
<ng-template let-node pTemplate="default"> | ||
<div class="tree"> | ||
<div class="flex-fill">{{ node.label }}</div> | ||
</div> | ||
</ng-template> | ||
</p-tree> | ||
</ng-container> | ||
</ng-container> | ||
|
||
<ng-template #noXA> | ||
<p class="ml-2">No XA selected</p> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Component, OnInit, OnDestroy } from '@angular/core'; | ||
import { TreeNode } from 'primeng/api'; | ||
import { Subscription } from 'rxjs'; | ||
import { NodeService } from 'src/app/services/node.service'; | ||
import { TreeService } from 'src/app/services/tree.service'; | ||
import { XAService } from 'src/app/services/XAService.service'; | ||
|
||
@Component({ | ||
selector: 'app-tree', | ||
templateUrl: './tree.component.html', | ||
styleUrls: ['./tree.component.css'] | ||
}) | ||
export class TreeComponent implements OnInit { | ||
export class TreeComponent implements OnInit, OnDestroy { | ||
|
||
private dropdownSubscription: Subscription; | ||
currentXA: string; | ||
filesTree: TreeNode[]; | ||
|
||
selectedXA = ''; | ||
|
||
selectOptionHandler(event: any) { | ||
this.selectedXA = event.target.value; | ||
} | ||
|
||
constructor( | ||
private treeService: TreeService, | ||
private nodeService: NodeService | ||
private nodeService: NodeService, | ||
private xaService: XAService | ||
) { } | ||
|
||
ngOnInit() { | ||
this.dropdownSubscription = this.xaService.xa$.subscribe(async (xa) => { | ||
this.currentXA = xa; | ||
}); | ||
this.nodeService.getFiles().then(files => (this.filesTree = files)); | ||
} | ||
|
||
nodeSelect(event: { node: TreeNode }) { | ||
this.treeService.changeNode(event.node); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.dropdownSubscription.unsubscribe(); | ||
} | ||
|
||
} |