Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

95 - Invoke js dataverse use cases in the dataset page #112

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f0aa3ba
Changed: using .npmrc.example to force creating a copy with secret value
GPortas May 23, 2023
865b15d
feat(InvokeJsDataverse): refactor dataset id to persistentId
MellyGray May 23, 2023
033a2c1
feat(invokeJSDataverse): create Dataset Builder to create the labels
MellyGray May 24, 2023
4cfa02d
fix(License): add translations for internationalization
MellyGray May 25, 2023
5fb9d19
Merge branch 'develop' of https://github.com/IQSS/dataverse-frontend …
MellyGray May 25, 2023
b832b29
fix(Citation): refactor name
MellyGray May 25, 2023
1f6bdec
Changed: lighter frontend dev docker image and using remote dataverse…
GPortas May 25, 2023
db9358e
Merge branch 'feature/95-environment-tweaks-and-fixes' of https://git…
MellyGray May 25, 2023
1447983
feat(jsDataverseInvoke): get dataset title from module response
MellyGray May 25, 2023
7d5dfe1
feat(invokeJsDataverse): refactor metadataBlocks to match jsDataverse…
MellyGray May 25, 2023
19c1e52
fix(dev-env): clone repos with http
MellyGray May 25, 2023
680e4f6
fix(DatasetCitation): refactor
MellyGray May 26, 2023
6944250
fix(getDatasetById): rename to getDatasetByPersistentId
MellyGray May 26, 2023
1343dbf
fix(DatasetCitation): convert citation html to react element
MellyGray May 26, 2023
443f37a
fix(DatasetLabels): show unpublished and reformat text
MellyGray May 26, 2023
156ba8c
fix(DatasetLicense): rename iconUrl to iconUri
MellyGray May 26, 2023
8fd00e4
feat(invokeJsDataverse): get summary fields from use case
MellyGray May 26, 2023
ad0e8d1
feat(invokejsDataverse): get citation from use case
MellyGray May 26, 2023
eadd50d
feat(invokeJsDataverse): add get dataset by private url use case
MellyGray May 26, 2023
32720aa
fix(Dataset tabs): show metadata tab by default until we develop the …
MellyGray May 26, 2023
e39bd5d
Added: .npmrc file setup to GitHub workflows
GPortas May 28, 2023
f9b15a5
Fixed: GitHub workflows linting
GPortas May 28, 2023
1c17190
Added: updated js-dataverse with fixes and getting private url datase…
GPortas May 28, 2023
67b7deb
Merge branch 'feature/95-invoke-js-dataverse-use-cases-in-the-dataset…
MellyGray May 29, 2023
cf5c94a
fix(Citation): restore commented icon
MellyGray May 29, 2023
a736dd6
fix(Citation): tooltip translation key
MellyGray May 29, 2023
cb0d920
feat(invokeJsDataverse): add search by version
MellyGray May 29, 2023
b9b61ad
fix(DatasetCitation): test tooltip states
MellyGray May 29, 2023
0876dd2
fix: remove isLoading state when there is an error with js-dataset
MellyGray May 29, 2023
108d9cd
fix(invokeJsDataverse): retry with latest version if error thrown
MellyGray May 29, 2023
af299b7
feat(e2e): add loginAsAdmin command to login in jsf in e2e tests
MellyGray May 29, 2023
ee51d6e
fix: remove unused method
MellyGray May 29, 2023
25edbf6
fix(DatasetCitation story): remove unhandled state
MellyGray May 29, 2023
dbaeb8d
feat(e2e): add tests for the getDataset use case
MellyGray May 30, 2023
daf2321
feat(e2e): add pirvateUrl tests
MellyGray May 30, 2023
3747ac6
fix(DatasetLicense): add default license
MellyGray May 30, 2023
2b34ced
fix: divide tests into integration and e2e folders
MellyGray May 30, 2023
43e9239
only ignore root .env
pdurbin May 30, 2023
26302a7
add .env for dev-env #112
pdurbin May 30, 2023
9ecc971
feat(integration tests): add DatasetJSDataverseRepository tests
MellyGray May 30, 2023
8dba484
fix: Unable to resolve action actions/integrationTestsSetup-node, rep…
MellyGray May 30, 2023
b786fb5
Merge branch 'feature/95-invoke-js-dataverse-use-cases-in-the-dataset…
MellyGray May 30, 2023
ebfb221
fix(bootstrap): fix version in package.json
MellyGray May 30, 2023
27c821e
refactor: integration tests create a DataverseApiHelper class
MellyGray May 31, 2023
0aa77b8
Added: README note about issues when running dev-env with wd option
GPortas May 31, 2023
520a743
Update packages/design-system/package.json to fix bootstrap version
MellyGray Jun 1, 2023
f19134a
Merge branch 'develop' of https://github.com/IQSS/dataverse-frontend …
MellyGray Jun 1, 2023
c4c6c03
fix(chromatic): add .npmrc to the Github Action
MellyGray Jun 1, 2023
0f8f95f
fix(chromatic): replace / by /spa to fix locales path
MellyGray Jun 1, 2023
513959f
Fixed: type errors on DatasetMockData (stories) and DatasetMother (te…
GPortas Jun 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_DATAVERSE_BACKEND_URL=https://demo.dataverse.org
VITE_DATAVERSE_BACKEND_URL=http://localhost:8000
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@
}
}
],
"ignorePatterns": ["packages/design-system/dist/**"]
"ignorePatterns": ["packages/design-system/dist/**", "dev-env/vite.config.ts"]
}
4 changes: 4 additions & 0 deletions .github/workflows/chromatic-design-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
# Job steps
steps:
- uses: actions/checkout@v1
- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install dependencies
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm
run: rm package-lock.json && npm install
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
# Job steps
steps:
- uses: actions/checkout@v1
- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc
- name: Install dependencies
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm
run: rm package-lock.json && npm install
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
node-version: 18
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc

