Skip to content

Commit 250613c

Browse files
committed
Merge branch 'main' into react-dashboard
2 parents c2a87d1 + 7caf8bd commit 250613c

File tree

11 files changed

+1957
-1475
lines changed

11 files changed

+1957
-1475
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Fetch base and install Poetry
1919
run: |
2020
git fetch origin ${{github.base_ref}}
21-
pipx install poetry
21+
pipx install poetry==2.1.1
2222
2323
- name: Setup Python
2424
uses: actions/setup-python@v4
@@ -31,7 +31,7 @@ jobs:
3131
cp --force designsafe/templates/base.j2 designsafe/templates/base.html
3232
3333
- run: |
34-
poetry install
34+
poetry sync
3535
3636
- name: Run Server-side unit tests and generate coverage report
3737
run: |
@@ -45,7 +45,7 @@ jobs:
4545
- name: Fetch base and install Poetry
4646
run: |
4747
git fetch origin ${{github.base_ref}}
48-
pipx install poetry
48+
pipx install poetry==2.1.1
4949
5050
- name: Setup Python
5151
uses: actions/setup-python@v4
@@ -55,7 +55,7 @@ jobs:
5555

5656
- name: Install Python Packages
5757
run: |
58-
poetry install
58+
poetry sync
5959
6060
- name: Run Server-side linting with pytest
6161
# Only run on new files for now-- for all changes, filter is ACMRTUXB

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ docs/_build/
9696
.docs/build
9797
target/
9898
venv/
99+
.venv/
99100
metrics/
100-
.python-version
101101

102102
# ignore Google Drive API secrets
103103
*secrets.json

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ build:
1212
build-dev:
1313
docker compose -f ./conf/docker/docker-compose-dev.yml build
1414

