Skip to content

Commit 634dbbf

Browse files
committed
Merge branch 'main' of https://github.com/RolnickLab/ami-platform into 387-add-top-species-chart-to-overview-page
2 parents 1ed5be8 + 8d1acd5 commit 634dbbf

File tree

6 files changed

+41
-6
lines changed

6 files changed

+41
-6
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ venv
1515
.env
1616
.envs
1717
.envs/*
18+
node_modules

ami/main/charts.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,12 @@ def event_top_taxa(event_pk: int, top_n: int = 10):
279279
else:
280280
taxa, counts = [], []
281281

282+
# Restrict number of top species if too many
283+
MAX_SPECIES = 10
284+
if len(taxa) > MAX_SPECIES:
285+
taxa = taxa[:MAX_SPECIES]
286+
counts = counts[:MAX_SPECIES]
287+
282288
return {
283289
"title": "Top species",
284290
"data": {"x": counts, "y": taxa},

ami/templates/base.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@
6161
<li class="nav-item active">
6262
<a class="nav-link" href="{% url 'home' %}">Home <span class="visually-hidden">(current)</span></a>
6363
</li>
64-
<li class="nav-item">
65-
<a class="nav-link" href="{% url 'about' %}">About</a>
66-
</li>
6764
</ul>
6865
</div>
6966
</div>

compose/local/ui/Dockerfile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# Node version should always match the version in `ui/.nvmrc`
22
FROM node:18
3+
4+
# Set the working directory in the container
35
WORKDIR /app
6+
7+
# Copy package.json and yarn.lock
48
COPY package.json yarn.lock ./
9+
10+
# Install dependencies
11+
# RUN yarn install --frozen-lockfile
512
RUN yarn install
6-
RUN ["git", "config", "--global", "--add", "safe.directory", "/app"]
13+
14+
# Copy the rest of the application code
15+
# Don't need this in the local env, we're mounting the code in the compose file
16+
# COPY . .
17+
18+
# Verify that node_modules exists and has content
19+
RUN ls -la /app/node_modules
20+
21+
# Configure git to trust the /app directory
22+
RUN git config --global --add safe.directory /app
23+
24+
# Don't try to open a browser
725
ENV BROWSER=none
8-
CMD ["yarn", "start", "--host", "0.0.0.0" , "--port", "4000"]
26+
27+
# Expose the port the app runs on
28+
EXPOSE 4000
29+
30+
# Define the command to run the app
31+
CMD ["yarn", "start", "--host", "0.0.0.0", "--port", "4000"]

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ volumes:
88
o: bind
99
minio_data:
1010
driver: local
11+
node_modules:
1112

1213
services:
1314
django: &django
@@ -53,6 +54,7 @@ services:
5354
volumes:
5455
- ./.git:/app/.git:ro
5556
- ./ui:/app
57+
- node_modules:/app/node_modules
5658
depends_on:
5759
- django
5860
environment:

ui/src/design-system/components/plot/plot.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ const Plot = ({
3434
marker: {
3535
color: markerColor,
3636
},
37-
hovertemplate,
37+
hovertemplate:
38+
type === 'bar' && orientation === 'h'
39+
? '%{x}'
40+
: type === 'bar'
41+
? '%{y}'
42+
: '<b>%{x}</b>: %{y}',
43+
name: '', // Remove ‘trace 0’ next to hover
3844
},
3945
]}
4046
config={{

0 commit comments

Comments
 (0)