Skip to content

Commit

Permalink
Update dependency to newest ARCtrl and change json state to arcjson
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Dec 21, 2023
1 parent 4823624 commit 9c70213
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 49 deletions.
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source https://api.nuget.org/v3/index.json
framework: net8.0
storage: none

nuget ARCtrl 1.0.0-beta.9
nuget ARCtrl 1.0.1
nuget Feliz.Bulma.Checkradio
nuget Feliz.Bulma.Switch
nuget Fsharp.Core ~> 8
Expand Down
50 changes: 25 additions & 25 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@ STORAGE: NONE
RESTRICTION: == net8.0
NUGET
remote: https://api.nuget.org/v3/index.json
ARCtrl (1.0.0-beta.9)
ARCtrl.Contract (>= 1.0.0-beta.9)
ARCtrl.CWL (>= 1.0.0-beta.9)
ARCtrl.FileSystem (>= 1.0.0-beta.9)
ARCtrl.ISA (>= 1.0.0-beta.9)
ARCtrl.ISA.Json (>= 1.0.0-beta.9)
ARCtrl.ISA.Spreadsheet (>= 1.0.0-beta.9)
ARCtrl (1.0.1)
ARCtrl.Contract (>= 1.0.1)
ARCtrl.CWL (>= 1.0.1)
ARCtrl.FileSystem (>= 1.0.1)
ARCtrl.ISA (>= 1.0.1)
ARCtrl.ISA.Json (>= 1.0.1)
ARCtrl.ISA.Spreadsheet (>= 1.0.1)
Fable.Fetch (>= 2.6)
Fable.SimpleHttp (>= 3.5)
FSharp.Core (>= 6.0.6)
ARCtrl.Contract (1.0.0-beta.9)
ARCtrl.ISA (>= 1.0.0-beta.9)
FSharp.Core (>= 6.0.6)
ARCtrl.CWL (1.0.0-beta.9)
FSharp.Core (>= 6.0.6)
ARCtrl.FileSystem (1.0.0-beta.9)
FSharp.Core (>= 6.0.7)
ARCtrl.Contract (1.0.1)
ARCtrl.ISA (>= 1.0.1)
FSharp.Core (>= 6.0.7)
ARCtrl.CWL (1.0.1)
FSharp.Core (>= 6.0.7)
ARCtrl.FileSystem (1.0.1)
Fable.Core (>= 4.2)
FSharp.Core (>= 6.0.6)
ARCtrl.ISA (1.0.0-beta.9)
ARCtrl.FileSystem (>= 1.0.0-beta.9)
FSharp.Core (>= 6.0.6)
ARCtrl.ISA.Json (1.0.0-beta.9)
ARCtrl.ISA (>= 1.0.0-beta.9)
FSharp.Core (>= 6.0.6)
FSharp.Core (>= 6.0.7)
ARCtrl.ISA (1.0.1)
ARCtrl.FileSystem (>= 1.0.1)
FSharp.Core (>= 6.0.7)
ARCtrl.ISA.Json (1.0.1)
ARCtrl.ISA (>= 1.0.1)
FSharp.Core (>= 6.0.7)
NJsonSchema (>= 10.8)
Thoth.Json (>= 10.1)
Thoth.Json.Net (>= 11.0)
ARCtrl.ISA.Spreadsheet (1.0.0-beta.9)
ARCtrl.FileSystem (>= 1.0.0-beta.9)
ARCtrl.ISA (>= 1.0.0-beta.9)
FSharp.Core (>= 6.0.6)
ARCtrl.ISA.Spreadsheet (1.0.1)
ARCtrl.FileSystem (>= 1.0.1)
ARCtrl.ISA (>= 1.0.1)
FSharp.Core (>= 6.0.7)
FsSpreadsheet (>= 5.0.1)
ExcelJS.Fable (0.3)
Fable.Core (>= 3.2.8)
Expand Down
33 changes: 16 additions & 17 deletions src/Client/MainComponents/Metadata/Forms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ module Helper =
prop.classes ["is-flex"; "is-justify-content-center"]
prop.children [
Bulma.button.button [
Bulma.button.isOutlined
Bulma.color.isInfo
prop.className "is-ghost"
prop.text "+"
prop.onClick clickEvent
]
Expand Down Expand Up @@ -134,34 +133,33 @@ type FormComponents =
]