15+
.PHONY: python-install
16+
python-install:
17+
pyenv local 3.11 && POETRY_VIRTUALENVS_IN_PROJECT=true poetry sync || echo \
18+
'Command failed. Do you have Poetry (https://python-poetry.org/docs/#installation) \
19+
and pyenv (https://github.com/pyenv/pyenv?tab=readme-ov-file#a-getting-pyenv) installed? \
20+
You may also need to run "pyenv install 3.11".'
21+
22+
1523
.PHONY: start
1624
start:
1725
docker compose --env-file $(NGROK_ENV_FILE) -f ./conf/docker/docker-compose-dev.all.debug.yml up

client/modules/datafiles/src/projects/ProjectCitation/ProjectCitation.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from 'react';
2+
import { Popover } from 'antd';
23
import {
34
useDataciteMetrics,
45
useProjectDetail,
@@ -170,11 +171,26 @@ export const DownloadCitation: React.FC<{
170171
</a>
171172
<div>
172173
<span className={styles['yellow-highlight']}>
173-
{dataciteMetrics?.data.attributes.downloadCount ?? '--'} Downloads
174+
<Popover
175+
overlayStyle={{ maxWidth: '400px' }}
176+
title="Unique Requests"
177+
content="User sessions in which one or more files are downloaded or previewed."
178+
>
179+
{dataciteMetrics?.data.attributes.downloadCount ?? '--'} Unique
180+
Requests
181+
</Popover>
174182
</span>
175183
&nbsp;&nbsp;&nbsp;&nbsp;
176184
<span className={styles['yellow-highlight']}>
177-
{dataciteMetrics?.data.attributes.viewCount ?? '--'} Views
185+
<Popover
186+
overlayStyle={{ maxWidth: '400px' }}
187+
title="Unique Investigations"
188+
content="User sessions in which any project or publication metadata is viewed,
189+
or one or more files is downloaded or previewed"
190+
>
191+
{dataciteMetrics?.data.attributes.viewCount ?? '--'} Unique
192+
Investigations
193+
</Popover>
178194
</span>
179195
&nbsp;&nbsp;&nbsp;&nbsp;
180196
<span className={styles['yellow-highlight']}>

client/modules/datafiles/src/projects/ProjectPreview/ProjectPreview.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useMemo, useState } from 'react';
1+
import React, { useEffect, useMemo, useRef, useState } from 'react';
22
import {
33
apiClient,
44
DoiContextProvider,
@@ -25,7 +25,7 @@ import {
2525
FileTypeIcon,
2626
TFileListingColumns,
2727
} from '@client/common-components';
28-
import { Link, useParams } from 'react-router-dom';
28+
import { Link, useLocation, useParams } from 'react-router-dom';
2929
import { PublishedEntityDetails } from '../PublishedEntityDetails';
3030
import { PreviewModalBody } from '../../DatafilesModal/PreviewModal';
3131
import { SubEntityDetails } from '../SubEntityDetails';
@@ -225,6 +225,14 @@ export const PublishedEntityDisplay: React.FC<{
225225
: '';
226226
const { data: citationMetrics } = useDataciteMetrics(dois, !preview);
227227

228+
const publishedRef = useRef<HTMLElement>(null);
229+
const location = useLocation();
230+
useEffect(() => {
231+
if (location.hash === `#detail-${treeData.uuid}`) {
232+
publishedRef.current?.scrollIntoView();
233+
}
234+
}, [publishedRef, location, treeData.uuid]);
235+
228236
useEffect(() => {
229237
if (active && !preview) {
230238
const identifier = dois ?? treeData.uuid;
@@ -237,7 +245,11 @@ export const PublishedEntityDisplay: React.FC<{
237245
}, [active, preview, dois, projectId, treeData.name, treeData.uuid]);
238246

239247
return (
240-
<section>
248+
<section
249+
id={`#detail-${treeData.uuid}`}
250+
ref={publishedRef}
251+
style={{ scrollMargin: '70px' }}
252+
>
241253
<div
242254
className={styles['pub-show-button']}
243255
style={{
@@ -399,6 +411,8 @@ export const PublicationView: React.FC<{
399411
const { children } = data?.tree ?? {};
400412

401413
const { selectedVersion } = usePublicationVersions(projectId);
414+
const { hash } = useLocation();
415+
const openUuid = hash.split('#detail-').slice(-1)[0];
402416

403417
const sortedChildren = useMemo(
404418
() => [...(children ?? [])].sort((a, b) => (a.order ?? 0) - (b.order ?? 0)),
@@ -420,7 +434,10 @@ export const PublicationView: React.FC<{
420434
license={data.baseProject.license}
421435
projectId={projectId}
422436
treeData={child}
423-
defaultOpen={idx === 0 && sortedChildren.length === 1}
437+
defaultOpen={
438+
(idx === 0 && sortedChildren.length === 1) ||
439+
child.uuid === openUuid
440+
}
424441
key={child.id}
425442
/>
426443
</DoiContextProvider>

client/modules/datafiles/src/publications/modals/DownloadDatasetModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export const DownloadDatasetModal: React.FC<{
287287
</a>{' '}
288288
and follow the
289289
<a
290-
href="/user-guide/managingdata/#data-transfer-guides"
290+
href="/user-guide/managingdata/datatransfer/"
291291
target="_blank"
292292
aria-describedby="msg-open-new-window"
293293
>

conf/docker/Dockerfile

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,49 +34,43 @@ ENV LC_ALL en_US.utf-8
3434
ENV LANG en_US.utf-8
3535

3636
# https://python-poetry.org/docs/configuration/#using-environment-variables
37-
ENV POETRY_VERSION=1.8.2 \
38-
POETRY_HOME="/opt/poetry" \
37+
ENV POETRY_VERSION=2.1.1 \
3938
POETRY_VIRTUALENVS_IN_PROJECT=true \
4039
PYSETUP_PATH="/opt/pysetup" \
41-
VENV_PATH="/opt/pysetup/.venv"
40+
VENV_PATH="/opt/pysetup/.venv" \
41+
PIPX_ROOT_PATH="/root/.local/bin"
4242

43-
# Prepend venv and poetry to path
44-
ENV PATH="$VENV_PATH/bin:$POETRY_HOME/bin:$PATH"
43+
# Install pipx and poetry
44+
RUN python3 -m pip install --user pipx && python3 -m pipx ensurepath
45+
ENV PATH="${PIPX_ROOT_PATH}:${VENV_PATH}/bin:$PATH"
46+
RUN pipx install poetry==2.1.1
4547

4648
RUN groupadd --gid 816877 G-816877 && \
4749
useradd --uid 458981 --gid G-816877 -m --shell /bin/bash tg458981 -d /home/tg458981
4850

49-
# Install poetry version $POETRY_VERSION to $POETRY_HOME
50-
RUN pip3 install --no-cache-dir --upgrade pip setuptools wheel \
51-
&& python3 -m venv "$POETRY_HOME" \
52-
&& "$POETRY_HOME/bin/pip" install --no-cache-dir poetry=="$POETRY_VERSION"
53-
5451
# Copy project requirement files here to ensure they will be cached.
5552
WORKDIR $PYSETUP_PATH
56-
COPY poetry.lock pyproject.toml ./
53+
COPY pyproject.toml poetry.lock ./
5754

5855
##############
5956
# `development` image target is used for local development
6057
FROM python-base as development
6158

62-
RUN "$POETRY_HOME/bin/poetry" install
59+
RUN poetry sync
6360

6461
# Copy in base project directory without built client assets for local development
6562
COPY --chown=tg458981:G-816877 . /srv/www/designsafe
6663

6764
USER tg458981
6865

69-
# Install dev dependencies
70-
RUN "$POETRY_HOME/bin/poetry" install --with dev
71-
7266
WORKDIR /srv/www/designsafe
7367

7468
##############
7569
# `production` image target is used for deployed runtime environments
7670
FROM python-base as production
7771

7872
# Install runtime dependencies
79-
RUN "$POETRY_HOME/bin/poetry" install --without dev
73+
RUN poetry sync --without=dev
8074

8175
# Copy in built client assets
8276
COPY --from=node_build --chown=tg458981:G-816877 /designsafe/ /srv/www/designsafe

conf/nginx/nginx.debug.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ http {
4343
}
4444

4545
server {
46-
listen 443 ssl http2;
46+
listen 443 ssl;
47+
http2 on;
4748
server_name designsafe.dev;
4849

4950
charset utf-8;

designsafe/apps/nco/templates/designsafe/apps/nco/ttc_grants.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% load cms_tags static sekizai_tags%}
33

44
{% block title %}
5-
NHERI Facilities Scheduling Dashbaord
5+
NHERI Grant Research
66
{% endblock %}
77
{% block head_extra %}
88
<base href="{% url 'nco:ttc_grants' %}">

0 commit comments

Comments
 (0)