Skip to content

Commit

Permalink
Make ARS service URL configurable separately (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Jun 20, 2023
1 parent b947a8b commit 0d32f07
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/.data_portal_ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ host: 127.0.0.1
port: 8080
svc_search_url: "http://127.0.0.1:8001"
svc_repository_url: "http://127.0.0.1:8002"
svc_api_url: "http://127.0.0.1:8000/api"
svc_ars_url: "http://127.0.0.1:8000/api/ars"
svc_users_url: "http://127.0.0.1:8000/api/auth/users"
svc_wps_url: "http://127.0.0.1:8000/api/wps"
default_data_access_duration_days: 365
2 changes: 1 addition & 1 deletion configure_build_serve/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Config(BaseSettings):
client_url: str = "https://data.ghga-dev.de/"
svc_search_url: str = f"{client_url}api/search"
svc_repository_url: str = f"{client_url}api/repository"
svc_api_url: str = f"{client_url}api"
svc_ars_url: str = f"{client_url}api/ars"
svc_users_url: str = f"{client_url}api/auth/users"
svc_wps_url: str = f"{client_url}api/wps"
oidc_client_id: str = "ghga-client"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-portal-ui",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "~6.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/components/accessRequests/accessRequests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { fetchJson } from "../../utils/utils";
import AccessRequestsList from "./accessRequestsList/accessRequestsList";
import AccessRequestsFilter from "./accessRequestsFilter/accessRequestsFilter";

const API_URL = process.env.REACT_APP_SVC_API_URL;
const ARS_URL = process.env.REACT_APP_SVC_ARS_URL;

const AccessRequests = () => {
const MIN_YEAR = 2000;
Expand Down Expand Up @@ -95,7 +95,7 @@ const AccessRequests = () => {
async function fetchData() {
let accessRequests: AccessRequest[] | null = null;
if (user?.id) {
const url = `${API_URL}/access-requests`;
const url = `${ARS_URL}/access-requests`;
try {
const response = await fetchJson(url);
if (response.ok) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { showMessage } from "../../messages/usage";
import { AccessRequest } from "../../../models/submissionsAndRequests";
import { useState } from "react";

const API_URL = process.env.REACT_APP_SVC_API_URL;
const ARS_URL = process.env.REACT_APP_SVC_ARS_URL;

interface AccessRequestModalProps {
show: boolean;
Expand All @@ -43,7 +43,7 @@ const AccessRequestModal = (props: AccessRequestModalProps) => {
return null;
}
setDisabledButtons(true);
const url = `${API_URL}/access-requests/${props.accessRequest?.id}`;
const url = `${ARS_URL}/access-requests/${props.accessRequest?.id}`;
try {
const response = await fetchJson(url, "PATCH", { status: status });
if (response.ok) {
Expand Down
6 changes: 3 additions & 3 deletions src/mocks/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ export const data = {
"POST /api/wps/work-packages": workPackageToken,

// All access requests
"GET /api/access-requests": accessRequests,
"GET /api/ars/access-requests": accessRequests,

// All access requests
"POST /api/access-requests": 204,
"POST /api/ars/access-requests": 204,

// Patch an access request
"PATCH /api/access-requests/*": 204,
"PATCH /api/ars/access-requests/*": 204,

// Static assets
"GET /static/*": undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/dataRequestFormModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DataRequestFormModal = (props: DataRequestFormModalProps) => {
return clean_email;
};

const API_URL = process.env.REACT_APP_SVC_API_URL;
const ARS_URL = process.env.REACT_APP_SVC_ARS_URL;
const { user } = useAuth();

const MILLISECONDS_TO_ADD: number =
Expand Down Expand Up @@ -56,7 +56,7 @@ const DataRequestFormModal = (props: DataRequestFormModalProps) => {
const { details, from, until, email, cancelButton, submitButton } =
e.target as typeof e.target & FormData;

const url = `${API_URL}/access-requests/`;
const url = `${ARS_URL}/access-requests/`;
submitButton.disabled = "true";
try {
const response = await fetchJson(url, "POST", {
Expand Down

0 comments on commit 0d32f07

Please sign in to comment.