[<ReactComponent>]
static member InputSequence<'A>(inputs: 'A [], empty: 'A, label: string, setter: 'A [] -> unit, inputComponent: 'A * string * ('A -> unit) * (MouseEvent -> unit) -> ReactElement) =
let texts = React.useRef (inputs)
React.useEffect((fun _ -> texts.current <- inputs), [|box inputs|])
static member InputSequence<'A>(inputs': 'A [], empty: 'A, label: string, setter: 'A [] -> unit, inputComponent: 'A * string * ('A -> unit) * (MouseEvent -> unit) -> ReactElement) =
let inputs : Fable.React.IRefValue<ResizeArray<'A>> = React.useRef (ResizeArray(collection=inputs'))
React.useEffect((fun _ -> inputs.current <- ResizeArray(inputs')), [|box inputs'|])
Bulma.field.div [
Bulma.label label
Bulma.field.div [
Html.orderedList [
yield! texts.current
|> Array.mapi (fun i x ->
for i in 0 .. inputs.current.Count - 1 do
let input = inputs.current.[i]
Html.li [
inputComponent(
x, "",
input, "",
(fun oa ->
texts.current.[i] <- oa
texts.current |> setter
inputs.current.[i] <- oa
inputs.current |> Array.ofSeq |> setter
),
(fun _ ->
texts.current <- Array.removeAt i texts.current
texts.current |> setter
inputs.current.RemoveAt i
inputs.current |> Array.ofSeq |> setter
)
)
]
)
]
]
Helper.addButton (fun _ ->
texts.current <- Array.append texts.current [|empty|]
texts.current |> setter
inputs.current.Add empty
inputs.current |> Array.ofSeq |> setter
)
]

Expand Down Expand Up @@ -203,9 +201,10 @@ type FormComponents =
]

[<ReactComponent>]
static member OntologyAnnotationInput (oa: OntologyAnnotation, label: string, setter: OntologyAnnotation -> unit, ?showTextLabels: bool, ?removebutton: MouseEvent -> unit) =
static member OntologyAnnotationInput (input: OntologyAnnotation, label: string, setter: OntologyAnnotation -> unit, ?showTextLabels: bool, ?removebutton: MouseEvent -> unit) =
let showTextLabels = defaultArg showTextLabels true
let oa = React.useRef(Helper.OntologyAnnotationMutable.fromOntologyAnnotation oa)
let oa = React.useRef(Helper.OntologyAnnotationMutable.fromOntologyAnnotation input)
React.useEffect((fun _ -> oa.current <- Helper.OntologyAnnotationMutable.fromOntologyAnnotation input), [|box input|])
let hasLabel = label <> ""
Bulma.field.div [
if hasLabel then Bulma.label label
Expand Down
17 changes: 11 additions & 6 deletions src/Client/States/LocalHistory.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,17 @@ module HistoryOrder =
// member this.toJson() = Json.serialize this

module ConversionTypes =
open ARCtrl.ISA
open ARCtrl.ISA.Json
open ARCtrl.Template.Json
open Shared

[<RequireQualifiedAccess>]
type JsonArcFiles =
| Investigation
| Study
| Assay
| Template
| None

type SessionStorage = {
Expand All @@ -70,9 +73,10 @@ module ConversionTypes =
static member fromSpreadsheetModel (model: Spreadsheet.Model) =
let jsonArcFile, jsonString =
match model.ArcFile with
| Some (ArcFiles.Investigation i) -> JsonArcFiles.Investigation, ArcInvestigation.toJsonString i
| Some (ArcFiles.Study (s,al)) -> JsonArcFiles.Study, ArcStudy.toJsonString s (ResizeArray(al))
| Some (ArcFiles.Assay a) -> JsonArcFiles.Assay, ArcAssay.toJsonString a
| Some (ArcFiles.Investigation i) -> JsonArcFiles.Investigation, i.ToArcJsonString()
| Some (ArcFiles.Study (s,al)) -> JsonArcFiles.Study, s.ToArcJsonString()
| Some (ArcFiles.Assay a) -> JsonArcFiles.Assay, a.ToArcJsonString()
| Some (ArcFiles.Template t) -> JsonArcFiles.Template, Template.toJsonString 0 t
| None -> JsonArcFiles.None, ""
{
JsonArcFiles = jsonArcFile
Expand All @@ -83,9 +87,10 @@ module ConversionTypes =
let init = Spreadsheet.Model.init()
let arcFile =
match this.JsonArcFiles with
| JsonArcFiles.Investigation -> ArcInvestigation.fromJsonString this.JsonString |> ArcFiles.Investigation |> Some
| JsonArcFiles.Study -> ArcStudy.fromJsonString this.JsonString |> fun (x,y) -> ArcFiles.Study(x, List.ofSeq y) |> Some
| JsonArcFiles.Assay -> ArcAssay.fromJsonString this.JsonString |> ArcFiles.Assay |> Some
| JsonArcFiles.Investigation -> ArcInvestigation.fromArcJsonString this.JsonString |> ArcFiles.Investigation |> Some
| JsonArcFiles.Study -> ArcStudy.fromArcJsonString this.JsonString |> fun s -> ArcFiles.Study(s, []) |> Some
| JsonArcFiles.Assay -> ArcAssay.fromArcJsonString this.JsonString |> ArcFiles.Assay |> Some
| JsonArcFiles.Template -> Template.fromJsonString this.JsonString |> ArcFiles.Template |> Some
| JsonArcFiles.None -> None
{
init with
Expand Down

0 comments on commit 9c70213

Please sign in to comment.