From 15bc1e8e63da982e6e0ddf61330100c61d9dfa88 Mon Sep 17 00:00:00 2001 From: Kevin F Date: Thu, 27 Jun 2024 16:00:42 +0200 Subject: [PATCH] Do setup for parent term support in forms #409 --- src/Client/MainComponents/Metadata/Forms.fs | 15 +++++++++------ src/Shared/StaticTermCollection.fs | 11 ++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Client/MainComponents/Metadata/Forms.fs b/src/Client/MainComponents/Metadata/Forms.fs index 10141165..90b2ae5d 100644 --- a/src/Client/MainComponents/Metadata/Forms.fs +++ b/src/Client/MainComponents/Metadata/Forms.fs @@ -85,7 +85,7 @@ module private API = |] let authorString = createAuthorString authors let title = json?title - let publication = Publication.create(pmid, doi, authorString, title, Term.Published) + let publication = Publication.create(pmid, doi, authorString, title, TermCollection.Published) return publication } @@ -122,7 +122,7 @@ module private API = |] let! pubmedId = requestByDOI_FromPubMed doi let authorString = createAuthorString authors - let publication = Publication.create(?pubMedID=pubmedId, doi=doi, authors=authorString, ?title=title, status=Term.Published) + let publication = Publication.create(?pubMedID=pubmedId, doi=doi, authors=authorString, ?title=title, status=TermCollection.Published) return publication } @@ -703,7 +703,7 @@ type FormComponents = ) [] - static member OntologyAnnotationInput (input: OntologyAnnotation, setter: OntologyAnnotation -> unit, ?label: string, ?showTextLabels: bool, ?removebutton: MouseEvent -> unit) = + static member OntologyAnnotationInput (input: OntologyAnnotation, setter: OntologyAnnotation -> unit, ?label: string, ?showTextLabels: bool, ?removebutton: MouseEvent -> unit, ?parent: OntologyAnnotation) = let showTextLabels = defaultArg showTextLabels true let state, setState = React.useState(input) let element = React.useElementRef() @@ -733,6 +733,7 @@ type FormComponents = input=state, fullwidth=true, ?portalTermSelectArea=element.current, + ?parent=parent, debounceSetter=1000 ) ] @@ -776,10 +777,10 @@ type FormComponents = ] [] - static member OntologyAnnotationsInput (oas: OntologyAnnotation [], label: string, setter: OntologyAnnotation [] -> unit, ?showTextLabels: bool) = + static member OntologyAnnotationsInput (oas: OntologyAnnotation [], label: string, setter: OntologyAnnotation [] -> unit, ?showTextLabels: bool, ?parent: OntologyAnnotation) = FormComponents.InputSequence( oas, (OntologyAnnotation.empty()), label, setter, - (fun (a,b,c,d) -> FormComponents.OntologyAnnotationInput(a,c,label=b,removebutton=d,?showTextLabels=showTextLabels)) + (fun (a,b,c,d) -> FormComponents.OntologyAnnotationInput(a,c,label=b,removebutton=d,?showTextLabels=showTextLabels, ?parent=parent)) ) [] @@ -879,6 +880,7 @@ type FormComponents = state |> setter ), showTextLabels = false + //parent=Shared.TermCollection.PersonRoleWithinExperiment ) if deletebutton.IsSome then Helper.deleteButton deletebutton.Value @@ -1041,7 +1043,8 @@ type FormComponents = state.Status <- if s = (OntologyAnnotation.empty()) then None else Some s state |> setter ), - "Status" + "Status", + parent=Shared.TermCollection.PublicationStatus ) FormComponents.CommentsInput( Array.ofSeq state.Comments, diff --git a/src/Shared/StaticTermCollection.fs b/src/Shared/StaticTermCollection.fs index e0e97d1b..eed1a05b 100644 --- a/src/Shared/StaticTermCollection.fs +++ b/src/Shared/StaticTermCollection.fs @@ -1,4 +1,4 @@ -module Term +module Shared.TermCollection open ARCtrl @@ -7,3 +7,12 @@ open ARCtrl /// let Published = OntologyAnnotation("published","EFO","EFO:0001796") +/// +/// https://github.com/nfdi4plants/Swate/issues/409#issuecomment-2176134201 +/// +let PublicationStatus = OntologyAnnotation("publication status","EFO","EFO:0001742") + +/// +/// https://github.com/nfdi4plants/Swate/issues/409#issuecomment-2176134201 +/// +let PersonRoleWithinExperiment = OntologyAnnotation("person role within the experiment","AGRO","AGRO:00000378") \ No newline at end of file