Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:OPIDoR/dmp_opidor_react into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmouths committed Nov 26, 2024
2 parents 51856e4 + c33f958 commit 9635bf6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/ExternalImport/OrcidList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function OrcidList({ fragment, setFragment, mapping = {} }) {

return (
<div style={{ position: "relative" }}>
{error && <CustomError />}
{error && <CustomError error={error} />}
{!error && (
<>
<div className="row" style={{ margin: "10px" }}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExternalImport/RorList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function RorList({ fragment, setFragment, mapping = {} }) {

return (
<div style={{ position: 'relative' }}>
{error && <CustomError />}
{error && <CustomError error={error} />}
{!error && (
<>
<div className="row" style={{ margin: '10px' }}>
Expand Down
7 changes: 6 additions & 1 deletion src/components/FormComponents/SelectContributorSingle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ function SelectContributorSingle({
service.createFragment(data, template.id, dmpId).then(res => {
const savedFragment = res.data.fragment;
savedFragment.action = 'update';
field.onChange({ ...contributor, person: savedFragment, role: defaultRole, action: 'update' })
field.onChange({
...contributor,
person: savedFragment,
role: defaultRole,
action: contributor ? 'update' : 'create'
})
setPersons([...persons, { ...savedFragment, to_string: parsePattern(savedFragment, template?.schema?.to_string) }]);
}).catch(error => setError(error));
handleClose();
Expand Down
5 changes: 3 additions & 2 deletions src/components/WritePlan/GuidanceChoice.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function GuidanceChoice({ planId, currentOrgId, currentOrgName, isClassic }) {
const [checkboxStates, setCheckboxStates] = useState({});
const [isOpen, setIsOpen] = useState(false);
const {
displayedResearchOutput,
setQuestionsWithGuidance,
setCurrentOrg,
currentOrg,
Expand Down Expand Up @@ -62,7 +63,7 @@ function GuidanceChoice({ planId, currentOrgId, currentOrgName, isClassic }) {
})
.catch((error) => setError(error))
.finally(() => setLoading(false));
}, [planId]);
}, [planId, locale]);

const sortGuidances = (guidances) => guidances.sort((a, b) => a.name.localeCompare(b.name));

Expand Down Expand Up @@ -137,7 +138,7 @@ function GuidanceChoice({ planId, currentOrgId, currentOrgName, isClassic }) {

let response;
try {
response = await guidances.postGuidanceGroups({ guidance_group_ids: selectedGuidancesIds }, planId, locale);
response = await guidances.postGuidanceGroups({ guidance_group_ids: selectedGuidancesIds, ro_id: displayedResearchOutput.id }, planId, locale);
} catch (error) {
return toast.error(t("An error occurred while saving the recommendations"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/context/Global.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const GlobalContext = createContext();
* @returns The GlobalContext.Provider is being returned.
*/
function Global({ children }) {
const [locale, setLocale] = useState('en');
const [locale, setLocale] = useState('fr_FR');
const [dmpId, setDmpId] = useState(null);
const [persons, setPersons] = useState([]);
// Plan Creation
Expand Down
6 changes: 3 additions & 3 deletions src/utils/GeneratorUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ export function formatDefaultValues(defaults) {
}

export function generateEmptyDefaults(properties = {}) {
const emtpyDefaults = {};
const emptyDefaults = {};
for (const [key, prop] of Object.entries(properties)) {
if(prop.type === 'array' && prop.items?.type === 'object') {
emtpyDefaults[key] = []
emptyDefaults[key] = []
}
};
return emtpyDefaults;
return emptyDefaults;
}

export function researchOutputTypeToDataType(type) {
Expand Down

0 comments on commit 9635bf6

Please sign in to comment.