- name: Install Dependencies
run: npm install

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
node-version: 19
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc

- name: Install Dependencies
run: rm package-lock.json && npm install

Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
node-version: 18
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc

- name: Install Dependencies
run: rm package-lock.json && npm install

Expand Down Expand Up @@ -90,6 +95,11 @@ jobs:
node-version: 18
cache: 'npm'

- name: Create .npmrc
run: |
cp .npmrc.example .npmrc
sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc

- name: Install Dependencies
run: rm package-lock.json && npm install

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@

# misc
.DS_Store
.env
./.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.npmrc

npm-debug.log*
yarn-debug.log*
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

3 changes: 3 additions & 0 deletions .npmrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
legacy-peer-deps=true
registry=https://npm.pkg.github.com/IQSS
//npm.pkg.github.com/:_authToken=<YOUR_GITHUB_AUTH_TOKEN>
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ Once the script has finished, you will be able to access Dataverse via:
- [http://localhost:8000/spa](http://localhost:8000/spa): SPA Frontend
- [http://localhost:8000](http://localhost:8000): Dataverse Backend and JSF Frontend

If you want to run the environment with aggregated test data (collections and datasets), run the following command:

```
./run-env <dataverse_branch_name> wd
```

_Note: The above command uses the dataverse-sample-data repository whose scripts occasionally fail, so the 'wd' option is currently unstable and not recommended._

### Remove the environment

To clean up your environment of any running environment containers, as well as any associated data volumes, run this script inside the `dev-env` folder:
Expand Down
5 changes: 3 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import path from 'path'
export default defineConfig({
video: false,
e2e: {
baseUrl: 'http://localhost:5173/spa',
specPattern: 'tests/e2e/**/*.spec.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:8000',
specPattern: 'tests/e2e-integration/**/*.spec.{js,jsx,ts,tsx}',
fixturesFolder: 'tests/e2e-integration/fixtures',
screenshotOnRunFailure: false,
video: false,
viewportWidth: 1920,
Expand Down
4 changes: 4 additions & 0 deletions dev-env/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POSTGRES_VERSION=13
DATAVERSE_DB_USER=dataverse
SOLR_VERSION=8.11.1
REGISTRY=ghcr.io
21 changes: 21 additions & 0 deletions dev-env/add-env-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

echo "INFO - Cloning Dataverse sample data repository..."
git clone https://github.com/IQSS/dataverse-sample-data.git

echo "INFO - Configuring Dataverse sample data repository..."
cd dataverse-sample-data
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp ../dvconfig.py ./dvconfig.py
curl -X PUT -d 'true' ${DATAVERSE_API_BASE_URL}/admin/settings/:AllowApiTokenLookupViaApi
dataverse_api_token=$(python3 get_api_token.py)
sed -i '' "s/<DATAVERSE_API_TOKEN>/${dataverse_api_token}/g" dvconfig.py

echo "INFO - Creating sample data..."
python3 create_sample_data.py

echo "INFO - Cleaning up repository..."
cd ..
rm -rf dataverse-sample-data
1 change: 1 addition & 0 deletions dev-env/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ services:
- VITE_DATAVERSE_BACKEND_URL=http://localhost:8000
volumes:
- ../:/usr/src/app
- ../dev-env/vite.config.ts:/usr/src/app/vite.config.ts
- /usr/src/app/dev-env
- /usr/src/app/node_modules

Expand Down
1 change: 1 addition & 0 deletions dev-env/rm-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

docker-compose -f "./docker-compose-dev.yml" down
rm -rf ./docker-dev-volumes
rm -rf ./dataverse
26 changes: 6 additions & 20 deletions dev-env/run-env.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

export DATAVERSE_BRANCH_NAME=$1
export WITH_DATA_OPTION_VALUE=${2:-unset}

# To avoid timeout issues on frontend container startup
export COMPOSE_HTTP_TIMEOUT=200
Expand All @@ -13,7 +14,7 @@ echo "INFO - Removing current environment if exists..."
./rm-env.sh

echo "INFO - Cloning Dataverse backend repository..."
git clone -b ${DATAVERSE_BRANCH_NAME} git@github.com:IQSS/dataverse.git
git clone -b ${DATAVERSE_BRANCH_NAME} https://github.com/IQSS/dataverse.git

echo "INFO - Running docker containers..."
docker-compose -f "./docker-compose-dev.yml" up -d --build
Expand Down Expand Up @@ -41,22 +42,7 @@ echo "INFO - Cleaning up repository..."
cd ..
rm -rf dataverse

echo "INFO - Cloning Dataverse sample data repository..."
git clone git@github.com:IQSS/dataverse-sample-data.git

echo "INFO - Configuring Dataverse sample data repository..."
cd dataverse-sample-data
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp ../dvconfig.py ./dvconfig.py
curl -X PUT -d 'true' ${DATAVERSE_API_BASE_URL}/admin/settings/:AllowApiTokenLookupViaApi
dataverse_api_token=$(python3 get_api_token.py)
sed -i '' "s/<DATAVERSE_API_TOKEN>/${dataverse_api_token}/g" dvconfig.py

echo "INFO - Creating sample data..."
python3 create_sample_data.py

echo "INFO - Cleaning up repository..."
cd ..
rm -rf dataverse-sample-data
if [ "$WITH_DATA_OPTION_VALUE" == "wd" ]; then
echo "INFO - Adding data to the environment..."
./add-env-data.sh
fi
24 changes: 24 additions & 0 deletions dev-env/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import istanbul from 'vite-plugin-istanbul'

export default defineConfig({
plugins: [
react(),
istanbul({
cypress: true,
requireEnv: false
})
],
preview: {
port: 5173
},
server: {
//https://github.com/vitejs/vite/discussions/3396
host: true,
port: 5173,
hmr: {
clientPort: 8000 // nginx reverse proxy port
}
}
})
15 changes: 14 additions & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
FROM node:19.6.1
FROM node:19.6.1-alpine as BUILD_IMAGE

WORKDIR /usr/src/app/packages/design-system
COPY ./packages/design-system ./
RUN npm install
RUN npm run build

WORKDIR /usr/src/app
COPY package.json ./
COPY .npmrc ./
RUN npm install

FROM node:19.6.1-alpine

WORKDIR /usr/src/app
COPY --from=BUILD_IMAGE /usr/src/app/node_modules ./node_modules

EXPOSE 5173
CMD ["npm", "start"]
Binary file removed js-dataverse-2.0.0.tgz
Binary file not shown.
Loading