Skip to content

Commit 4324a74

Browse files
authored
Merge pull request #30 from livMatS/master
Polished webapp
2 parents 3caa2cd + d79d0e0 commit 4324a74

35 files changed

+2022
-421
lines changed

.github/workflows/build-and-test.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ jobs:
1616
name: Node ${{ matrix.node-version }}
1717
steps:
1818
- name: Check out
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Set up node
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
2424
node-version: ${{ matrix.node-version }}
2525

@@ -29,13 +29,12 @@ jobs:
2929

3030
- name: Lint
3131
working-directory: ./dtool-lookup-webapp
32-
run: npm run lint
32+
run: npm run lint src
3333

3434
- name: Build
3535
working-directory: ./dtool-lookup-webapp
3636
run: npm run build
3737

38-
# needs true tests first:
39-
# - name: Run tests
40-
# working-directory: ./dtool-lookup-webapp
41-
# run: npm test
38+
- name: Run tests
39+
working-directory: ./dtool-lookup-webapp
40+
run: npm run test:unit

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ This change log uses principles from `keep a changelog <http://keepachangelog.co
1010
Added
1111
^^^^^
1212

13+
- Customizable landing page.
14+
- Logout button.
15+
- Search result pagniation.
16+
- Selection of entry number per page.
17+
- Version-dependent display of pagination.
18+
- Version-dependent display of README.yml content as clear text or as processed YAML/JSON.
19+
- A few simple unit tests.
1320

1421

1522
Changed
1623
^^^^^^^
1724

25+
- Updated from bootstrap-vue-3 to bootstap-vue-next
26+
- Adapted routes to remodeled dserver REST API.
27+
1828

1929
Deprecated
2030
^^^^^^^^^^
@@ -27,6 +37,7 @@ Removed
2737
Fixed
2838
^^^^^
2939

40+
- No search box on login screen.
3041

3142
Security
3243
^^^^^^^^

CONTRIBUTORS.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
Contributors
22
============
33

4-
- Lars Pastewka added the ability to configure the dtool-lookup-server and
5-
token-generator URLs from environment variables
4+
- **Ashwin Vazhappilly**:
5+
- Implemented direct MongoDB query functionality.
6+
- Added a logout button to the user interface.
7+
- Introduced pagination to improve data handling.
8+
- Contributed several unit tests to ensure reliability.
9+
- Adapted the web application to the remodeled dserver REST API for enhanced compatibility.
10+
- Enhanced user experience by allowing customizable landing pages.
11+
12+
- **Johannes L. Hörmann**:
13+
- Updated the initial codebase from Vue.js version 2 to Vue.js version 3, ensuring the application leverages the latest Vue.js features and improvements.
14+
15+
- **Lars Pastewka**:
16+
- Integrated the ability to configure dtool-lookup-server and token-generator URLs through environment variables, adding flexibility in deployment and configuration.
17+
18+
- **Tjelvar S. G. Olsson**:
19+
- Authored the initial version of the web application using Vue.js version 2, laying the foundation for further development and enhancements.

README.rst

Lines changed: 104 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,138 @@
11
dtool lookup webapp
22
===================
33

4-
- GitHub: https://github.com/jic-dtool/dtool-lookup-webapp
5-
- Free software: MIT License
4+
.. image:: https://github.com/livMatS/dtool-lookup-webapp/actions/workflows/build-and-test.yml/badge.svg
5+
:target: https://github.com/livMatS/dtool-lookup-webapp/actions/workflows/build-and-test.yml
6+
:alt: dtool-lookup-webapp build and test
67

7-
Web application to query and display information about datasets stored in one
8-
or more base URIs.
8+
.. image:: https://img.shields.io/badge/License-MIT-yellow.svg
9+
:target: https://opensource.org/licenses/MIT
10+
:alt: License: MIT
11+
12+
- GitHub repository: https://github.com/jic-dtool/dtool-lookup-webapp
13+
- License: MIT License (https://opensource.org/licenses/MIT)
14+
15+
This web application allows querying and displaying information about datasets stored in one or more base URIs.
916

1017
Dependencies
1118
------------
1219

13-
This web application depends on having two other web services to talk to:
20+
The web application requires two other web services:
1421

15-
1. `dtool-lookup-server <https://github.com/jic-dtool/dtool-lookup-server>`_
16-
2. `token-generator-ldap <https://github.com/jic-dtool/token-generator-ldap>`_
22+
1. dtool-lookup-server: https://github.com/jic-dtool/dtool-lookup-server - Provides a means to search and display dataset metadata.
23+
2. token-generator-ldap: https://github.com/jic-dtool/token-generator-ldap - Facilitates user authentication.
1724

18-
The first provides a means to search and display dataset metadata.
19-
The latter provides a means to authenticate users.
25+
Setup
26+
-----
2027

21-
Preamble
22-
-------
28+
Navigate to the `dtool-lookup-webapp` directory:
2329

24-
::
30+
.. code-block:: bash
2531
2632
cd dtool-lookup-webapp
2733
34+
Create a `.env` file in the `dtool-lookup-webapp` directory with the following contents:
2835

