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

V1.3.4 patch #749

Open
wants to merge 5 commits into
base: v1.3.4-release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions configHelper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ prompt_required GLOBUS_CLIENT_SECRET "Enter the Globus Social Auth Secret" "6aWj
prompt_required SOLR_URL "Enter the SOLR URL \(default: https://esgf-node.llnl.gov/esg-search\)" "https://esgf-node.llnl.gov/esg-search" "https://esgf-node.llnl.gov/esg-search" "The URL at which the SOLR endpoint can be reached."
prompt_optional AUTHENTICATION_METHOD "Enter the Globus Authentication Method" "globus" "Which authentication method to enable for user sign in on the frontend."
prompt_optional FOOTER_TEXT "Enter the Footer Text (if it's a single line of markdown). If you need a more complex footer, skip for now and you can update the overlay file with your desired footer markdown afterwards." "Privacy & Legal Notice: [https://www.llnl.gov/disclaimer.html](https://www.llnl.gov/disclaimer.html)" "Text to display in the footer of the frontend. Useful for adding a link to the terms of service or other legal information. The string should be formatted as MarkDown and will be rendered as such."
prompt_optional GLOBUS_NODES "Enter a list of Globus enabled nodes (comma-separated)" "[ 'node1', 'node2' ]" "A comma-separated list of Globus enabled nodes."

# Prompt for Keycloak deployment
echo "(Optional) Do you wish to add Keycloak social auth settings? (yes/no)"
Expand Down Expand Up @@ -122,6 +123,7 @@ services:
METAGRID_SOCIAL_AUTH_GLOBUS_SECRET: $GLOBUS_CLIENT_SECRET
METAGRID_AUTHENTICATION_METHOD: $AUTHENTICATION_METHOD
METAGRID_FOOTER_TEXT: $FOOTER_TEXT
METAGRID_GLOBUS_NODES: $GLOBUS_NODES
EOF

if [ "$USE_KEYCLOAK" == "yes" ]; then
Expand Down
67 changes: 44 additions & 23 deletions docs/docs/contributors/frontend_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,18 @@ Adapted from sources:

```scaffold
frontend
├── Dockerfile
├── public
│ ├── changelog
│ │ ├── ...previous changelogs
│ │ └── v1.3.4.md
│ ├── messages
│ │ └── metagrid_messages.md
│ ├── favicon.ico
│ ├── index.html
│ └── manifest.json
│ ├── manifest.json
│ └── robots.txt
├── src
│ ├── api
│ │ ├── mock
│ │ │ ├── fixtures.ts
│ │ │ ├── server-handlers.test.ts
│ │ │ ├── server-handlers.ts
│ │ │ ├── server.ts
│ │ │ └── setup-env.ts
│ │ ├── index.test.ts
│ │ ├── index.ts
│ │ └── routes.ts
Expand All @@ -69,9 +68,11 @@ frontend
│ │ └── utils.ts
│ ├── components
│ │ ├── App
│ │ │ ├── recoil
│ │ │ │ └── atoms.ts
│ │ │ ├── App.css
│ │ │ ├── App.tsx
│ │ │ └── App.test.tsx
│ │ │ ├── App.test.tsx
│ │ │ └── App.tsx
│ │ ├── Cart
│ │ └── ...
│ ├── contexts
Expand All @@ -87,8 +88,22 @@ frontend
│ │ ├── keycloak
│ │ │ └── index.ts
│ ├── test
│ │ └── custom-render.tsx
│ ├── env.ts
│ │ ├── __mocks__
│ │ │ ├── assetFileMock.js
│ │ │ ├── js-pkce.ts
│ │ │ ├── keycloak-js.tsx
│ │ │ └── ReactMarkdownMock.tsx
│ │ ├── mock
│ │ │ ├── fixtures.ts
│ │ │ ├── mockStorage.ts
│ │ │ ├── server-handlers.test.ts
│ │ │ ├── server-handlers.ts
│ │ │ ├── server.ts
│ │ │ └── setup-env.ts
│ │ ├── custom-render.tsx
│ │ └── jestTestFunction.tsx
│ ├── types
│ │ └── globals.ts
│ ├── index.css
│ ├── index.tsx
│ └── setupTests.ts
Expand All @@ -97,23 +112,22 @@ frontend
├── .gitignore
├── .prettierignore
├── .prettierrc
├── docker-compose.prod.yml
├── docker-compose.yml
├── Dockerfile
├── index.html
├── Makefile
├── messageData.json
├── nginx.conf
├── package.json
├── README.md
├── tsconfig.json
├── vite.config.js
└── yarn.lock
```

