Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to multiple smaller issues #549

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Swate.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.assets\assets\install.cmd = .assets\assets\install.cmd
build\manifest.xml = build\manifest.xml
package.json = package.json
paket.dependencies = paket.dependencies
paket.lock = paket.lock
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
Expand All @@ -24,8 +22,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E0FF3176-0B7
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{54B2B950-6393-4086-8AF4-3D211495433C}"
ProjectSection(SolutionItems) = preProject
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
.github\ISSUE_TEMPLATE\bug_report.yml = .github\ISSUE_TEMPLATE\bug_report.yml
.github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
.github\ISSUE_TEMPLATE\feature_request.yml = .github\ISSUE_TEMPLATE\feature_request.yml
EndProjectSection
EndProject
Expand Down
46 changes: 46 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"scripts": {},
"devDependencies": {
"@tailwindcss/typography": "^0.5.15",
"@types/node": "^20.10.3",
"@vitejs/plugin-basic-ssl": "^1.0.2",
"@vitejs/plugin-react": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Client/MainComponents/FooterTabs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ let MainMetadata(model: Model, dispatch: Messages.Msg -> unit) =
prop.children [
Html.a [
Bulma.icon [Html.i [prop.className "fa-solid fa-circle-info"]]
Html.text "Metadata"
Html.text model.SpreadsheetModel.FileType
]
]
]
Expand Down
21 changes: 18 additions & 3 deletions src/Client/MainComponents/Navbar.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,29 @@ open Messages
open Components.QuickAccessButton
open MainComponents
open Model
open Shared

let private quickAccessButtonListStart (state: LocalHistory.Model) dispatch =
let private FileName (model: Model) =
let txt =
match model.SpreadsheetModel.ArcFile with
| Some (ArcFiles.Assay a) -> a.Identifier
| Some (ArcFiles.Study (s,_)) -> s.Identifier
| Some (ArcFiles.Investigation i) -> i.Identifier
| Some (ArcFiles.Template t) -> t.FileName
| _ -> ""
Html.div [
prop.className "text-white text-lg font-bold flex items-center max-w-[125px] p-2 truncate inline-block"
prop.text txt
prop.title txt
]

