Skip to content

Commit

Permalink
Added metrics info to floating menu
Browse files Browse the repository at this point in the history
  • Loading branch information
chuanlin2018 committed Apr 11, 2024
1 parent 881076e commit 1f30008
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 13 deletions.
8 changes: 4 additions & 4 deletions angular/src/app/landing/landingpage.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@
</button>

<app-menu [record]="md" class="sticky-menu-popup" *ngIf="showStickMenu && mobileMode" [collection]="collection"
[theme]="theme" (scroll)="goToSection($event)" (toggle_citation)="toggleCitation('large')">
[theme]="theme" [inBrowser]="inBrowser" [metricsData]="metricsData" [showMetrics]="showMetrics" (scroll)="goToSection($event)" (toggle_citation)="toggleCitation('large')">
</app-menu>
</div>
<div #stickyMenu></div>
<div *ngIf="_showData">
<div class="sticky-menu">
<div *ngIf="inBrowser" class="d-none d-md-block d-lg-block d-xl-block ">

<app-menu [record]="md" [collection]="collection" [theme]="theme" (scroll)="goToSection($event)"
<app-menu [record]="md" [collection]="collection" [theme]="theme" [inBrowser]="inBrowser" [metricsData]="metricsData" [showMetrics]="showMetrics" (scroll)="goToSection($event)"
(toggle_citation)="toggleCitation('large')">
</app-menu>

<app-metricsinfo *ngIf="theme != scienceTheme" [inBrowser]="inBrowser" [record]="md"
<!-- <app-metricsinfo *ngIf="theme != scienceTheme" [inBrowser]="inBrowser" [record]="md"
[metricsData]="metricsData" [showMetrics]="showMetrics">
</app-metricsinfo>
</app-metricsinfo> -->

<app-downloadstatus [inBrowser]="inBrowser"></app-downloadstatus>
</div>
Expand Down
4 changes: 2 additions & 2 deletions angular/src/app/landing/landingpage.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { DoneComponent } from './done/done.component';
import { DownloadstatusComponent } from './downloadstatus/downloadstatus.component';
import { TaxonomyListService } from '../shared/taxonomy-list'
import { ErrorComponent, UserErrorComponent } from './error.component';
import { MetricsinfoComponent } from './metricsinfo/metricsinfo.component';

// import { ForensicslandingbodyModule } from './forensicslandingbody/forensicslandingbody.module';
// import { ForensicssearchresultModule } from './forensicssearchresult/forensicssearchresult.module';
import { SearchresultModule } from './searchresult/searchresult.module';
Expand All @@ -43,7 +43,7 @@ import { CollectionService } from '../shared/collection-service/collection.servi
],
declarations: [
LandingPageComponent, LandingBodyComponent, DoneComponent, DownloadstatusComponent,
ErrorComponent, UserErrorComponent, NoidComponent, NerdmComponent, MetricsinfoComponent
ErrorComponent, UserErrorComponent, NoidComponent, NerdmComponent
],
providers: [
MetadataUpdateService, TaxonomyListService, DatePipe, CollectionService
Expand Down
13 changes: 13 additions & 0 deletions angular/src/app/landing/metricsinfo/metricsinfo.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MetricsinfoComponent } from './metricsinfo.component';


@NgModule({
declarations: [MetricsinfoComponent],
imports: [
CommonModule
],
exports: [ MetricsinfoComponent ]
})
export class MetricsinfoModule { }
7 changes: 6 additions & 1 deletion angular/src/app/landing/tools/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@
{{menuitem.title}}
</td>
</tr>
</table>
</table>

<!-- Metrics info-->
<app-metricsinfo *ngIf="theme != scienceTheme" [inBrowser]="inBrowser" [record]="record"
[metricsData]="metricsData" [showMetrics]="showMetrics">
</app-metricsinfo>
19 changes: 16 additions & 3 deletions angular/src/app/landing/tools/menu/menu.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Component, EventEmitter, Input, OnInit, Output, HostListener } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, HostListener, Inject, PLATFORM_ID } from '@angular/core';
import { CollectionService } from '../../../shared/collection-service/collection.service';
import { Themes, ThemesPrefs, Collections, Collection, ColorScheme, CollectionThemes } from '../../../shared/globals/globals';
import { NerdmRes, NERDResource } from '../../../nerdm/nerdm';
import { CartConstants } from '../../../datacart/cartconstants';
import { AppConfig } from '../../../config/config';
import * as _ from 'lodash-es';
import { isPlatformBrowser } from '@angular/common';
import { MetricsData } from "../../metrics-data";

export class menuItem {
title: string;
Expand Down Expand Up @@ -47,20 +49,31 @@ export class MenuComponent implements OnInit {
public CART_CONSTANTS: any = CartConstants.cartConst;
globalCartUrl: string = "/datacart/" + this.CART_CONSTANTS.GLOBAL_CART_NAME;
recordType: string = "";

scienceTheme = Themes.SCIENCE_THEME;
inBrowser: boolean = false;

// the resource record metadata that the tool menu data is drawn from
@Input() record : NerdmRes|null = null;
@Input() collection: string = Collections.DEFAULT;
@Input() theme: string = "nist";

// Record level metrics data
@Input() metricsData : MetricsData;

// flag if metrics is ready to display
@Input() showMetrics : boolean = false;

@Output() scroll = new EventEmitter<string>();

// signal for triggering display of the citation information
@Output() toggle_citation = new EventEmitter<boolean>();

constructor(
public collectionService: CollectionService,
private cfg : AppConfig) { }
@Inject(PLATFORM_ID) private platformId: Object,
private cfg : AppConfig) {
this.inBrowser = isPlatformBrowser(platformId);
}

ngOnInit(): void {
this.allCollections = this.collectionService.loadCollections(this.collection.toLowerCase());
Expand Down
6 changes: 3 additions & 3 deletions angular/src/app/landing/tools/tools.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { MenuModule } from 'primeng/menu';

import { ToolMenuComponent } from './toolmenu.component';
import { MenuComponent } from './menu/menu.component';
import { MetricsinfoModule } from '../metricsinfo/metricsinfo.module';

/**
* A module providing tools for interacting with the landing page's record metadata.
Expand All @@ -15,7 +14,8 @@ import { MenuComponent } from './menu/menu.component';
@NgModule({
imports: [
CommonModule,
MenuModule
MenuModule,
MetricsinfoModule
],
declarations: [
ToolMenuComponent,
Expand Down

0 comments on commit 1f30008

Please sign in to comment.