- `Dockerfile` - The Dockerfile used by docker compose for the frontend
- `public/` - stores static files used before app is compiled [https://create-react-app.dev/docs/using-the-public-folder/#when-to-use-the-public-folder](https://create-react-app.dev/docs/using-the-public-folder/#when-to-use-the-public-folder)
- `public/` - stores static files used before app is compiled
- `src/` - where dynamic files reside, the **bulk of your work is done here**
- `api/` - contains API related files
- `mock/` - API mocking using [_mock-service-worker_](https://mswjs.io/docs/) package to avoid making real requests in test suites. More info [here](https://kentcdodds.com/blog/stop-mocking-fetch)
- `fixtures.ts` - stores objects that resemble API response data
- `server-handlers.ts` - handles requests to routes by mapping fixtures as responses to each route endpoint
- `server.ts` - sets up mock service worker server with server-handlers for tests. Essentially, it creates a mock server that intercepts all requests and handle it as if it were a real server
- `setup-envs.ts` - imports the mock service worker server to all tests before initialization
- `index.ts` - contains promise-based HTTP client request functions to APIs, references `routes.ts` for API URL endpoints
- `routes.ts` - contains routes to APIs and error-handling
- `assets/` - stores assets used when the app is compiled
Expand All @@ -123,14 +137,21 @@ frontend
- `contexts/` - stores React [Context](https://reactjs.org/docs/context.html) components, such as for authentication state
- `lib/` - stores initialized instances of third party library that are exported for use in the codebase (e.g. Axios, Keycloak)
- `test/` - contains related files and functions shared among tests
- `__mocks__/` - Directory containing mock versions of required dependencies to ensure they work with tests
- `js-pkce.ts` - A mock of the js-pkce.ts library used for Globus transfer steps
- `keycloak-js.tsx` - A mock of the keycloak-js library used for Keycloak authentication
- `mock/` - API mocking using [_mock-service-worker_](https://mswjs.io/docs/) package to avoid making real requests in test suites. More info [here](https://kentcdodds.com/blog/stop-mocking-fetch)
- `fixtures.ts` - stores objects that resemble API response data
- `mockStorage.ts` - functions and code that handles persistent storage requests for the test suite
- `server-handlers.ts` - handles requests to routes by mapping fixtures as responses to each route endpoint
- `server.ts` - sets up mock service worker server with server-handlers for tests. Essentially, it creates a mock server that intercepts all requests and handle it as if it were a real server
- `custom-render.tsx` - wraps the react-testing-library render method with contexts from `/context`
- `jestTestFunctions.tsx` - contains a set of helper functions that are used by various tests
- `setupTests.ts` - configuration for additional test environment settings for jest
- `.dockerignore` - files and folders to ignore when building docker containers
- `eslintrc.js` - configuration file for ESLint
- `.eslintrc.js` - configuration file for ESLint
- `.prettierignore` - files and folders to ignore when running prettier
- `.prettierrc` - configuration file for prettier
- `docker-compose.prod.yml` - the production overlay for docker-compose
- `docker-compose.yml` - the local development config for docker-compose
- `tsconfig.json` - configuration file for TypeScript
- `yarn.lock` - the purpose of a lock file is to lock down the versions of the dependencies specified in a package.json file. This means that in a yarn.lock file, there is an identifier for every dependency and sub dependency that is used for a project

Expand Down
14 changes: 7 additions & 7 deletions frontend/public/changelog/v1.0.10.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This update includes several improvements, bug fixes and enhancements.

**Changes**

1. Bugfix: limited wget script dataset count
2. Fix logout redirect issue
3. Added a Federated Nodes link (under the ESGF logo)
4. Updated Project website links
5. Updated React to version 18, migrated frontend components to a newer version, and other frontend package updates
6. Updated the compactness of the search table and adjusted styling to improve display of important feature columns
1. Bugfix: limited wget script dataset count.
2. Fix logout redirect issue.
3. Added a Federated Nodes link (under the ESGF logo).
4. Updated Project website links.
5. Updated React to version 18, migrated frontend components to a newer version, and other frontend package updates.
6. Updated the compactness of the search table and adjusted styling to improve display of important feature columns.
7. Added Globus Auth.
8. Updated keycloak version to 19 and updated configurations
8. Updated keycloak version to 19 and updated configurations.
14 changes: 7 additions & 7 deletions frontend/public/changelog/v1.0.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ This is the 'Messages' update! Moving forward, when a new Metagrid version is re

1. Added new notification drawer on the right which provides admins a way to communicate with users information relevant to Metagrid. Markdown docs can be displayed and content modified at run-time will be shown.
2. Created new Welcome dialog for first time users which includes buttons to start feature tours or view latest changes.
3. Created Change Log dialog that allows users to see details about latest update
4. Refactored the Joyride tours to improve ease and reliability of future updates
5. Updated test suite to handle latest major package updates and modifications
6. Migrated to the react-router-dom major version 6
7. Upgraded to Django 4.1.7 and upgraded various backend dependencies
8. Added support for backend url settings
9. Updated various minor frontend dependencies including keycloak-js
3. Created Change Log dialog that allows users to see details about latest update.
4. Refactored the Joyride tours to improve ease and reliability of future updates.
5. Updated test suite to handle latest major package updates and modifications.
6. Migrated to the react-router-dom major version 6.
7. Upgraded to Django 4.1.7 and upgraded various backend dependencies.
8. Added support for backend url settings.
9. Updated various minor frontend dependencies including keycloak-js.
8 changes: 4 additions & 4 deletions frontend/public/changelog/v1.0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is the 'Globus Transfer' update! You now have the ability to use the Globus
- Provided notifications and logic to alert users when they try to transfer a dataset that is not Globus Ready
- Added ability to store recent Globus transfer tasks as they are submitted, for later reference
- After a successful transfer, users can now click a link and view the submitted task on the Globus site
3. Utilized new functions that take advantage of Django's session storage, for persistent storage of needed data
4. Introduced the use or Recoil and shared state among various components, which will allow improved flexibility for adding features moving forward
5. Several updates to packages and refactoring of code to improve code base and application reliability
6. Bug fixes and minor improvements to the User Interface
3. Utilized new functions that take advantage of Django's session storage, for persistent storage of needed data.
4. Introduced the use or Recoil and shared state among various components, which will allow improved flexibility for adding features moving forward.
5. Several updates to packages and refactoring of code to improve code base and application reliability.
6. Bug fixes and minor improvements to the User Interface.
4 changes: 2 additions & 2 deletions frontend/public/changelog/v1.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ This update includes several improvements, additional features, bug fixes and en
1. Added ability to select a managed endpoint and obtain required scopes and permissions to successfully perform a transfer.
2. Added feature to allow users to copy a list of the available facet options when selecting facet filters. The list is copied as text to the user's clipboard and include the result count to match the frontend display.
3. Updated the search page to no longer use a button to confirm selected project. CMIP6 project will be selected by default.
4. Upgrade `antd` frontend library to `v5`
5. Upgrade `django` backend library to `4.2.10`
4. Upgrade `antd` frontend library to `v5`.
5. Upgrade `django` backend library to `4.2.10`.
6. **Bugfix** - support larger Globus Transfer dataset counts.
4 changes: 2 additions & 2 deletions frontend/public/changelog/v1.1.1-pre.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ This update includes a quick bug fix to address issues related to saved searches

**Changes**

1. Fixed bug related to saved search where the save action would fail if logged-in due to csrf tokens
2. Fixed issue where clicking saved search wouldn't restore the saved search in the search page
1. Fixed bug related to saved search where the save action would fail if logged-in due to csrf tokens.
2. Fixed issue where clicking saved search wouldn't restore the saved search in the search page.
2 changes: 1 addition & 1 deletion frontend/public/changelog/v1.1.2-pre.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This update includes several improvements, bug fixes and enhancements.

**Changes**

1. Added Globus endpoint pop-up that allows users to search and save collections and paths for transfers
1. Added Globus endpoint pop-up that allows users to search and save collections and paths for transfers.
2 changes: 1 addition & 1 deletion frontend/public/changelog/v1.1.3-pre.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Summary

1. **bugfix** affecting Wget script requests after clearing/repopulating the data cart.
2. Additonal reliability with more unit tests completed
2. Additonal reliability with more unit tests completed.
8 changes: 4 additions & 4 deletions frontend/public/changelog/v1.2.0.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Summary

1. Several bugfixes, typo fixes and minor enhancements
2. Updates to the CI configuration and full test suite upgrade
3. Additional reliability with most unit tests completed and passing
4. Several package upgrades for backend and frontend
1. Several bugfixes, typo fixes and minor enhancements.
2. Updates to the CI configuration and full test suite upgrade.
3. Additional reliability with most unit tests completed and passing.
4. Several package upgrades for backend and frontend.
2 changes: 1 addition & 1 deletion frontend/public/changelog/v1.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

1. Updates to the deployment of Metagrid
- Configuration for frontend is pulled from backend
2. Footer can now be customized and modified to satisfy requirements for different deployment sites
2. Footer can now be customized and modified to satisfy requirements for different deployment sites.
3. Added Dark Mode with the option to switch between Light and Dark themes.
2. Minor bugfixes.
6 changes: 3 additions & 3 deletions frontend/public/changelog/v1.3.1.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Summary

1. Updates to the Traefik deployment of Metagrid to work with the changes from v1.3.0s
2. Improvements and additional support for Helm deployments
3. Updates to Joyride Tutorial styling, to match selected themes
1. Updates to the Traefik deployment of Metagrid to work with the changes from v1.3.0s.
2. Improvements and additional support for Helm deployments.
3. Updates to Joyride Tutorial styling, to match selected themes.
4. Updated the link to obs4MIPS project and renamed buttons to use 'Data Info' instead of 'Website'.
4. Minor bugfixes.
9 changes: 5 additions & 4 deletions frontend/public/changelog/v1.3.4.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Summary

1. Updated the Globus path handling to work with the newest Globus changes
2. Bug fix for Globus transfers in Firefox
3. Globus login permissions may be requested, to help permissions with some endpoints.
4. Minor updates to Helm deployment
1. Updated the Globus path handling to work with the newest Globus changes.
2. Bug fix for Globus transfers in Firefox.
3. Minor updates to Helm deployment.
4. Updated to how session storage is used to persist variables between redirects.
5. Updated the cart summary to display information on selected datasets
19 changes: 0 additions & 19 deletions frontend/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import 'setimmediate'; // Added because in Jest 27, setImmediate is not defined,
import humps from 'humps';
import queryString from 'query-string';
import { AxiosResponse } from 'axios';
import PKCE from 'js-pkce';
import axios from '../lib/axios';
import {
RawUserCart,
Expand All @@ -30,11 +29,6 @@ import {
import { RawUserAuth, RawUserInfo } from '../contexts/types';
import apiRoutes, { ApiRoute, HTTPCodeType } from './routes';
import { GlobusEndpointSearchResults } from '../components/Globus/types';
import GlobusStateKeys from '../components/Globus/recoil/atom';

// Reference: https://github.com/bpedroza/js-pkce
export const REQUESTED_SCOPES =
'openid profile email urn:globus:auth:scope:transfer.api.globus.org:all';

export interface ResponseError extends Error {
status?: number;
Expand Down Expand Up @@ -647,19 +641,6 @@ export const saveSessionValues = async (data: { key: string; value: unknown }[])
await Promise.all(saveFuncs);
};

// Creates an auth object using desired authentication scope
export async function createGlobusAuthObject(): Promise<PKCE> {
const authScope = await loadSessionValue<string>(GlobusStateKeys.globusAuth);

return new PKCE({
client_id: window.METAGRID.GLOBUS_CLIENT_ID, // Update this using your native client ID
redirect_uri: `${window.location.origin}/cart/items`, // Update this if you are deploying this anywhere else (Globus Auth will redirect back here once you have logged in)
authorization_endpoint: 'https://auth.globus.org/v2/oauth2/authorize', // No changes needed
token_endpoint: 'https://auth.globus.org/v2/oauth2/token', // No changes needed
requested_scopes: authScope || REQUESTED_SCOPES, // Update with any scopes you would need, e.g. transfer
});
}

export const startSearchGlobusEndpoints = async (
searchText: string
): Promise<GlobusEndpointSearchResults> => {
Expand Down
Loading
Loading