Skip to content

Commit

Permalink
Modified collection class; fixed unit test; code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
chuanlin2018 committed Mar 25, 2024
1 parent 42d9c46 commit ffe6e35
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 234 deletions.
79 changes: 3 additions & 76 deletions angular/src/app/landing/filters/filters.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,87 +23,14 @@
</div>

<div style="padding-left: -1em;" *ngIf="isActive && !searching">
<div *ngFor="let theme of allThemes | keyvalue">
<app-taxonomy [collectionThemesTree]="allThemes[theme.key].collectionThemesTree"
<!-- Loop through all themes -->
<div *ngFor="let collection of allCollections | keyvalue">
<app-taxonomy [collectionThemesTree]="allCollections[collection.key].theme?.collectionThemesTree"
[backgroundColor]="lighterColor" [defaultColor]="defaultColor"
(filterString)="updateFilterString($event, collection)">
</app-taxonomy>
</div>

<!-- Collection Research topics -->
<!-- <app-taxonomy [collectionThemesTree]="collectionThemesTree" [backgroundColor]="lighterColor"
[defaultColor]="defaultColor" (filterString)="updateFilterString($event, collection)">
</app-taxonomy> -->

<!-- NIST Research topics -->
<!-- <app-taxonomy [collectionThemesTree]="themesTree" [backgroundColor]="lighterColor"
[defaultColor]="defaultColor" (filterString)="updateFilterString($event, collection)">
</app-taxonomy> -->

<!-- Collection Research topics -->
<!-- <div class="bottom-line" *ngIf="collectionThemesTree.length > 0">
<div class="filter-checkbox">
<div [@expand]="collectionNodeExpanded? collectionShowMoreLink ? 'collapsed':'expanded':'closed'" >
<p-tree id="collectionThemes" [value]="collectionThemesTree" selectionMode="checkbox" [style]="researchTopicStyle" [(selection)]="collectionSelectedThemesNode"
(onNodeUnselect)="filterResults()"
(onNodeSelect)="filterResults()"
(onNodeExpand)="collectionNodeExpanded = true"
(onNodeCollapse)="collectionNodeExpanded = false">
<ng-template let-node pTemplate="default">
<div class="text-nowrap" data-toggle="tooltip" [title]="filterTooltip(node)">
<span *ngIf="node.label.split('-')[1] !=''; else header1" class="invisible-scrollbar" > {{node.label.split("-")[0]}}&nbsp;</span>
<ng-template #header1>
<span><b> {{node.label.split("-")[0]}}&nbsp;</b></span>
</ng-template>
<span class="w3-badge badge-notify badge-style" [style.background-color]="defaultColor"
*ngIf="node.label.split('-')[1] !=''">
{{node.label.split("-")[1]}}</span>
</div>
</ng-template>
</p-tree>
</div>
</div>
<div class="show-more-less" (click)="$event.preventDefault(); collectionShowMoreLink = false" [style.background-color]="lighterColor"
*ngIf="collectionNodeExpanded == true && collectionShowMoreLink == true && collectionThemesTree[0]?.children.length > 5">Show More...
</div>
<div class="show-more-less" (click)="$event.preventDefault();collectionShowMoreLink = true" [style.background-color]="lighterColor"
*ngIf="collectionNodeExpanded == true && collectionShowMoreLink == false && collectionThemesTree[0]?.children.length > 5">Show Less
</div>
</div> -->

<!-- NIST Research topics -->
<!-- <div class="bottom-line">
<div class="filter-checkbox">
<div [@expand]="nodeExpanded? showMoreLink ? 'collapsed':'expanded':'closed'">
<p-tree id="themes" [value]="themesTree" selectionMode="checkbox" [style]="researchTopicStyle" [(selection)]="selectedThemesNode"
(onNodeUnselect)="filterResults()"
(onNodeSelect)="filterResults()"
(onNodeExpand)="nodeExpanded = true"
(onNodeCollapse)="nodeExpanded = false">
<ng-template let-node pTemplate="default">
<div class="text-nowrap" data-toggle="tooltip" [title]="filterTooltip(node)">
<span *ngIf="node.label.split('-')[1] !=''; else header1" class="invisible-scrollbar"> {{node.label.split("-")[0]}}&nbsp;</span>
<ng-template #header1>
<span><b> {{node.label.split("-")[0]}}&nbsp;</b></span>
</ng-template>
<span class="w3-badge badge-notify badge-style"
*ngIf="node.label.split('-')[1] !=''">
{{node.label.split("-")[1]}}</span>
</div>
</ng-template>
</p-tree>
</div>
</div>
<div class="show-more-less" (click)="$event.preventDefault(); showMoreLink = false"
*ngIf="nodeExpanded == true && showMoreLink == true && themesTree[0]?.children.length > 5">Show More...
</div>
<div class="show-more-less" (click)="$event.preventDefault();showMoreLink = true"
*ngIf="nodeExpanded == true && showMoreLink == false && themesTree[0]?.children.length > 5">Show Less
</div>
</div> -->

<div *ngIf="theme=='ScienceTheme'" style="width: 100%;">
<span class="show-more-less" style="float: right;"
(click)="toggleMoreOptions()">{{moreOptionsText}}</span>
Expand Down
7 changes: 5 additions & 2 deletions angular/src/app/landing/filters/filters.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { FormsModule } from '@angular/forms';
import { TreeModule } from 'primeng/tree';
import { BrowserAnimationsModule} from '@angular/platform-browser/animations';
import { testdata } from '../../../environments/environment';
import { TaxonomyModule } from '../taxonomy/taxonomy.module';
import { TaxonomyComponent } from '../taxonomy/taxonomy.component';

describe('FiltersComponent', () => {
let component: FiltersComponent;
Expand All @@ -22,14 +24,15 @@ describe('FiltersComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FiltersComponent ],
declarations: [ FiltersComponent, TaxonomyComponent ],
imports: [
HttpClientTestingModule,
BrowserTransferStateModule,
AutoCompleteModule,
FormsModule,
TreeModule,
BrowserAnimationsModule],
BrowserAnimationsModule,
TaxonomyModule],
providers: [
SearchService,
{ provide: AppConfig, useValue: cfg }
Expand Down
Loading

0 comments on commit ffe6e35

Please sign in to comment.