let private quickAccessButtonListStart (model: Model) (state: LocalHistory.Model) dispatch =
Html.div [
prop.style [
style.display.flex; style.flexDirection.row
]
prop.children [

FileName model
QuickAccessButton.create(
"Back",
[
Expand Down Expand Up @@ -167,7 +182,7 @@ let Main(model: Model, dispatch, widgets, setWidgets) =
Bulma.navbarStart.div [
prop.style [style.display.flex; style.alignItems.stretch; style.justifyContent.flexStart; style.custom("marginRight", "auto")]
prop.children [
quickAccessButtonListStart model.History dispatch
quickAccessButtonListStart model model.History dispatch
WidgetNavbarList(model, dispatch, addWidget)
]
]
Expand Down
6 changes: 3 additions & 3 deletions src/Client/Messages.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ module BuildingBlock =
open TermSearch

type Msg =
| UpdateHeaderWithIO of BuildingBlock.HeaderCellType * IOType
| UpdateHeaderCellType of BuildingBlock.HeaderCellType
| UpdateHeaderWithIO of CompositeHeaderDiscriminate * IOType
| UpdateHeaderCellType of CompositeHeaderDiscriminate
| UpdateHeaderArg of U2<OntologyAnnotation,IOType> option
| UpdateBodyCellType of BuildingBlock.BodyCellType
| UpdateBodyCellType of CompositeCellDiscriminate
| UpdateBodyArg of U2<string, OntologyAnnotation> option

module Protocol =
Expand Down
74 changes: 38 additions & 36 deletions src/Client/Modals/EditColumn.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ open ARCtrl

type private State =
{
NextHeaderType: BuildingBlock.HeaderCellType option
NextHeaderType: CompositeHeaderDiscriminate option
NextIOType: IOType option
} with
static member init() = {
Expand All @@ -37,33 +37,34 @@ module private EditColumnComponents =
prop.onClick submit
]

let SelectHeaderTypeOption(headerType: BuildingBlock.HeaderCellType) =
let SelectHeaderTypeOption(headerType: CompositeHeaderDiscriminate) =
let txt = headerType.ToString()
Html.option [
prop.value txt
prop.text txt
]

let SelectHeaderType(state, setState) =
let SelectHeaderType(header, state, setState) =
Bulma.select [
prop.onChange (fun (e: string) -> {state with NextHeaderType = Some (BuildingBlock.HeaderCellType.fromString e)} |> setState )
prop.value (header.ToString())
prop.onChange (fun (e: string) -> {state with NextHeaderType = Some (CompositeHeaderDiscriminate.fromString e)} |> setState )
prop.children [
// -- term columns --
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Characteristic
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Component
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Factor
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Parameter
SelectHeaderTypeOption CompositeHeaderDiscriminate.Characteristic
SelectHeaderTypeOption CompositeHeaderDiscriminate.Component
SelectHeaderTypeOption CompositeHeaderDiscriminate.Factor
SelectHeaderTypeOption CompositeHeaderDiscriminate.Parameter
// -- io columns --
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Input
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Output
SelectHeaderTypeOption CompositeHeaderDiscriminate.Input
SelectHeaderTypeOption CompositeHeaderDiscriminate.Output
// -- single columns --
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Date
SelectHeaderTypeOption BuildingBlock.HeaderCellType.Performer
SelectHeaderTypeOption BuildingBlock.HeaderCellType.ProtocolDescription
SelectHeaderTypeOption BuildingBlock.HeaderCellType.ProtocolREF
SelectHeaderTypeOption BuildingBlock.HeaderCellType.ProtocolType
SelectHeaderTypeOption BuildingBlock.HeaderCellType.ProtocolUri
SelectHeaderTypeOption BuildingBlock.HeaderCellType.ProtocolVersion
SelectHeaderTypeOption CompositeHeaderDiscriminate.Date
SelectHeaderTypeOption CompositeHeaderDiscriminate.Performer
SelectHeaderTypeOption CompositeHeaderDiscriminate.ProtocolDescription
SelectHeaderTypeOption CompositeHeaderDiscriminate.ProtocolREF
SelectHeaderTypeOption CompositeHeaderDiscriminate.ProtocolType
SelectHeaderTypeOption CompositeHeaderDiscriminate.ProtocolUri
SelectHeaderTypeOption CompositeHeaderDiscriminate.ProtocolVersion
]
]

Expand Down Expand Up @@ -136,43 +137,44 @@ let Main (columnIndex: int) (model: Model) (dispatch) (rmv: _ -> unit) =
match state.NextHeaderType, state.NextIOType with
| None, _ -> column
// -- term columns --
| Some BuildingBlock.HeaderCellType.Characteristic, _ ->
| Some CompositeHeaderDiscriminate.Characteristic, _ ->
CompositeColumn.create(CompositeHeader.Characteristic (header.ToTerm()), cellsToTermCells(column))
| Some BuildingBlock.HeaderCellType.Parameter, _ ->
| Some CompositeHeaderDiscriminate.Parameter, _ ->
CompositeColumn.create(CompositeHeader.Parameter (header.ToTerm()), cellsToTermCells(column))
| Some BuildingBlock.HeaderCellType.Component, _ ->
| Some CompositeHeaderDiscriminate.Component, _ ->
CompositeColumn.create(CompositeHeader.Component (header.ToTerm()), cellsToTermCells(column))
| Some BuildingBlock.HeaderCellType.Factor, _ ->
| Some CompositeHeaderDiscriminate.Factor, _ ->
CompositeColumn.create(CompositeHeader.Factor (header.ToTerm()), cellsToTermCells(column))
// -- input columns --
| Some BuildingBlock.HeaderCellType.Input, Some IOType.Data ->
| Some CompositeHeaderDiscriminate.Input, Some IOType.Data ->
CompositeColumn.create(CompositeHeader.Input IOType.Data, cellsToDataOrFreeText(column))
| Some BuildingBlock.HeaderCellType.Input, Some io ->
| Some CompositeHeaderDiscriminate.Input, Some io ->
CompositeColumn.create(CompositeHeader.Input io, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.Input, None ->
| Some CompositeHeaderDiscriminate.Input, None ->
CompositeColumn.create(CompositeHeader.Input IOType.Sample, cellsToFreeText(column))
// -- output columns --
| Some BuildingBlock.HeaderCellType.Output, Some IOType.Data ->
| Some CompositeHeaderDiscriminate.Output, Some IOType.Data ->
CompositeColumn.create(CompositeHeader.Output IOType.Data, cellsToDataOrFreeText(column))
| Some BuildingBlock.HeaderCellType.Output, Some io ->
| Some CompositeHeaderDiscriminate.Output, Some io ->
CompositeColumn.create(CompositeHeader.Output io, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.Output, None ->
| Some CompositeHeaderDiscriminate.Output, None ->
CompositeColumn.create(CompositeHeader.Output IOType.Sample, cellsToFreeText(column))
// -- single columns --
| Some BuildingBlock.HeaderCellType.ProtocolREF, _ ->
| Some CompositeHeaderDiscriminate.ProtocolREF, _ ->
CompositeColumn.create(CompositeHeader.ProtocolREF, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.Date, _ ->
| Some CompositeHeaderDiscriminate.Date, _ ->
CompositeColumn.create(CompositeHeader.Date, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.Performer, _ ->
| Some CompositeHeaderDiscriminate.Performer, _ ->
CompositeColumn.create(CompositeHeader.Performer, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.ProtocolDescription, _ ->
| Some CompositeHeaderDiscriminate.ProtocolDescription, _ ->
CompositeColumn.create(CompositeHeader.ProtocolDescription, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.ProtocolType, _ ->
| Some CompositeHeaderDiscriminate.ProtocolType, _ ->
CompositeColumn.create(CompositeHeader.ProtocolType, cellsToTermCells(column))
| Some BuildingBlock.HeaderCellType.ProtocolUri, _ ->
| Some CompositeHeaderDiscriminate.ProtocolUri, _ ->
CompositeColumn.create(CompositeHeader.ProtocolUri, cellsToFreeText(column))
| Some BuildingBlock.HeaderCellType.ProtocolVersion, _ ->
| Some CompositeHeaderDiscriminate.ProtocolVersion, _ ->
CompositeColumn.create(CompositeHeader.ProtocolVersion, cellsToFreeText(column))
| Some CompositeHeaderDiscriminate.Comment, _ -> failwith "Comment header type is not yet implemented"
let submit (e) =
let nxtCol = updateColumn column0
Spreadsheet.SetColumn (columnIndex, nxtCol) |> SpreadsheetMsg |> dispatch
Expand All @@ -196,9 +198,9 @@ let Main (columnIndex: int) (model: Model) (dispatch) (rmv: _ -> unit) =
Bulma.field.div [
Bulma.buttons [
prop.children [
SelectHeaderType(state, setState)
SelectHeaderType(column0.Header.AsDiscriminate, state, setState)
match state.NextHeaderType with
| Some BuildingBlock.HeaderCellType.Output | Some BuildingBlock.HeaderCellType.Input ->
| Some CompositeHeaderDiscriminate.Output | Some CompositeHeaderDiscriminate.Input ->
SelectIOType(state, setState)
| _ -> Html.none
]
Expand Down
22 changes: 17 additions & 5 deletions src/Client/Modals/TermModal.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open Shared.TermTypes
open Feliz
open Feliz.Bulma
open ARCtrl
open Shared

type private State =
| Loading
Expand Down Expand Up @@ -46,25 +47,36 @@ let Main (oa: OntologyAnnotation, dispatch) (rmv: _ -> unit) =
]
]
Bulma.modalCardBody [
prop.className "has-text-justified"
prop.className "content"
prop.children [
Bulma.content [
Html.div [
match state with
| Loading -> Html.p "loading .."
| NotFound ->
Html.p [
prop.dangerouslySetInnerHTML $"Unable to find term with id <b>{oa.TermAccessionShort}</b> in database."
]
| Found term ->
Html.h6 "Description"
Html.h5 "Description"
Html.p term.Description
Html.h6 "Source Ontology"
Html.h5 "Source Ontology"
Html.p term.FK_Ontology
if term.IsObsolete then
Html.p [
color.hasTextDanger
prop.text "Obsolete"
]
]
Html.a [
prop.className "space-x-2 float-right"
prop.href (OntologyAnnotation.fromTerm term |> _.TermAccessionOntobeeUrl)
prop.target.blank
prop.children [
Html.span "Ref"
Html.i [
prop.className "fas fa-external-link-alt"
]
]
]
]
]
]
Expand Down
Loading