Skip to content

Commit c807550

Browse files
authored
Merge pull request #50 from mboudet/dev_version
Update UI & fix search
2 parents 1765cea + 6f1cc21 commit c807550

7 files changed

Lines changed: 68 additions & 44 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14-
- uses: actions/setup-node@v3
14+
- uses: actions/setup-node@v4
1515
with:
1616
node-version: 15
1717
- name: npm install

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
77

8+
## [0.4.10] 2023-11-23
9+
10+
### Added
11+
12+
- Added 'disable_header' config option, to hide GeneNotebook links and display on the landing page
13+
14+
### Fixed
15+
16+
- Fixed test CI
17+
- Fixed gene list not re-rendering properly when searching
18+
- Fixed search block on the bottom of the landing page
19+
820
## [0.4.9] 2023-11-17
921

1022
### Fixed

config.json.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"disable_blast": false,
44
"disable_user_login": false,
55
"disable_user_registration": false,
6+
"disable_header": false,
67
"blast_link": "",
78
"expression_unit": "My unit",
89
"externalSearch": false,

imports/ui/genetable/GeneTableBody.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function GeneTableBody({
236236
return (
237237
<tbody className="genetable-body">
238238
{genes.map((gene) => (
239-
<GeneTableRow key={gene.ID} gene={gene} {...props} />
239+
<GeneTableRow key={gene._id._str} gene={gene} {...props} />
240240
))}
241241
</tbody>
242242
);

imports/ui/landingpage/LandingPage.jsx

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { withTracker } from 'meteor/react-meteor-data';
44
import React, { useState } from 'react';
55
import PropTypes from 'prop-types';
66
import { Link } from 'react-router-dom';
7+
import SearchBar from '/imports/ui/main/SearchBar.jsx';
78

89
import getQueryCount from '/imports/api/methods/getQueryCount.js';
910
import { genomeCollection } from '/imports/api/genomes/genomeCollection.js';
@@ -14,9 +15,9 @@ import {
1415

1516
import './landingpage.scss';
1617

17-
function GeneNumber({ _id: genomeId }) {
18+
function GeneNumber({ _id: genomeId, annotationName: annotationName }) {
1819
const [geneNumber, setGeneNumber] = useState('...');
19-
getQueryCount.call({ query: { genomeId } }, (err, res) => {
20+
getQueryCount.call({ query: { genomeId, annotationName } }, (err, res) => {
2021
setGeneNumber(res);
2122
});
2223
return (
@@ -31,32 +32,37 @@ function Stats({ genomes = [] }) {
3132
<table className="table is-hoverable is-fullwidth has-background-white-bis">
3233
<thead>
3334
<tr>
34-
<th className="has-text-weight-bold">Name</th>
35-
<th className="has-text-weight-bold">Organism</th>
35+
<th className="has-text-weight-bold">Genome</th>
36+
<th className="has-text-weight-bold">Annotation</th>
3637
<th className="has-text-weight-bold has-text-centered">Status</th>
3738
<th className="has-text-weight-bold has-text-right">&#8470; genes</th>
3839
</tr>
3940
</thead>
4041
<tbody>
4142
{
4243
genomes.map(({
43-
_id, name, organism, isPublic,
44-
}) => (
45-
<tr key={_id} className="list-group-item d-flex justify-content-between">
46-
<td>{name}</td>
47-
<td>{ organism }</td>
48-
<td className="has-text-centered">
49-
{
50-
isPublic
51-
? <span className="tag is-success is-light">Public</span>
52-
: <span className="tag is-warning is-light">Private</span>
53-
}
54-
</td>
55-
<td className="has-text-right">
56-
<GeneNumber _id={_id} />
57-
</td>
58-
</tr>
59-
))
44+
_id, name, isPublic, annotationTrack
45+
}) => {
46+
if (typeof annotationTrack === 'undefined'){
47+
return []
48+
}
49+
return annotationTrack.map((annotation) => (
50+
<tr key={annotation._id} className="list-group-item d-flex justify-content-between">
51+
<td>{name}</td>
52+
<td>{ annotation.name }</td>
53+
<td className="has-text-centered">
54+
{
55+
isPublic
56+
? <span className="tag is-success is-light">Public</span>
57+
: <span className="tag is-warning is-light">Private</span>
58+
}
59+
</td>
60+
<td className="has-text-right">
61+
<GeneNumber _id={_id} annotationName={annotation.name} />
62+
</td>
63+
</tr>
64+
))
65+
})
6066
}
6167
</tbody>
6268
</table>
@@ -84,7 +90,7 @@ function statsDataTracker() {
8490
}
8591

8692
function hasNoGenomes({ genomes }) {
87-
return typeof genomes === 'undefined' || genomes.length === 0;
93+
return typeof genomes === 'undefined' || genomes.length === 0 || !genomes.some((genome) => typeof genome.annotationTrack !== 'undefined' && genome.annotationTrack.length > 0);;
8894
}
8995

9096
function NoGenomes() {
@@ -93,21 +99,21 @@ function NoGenomes() {
9399
? (
94100
<article className="message is-info" role="alert">
95101
<div className="message-body">
96-
Currently no genomes are available
102+
Currently no annotated genomes are available
97103
</div>
98104
</article>
99105
)
100106
: (
101107
<article className="message is-info" role="alert">
102108
<div className="message-body">
103-
No public genomes are available.&nbsp;
109+
No public annotated genomes are available.&nbsp;
104110
{! Meteor.settings.public.disable_user_login && (
105111
<>
106112
<Link to="/login">
107113
Sign in
108114
</Link>
109115
&nbsp;to access private data.
110-
</>
116+
</>
111117
)}
112118
</div>
113119
</article>
@@ -139,14 +145,18 @@ function LandingPage() {
139145
</a>
140146
)
141147
}
142-
148+
143149

144150
return (
145151
<>
146152
<section className="hero is-small is-light is-bold">
147153
<div className="hero-body">
154+
{ !Meteor.settings.public.disable_header && (
155+
<>
148156
<h1 className="title"> GeneNoteBook </h1>
149157
<h2 className="subtitle"> A collaborative notebook for genes and genomes </h2>
158+
</>
159+
)}
150160
<div className="box">
151161
<p className="font-weight-light">
152162
Through this site you can browse and query data for the following genomes:
@@ -157,7 +167,7 @@ function LandingPage() {
157167
!Meteor.userId()
158168
&& (
159169
<div className="buttons are-small" role="group">
160-
{! (Meteor.settings.public.disable_user_login === true || Meteor.settings.public.disable_user_registration === true) && (
170+
{! (Meteor.settings.public.disable_user_login === true || Meteor.settings.public.disable_user_registration === true) && (
161171
<Link to="/register" className="button is-success">
162172
<span className="icon-user-add" aria-hidden="true" />
163173
&nbsp;Create account
@@ -169,10 +179,12 @@ function LandingPage() {
169179
&nbsp;Sign in
170180
</Link>
171181
)}
182+
{ !Meteor.settings.public.disable_header && (
172183
<a href="http://genenotebook.github.io/" className="button is-dark is-outlined">
173184
<span className="icon-github" aria-hidden="true" />
174185
&nbsp;About GeneNotebook
175186
</a>
187+
)}
176188
</div>
177189
)
178190
}
@@ -233,15 +245,9 @@ function LandingPage() {
233245
</div>
234246
</div>
235247
<div className="content">
236-
Search genes by their attributes, such as GO-terms,
237-
protein domains or manual annotations.
238-
</div>
239-
<div className="content">
240-
<Link to={{ path: '/', state: { highLightSearch: true } }} className="button is-warning is-light is-fullwidth">
241-
<span className="icon-search" aria-hidden="true" />
242-
&nbsp;Search
243-
</Link>
248+
Search genes by their attributes, such as GO-terms, or protein domains.
244249
</div>
250+
<SearchBar isBlock={true}/>
245251
</div>
246252
</div>
247253
</div>
@@ -269,7 +275,7 @@ function LandingPage() {
269275
<div className="content">
270276
BLAST your protein or DNA sequence to genome annotations.
271277
</div>
272-
<div className="content">
278+
<div className="content">
273279
{blastLink}
274280
</div>
275281
</div>

imports/ui/main/SearchBar.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function SearchBar({
5151
searchString: initialSearchString,
5252
attributes,
5353
highLightSearch,
54+
isBlock
5455
}) {
5556
const [redirect, setRedirect] = useState(false);
5657
const [searchString, setSearchString] = useState(initialSearchString);
@@ -128,9 +129,13 @@ function SearchBar({
128129
let label = Meteor.settings.public.externalSearch ? "Select attributes to display" : "Select attributes to search"
129130
let display_attr = Meteor.settings.public.redirectSearch ? false : true
130131

132+
const className = isBlock ? "" : "navbar-item is-pulled-right"
133+
const size = isBlock ? "" : "is-small"
134+
const expanded = isBlock ? "is-expanded" : ""
135+
131136
return (
132137
<form
133-
className="navbar-item is-pulled-right"
138+
className={className}
134139
role="search"
135140
onSubmit={submit}
136141
>
@@ -139,7 +144,7 @@ function SearchBar({
139144
<div className="control has-dropdown">
140145
<div className="dropdown is-hoverable">
141146
<div className="dropdown-trigger">
142-
<button type="button" className="button is-small">
147+
<button type="button" className={"button " + size }>
143148
<span className="icon">
144149
<span className="icon-down" />
145150
</span>
@@ -170,10 +175,10 @@ function SearchBar({
170175
</div>
171176
</div>
172177
}
173-
<div className="control">
178+
<div className={"control " + expanded}>
174179
<input
175180
type="text"
176-
className="input is-small"
181+
className={"input " + size }
177182
placeholder="Search genes"
178183
value={searchString}
179184
onChange={(event) => setSearchString(event.target.value)}
@@ -182,7 +187,7 @@ function SearchBar({
182187
/>
183188
</div>
184189
<div className="control">
185-
<button type="submit" className="button is-small" disabled={invalidForm()}>
190+
<button type="submit" className={"button " + size } disabled={invalidForm()}>
186191
<span className="icon-search" />
187192
</button>
188193
</div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "genoboo",
3-
"version": "0.4.9",
3+
"version": "0.4.10",
44
"repository": "https://github.com/gogepp/genoboo",
55
"description": "A portable website for browsing and querying genome sequences and annotations. Forked from genenotebook",
66
"license": "AGPL-3.0",

0 commit comments

Comments
 (0)