29-
Create a file `.env` in the `dtool-lookup-webapp` directory with the following contents:
36+
.. code-block:: bash
3037
31-
```
32-
VUE_APP_DTOOL_LOOKUP_SERVER_URL="http://localhost:5000"
33-
VUE_APP_DTOOL_LOOKUP_SERVER_TOKEN_GENERATOR_URL="http://localhost:5001/token"
34-
```
38+
VUE_APP_DTOOL_LOOKUP_SERVER_URL="http://localhost:5000"
39+
VUE_APP_DTOOL_LOOKUP_SERVER_TOKEN_GENERATOR_URL="http://localhost:5001/token"
3540
3641
For deployment, replace these URLs with the actual endpoints of the lookup server and the token generator.
3742

43+
Customization options for the landing page are available through the following environment variables in the `.env` file:
44+
45+
.. code-block:: text
46+
47+
VUE_APP_FIRST_CONTAINER_TITLE=Log in
48+
VUE_APP_SECOND_CONTAINER_TITLE=dserver
49+
VUE_APP_SECOND_CONTAINER_MESSAGE=Welcome to <b>dserver</b>'s webapp.
50+
VUE_APP_THIRD_CONTAINER_HEADING=Access
51+
VUE_APP_THIRD_CONTAINER_MESSAGE=Some notes on how to gain access.
52+
VUE_APP_FOURTH_CONTAINER_HEADING=Docs
53+
VUE_APP_FOURTH_CONTAINER_INTRO=Some notes on how to find help. The following list may contain an arbitrary number of links.
54+
VUE_APP_FOURTH_CONTAINER_RESOURCES=[{"text": "dtool-lookup-webapp repository", "url": "https://github.com/jic-dtool/dtool-lookup-webapp"}]
55+
VUE_APP_LANDING_PAGE_ICON_PATH=/icons/128x128/dtool_logo.png
56+
57+
Customization options for the upper right corner drop-down menu in the app are available through the following environment variables in the `.env` file:
58+
59+
.. code-block:: text
3860
39-
Start a development server
40-
--------------------------
61+
VUE_APP_OFFER_DTOOL_README_YAML_DOWNLOAD=true
62+
VUE_APP_OFFER_DTOOL_JSON_DOWNLOAD=true
63+
VUE_APP_SHOW_INFO_MENU_ENTRY=true
64+
VUE_APP_DTOOL_JSON_PATH=/data/templates/dtool.json
65+
VUE_APP_DTOOL_README_YAML_PATH=/data/templates/dtool_readme.yml
66+
VUE_APP_INFO_CONTENT="<tt>dtool.json</tt> is you local <i>dtool</i> client's configuration file. Place it at <tt>~/.config/dtool/dtool.json</tt>, where <tt>~</tt> is your home directoy, and create the directories if they do not exist.<br /><br /><tt>dtool_readme.yml</tt> is the metadata template used for documenting your datasets. Place it anywhere, but make sure that the entry <tt>DTOOL_README_TEMPLATE_FPATH</tt> within above's dtool.json points to the correct absolute path of your <tt>dtool_readme.yml</tt>. See <a href="https://dtool.readthedocs.io/en/latest/configuring_a_custom_readme_template.html" target="_blank" rel="noopener noreferrer">Configuring a custom README template</a> of <a href="https://dtool.readthedocs.io" target="_blank" rel="noopener noreferrer"></i>dtool</i>'s documentation</a>."
4167
42-
::
68+
All paths provided in these environment variables must be relative to this
69+
repository's `dtool-lookup-webapp/public` as root.
70+
Setting any of the `VUE_APP_OFFER_DTOOL_README_YAML_DOWNLOAD`,
71+
`VUE_APP_OFFER_DTOOL_JSON_DOWNLOAD`, `VUE_APP_SHOW_INFO_MENU_ENTRY` to `true`
72+
will show a download button for a `dtool_readme.yml` template, for a
73+
`dtool.json` configuration file, and a button for displaying arbitrary
74+
textual information configured with `VUE_APP_INFO_CONTENT`.
75+
Per default, all these buttons are hidden.
76+
77+
To apply changes to the `.env` file, execute:
78+
79+
.. code-block:: bash
80+
81+
npm install
82+
83+
Development Server
84+
------------------
85+
86+
To start a development server:
87+
88+
.. code-block:: bash
4389
4490
cd dtool-lookup-webapp
4591
npm run serve
4692
93+
Building for Production
94+
-----------------------
4795

48-
Compile into a static single page website
49-
-----------------------------------------
96+
To compile the application into a static single-page website:
5097

51-
::
98+
.. code-block:: bash
5299
53100
cd dtool-lookup-webapp
54101
npm run build
55102
103+
Fixing Broken Installations
104+
---------------------------
105+
106+
To address issues with dependencies in a broken installation:
107+
108+
.. code-block:: bash
109+
110+
rm -rf dist/ node_modules/
111+
rm package-lock.json
112+
113+
Then, reinstall the Vue CLI service and rebuild:
114+
115+
.. code-block:: bash
116+
117+
npm install @vue/cli-service
118+
npm run build
119+
120+
Testing
121+
-------
122+
123+
Testing requires the `jest.config.js` configuration file, which can be auto-generated by:
124+
125+
.. code-block:: bash
126+
127+
vue add unit-jest
128+
129+
This step follows the global installation of the Vue CLI:
130+
131+
.. code-block:: bash
132+
133+
npm install -g @vue/cli
56134
57-
More information
58-
----------------
135+
Additional Information
136+
----------------------
59137

