Commit 81ff64f3 authored by Guillaume Cornut's avatar Guillaume Cornut
Browse files

fix: Remove home page using the result page instead. Use ng-bootstrap dropdown...

fix: Remove home page using the result page instead. Use ng-bootstrap dropdown menu instead of the basic bootstrap JS dropdown. Minor fixes. GNP-5430.
parent ea3ee96b
......@@ -63,8 +63,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "650kb",
"maximumError": "900kb"
"maximumWarning": "1500kb",
"maximumError": "2000kb"
}
],
"stylePreprocessorOptions": {
......
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ResultPageComponent } from './result-page/result-page.component';
import { GermplasmCardComponent } from './germplasm-card/germplasm-card.component';
import { StudyCardComponent } from './study-card/study-card.component';
import { SiteCardComponent } from './site-card/site-card.component';
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'results', component: ResultPageComponent },
{ path: 'germplasm/:id', component: GermplasmCardComponent },
{ path: 'studies/:id', component: StudyCardComponent },
{ path: 'sites/:id', component: SiteCardComponent },
{ path: '', component: HomeComponent },
{ path: '', component: ResultPageComponent },
];
@NgModule({
......
......@@ -3,7 +3,6 @@ import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { FormComponent } from './form/form.component';
import { ResultPageComponent } from './result-page/result-page.component';
import { GermplasmCardComponent } from './germplasm-card/germplasm-card.component';
......@@ -12,7 +11,7 @@ import { SiteCardComponent } from './site-card/site-card.component';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { NavbarComponent } from './navbar/navbar.component';
import { MapComponent } from './map/map.component';
import { NgbAlertModule, NgbPaginationModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { NgbAlertModule, NgbDropdownModule, NgbPaginationModule, NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { SuggestionFieldComponent } from './form/suggestion-field/suggestion-field.component';
import { DocumentComponent } from './result-page/document/document.component';
......@@ -25,7 +24,6 @@ import { FacetsComponent } from './result-page/facets/facets.component';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
FormComponent,
ResultPageComponent,
GermplasmCardComponent,
......@@ -45,6 +43,7 @@ import { FacetsComponent } from './result-page/facets/facets.component';
NgbTypeaheadModule,
NgbPaginationModule,
NgbAlertModule,
NgbDropdownModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
......
......@@ -18,7 +18,7 @@ export class SuggestionFieldComponent implements OnInit {
@Input() criteria$: BehaviorSubject<DataDiscoveryCriteria>;
@Input() placeholder: string;
private selectedKeys: string[] = [];
selectedKeys: string[] = [];
focus$ = new Subject();
......
<p>
home works!
<a routerLink="results">Go to results</a>
</p>
List of crops:
<ul>
<li *ngFor="let crop of crops">{{ crop }}</li>
</ul>
import { async, TestBed } from '@angular/core/testing';
import { HomeComponent } from './home.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { GnpisService } from '../gnpis.service';
describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [HomeComponent],
providers: [HttpClientTestingModule]
});
}));
it('should create', () => {
const service: GnpisService = TestBed.get(GnpisService) as GnpisService;
const component = new HomeComponent(service);
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { GnpisService } from '../gnpis.service';
@Component({
selector: 'gpds-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
crops: Array<string> = [];
constructor(private gnpisService: GnpisService) {
}
ngOnInit() {
this.gnpisService.suggest('crops', 10)
.subscribe(crops => {
this.crops = crops;
});
}
}
......@@ -9,26 +9,32 @@
<div id="navbar" class="collapse navbar-collapse" [class.collapse]="navbarCollapsed">
<ul class="navbar-nav mr-auto">
<li class="nav-item" *ngFor="let link of navbar.links">
<!-- Simple link -->
<div *ngIf="!link.subMenu">
<a class="nav-link d-flex align-items-center"
[href]="link.url" target="_blank">{{ link.label }}</a>
</div>
<!-- Dropdown -->
<div *ngIf="link.subMenu" class="dropdown-container">
<!-- OR Dropdown button -->
<div *ngIf="link.subMenu" class="dropdown-container" ngbDropdown>
<a class="nav-link d-flex align-items-center dropdown-toggle" data-toggle="dropdown"
[href]="link.url"
<!-- Toggle button -->
<a class="nav-link d-flex align-items-center dropdown-toggle" ngbDropdownToggle
role="button"
aria-haspopup="true"
aria-expanded="false"
target="_blank">{{ link.label }}</a>
<div class="dropdown-menu">
aria-expanded="false">
{{ link.label }}
</a>
<!-- Items -->
<div class="dropdown-menu" ngbDropdownMenu>
<div *ngFor="let subItem of link.subMenu">
<a class="dropdown-item"
href="{{ subItem.url }}">{{ subItem.label }}</a>
target="_blank"
[href]="subItem.url">
{{ subItem.label }}
</a>
</div>
</div>
</div>
......
export const environment = {
production: true,
production: false,
navbar: {
title: 'GnpIS Plant Data Search',
links: [{ label: 'URGI', url: 'http://urgi.versailles.inra.fr' }]
links: [
{ label: 'INRA', url: 'http://www.inra.fr/' },
{
label: 'URGI',
url: '#',
subMenu: [
{ label: 'Home', url: 'https://urgi.versailles.inra.fr' },
{ label: 'News', url: 'https://urgi.versailles.inra.fr/About-us/News' },
{ label: 'About us', url: 'https://urgi.versailles.inra.fr/About-us' }
]
},
{
label: 'Taxon/Germplasm',
url: '#',
subMenu: [
{ label: 'Taxon', url: 'https://urgi.versailles.inra.fr/siregal/common/taxon/form.do' },
{ label: 'Accession Simple', url: 'https://urgi.versailles.inra.fr/gnpis-core' },
{ label: 'Accession passport', url: 'https://urgi.versailles.inra.fr/siregal/siregal/accessionForm.do' },
{ label: 'Collections CRB', url: 'https://urgi.versailles.inra.fr/siregal/siregal/grc.do' },
]
},
{ label: 'Phenotyping', url: 'https://urgi.versailles.inra.fr/ephesis/ephesis/viewer.do' },
{
label: 'Polymorphism',
url: '#',
subMenu: [
{ label: 'Genotyping', url: 'https://urgi.versailles.inra.fr/GnpSNP/snp/genotyping/form.do' },
{ label: 'SNP Discovery', url: 'https://urgi.versailles.inra.fr/GnpSNP/snp/welcome.do' },
]
},
{ label: 'Association', url: 'https://urgi.versailles.inra.fr/association/association/viewer.do#form' },
{
label: 'Map/Marker/QTL',
url: '#',
subMenu: [
{ label: 'Map', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/searchMap.do' },
{ label: 'Loci', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/loci/queryLociSelect.do' },
{ label: 'QTL', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/qtl/queryQtlSelect.do' },
{ label: 'MetaQTLs', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/metaqtl/form.do' },
{ label: 'Marker', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/marker/markerForm.do' },
{ label: 'Pool', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/pool/poolForm.do' },
{ label: 'Traits', url: 'https://urgi.versailles.inra.fr/GnpMap/mapping/queryTraitSelect.do' },
{ label: 'Biomercator', url: 'https://urgi.versailles.inra.fr/Tools/BioMercator-V4' },
]
},
{ label: 'Genomes', url: 'https://urgi.versailles.inra.fr/Data/Genome/Genome-data-access' },
{ label: 'Synteny', url: 'https://urgi.versailles.inra.fr/synteny/synteny/viewer.do#dataset' },
{
label: 'Sequence',
url: '#',
subMenu: [
{ label: 'Sequence', url: 'https://urgi.versailles.inra.fr/sequence/sequence/sequence/form.do' },
{ label: 'Experiment', url: 'https://urgi.versailles.inra.fr/sequence/sequence/experiment/form.do' },
{ label: 'Analysis', url: 'https://urgi.versailles.inra.fr/sequence/sequence/analysis/form.do' },
{ label: 'Project', url: 'https://urgi.versailles.inra.fr/sequence/sequence/project/form.do' },
]
}
]
}
};
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GnpIS Plant Data Search</title>
<base href="/">
<head>
<meta charset="utf-8">
<title>GnpIS Plant Data Search</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<gpds-root></gpds-root>
<!-- Required for the dropdown menu see : https://getbootstrap.com/docs/4.0/getting-started/introduction/#js -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</body>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<gpds-root></gpds-root>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment