{
- const { user, setUser } = useContext(myContext);
+ const { user, setUser,setUserPic, userPic, vocabUrl } = useContext(myContext);
useEffect(() => {
const storedUser = localStorage.getItem('user');
+ const storedUserPic = localStorage.getItem('userPic');
if (storedUser) {
setUser(JSON.parse(storedUser));
+ setUserPic(JSON.parse(storedUserPic));
}
}, []);
+
// If there is a user, it displays the Logout function with user information. Otherwise, it displays the login button
return user ? (
-
+
) : (
// Logs user in, decodes the JWT token, saves the decoded JWT in local storage and sets user to it
@@ -25,11 +29,18 @@ export const Login = () => {
const credentialResponseDecoded = jwtDecode(
credentialResponse.credential
);
- setUser(credentialResponseDecoded);
+ console.log(credentialResponseDecoded,"credentialResponseDecoded");
localStorage.setItem(
'user',
- JSON.stringify(credentialResponseDecoded)
+ JSON.stringify(credentialResponseDecoded.email)
);
+ localStorage.setItem(
+ 'picture',
+ JSON.stringify(credentialResponseDecoded.picture)
+ );
+ startSession(vocabUrl, credentialResponseDecoded.email);
+ setUser(credentialResponseDecoded.email);
+ setUserPic(credentialResponseDecoded.picture);
}}
onError={() => {
console.log('Login Failed');
@@ -37,4 +48,4 @@ export const Login = () => {
/>
);
-};
\ No newline at end of file
+};
diff --git a/src/components/Auth/LoginPage.jsx b/src/components/Auth/LoginPage.jsx
index 9df1e10..04f31bc 100644
--- a/src/components/Auth/LoginPage.jsx
+++ b/src/components/Auth/LoginPage.jsx
@@ -1,14 +1,14 @@
import { Login } from "./Login"
import { useContext } from 'react';
import { myContext } from '../../App';
+import { getSessionStatus } from "../Manager/SessionsManager";
export const LoginPage = () => {
- const {user} = useContext(myContext);
+ const {user,vocabUrl} = useContext(myContext);
return
{user &&
You are logged in and can navigate to the rest of the site
}
-
}
\ No newline at end of file
diff --git a/src/components/Auth/Logout.jsx b/src/components/Auth/Logout.jsx
index 3aa8d16..8691708 100644
--- a/src/components/Auth/Logout.jsx
+++ b/src/components/Auth/Logout.jsx
@@ -2,11 +2,19 @@ import { googleLogout } from '@react-oauth/google';
import './Auth.scss';
import { LogoutOutlined } from '@ant-design/icons';
import { Tooltip } from 'antd';
+import { endSession } from '../Manager/SessionsManager';
+import { useContext } from 'react';
+import { myContext } from '../../App';
+
+export const Logout = ({ user, setUser,userPic,setUserPic }) => {
+ const { vocabUrl } = useContext(myContext)
-export const Logout = ({ user, setUser }) => {
const logOut = () => {
+
googleLogout();
+ endSession(vocabUrl);
setUser(null);
+ setUserPic(null);
localStorage.removeItem('user');
};
@@ -14,8 +22,8 @@ export const Logout = ({ user, setUser }) => {
<>
-
![]({user.picture})
- {user?.email}
+
![]({userPic})
+ {String(user)}
{
>
);
-};
\ No newline at end of file
+};
diff --git a/src/components/Manager/FetchManager.jsx b/src/components/Manager/FetchManager.jsx
index 7c5747c..b945660 100644
--- a/src/components/Manager/FetchManager.jsx
+++ b/src/components/Manager/FetchManager.jsx
@@ -4,6 +4,7 @@ import { ontologyReducer } from './Utility';
export const getAll = (vocabUrl, name, navigate) => {
return fetch(`${vocabUrl}/${name}`, {
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -24,6 +25,7 @@ export const getAll = (vocabUrl, name, navigate) => {
export const getById = async (vocabUrl, name, id, navigate) => {
return fetch(`${vocabUrl}/${name}/${id}`, {
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -46,13 +48,13 @@ export const getById = async (vocabUrl, name, id, navigate) => {
// Deletes one element by its id
export const handleDelete = (evt, vocabUrl, name, component, user) => {
- const options = { method: 'DELETE' };
+ const options = { method: 'DELETE', credentials: 'include', };
if (name === 'Table' || name === 'Terminology') {
options.headers = {
'Content-Type': 'application/json',
};
- options.body = JSON.stringify({ editor: user.email });
+ // options.body = JSON.stringify({ editor: user.email });
}
return fetch(`${vocabUrl}/${name}/${component.id}`, options)
.then(response => {
@@ -82,6 +84,7 @@ export const handleDelete = (evt, vocabUrl, name, component, user) => {
export const handleUpdate = (vocabUrl, name, component, values) => {
return fetch(`${vocabUrl}/${name}/${component.id}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -101,6 +104,7 @@ export const handleUpdate = (vocabUrl, name, component, values) => {
export const handlePost = (vocabUrl, name, body) => {
return fetch(`${vocabUrl}/${name}`, {
method: 'POST',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -119,6 +123,7 @@ export const handlePost = (vocabUrl, name, body) => {
export const handlePatch = (vocabUrl, name, component, body) => {
return fetch(`${vocabUrl}/${name}/${component.id}/rename`, {
method: 'PATCH',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -137,6 +142,7 @@ export const handlePatch = (vocabUrl, name, component, body) => {
export const getProvenanceByCode = async (vocabUrl, name, id, code) => {
return fetch(`${vocabUrl}/Provenance/${name}/${id}/code/${code}`, {
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -154,6 +160,7 @@ export const getProvenanceByCode = async (vocabUrl, name, id, code) => {
export const getOntologies = vocabUrl => {
return fetch(`${vocabUrl}/OntologyAPI`, {
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -188,6 +195,7 @@ export const olsFilterOntologiesSearch = (
`${vocabUrl}/ontology_search?keyword=${query}&selected_ontologies=${ontologiesToSearch}&selected_api=ols&results_per_page=${entriesPerPage}&start_index=${pageStart}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -234,6 +242,7 @@ export const getFiltersByCode = (
}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Manager/MappingsFunctions/AssignMappings.jsx b/src/components/Manager/MappingsFunctions/AssignMappings.jsx
index 1cd04c5..0718038 100644
--- a/src/components/Manager/MappingsFunctions/AssignMappings.jsx
+++ b/src/components/Manager/MappingsFunctions/AssignMappings.jsx
@@ -77,7 +77,6 @@ export const AssignMappings = ({
}));
const mappingsDTO = {
mappings: selectedMappings,
- editor: user.email,
};
fetch(
diff --git a/src/components/Manager/MappingsFunctions/ClearMappings.jsx b/src/components/Manager/MappingsFunctions/ClearMappings.jsx
index bf2506b..4121143 100644
--- a/src/components/Manager/MappingsFunctions/ClearMappings.jsx
+++ b/src/components/Manager/MappingsFunctions/ClearMappings.jsx
@@ -18,10 +18,11 @@ export const ClearMappings = ({ propId, component }) => {
const handleDelete = evt => {
return fetch(`${vocabUrl}/${component}/${propId}/mapping`, {
method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ editor: user.email }),
+ credentials: 'include',
+ // headers: {
+ // 'Content-Type': 'application/json',
+ // },
+ // body: JSON.stringify({ editor: user.email }),
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Manager/MappingsFunctions/FilterAPI.jsx b/src/components/Manager/MappingsFunctions/FilterAPI.jsx
index 281151a..60bf335 100644
--- a/src/components/Manager/MappingsFunctions/FilterAPI.jsx
+++ b/src/components/Manager/MappingsFunctions/FilterAPI.jsx
@@ -60,6 +60,7 @@ export const FilterAPI = ({
setTableLoading(true),
fetch(`${vocabUrl}/OntologyAPI/${active}`, {
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Manager/MappingsFunctions/FilterReset.jsx b/src/components/Manager/MappingsFunctions/FilterReset.jsx
index 13f5f6e..7c3c56b 100644
--- a/src/components/Manager/MappingsFunctions/FilterReset.jsx
+++ b/src/components/Manager/MappingsFunctions/FilterReset.jsx
@@ -24,10 +24,10 @@ export const FilterReset = ({ table, terminology }) => {
}`,
{
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
}
)
.then(res => {
@@ -52,6 +52,7 @@ export const FilterReset = ({ table, terminology }) => {
}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Manager/MappingsFunctions/FilterSelect.jsx b/src/components/Manager/MappingsFunctions/FilterSelect.jsx
index 5de5553..740e558 100644
--- a/src/components/Manager/MappingsFunctions/FilterSelect.jsx
+++ b/src/components/Manager/MappingsFunctions/FilterSelect.jsx
@@ -124,7 +124,6 @@ export const FilterSelect = ({ component, table, terminology }) => {
const apiPreferenceDTO = {
api_preference: apiPreference?.api_preference,
- editor: user.email,
};
const method =
@@ -139,6 +138,7 @@ export const FilterSelect = ({ component, table, terminology }) => {
: `Terminology/${terminology.id}/filter`)}`,
{
method: method,
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -159,6 +159,7 @@ export const FilterSelect = ({ component, table, terminology }) => {
: `Terminology/${terminology.id}/filter`)}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Manager/MappingsFunctions/GetMappingsModal.jsx b/src/components/Manager/MappingsFunctions/GetMappingsModal.jsx
index 17e2259..ace4691 100644
--- a/src/components/Manager/MappingsFunctions/GetMappingsModal.jsx
+++ b/src/components/Manager/MappingsFunctions/GetMappingsModal.jsx
@@ -19,7 +19,6 @@ import {
ontologyFilterCodeSubmit,
} from '../FetchManager';
import { OntologyCheckboxes } from './OntologyCheckboxes';
-
import { MappingRelationship } from './MappingRelationship';
export const GetMappingsModal = ({
@@ -172,7 +171,7 @@ export const GetMappingsModal = ({
const mappingsDTO = {
mappings: selectedMappings,
- editor: user.email,
+ editor: user
};
setLoading(true);
@@ -180,6 +179,7 @@ export const GetMappingsModal = ({
`${vocabUrl}/${componentString}/${component.id}/mapping/${mappingProp}?user_input=true&user=${user?.email}`,
{
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Manager/SessionsManager.jsx b/src/components/Manager/SessionsManager.jsx
new file mode 100644
index 0000000..3e4cccc
--- /dev/null
+++ b/src/components/Manager/SessionsManager.jsx
@@ -0,0 +1,60 @@
+export const startSession = (vocabUrl, email) => {
+ const body = {
+ 'user_id': email,
+ // 'affiliation': 'affiliation',
+ };
+ return fetch(`${vocabUrl}/session/start`, {
+ method: 'POST',
+ credentials: 'include',
+ body: JSON.stringify(body),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ }).then(async res => {
+ const data = await res.json();
+ if (res.ok) {
+ console.log(data.message);
+ return data;
+ } else {
+ throw new Error(data.message || 'Unknown error occurred');
+ }
+ });
+};
+
+export const endSession = vocabUrl => {
+
+ return fetch(`${vocabUrl}/session/terminate`, {
+ method: 'POST',
+ credentials: 'include',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ }).then(async res => {
+ const data = await res.json();
+ if (res.ok) {
+ console.log(data.message,'ended');
+
+ return data;
+ } else {
+ throw new Error(data.message || 'Unknown error occurred');
+ }
+ });
+};
+
+export const getSessionStatus = vocabUrl => {
+ return fetch(`${vocabUrl}/session/status`, {
+ method: 'GET',
+ credentials: 'include',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ }).then(async res => {
+ const data = await res.json();
+ if (res.ok) {
+ console.log(data.message);
+ return data;
+ } else {
+ throw new Error(data.message || 'Unknown error occurred');
+ }
+ });
+};
diff --git a/src/components/Manager/ShowHistory.jsx b/src/components/Manager/ShowHistory.jsx
index 6d171d6..14bc620 100644
--- a/src/components/Manager/ShowHistory.jsx
+++ b/src/components/Manager/ShowHistory.jsx
@@ -34,7 +34,7 @@ export const ShowHistory = ({
const valuesRender = text => {
if (!text) return null;
return text
- .split(',')
+ ?.split(',')
.map((item, index) => {item.trim()}
);
};
@@ -74,24 +74,25 @@ export const ShowHistory = ({
};
const dataSource =
- provData?.changes?.map((prov, index) => ({
- key: index,
- timestamp: prov.timestamp,
- action: prov.action,
- old_value: prov.old_value,
- new_value: prov.new_value,
- editor: prov.editor,
- })).sort((a, b) => {
- const dateA = new Date(a.timestamp);
- const dateB = new Date(b.timestamp);
- return dateB - dateA;
- }) ?? [];
+ provData?.changes
+ ?.map((prov, index) => ({
+ key: index,
+ timestamp: prov.timestamp,
+ action: prov.action,
+ old_value: prov.old_value,
+ new_value: prov.new_value,
+ editor: prov.editor,
+ }))
+ .sort((a, b) => {
+ const dateA = new Date(a.timestamp);
+ const dateB = new Date(b.timestamp);
+ return dateB - dateA;
+ }) ?? [];
const handleTableChange = (current, size) => {
setPageSize(size);
};
-
return (
showHistory === tableData.key && (
diff --git a/src/components/Ontologies/OntologyAPIs.jsx b/src/components/Ontologies/OntologyAPIs.jsx
index 1feb1d2..eb00ca4 100644
--- a/src/components/Ontologies/OntologyAPIs.jsx
+++ b/src/components/Ontologies/OntologyAPIs.jsx
@@ -38,6 +38,7 @@ export const OntologyInfo = () => {
setTableLoading(true),
fetch(`${vocabUrl}/OntologyAPI/${active}`, {
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/DataDictionaries/RemoveTableDD.jsx b/src/components/Projects/DataDictionaries/RemoveTableDD.jsx
index 0327fd1..0a0a0d1 100644
--- a/src/components/Projects/DataDictionaries/RemoveTableDD.jsx
+++ b/src/components/Projects/DataDictionaries/RemoveTableDD.jsx
@@ -20,6 +20,7 @@ export const RemoveTableDD = ({ DDId, table, getDDTables }) => {
const handleRemove = () => {
return fetch(`${vocabUrl}/DataDictionary/${DDId}/Table/${table.id}`, {
method: 'DELETE',
+ credentials: 'include',
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Projects/Studies/RemoveStudyDD.jsx b/src/components/Projects/Studies/RemoveStudyDD.jsx
index 3989b51..a17c4f2 100644
--- a/src/components/Projects/Studies/RemoveStudyDD.jsx
+++ b/src/components/Projects/Studies/RemoveStudyDD.jsx
@@ -19,6 +19,7 @@ export const RemoveStudyDD = ({ studyId, dd, getStudyDDs }) => {
const handleRemove = () => {
return fetch(`${vocabUrl}/Study/${studyId}/dd/${dd.id}`, {
method: 'DELETE',
+ credentials: 'include',
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Projects/Tables/AddVariable.jsx b/src/components/Projects/Tables/AddVariable.jsx
index 54cf7db..213658d 100644
--- a/src/components/Projects/Tables/AddVariable.jsx
+++ b/src/components/Projects/Tables/AddVariable.jsx
@@ -1,6 +1,15 @@
import { useContext, useState } from 'react';
import { myContext } from '../../../App';
-import { Button, Form, Input, message, Modal, Select, Space } from 'antd';
+import {
+ Button,
+ Form,
+ Input,
+ message,
+ Modal,
+ notification,
+ Select,
+ Space,
+} from 'antd';
import DataTypeSubForm from './DataTypeSubForm';
import { ModalSpinner } from '../../Manager/Spinner';
import { RequiredLogin } from '../../Auth/RequiredLogin';
@@ -24,10 +33,12 @@ export const AddVariable = ({ table, setTable }) => {
fetch(`${vocabUrl}/Table/${table.id}/variable/${values.name}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, editor: user.email }),
+ body: JSON.stringify(values),
+ // body: JSON.stringify({ ...values, editor: user.email }),
})
.then(res => {
if (res.ok) {
@@ -40,9 +51,18 @@ export const AddVariable = ({ table, setTable }) => {
setTable(data);
form.resetFields();
setAddRow(false);
+ message.success('Variable added successfully.');
})
- // Displays a self-closing message that the udpates have been successfully saved.
- .then(() => message.success('Variable added successfully.'))
+ .catch(error => {
+ if (error) {
+ notification.error({
+ message: 'Error',
+ description: 'An error occurred saving the variable.',
+ });
+ }
+ return error;
+ })
+
.finally(() => setLoading(false));
};
diff --git a/src/components/Projects/Tables/DeleteTable.jsx b/src/components/Projects/Tables/DeleteTable.jsx
index 67b315d..e3b668a 100644
--- a/src/components/Projects/Tables/DeleteTable.jsx
+++ b/src/components/Projects/Tables/DeleteTable.jsx
@@ -15,10 +15,11 @@ export const DeleteTable = ({ DDId, studyId }) => {
const deleteTable = evt => {
return fetch(`${vocabUrl}/Table/${table.id}`, {
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
+ // body: JSON.stringify({ editor: user.email }),
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Projects/Tables/EditMappingsTableModal.jsx b/src/components/Projects/Tables/EditMappingsTableModal.jsx
index 4198436..5027302 100644
--- a/src/components/Projects/Tables/EditMappingsTableModal.jsx
+++ b/src/components/Projects/Tables/EditMappingsTableModal.jsx
@@ -66,6 +66,7 @@ export const EditMappingsTableModal = ({
`${vocabUrl}/Table/${tableId}/mapping/${editMappings.code}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -146,6 +147,7 @@ export const EditMappingsTableModal = ({
fetch(`${vocabUrl}/Table/${tableId}/mapping/${editMappings.code}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -205,6 +207,7 @@ export const EditMappingsTableModal = ({
fetch(`${vocabUrl}/Table/${tableId}/mapping/${editMappings.code}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/Tables/EditTableDetails.jsx b/src/components/Projects/Tables/EditTableDetails.jsx
index cae5c4c..5bfbf1d 100644
--- a/src/components/Projects/Tables/EditTableDetails.jsx
+++ b/src/components/Projects/Tables/EditTableDetails.jsx
@@ -26,7 +26,7 @@ export const EditTableDetails = ({ table, setTable, edit, setEdit }) => {
...values,
filename: table.filename,
variables: table?.variables,
- editor: user.email,
+ // editor: user.email,
})
.then(data => {
setTable(data);
diff --git a/src/components/Projects/Tables/EditVariable.jsx b/src/components/Projects/Tables/EditVariable.jsx
index a87daa7..517b31c 100644
--- a/src/components/Projects/Tables/EditVariable.jsx
+++ b/src/components/Projects/Tables/EditVariable.jsx
@@ -74,7 +74,6 @@ export const EditVariable = ({
if (!table.variables.some(item => item?.name === values?.name)) {
handlePatch(vocabUrl, 'Table', table, {
...updatedName,
- editor: user.email,
})
.catch(error => {
if (error) {
@@ -88,10 +87,12 @@ export const EditVariable = ({
.then(() => {
fetch(`${vocabUrl}/Table/${table.id}/variable/${values.name}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, editor: user.email }),
+ body: JSON.stringify(values),
+ // body: JSON.stringify({ ...values, editor: user.email }),
})
.then(res => {
if (res.ok) {
@@ -126,10 +127,11 @@ export const EditVariable = ({
setLoading(true);
fetch(`${vocabUrl}/Table/${table.id}/variable/${values.name}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, editor: user.email }),
+ // body: JSON.stringify({ ...values, editor: user.email }),
})
.then(res => {
if (res.ok) {
@@ -144,6 +146,16 @@ export const EditVariable = ({
setEditRow('');
message.success('Changes saved successfully.');
})
+ .catch(error => {
+ if (error) {
+ notification.error({
+ message: 'Error',
+ description: 'An error occurred editing the variable.',
+ });
+ }
+ return error;
+ })
+ .finally(() => setLoading(false))
.then(() =>
getById(vocabUrl, 'Table', `${tableId}/mapping`)
diff --git a/src/components/Projects/Tables/LoadVariables.jsx b/src/components/Projects/Tables/LoadVariables.jsx
index feff7ce..efcc854 100644
--- a/src/components/Projects/Tables/LoadVariables.jsx
+++ b/src/components/Projects/Tables/LoadVariables.jsx
@@ -16,10 +16,11 @@ export const LoadVariables = ({ load, setLoad }) => {
setLoading(true);
fetch(`${vocabUrl}/LoadTable/${table.id}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, editor: user.email }),
+ body: JSON.stringify(values),
})
.then(res => {
if (res.status === 400) {
diff --git a/src/components/Projects/Tables/ResetTableMappings.jsx b/src/components/Projects/Tables/ResetTableMappings.jsx
index ad63bd8..087ecca 100644
--- a/src/components/Projects/Tables/ResetTableMappings.jsx
+++ b/src/components/Projects/Tables/ResetTableMappings.jsx
@@ -15,10 +15,11 @@ export const ResetTableMappings = ({ tableId, editMappings, setReset }) => {
const handleDelete = evt => {
return fetch(`${vocabUrl}/Table/${tableId}/mapping/${editMappings.code}`, {
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
+ // body: JSON.stringify({ editor: user.email }),
})
.then(response => {
if (response.ok) {
diff --git a/src/components/Projects/Tables/TableDetails.jsx b/src/components/Projects/Tables/TableDetails.jsx
index 6370b4e..8234410 100644
--- a/src/components/Projects/Tables/TableDetails.jsx
+++ b/src/components/Projects/Tables/TableDetails.jsx
@@ -85,11 +85,12 @@ export const TableDetails = () => {
const updateMappings = (mapArr, mappingCode) => {
const mappingsDTO = {
mappings: mapArr,
- editor: user.email,
+ // editor: user.email,
};
fetch(`${vocabUrl}/Table/${tableId}/mapping/${mappingCode}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/Tables/TableMenu.jsx b/src/components/Projects/Tables/TableMenu.jsx
index 83c261a..7db9402 100644
--- a/src/components/Projects/Tables/TableMenu.jsx
+++ b/src/components/Projects/Tables/TableMenu.jsx
@@ -56,10 +56,11 @@ export const TableMenu = ({
const handleVarDelete = varName => {
fetch(`${vocabUrl}/Table/${table.id}/variable/${varName}`, {
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
+ // body: JSON.stringify({ editor: user.email }),
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Projects/Tables/TableStyling.scss b/src/components/Projects/Tables/TableStyling.scss
index 609bd6b..10cf06e 100644
--- a/src/components/Projects/Tables/TableStyling.scss
+++ b/src/components/Projects/Tables/TableStyling.scss
@@ -75,3 +75,30 @@ input::file-selector-button:hover {
gap: 10px;
margin-left: 50px;
}
+
+.mapping {
+ &-display {
+ white-space: nowrap;
+ }
+ display: flex;
+ .remove-mapping {
+ padding-left: 0.25rem;
+ cursor: pointer;
+ opacity: 0;
+
+ &:hover {
+ transition: all 0.4s linear;
+ opacity: 1;
+ }
+ }
+}
+
+.mapping_relationship {
+ padding: 2px 6px;
+ border: 1px solid $greyColor;
+ border-radius: 4px;
+ &:hover {
+ background-color: rgb(245, 245, 245);
+ transition: all 0.3s linear;
+ }
+}
diff --git a/src/components/Projects/Tables/UploadTable.jsx b/src/components/Projects/Tables/UploadTable.jsx
index 850976e..45dcf16 100644
--- a/src/components/Projects/Tables/UploadTable.jsx
+++ b/src/components/Projects/Tables/UploadTable.jsx
@@ -34,10 +34,11 @@ export const UploadTable = ({ addTable, setAddTable }) => {
const newTableArray = [...dataDictionary?.tables];
fetch(`${vocabUrl}/LoadTable`, {
method: 'POST',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, editor: user.email }),
+ body: JSON.stringify(values),
})
.then(res => {
if (res.status === 400) {
diff --git a/src/components/Projects/Terminologies/AddCode.jsx b/src/components/Projects/Terminologies/AddCode.jsx
index 56f3701..3781797 100644
--- a/src/components/Projects/Terminologies/AddCode.jsx
+++ b/src/components/Projects/Terminologies/AddCode.jsx
@@ -20,10 +20,12 @@ export const AddCode = ({ terminology, setTerminology }) => {
setLoading(true);
fetch(`${vocabUrl}/Terminology/${terminology.id}/code/${values.code}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ ...values, editor: user.email }),
+ body: JSON.stringify(values),
+ // EDITOR NOT SHOWING UP IN PROVENANCE body: JSON.stringify({ ...values, editor: user.email }),
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Projects/Terminologies/AddTerminology.jsx b/src/components/Projects/Terminologies/AddTerminology.jsx
index 8e0c36a..ae1d1ac 100644
--- a/src/components/Projects/Terminologies/AddTerminology.jsx
+++ b/src/components/Projects/Terminologies/AddTerminology.jsx
@@ -38,6 +38,7 @@ export const AddTerminology = () => {
setLoading(true);
fetch(`${vocabUrl}/Terminology`, {
method: 'POST',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/Terminologies/AssignMappingsViaButton.jsx b/src/components/Projects/Terminologies/AssignMappingsViaButton.jsx
index 102b505..3ab4b60 100644
--- a/src/components/Projects/Terminologies/AssignMappingsViaButton.jsx
+++ b/src/components/Projects/Terminologies/AssignMappingsViaButton.jsx
@@ -71,7 +71,7 @@ export const AssignMappingsViaButton = ({
}));
const mappingsDTO = {
mappings: selectedMappings,
- editor: user.email,
+ // editor: user.email,
};
fetch(
diff --git a/src/components/Projects/Terminologies/DeleteTerminology.jsx b/src/components/Projects/Terminologies/DeleteTerminology.jsx
index ba01443..92bd233 100644
--- a/src/components/Projects/Terminologies/DeleteTerminology.jsx
+++ b/src/components/Projects/Terminologies/DeleteTerminology.jsx
@@ -14,10 +14,10 @@ export const DeleteTerminology = ({ setTerms, deleteId, setDeleteId }) => {
const deleteTerm = evt => {
fetch(`${vocabUrl}/Terminology/${deleteId}`, {
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Projects/Terminologies/EditCode.jsx b/src/components/Projects/Terminologies/EditCode.jsx
index 466c1c5..9302d62 100644
--- a/src/components/Projects/Terminologies/EditCode.jsx
+++ b/src/components/Projects/Terminologies/EditCode.jsx
@@ -76,7 +76,7 @@ export const EditCode = ({
handlePatch(vocabUrl, 'Terminology', terminology, {
...updatedRowDTO,
- editor: user.email,
+ // editor: user.email,
})
.then(data => {
setTerminology(data);
diff --git a/src/components/Projects/Terminologies/EditMappingModal.jsx b/src/components/Projects/Terminologies/EditMappingModal.jsx
index 6d6fbc7..28e1ead 100644
--- a/src/components/Projects/Terminologies/EditMappingModal.jsx
+++ b/src/components/Projects/Terminologies/EditMappingModal.jsx
@@ -67,6 +67,7 @@ export const EditMappingsModal = ({
`${vocabUrl}/Terminology/${terminologyId}/mapping/${editMappings.code}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -147,6 +148,7 @@ export const EditMappingsModal = ({
`${vocabUrl}/Terminology/${terminologyId}/mapping/${editMappings.code}?user_input=true&user=${user?.email}`,
{
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
@@ -208,6 +210,7 @@ export const EditMappingsModal = ({
`${vocabUrl}/Terminology/${terminologyId}/mapping/${editMappings.code}?user_input=true&user=${user?.email}`,
{
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/Terminologies/LoadCodes.jsx b/src/components/Projects/Terminologies/LoadCodes.jsx
index 3aae669..a4f4112 100644
--- a/src/components/Projects/Terminologies/LoadCodes.jsx
+++ b/src/components/Projects/Terminologies/LoadCodes.jsx
@@ -20,6 +20,7 @@ export const LoadCodes = ({ terminology, setTerminology }) => {
setLoading(true);
fetch(`${vocabUrl}/Terminology/${terminology.id}`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/Terminologies/PreferredTerminology.jsx b/src/components/Projects/Terminologies/PreferredTerminology.jsx
index ef66b10..e1604a0 100644
--- a/src/components/Projects/Terminologies/PreferredTerminology.jsx
+++ b/src/components/Projects/Terminologies/PreferredTerminology.jsx
@@ -66,13 +66,14 @@ export const PreferredTerminology = ({ terminology, setTerminology }) => {
const preferredTermDTO = () => {
return {
- 'editor': user.email,
+ // 'editor': user.email,
'preferred_terminologies': preferredTerminologies,
};
};
fetch(`${vocabUrl}/Terminology/${terminology.id}/preferred_terminology`, {
method: 'PUT',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
diff --git a/src/components/Projects/Terminologies/ResetMappings.jsx b/src/components/Projects/Terminologies/ResetMappings.jsx
index 86dc52b..1d63a7e 100644
--- a/src/components/Projects/Terminologies/ResetMappings.jsx
+++ b/src/components/Projects/Terminologies/ResetMappings.jsx
@@ -17,10 +17,11 @@ export const ResetMappings = ({ terminologyId, editMappings, setReset }) => {
`${vocabUrl}/Terminology/${terminologyId}/mapping/${editMappings.code}`,
{
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
+ // body: JSON.stringify({ editor: user.email }),
}
)
.then(response => {
diff --git a/src/components/Projects/Terminologies/Terminology.jsx b/src/components/Projects/Terminologies/Terminology.jsx
index b45f56a..66f1a34 100644
--- a/src/components/Projects/Terminologies/Terminology.jsx
+++ b/src/components/Projects/Terminologies/Terminology.jsx
@@ -112,8 +112,8 @@ export const Terminology = () => {
.then(data => {
setMapping(data.codes);
setEditMappings(null);
- form.resetFields();
message.success('Mapping removed.');
+ form.resetFields();
})
.catch(error => {
console.log(error, 'error');
diff --git a/src/components/Projects/Terminologies/TerminologyMenu.jsx b/src/components/Projects/Terminologies/TerminologyMenu.jsx
index 54b5ed5..92a7962 100644
--- a/src/components/Projects/Terminologies/TerminologyMenu.jsx
+++ b/src/components/Projects/Terminologies/TerminologyMenu.jsx
@@ -69,10 +69,11 @@ export const TerminologyMenu = ({
const handleVarDelete = varName => {
fetch(`${vocabUrl}/Terminology/${terminology.id}/code/${varName}`, {
method: 'DELETE',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
- body: JSON.stringify({ editor: user.email }),
+ // body: JSON.stringify({ editor: user.email }),
})
.then(res => {
if (res.ok) {
diff --git a/src/components/Search/SearchResults.jsx b/src/components/Search/SearchResults.jsx
index c906914..dc3c7b3 100644
--- a/src/components/Search/SearchResults.jsx
+++ b/src/components/Search/SearchResults.jsx
@@ -55,6 +55,7 @@ export const SearchResults = () => {
`${vocabUrl}/ontology_search?keyword=${query}&selected_ontologies=${defaultOntologies}&selected_api=ols&results_per_page=${entriesPerPage}&start_index=${pageStart}`,
{
method: 'GET',
+ credentials: 'include',
headers: {
'Content-Type': 'application/json',
},