60-
See dtool-lookup-webapp/README.md for more information about how to develop and build.
61-
See provision/README.rst for instructions on how to deploy using Ansibl.e
138+
For more details on development and build processes, refer to the `README.md` file within the `dtool-lookup-webapp` directory. For deployment instructions using Ansible, consult the `provision/README.rst`.

dtool-lookup-webapp/jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
preset: '@vue/cli-plugin-unit-jest'
3+
}

dtool-lookup-webapp/package.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8+
"test:unit": "vue-cli-service test:unit",
89
"lint": "vue-cli-service lint"
910
},
1011
"dependencies": {
12+
"@popperjs/core": "^2.11.7",
1113
"@soerenmartius/vue3-clipboard": "^0.1.2",
12-
"@vue/compat": "^3.2.31",
14+
"@vue/compat": "^3.4.15",
1315
"axios": "^1.1.3",
14-
"bootstrap": "^5.1.3",
15-
"bootstrap-vue-3": "^0.3.12",
16+
"bootstrap": "^5.3.2",
17+
"bootstrap-vue-next": "^0.16.6",
1618
"core-js": "^3.21.1",
17-
"filesize": "^8.0.7",
19+
"filesize": "9.0.11",
1820
"json2yaml": "^1.1.0",
1921
"moment": "^2.24.0",
20-
"vue": "^3.2.31",
22+
"vue": "^3.2.26",
2123
"vue-axios": "^3.4.1",
2224
"vuex": "^4.0.2"
2325
},
@@ -26,11 +28,20 @@
2628
"@babel/preset-react": "^7.16.7",
2729
"@vue/cli-plugin-babel": "^5.0.3",
2830
"@vue/cli-plugin-eslint": "^5.0.4",
31+
"@vue/cli-plugin-unit-jest": "~5.0.0",
2932
"@vue/cli-service": "^5.0.4",
30-
"@vue/compiler-sfc": "^3.2.31",
31-
"@vue/eslint-config-prettier": "^7.0.0",
33+
"@vue/compiler-sfc": "^3.4.15",
34+
"@vue/eslint-config-prettier": "^8.0.0",
35+
"@vue/test-utils": "^2.0.0-0",
36+
"@vue/vue3-jest": "^27.0.0-alpha.1",
37+
"babel-jest": "^27.0.6",
38+
"deepmerge": "^4.3.1",
3239
"eslint": "^8.11.0",
3340
"eslint-plugin-vue": "^9.6.0",
41+
"flush-promises": "^1.0.2",
42+
"jest": "^27.0.5",
43+
"sass": "^1.71.1",
44+
"sass-loader": "^14.1.1",
3445
"webpack": "^5.7.0"
3546
}
3647
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
{
3+
"DSERVER_TOKEN_GENERATOR_URL": "https://demo.dtool.dev/token",
4+
"DSERVER_URL": "https://demo.dtool.dev/lookup",
5+
"DSERVER_USERNAME": "testuser",
6+
"DSERVER_VERIFY_SSL": "true",
7+
"DTOOL_README_TEMPLATE_FPATH": "/path/to/.dtool_readme.yml",
8+
"DTOOL_S3_ACCESS_KEY_ID_test-bucket": "testuser_access_key",
9+
"DTOOL_S3_DATASET_PREFIX": "u/testuser/",
10+
"DTOOL_S3_ENDPOINT_test-bucket": "http://demo.dtool.dev:9000",
11+
"DTOOL_S3_SECRET_ACCESS_KEY_test-bucket": "testuser_secret_key",
12+
"DTOOL_SMB_DOMAIN_test-share": "WORKGROUP",
13+
"DTOOL_SMB_PASSWORD_test-share": "a-guest-needs-no-password",
14+
"DTOOL_SMB_PATH_test-share": "dtool",
15+
"DTOOL_SMB_SERVER_NAME_test-share": "demo.dtool.dev",
16+
"DTOOL_SMB_SERVER_PORT_test-share": 445,
17+
"DTOOL_SMB_SERVICE_NAME_test-share": "sambashare",
18+
"DTOOL_SMB_USERNAME_test-share": "guest",
19+
"DTOOL_USER_EMAIL": "[email protected]",
20+
"DTOOL_USER_FULL_NAME": "Your full name"
21+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
project: Project name
2+
description: Short description
3+
owners:
4+
- name: {DTOOL_USER_FULL_NAME}
5+
email: {DTOOL_USER_EMAIL}
6+
username: {username}
7+
orcid: Your orcid
8+
funders:
9+
- organization: Your funding organization
10+
program: Your program
11+
code: Program code
12+
creation_date: '{date}'
4.19 KB
Binary file not shown.
-4.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)