diff --git a/.github/workflows/component-test.yaml b/.github/workflows/component-test.yaml index c8607495..457e694a 100644 --- a/.github/workflows/component-test.yaml +++ b/.github/workflows/component-test.yaml @@ -16,7 +16,7 @@ jobs: - name: Create .env file run: | - echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/\nNB_IS_FEDERATION_API=true" > .env + echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/" > .env - name: build run: npm install && npm run build diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 26a14990..bd94a11a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -33,7 +33,7 @@ jobs: cache: 'npm' - name: Create .env file run: | - echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/\nNB_IS_FEDERATION_API=true" > .env + echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/" > .env - name: Install dependencies run: npm ci - name: Build diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index c3d46f69..869abdcf 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -21,7 +21,7 @@ jobs: - name: Create .env file run: | - echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/\nNB_IS_FEDERATION_API=true\nNB_ENABLE_AUTH=true\nNB_QUERY_CLIENT_ID=mockclientid" > .env + echo -e "NB_API_QUERY_URL=https://federate.neurobagel.org/\nNB_ENABLE_AUTH=true\nNB_QUERY_CLIENT_ID=mockclientid" > .env - name: build run: npm install && npm run build diff --git a/README.md b/README.md index bb6e7876..686e43ba 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,6 @@ but before proceeding with either you need to set the environment variables. | Environment variable | Type | Required | Default value if not set | Example | | ------------------------ | ------- | ---------------------------------------- | ------------------------ | --------------------------------------------------------- | | `NB_API_QUERY_URL` | string | Yes | - | `https://federate.neurobagel.org/` | -| `NB_IS_FEDERATION_API` | boolean | No | `true` | `true` | | `NB_QUERY_APP_BASE_PATH` | string | No | `/` | `/query/` | | `NB_ENABLE_AUTH` | boolean | No | `false` | `false` | | `NB_QUERY_CLIENT_ID` | string | Yes (if `NB_ENABLE_AUTH` is set to true) | - | `46923719231972-dhsahgasl3123.apps.googleusercontent.com` | @@ -59,10 +58,6 @@ but before proceeding with either you need to set the environment variables. You'll need to set the `NB_API_QUERY_URL` environment variable required to run the query tool. `NB_API_QUERY_URL` is the [Neurobagel API](https://github.com/neurobagel/api) URL that the query tool uses to send requests to for results. -#### `NB_IS_FEDERATION_API` - -If the API you'd like to send queries to is not a [federation api](https://neurobagel.org/federate/), you need to set the `NB_IS_FEDERATION_API` to `false` as it is `true` by default. - #### `NB_QUERY_APP_BASE_PATH` If you are using a custom configuration where the query tool is accessible via a path other than the root (`/`), you need to set the `NB_QUERY_APP_BASE_PATH` to your custom path. This ensures that the query tool is correctly rendered and accessible at the specified URL @@ -82,16 +77,15 @@ To set environment variables, create a `.env` file in the root directory and add ```bash NB_API_QUERY_URL=http://localhost:8000/ -NB_IS_FEDERATION_API=false # For node API ``` -if you're using the remote (in this example federation) api, your `.env` file would look something like this: +if you're using the remote api, your `.env` file would look something like this: ```bash NB_API_QUERY_URL=https://federate.neurobagel.org/ ``` -if you're using a federation api with authentication, your `.env` file would look something like this: +if you're using a remote api with authentication, your `.env` file would look something like this: ```bash NB_API_QUERY_URL=https://federate.neurobagel.org/ diff --git a/src/App.tsx b/src/App.tsx index 2b99405f..1dcab97d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,7 +6,7 @@ import CloseIcon from '@mui/icons-material/Close'; import { SnackbarKey, SnackbarProvider, closeSnackbar, enqueueSnackbar } from 'notistack'; import { jwtDecode } from 'jwt-decode'; import { googleLogout } from '@react-oauth/google'; -import { queryURL, attributesURL, isFederationAPI, nodesURL, enableAuth } from './utils/constants'; +import { queryURL, attributesURL, nodesURL, enableAuth } from './utils/constants'; import { RetrievedAttributeOption, AttributeOption, @@ -136,17 +136,15 @@ function App() { } } - if (isFederationAPI) { - getNodeOptions(nodesURL).then((nodeResponse) => { - if (nodeResponse === null) { - enqueueSnackbar('Failed to retrieve Node options', { variant: 'error', action }); - } else if (nodeResponse.length === 0) { - enqueueSnackbar('No options found for Node', { variant: 'info', action }); - } else { - setAvailableNodes([...nodeResponse, { NodeName: 'All', ApiURL: 'allNodes' }]); - } - }); - } + getNodeOptions(nodesURL).then((nodeResponse) => { + if (nodeResponse === null) { + enqueueSnackbar('Failed to retrieve Node options', { variant: 'error', action }); + } else if (nodeResponse.length === 0) { + enqueueSnackbar('No options found for Node', { variant: 'info', action }); + } else { + setAvailableNodes([...nodeResponse, { NodeName: 'All', ApiURL: 'allNodes' }]); + } + }); }, []); useEffect(() => { @@ -309,34 +307,24 @@ function App() { 'Content-Type': 'application/json', }, }); - // TODO: remove this branch once there is no more non-federation option - if (isFederationAPI) { - setResult(response.data); - switch (response.data.nodes_response_status) { - case 'partial success': { - response.data.errors.forEach((error: NodeError) => { - enqueueSnackbar(`${error.node_name} failed to respond`, { - variant: 'warning', - action, - }); + setResult(response.data); + switch (response.data.nodes_response_status) { + case 'partial success': { + response.data.errors.forEach((error: NodeError) => { + enqueueSnackbar(`${error.node_name} failed to respond`, { + variant: 'warning', + action, }); - break; - } - case 'fail': { - enqueueSnackbar('Error: All nodes failed to respond', { variant: 'error', action }); - break; - } - default: { - break; - } + }); + break; + } + case 'fail': { + enqueueSnackbar('Error: All nodes failed to respond', { variant: 'error', action }); + break; + } + default: { + break; } - } else { - const myResponse = { - responses: response.data, - nodes_response_status: 'success', - errors: [], - }; - setResult(myResponse); } } catch (error) { enqueueSnackbar('Failed to retrieve results', { variant: 'error', action }); diff --git a/src/components/QueryForm.tsx b/src/components/QueryForm.tsx index 8867c764..96688acd 100644 --- a/src/components/QueryForm.tsx +++ b/src/components/QueryForm.tsx @@ -6,7 +6,7 @@ import { FormHelperText, } from '@mui/material'; import SendIcon from '@mui/icons-material/Send'; -import { isFederationAPI, sexes, modalities } from '../utils/constants'; +import { sexes, modalities } from '../utils/constants'; import { NodeOption, AttributeOption, FieldInput } from '../utils/types'; import CategoricalField from './CategoricalField'; import ContinuousField from './ContinuousField'; @@ -78,35 +78,27 @@ function QueryForm({ minNumImagingSessionsHelperText !== ''; return ( -