Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature-2079-file-…
Browse files Browse the repository at this point in the history
…display
  • Loading branch information
rushirajnenuji committed Mar 25, 2024
2 parents 2e40dff + 5e05f0b commit 02b4d00
Show file tree
Hide file tree
Showing 68 changed files with 3,711 additions and 870 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ jobs:
run: npm ci
- name: Run tests
run: npm test
- name: Dry run jsdoc
run: npm run jsdoc-dry-run
29 changes: 28 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [Testing](#testing)
- [Code style](#code-style)
- [Documentation](#documentation)
- [PR Code Review Guidelines](#pr-code-review-guidelines)
- [Contributor license agreement](#contributor-license-agreement)

## Types of contributions
Expand All @@ -32,6 +33,10 @@ made to increase the value of MetacatUI to the community. We strive to
incorporate code, documentation, and other useful contributions quickly and
efficiently while maintaining a high-quality repository software product.

If you have any questions about contributing, please feel free to ask on the
[MetacatUI discussions board](https://github.com/NCEAS/metacatui/discussions) or
on the [DataONE Slack team](https://slack.dataone.org/).

## Pull Requests
We use the pull-request model for contributions. See [GitHub's help on pull-requests](https://help.github.com/articles/about-pull-requests/).

Expand Down Expand Up @@ -133,7 +138,7 @@ Read more documentation about how tests are run and viewed in [/test/README.md](
Code should be written to professional standards to enable clean, well-documented,
readable, and maintainable software. While there has been significant variability
in the coding styles applied historically, new contributions should strive for
clean code formatting. Some of the guidelines we follow include:
clean code formatting.

## Documentation

Expand Down Expand Up @@ -167,6 +172,28 @@ Things to check:
- All class methods and attributes are documented and displaying correctly
- Screenshots of views are displaying correctly

## PR Code Review Guidelines

When submitting a pull request (PR) to MetacatUI, it's essential to adhere not only to the above criteria on tests, formatting, and documentation, but also to additional aspects that ensure the quality and functionality of your contributions. Here are key points that reviewers will check during the code review process:

1. **Theme Compatibility**: Test your changes across all standard themes included in MetacatUI (such as `arctic`, `dataone`, `default`, `knb`) and those in the [metacatui-themes repository](https://github.com/NCEAS/metacatui-themes) (`drp` and `sctld`). This ensures consistency and compatibility across different visual presentations.

2. **Responsive Design**: Ensure that your changes perform well on various screen sizes, including mobile devices.

3. **Component Impact Analysis**: If you modify an existing model, collection, or view, review all instances where that component is utilized within MetacatUI. This is crucial to prevent unintended impacts, especially considering that our test coverage is not yet exhaustive.

4. **Performance Consideration**: Be mindful of the performance implications of your changes. This is particularly important for substantial additions, as we aim to maintain or improve the current performance levels of MetacatUI.

5. **Error Handling and Messaging**: Incorporate robust error handling in your code and ensure that any error messages are clear and user-friendly. If one component triggers an error for any reason, it should not disrupt the functionality of the entire application.

6. **Dependency Management**: When adding or updating dependencies, evaluate their necessity and impact on the project size. Avoid redundancy and prefer dependencies with a strong maintenance history and a large supporting community, as this increases the likelihood of long-term support.

7. **User Status Consideration**: If applicable, test the functionality of your changes for both signed-in and non-signed-in users.

8. **Documentation Updates**: In addition to updating JSDocs, if your changes affect any aspect covered in the MetacatUI guides (`docs/guide`), make the necessary updates. For significant features requiring configuration by MetacatUI administrators, consider adding a new guide.

9. **Security Assessment**: Ensure that any security implications of your changes are thoroughly considered and addressed.

## Contributor license agreement

In order to clarify the intellectual property license
Expand Down
5 changes: 4 additions & 1 deletion docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ GEM
jekyll-seo-tag (~> 2.1)
minitest (5.20.0)
mutex_m (0.1.2)
nokogiri (1.15.4-x86_64-darwin)
nokogiri (1.16.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
Expand Down Expand Up @@ -265,6 +267,7 @@ GEM

PLATFORMS
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
github-pages
Expand Down
1 change: 1 addition & 0 deletions docs/_includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ <h2>Themes</h2>
<a href="{{ site.url }}/install/configuration/index.html">Create a custom theme</a>
<a href="{{ site.url }}/guides/themes/images.html">Images</a>
<a href="{{ site.url }}/guides/themes/citations.html">Citations</a>
<a href="{{ site.url }}/guides/editor/funding-autocomplete">Funding Autocomplete</a>

<h2>API</h2>
<a href="{{ site.url }}/docs/AppConfig.html">Configuration</a>
Expand Down
87 changes: 87 additions & 0 deletions docs/guides/editor/funding-autocomplete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Setting Up a Proxy for NSF Award API in MetacatUI

MetacatUI integrates with the NSF (National Science Foundation) Award API to fetch award information. Since the NSF Award API does not support CORS (Cross-Origin Resource Sharing) or JSONP (JSON with Padding), it's necessary to set up a server-side proxy. This documentation guides you through setting up an Apache proxy to enable this functionality in MetacatUI.

![NSF Award API Proxy](guides/images/funding.png)

## Prerequisites

- Apache Web Server
- Access to Apache configuration files
- MetacatUI already installed and served via Apache

## Steps to Configure Apache as a Proxy

### 1. Enable Required Apache Modules

Ensure that the following Apache modules are enabled:

- `mod_proxy`
- `mod_proxy_http`

You can enable them by running the following commands:

```bash
sudo a2enmod proxy
sudo a2enmod proxy_http
```

Then, restart Apache to apply the changes:

```bash
sudo systemctl restart apache2
```

### 2. Configure Apache Virtual Host

Edit your Apache virtual host configuration file where MetacatUI is served. This file is typically located in `/etc/apache2/sites-available/`.

Add the following configuration inside the `<VirtualHost>` block:

```apache
# NSF Award API Proxy Configuration
ProxyPass "/research.gov/awardapi-service/v1/awards.json" "https://www.research.gov/awardapi-service/v1/awards.json"
ProxyPassReverse "/research.gov/awardapi-service/v1/awards.json" "https://www.research.gov/awardapi-service/v1/awards.json"
```

Replace `"https://www.research.gov/awardapi-service/v1/awards.json"` with the actual URL of the NSF Award API if it's different. You may also use a different proxy path if you prefer (other than `/research.gov/awardapi-service/v1/awards.json`), but make sure to update the proxy path in the `grantsUrl` property of the MetacatUI configuration as well.

### 3. Restart Apache

After editing the configuration file, restart Apache to apply the new settings:

```bash
sudo systemctl restart apache2
```

## Update MetacatUI Configuration

The last step is to update the MetacatUI configuration to use the proxy path, if you used a different proxy path than the default one. The default path is `/research.gov/awardapi-service/v1/awards.json`, relative to the domain on which your MetacatUI is served. If you used a different proxy path, you will need to update the `grantsUrl` property in the MetacatUI configuration:

```javascript
grantsUrl: "/research.gov/awardapi-service/v1/awards.json";
```

Ensure that you also have the funding lookup feature enabled in the MetacatUI configuration by setting the `fundingLookup` property to `true`. It defaults to `false`.

```javascript
useNSFAwardAPI: true;
```

## Testing

Ensure that the proxy is correctly set up by accessing the following URL in your browser:

```
[your MetacatUI domain]/research.gov/awardapi-service/v1/awards.json
```

You should see the JSON response from the NSF Award API.

## Conclusion

By following these steps, you set up an Apache proxy to enable the NSF award lookup feature in MetacatUI. Ensure you test the configuration to confirm everything is working as expected.

## Additional Notes

- Each MetacatUI installation that wants to use the NSF award lookup feature will need to set up its own proxy.
Binary file added docs/guides/images/funding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ of your MetacatUI application.
- <a href="{{ site.url }}/guides/catalog-view-config.html">📑 Catalog Search View</a>
- <a href="{{ site.url }}/guides/maps/cesium.html">🌎 Cesium Map</a>
- <a href="{{ site.url }}/guides/maps/cesium-for-portals.html">📍 Cesium Map for Portals</a>
- <a href="{{ site.url }}/guides/editor/funding-autocomplete.md">🔍 Funding Autocomplete</a>

<b>ℹ️ Is something missing? [Email us](mailto:metacat-dev@ecoinformatics.org) or join us on [Slack](https://slack.dataone.org/) and we'll add it!</b>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/views/maps/LayersPanelView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshots/views/maps/ViewfinderView.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 02b4d00

Please sign in to comment.