Skip to content

Commit

Permalink
Do setup for parent term support in forms #409
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jun 27, 2024
1 parent c78b08e commit 15bc1e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/Client/MainComponents/Metadata/Forms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -703,7 +703,7 @@ type FormComponents =
)

[<ReactComponent>]
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()
Expand Down Expand Up @@ -733,6 +733,7 @@ type FormComponents =
input=state,
fullwidth=true,
?portalTermSelectArea=element.current,
?parent=parent,
debounceSetter=1000
)
]
Expand Down Expand Up @@ -776,10 +777,10 @@ type FormComponents =
]

[<ReactComponent>]
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))
)

[<ReactComponent>]
Expand Down Expand Up @@ -879,6 +880,7 @@ type FormComponents =
state |> setter
),
showTextLabels = false
//parent=Shared.TermCollection.PersonRoleWithinExperiment
)
if deletebutton.IsSome then
Helper.deleteButton deletebutton.Value
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 10 additions & 1 deletion src/Shared/StaticTermCollection.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Term
module Shared.TermCollection

open ARCtrl

Expand All @@ -7,3 +7,12 @@ open ARCtrl
/// </summary>
let Published = OntologyAnnotation("published","EFO","EFO:0001796")

/// <summary>
/// https://github.com/nfdi4plants/Swate/issues/409#issuecomment-2176134201
/// </summary>
let PublicationStatus = OntologyAnnotation("publication status","EFO","EFO:0001742")

/// <summary>
/// https://github.com/nfdi4plants/Swate/issues/409#issuecomment-2176134201
/// </summary>
let PersonRoleWithinExperiment = OntologyAnnotation("person role within the experiment","AGRO","AGRO:00000378")

0 comments on commit 15bc1e8

Please sign in to comment.