diff --git a/src/Client/Client.fsproj b/src/Client/Client.fsproj
index 3f0db094..db718977 100644
--- a/src/Client/Client.fsproj
+++ b/src/Client/Client.fsproj
@@ -23,9 +23,9 @@
+
-
diff --git a/src/Client/CustomComponents/AdvancedSearch.fs b/src/Client/CustomComponents/AdvancedSearch.fs
index 88f6b215..1979a48b 100644
--- a/src/Client/CustomComponents/AdvancedSearch.fs
+++ b/src/Client/CustomComponents/AdvancedSearch.fs
@@ -44,11 +44,11 @@ let createOntologyDropdownItem (model:Model) (dispatch:Msg -> unit) (ont: DbDoma
Text.span [] [ont.Name |> str]
]
-let createAdvancedTermSearchResultList (model:Model) (dispatch: Msg -> unit) =
+let createAdvancedTermSearchResultRows (model:Model) (dispatch: Msg -> unit) (suggestionUsedHandler: DbDomain.Term -> Msg) =
if model.AdvancedSearchState.AdvancedSearchTermResults.Length > 0 then
model.AdvancedSearchState.AdvancedSearchTermResults
|> Array.map (fun sugg ->
- tr [OnClick (fun _ -> sugg.Name |> AdvancedSearchResultUsed |> AdvancedSearch |> dispatch)
+ tr [OnClick (fun _ -> sugg |> suggestionUsedHandler |> dispatch)
colorControl model.SiteStyleState.ColorMode
Class "suggestion"
] [
@@ -61,13 +61,12 @@ let createAdvancedTermSearchResultList (model:Model) (dispatch: Msg -> unit) =
td [Style [Color "red"]] [if sugg.IsObsolete then str "obsolete"]
td [Style [FontWeight "light"]] [small [] [str sugg.Accession]]
])
- |> List.ofArray
else
- [
+ [|
tr [] [
td [] [str "No terms found matching your input."]
]
- ]
+ |]
let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
@@ -75,13 +74,13 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
OnSubmit (fun e -> e.preventDefault())
OnKeyDown (fun k -> if (int k.keyCode) = 13 then k.preventDefault())
] [
- Label.label [Label.Size Size.IsLarge; Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]][ str "Ontology term search"]
- br []
Field.div [] [
- Label.label [] [ str "Ontology"]
+ Label.label [Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [ str "Ontology"]
Help.help [] [str "Only search terms in the selected ontology"]
Field.div [] [
- Dropdown.dropdown [Dropdown.IsActive model.AdvancedSearchState.HasOntologyDropdownVisible] [
+ Dropdown.dropdown [
+ Dropdown.IsActive model.AdvancedSearchState.HasOntologyDropdownVisible
+ ] [
Dropdown.trigger [] [
Button.button [Button.OnClick (fun _ -> ToggleOntologyDropdown |> AdvancedSearch |> dispatch)] [
span [] [
@@ -92,7 +91,7 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
Fa.i [Fa.Solid.AngleDown] []
]
]
- Dropdown.menu [Props[colorControl model.SiteStyleState.ColorMode]] [
+ Dropdown.menu [Props[colorControl model.SiteStyleState.ColorMode];] [
Dropdown.content [] (
model.PersistentStorageState.SearchableOntologies
|> Array.map snd
@@ -103,13 +102,13 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
]
]
Field.div [] [
- Label.label [] [ str "Starts with:"]
+ Label.label [Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [ str "Starts with:"]
Help.help [] [str "The term name must start with this string"]
Field.div [] [
Control.div [] [
Input.input [
Input.Placeholder "Enter starts with text"
- Input.Size IsMedium
+ Input.Size IsSmall
Input.Props [ExcelColors.colorControl model.SiteStyleState.ColorMode]
Input.OnChange (fun e ->
{model.AdvancedSearchState.AdvancedSearchOptions
@@ -124,13 +123,13 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
]
]
Field.div [] [
- Label.label [] [ str "Must contain:"]
+ Label.label [Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [ str "Must contain:"]
Help.help [] [str "The term name must contain any of these space-separated words (at any position)"]
Field.div [] [
Control.div [] [
Input.input [
Input.Placeholder "Enter contains text"
- Input.Size IsMedium
+ Input.Size IsSmall
Input.Props [ExcelColors.colorControl model.SiteStyleState.ColorMode]
Input.OnChange (fun e ->
{model.AdvancedSearchState.AdvancedSearchOptions
@@ -145,13 +144,13 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
]
]
Field.div [] [
- Label.label [] [ str "Ends with:"]
+ Label.label [Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [ str "Ends with:"]
Help.help [] [str "The term must end with this string"]
Field.div [] [
Control.div [] [
Input.input [
Input.Placeholder "enter ends with text"
- Input.Size IsMedium
+ Input.Size IsSmall
Input.Props [ExcelColors.colorControl model.SiteStyleState.ColorMode]
Input.OnChange (fun e ->
{model.AdvancedSearchState.AdvancedSearchOptions
@@ -166,14 +165,14 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
]
]
Field.div [] [
- Label.label [] [ str "Definition must contain:"]
+ Label.label [Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [ str "Definition must contain:"]
Help.help [] [str "The definition of the term must contain any of these space-separated words (at any position)"]
Field.body [] [
Field.div [] [
Control.div [] [
Input.input [
Input.Placeholder "enter definition must contain text"
- Input.Size IsMedium
+ Input.Size IsSmall
Input.Props [ExcelColors.colorControl model.SiteStyleState.ColorMode]
Input.OnChange (fun e ->
{model.AdvancedSearchState.AdvancedSearchOptions
@@ -188,55 +187,132 @@ let advancedTermSearchComponent (model:Model) (dispatch: Msg -> unit) =
]
]
]
- Field.div [] [
- Control.div [] [
- Button.button [
- let isValid = isValidAdancedSearchOptions model.AdvancedSearchState.AdvancedSearchOptions
- if isValid then
- Button.CustomClass "is-success"
- Button.IsActive true
- else
- Button.CustomClass "is-danger"
- Button.Props [Disabled (not isValid)]
- Button.IsFullWidth
- Button.OnClick (fun _ -> model.AdvancedSearchState.AdvancedSearchOptions |> GetNewAdvancedTermSearchResults |> Request |> Api |> dispatch)
- ] [ str "Start advanced search"]
+ ]
+
+let advancedSearchResultTable (model:Model) (dispatch: Msg -> unit) =
+ Field.div [Field.Props [] ] [
+ Label.label [] [str "Results:"]
+ if model.AdvancedSearchState.ShowAdvancedSearchResults then
+ if model.AdvancedSearchState.HasAdvancedSearchResultsLoading then
+ Loading.loadingComponent
+ else
+ Button.buttonComponent model.SiteStyleState.ColorMode true "Change search options" (fun _ -> ResetAdvancedSearchOptions |> AdvancedSearch |> dispatch)
+ PaginatedTable.paginatedTableComponent
+ model
+ dispatch
+ (createAdvancedTermSearchResultRows
+ model
+ dispatch
+ (AdvancedSearchResultSelected >> AdvancedSearch)
+ )
+ ]
+
+let advancedSearchSelectedResultDisplay (model:Model) (result:DbDomain.Term) =
+ Container.container [] [
+ Heading.h4 [] [str "Selected Result:"]
+ Table.table [Table.IsFullWidth] [
+ thead [] []
+ tbody [] [
+ tr [
+ colorControl model.SiteStyleState.ColorMode
+ Class "suggestion"
+ ] [
+ td [Class (Tooltip.ClassName + " " + Tooltip.IsTooltipRight + " " + Tooltip.IsMultiline);Tooltip.dataTooltip result.Definition] [
+ Fa.i [Fa.Solid.InfoCircle] []
+ ]
+ td [] [
+ b [] [str result.Name]
+ ]
+ td [Style [Color "red"]] [if result.IsObsolete then str "obsolete"]
+ td [Style [FontWeight "light"]] [small [] [str result.Accession]]
+ ]
]
]
- Field.div [Field.Props [] ] [
- Label.label [] [str "Results:"]
- ]
]
-let advancedSearchModal (model:Model) (dispatch: Msg -> unit) (resultHandler: DbDomain.Term -> Msg) =
- Modal.modal [Modal.IsActive model.AdvancedSearchState.HasModalVisible] [
+let advancedSearchModal (model:Model) (id:string) (dispatch: Msg -> unit) (resultHandler: DbDomain.Term -> Msg) =
+ Modal.modal [
+ Modal.IsActive (
+ model.AdvancedSearchState.HasModalVisible
+ && model.AdvancedSearchState.ModalId = id
+ )
+ Modal.Props [
+ colorControl model.SiteStyleState.ColorMode
+ Id id
+ ]
+ ] [
Modal.background [] []
- Modal.Card.card [] [
- Modal.Card.head [] [
- Modal.close [Modal.Close.Size IsLarge; Modal.Close.OnClick (fun _ -> ToggleModal |> AdvancedSearch |> dispatch)] []
- Heading.h2 [] [
+ Modal.Card.card [Props [colorControl model.SiteStyleState.ColorMode]] [
+ Modal.Card.head [Props [colorControl model.SiteStyleState.ColorMode]] [
+ Modal.close [Modal.Close.Size IsLarge; Modal.Close.OnClick (fun _ -> ToggleModal id |> AdvancedSearch |> dispatch)] []
+ Heading.h4 [Heading.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [
str "Advanced Search"
]
]
- Modal.Card.body [] [
- advancedTermSearchComponent model dispatch
+ Modal.Card.body [Props [colorControl model.SiteStyleState.ColorMode]] [
+ if (not model.AdvancedSearchState.ShowAdvancedSearchResults) then
+ advancedTermSearchComponent model dispatch
+ else
+ match model.AdvancedSearchState.SelectedResult with
+ |None -> advancedSearchResultTable model dispatch
+ |Some r -> advancedSearchSelectedResultDisplay model r
+
]
Modal.Card.foot [] [
- Field.div [] [
- Control.div [] [
- Button.button [ let hasText = model.AdvancedSearchState.SelectedResult.IsSome
- if hasText then
- Button.CustomClass "is-success"
- Button.IsActive true
- else
+ form [
+ OnSubmit (fun e -> e.preventDefault())
+ OnKeyDown (fun k -> if (int k.keyCode) = 13 then k.preventDefault())
+ ] [
+ Field.div [Field.HasAddons;Field.IsExpanded] [
+ Control.div [Control.IsExpanded] [
+ if (not model.AdvancedSearchState.ShowAdvancedSearchResults) then
+ Button.button [
+ let isValid = isValidAdancedSearchOptions model.AdvancedSearchState.AdvancedSearchOptions
+ if isValid then
+ Button.CustomClass "is-success"
+ Button.IsActive true
+ else
+ Button.CustomClass "is-danger"
+ Button.Props [Disabled (not isValid)]
+ Button.IsFullWidth
+ Button.OnClick (fun _ -> StartAdvancedSearch |> AdvancedSearch |> dispatch)
+ ] [ str "Start advanced search"]
+ else
+ Button.button [ let hasText = model.AdvancedSearchState.SelectedResult.IsSome
+ if hasText then
+ Button.CustomClass "is-success"
+ Button.IsActive true
+ else
+ Button.CustomClass "is-danger"
+ Button.Props [Disabled true]
+ Button.IsFullWidth
+ Button.OnClick (fun _ ->
+ ResetAdvancedSearchState |> AdvancedSearch |> dispatch;
+ model.AdvancedSearchState.SelectedResult.Value |> resultHandler |> dispatch)
+ ] [
+ str "Confirm"
+
+ ]
+ ]
+ Control.div [Control.IsExpanded] [
+ Button.button [
Button.CustomClass "is-danger"
- Button.Props [Disabled true]
- Button.IsFullWidth
- Button.OnClick (fun _ -> model.AdvancedSearchState.SelectedResult.Value |> resultHandler |> dispatch)
+ Button.IsFullWidth
+ Button.OnClick (fun _ -> ResetAdvancedSearchOptions |> AdvancedSearch |> dispatch)
- ] [
- str "Confirm"
-
+ ] [
+ str "Reset"
+ ]
+ ]
+ Control.div [Control.IsExpanded] [
+ Button.button [
+ Button.CustomClass "is-danger"
+ Button.IsFullWidth
+ Button.OnClick (fun _ -> ResetAdvancedSearchState |> AdvancedSearch |> dispatch)
+
+ ] [
+ str "Cancel"
+ ]
]
]
]
diff --git a/src/Client/CustomComponents/AutocompleteSearch.fs b/src/Client/CustomComponents/AutocompleteSearch.fs
index d0384dba..3e70dcfd 100644
--- a/src/Client/CustomComponents/AutocompleteSearch.fs
+++ b/src/Client/CustomComponents/AutocompleteSearch.fs
@@ -43,6 +43,8 @@ with
type AutocompleteParameters<'SearchResult> = {
+ Id : string
+
StateBinding : string
Suggestions : AutocompleteSuggestion<'SearchResult> []
MaxItems : int
@@ -58,6 +60,8 @@ type AutocompleteParameters<'SearchResult> = {
}
with
static member ofTermSearchState (state:TermSearchState) : AutocompleteParameters = {
+ Id = "TermSearch"
+
StateBinding = state.TermSearchText
Suggestions = state.TermSuggestions |> Array.map AutocompleteSuggestion.ofTerm
MaxItems = 5
@@ -69,25 +73,29 @@ with
HasAdvancedSearch = true
AdvancedSearchLinkText = "Cant find the Term you are looking for?"
- OnAdvancedSearch = (fun (term:DbDomain.Term) -> term.Name |> SearchTermTextChange |> TermSearch )
+ OnAdvancedSearch = (fun (term:DbDomain.Term) -> term.Name |> TermSuggestionUsed |> TermSearch )
}
- //static member ofAdvancedSearchStateWithStorage (searchState:AdvancedSearchState) (storageState : PersistentStorageState) : AutocompleteParameters = {
- // StateBinding = searchState.OntologySearchText
- // Suggestions = storageState.SearchableOntologies |> Array.map (snd >> AutocompleteSuggestion.ofOntology)
- // MaxItems = 5
- // DropDownIsVisible = searchState.ShowOntologySuggestions
- // DropDownIsLoading = searchState.HasOntologySuggestionsLoading
+ static member ofAddBuildingBlockUnitState (state:AddBuildingBlockState) : AutocompleteParameters = {
+ Id = "UnitSearch"
- // OnInputChangeMsg = (SearchOntologyTextChange >> AdvancedSearch )
- // OnSuggestionSelect = (fun sugg -> sugg.Name |> TermSuggestionUsed |> TermSearch)
+ StateBinding = state.UnitTermSearchText
+ Suggestions = state.UnitTermSuggestions |> Array.map AutocompleteSuggestion.ofTerm
+ MaxItems = 5
+ DropDownIsVisible = state.ShowUnitTermSuggestions
+ DropDownIsLoading = state.HasUnitTermSuggestionsLoading
- // HasAdvancedSearch = false
- // AdvancedSearchLinkText = "Seems like the ontology you are looking for is not in our database."
- // OnAdvancedSearch = (fun _ -> DoNothing)
- //}
+ AdvancedSearchLinkText = "Can't find the unit you are looking for?"
+ OnInputChangeMsg = (SearchUnitTermTextChange >> AddBuildingBlock)
+ OnSuggestionSelect = (fun sugg -> sugg.Name |> UnitTermSuggestionUsed |> AddBuildingBlock)
+
+ HasAdvancedSearch = true
+ OnAdvancedSearch = (fun sugg -> sugg.Name |> UnitTermSuggestionUsed |> AddBuildingBlock)
+ }
static member ofAddBuildingBlockState (state:AddBuildingBlockState) : AutocompleteParameters = {
+ Id = "BlockNameSearch"
+
StateBinding = state.CurrentBuildingBlock.Name
Suggestions = state.BuildingBlockNameSuggestions |> Array.map AutocompleteSuggestion.ofTerm
MaxItems = 5
@@ -102,19 +110,6 @@ with
OnAdvancedSearch = (fun sugg -> sugg.Name |> BuildingBlockNameSuggestionUsed |> AddBuildingBlock)
}
- static member ofAddBuildingBlockUnitState (state:AddBuildingBlockState) : AutocompleteParameters = {
- StateBinding = state.UnitTermSearchText
- Suggestions = state.UnitTermSuggestions |> Array.map AutocompleteSuggestion.ofTerm
- MaxItems = 5
- DropDownIsVisible = state.ShowUnitTermSuggestions
- DropDownIsLoading = state.HasUnitTermSuggestionsLoading
- AdvancedSearchLinkText = "Can't find the unit you are looking for?"
- OnInputChangeMsg = (SearchUnitTermTextChange >> AddBuildingBlock)
- OnSuggestionSelect = (fun sugg -> sugg.Name |> UnitTermSuggestionUsed |> AddBuildingBlock)
- HasAdvancedSearch = true
- OnAdvancedSearch = (fun sugg -> sugg.Name |> UnitTermSuggestionUsed |> AddBuildingBlock)
- }
-
let createAutocompleteSuggestions
(dispatch: Msg -> unit)
(colorMode:ColorMode)
@@ -157,7 +152,7 @@ let createAutocompleteSuggestions
][
td [ColSpan 4] [
str (sprintf "%s " autocompleteParams.AdvancedSearchLinkText)
- a [OnClick (fun _ -> ToggleModal |> AdvancedSearch |> dispatch)] [
+ a [OnClick (fun _ -> ToggleModal autocompleteParams.Id |> AdvancedSearch |> dispatch)] [
str "Use Advanced Search"
]
]
@@ -205,7 +200,7 @@ let autocompleteTermSearchComponent
=
Control.div [Control.IsExpanded] [
- AdvancedSearch.advancedSearchModal model dispatch autocompleteParams.OnAdvancedSearch
+ AdvancedSearch.advancedSearchModal model autocompleteParams.Id dispatch autocompleteParams.OnAdvancedSearch
Input.input [ Input.Placeholder inputPlaceholderText
match inputSize with
| Some size -> Input.Size size
diff --git a/src/Client/CustomComponents/PaginatedTable.fs b/src/Client/CustomComponents/PaginatedTable.fs
index 563dbcf9..5bde1553 100644
--- a/src/Client/CustomComponents/PaginatedTable.fs
+++ b/src/Client/CustomComponents/PaginatedTable.fs
@@ -8,4 +8,57 @@ open ExcelColors
open Model
open Messages
-//TO-DO: generic pageination table for dsiplay of e.g. large amounts of advanced search copmponents
\ No newline at end of file
+//TO-DO: generic pageination table for dsiplay of e.g. large amounts of advanced search copmponents
+
+type paginationParameters = {
+ ChunkSize : int
+ OnNext : Msg
+ OnPrevious : Msg
+
+}
+
+let createPaginationLinkFromIndex (dispatch:Msg->unit) (pageIndex:int) (currentPageinationIndex: int)=
+
+ Pagination.Link.a [
+ Pagination.Link.Current (pageIndex = currentPageinationIndex)
+ Pagination.Link.Props [OnClick (fun _ -> pageIndex |> ChangePageinationIndex |> AdvancedSearch |> dispatch)]
+ ] [
+ span [] [str (string (pageIndex+1))]
+ ]
+
+let pageinateDynamic (dispatch:Msg->unit) (currentPageinationIndex: int) (pageCount:int) =
+ (*[0 .. pageCount-1].*)
+ [(max 1 (currentPageinationIndex-2)) .. (min (currentPageinationIndex+2) (pageCount-2)) ]
+ |> List.map (
+ fun index -> createPaginationLinkFromIndex dispatch index currentPageinationIndex
+ )
+
+
+let paginatedTableComponent (model:Model) (dispatch: Msg -> unit) (elements:ReactElement []) =
+
+ if elements.Length > 0 then
+
+ let currentPageinationIndex = model.AdvancedSearchState.AdvancedSearchResultPageinationIndex
+ let chunked = elements |> Array.chunkBySize 5
+ let len = chunked.Length
+
+ Container.container [] [
+ Pagination.pagination [Pagination.IsCentered] [
+ Pagination.previous [Props [OnClick (fun _ -> (max (currentPageinationIndex - 1) 0) |> ChangePageinationIndex |> AdvancedSearch |> dispatch )]] [str "Prev"]
+ Pagination.list [] [
+ yield createPaginationLinkFromIndex dispatch 0 currentPageinationIndex
+ if len > 5 then yield Pagination.ellipsis []
+ yield! pageinateDynamic dispatch currentPageinationIndex (len - 1)
+ if len > 5 then yield Pagination.ellipsis []
+ yield createPaginationLinkFromIndex dispatch (len-1) currentPageinationIndex
+ ]
+ Pagination.next [Props [OnClick (fun _ -> (min (currentPageinationIndex + 1) (len - 1)) |> ChangePageinationIndex |> AdvancedSearch |> dispatch )]] [str "Next"]
+ ]
+ Table.table [Table.IsFullWidth] [
+ thead [] []
+ tbody [] (
+ chunked.[currentPageinationIndex] |> Array.toList
+ )
+ ]
+ ]
+ else div [] []
\ No newline at end of file
diff --git a/src/Client/Messages.fs b/src/Client/Messages.fs
index 46756e38..8c3a063e 100644
--- a/src/Client/Messages.fs
+++ b/src/Client/Messages.fs
@@ -25,12 +25,16 @@ type TermSearchMsg =
| NewSuggestions of DbDomain.Term []
type AdvancedSearchMsg =
- | ToggleModal
+ | ResetAdvancedSearchState
+ | ResetAdvancedSearchOptions
+ | ToggleModal of string
| ToggleOntologyDropdown
| AdvancedSearchOptionsChange of AdvancedTermSearchOptions
- | AdvancedSearchResultUsed of string
+ | AdvancedSearchResultSelected of DbDomain.Term
| OntologySuggestionUsed of DbDomain.Ontology
+ | StartAdvancedSearch
| NewAdvancedSearchResults of DbDomain.Term []
+ | ChangePageinationIndex of int
type DevMsg =
| LogTableMetadata
diff --git a/src/Client/Model.fs b/src/Client/Model.fs
index 70a7241f..014fbeb3 100644
--- a/src/Client/Model.fs
+++ b/src/Client/Model.fs
@@ -74,22 +74,26 @@ type TermSearchState = {
}
type AdvancedSearchState = {
- HasModalVisible : bool
- HasOntologyDropdownVisible : bool
- AdvancedSearchOptions : AdvancedTermSearchOptions
- AdvancedSearchTermResults : DbDomain.Term []
- HasAdvancedSearchResultsLoading : bool
- ShowAdvancedSearchResults : bool
- SelectedResult : DbDomain.Term option
+ ModalId : string
+ HasModalVisible : bool
+ HasOntologyDropdownVisible : bool
+ AdvancedSearchOptions : AdvancedTermSearchOptions
+ AdvancedSearchTermResults : DbDomain.Term []
+ HasAdvancedSearchResultsLoading : bool
+ ShowAdvancedSearchResults : bool
+ AdvancedSearchResultPageinationIndex: int
+ SelectedResult : DbDomain.Term option
} with
static member init () = {
- HasModalVisible = false
- HasOntologyDropdownVisible = false
- AdvancedSearchOptions = AdvancedTermSearchOptions.init ()
- AdvancedSearchTermResults = [||]
- HasAdvancedSearchResultsLoading = false
- ShowAdvancedSearchResults = false
- SelectedResult = None
+ ModalId = ""
+ HasModalVisible = false
+ HasOntologyDropdownVisible = false
+ AdvancedSearchOptions = AdvancedTermSearchOptions.init ()
+ AdvancedSearchTermResults = [||]
+ HasAdvancedSearchResultsLoading = false
+ ShowAdvancedSearchResults = false
+ AdvancedSearchResultPageinationIndex= 0
+ SelectedResult = None
}
type SiteStyleState = {
diff --git a/src/Client/OfficeInterop.fs b/src/Client/OfficeInterop.fs
index 0fc7babf..9b7704dc 100644
--- a/src/Client/OfficeInterop.fs
+++ b/src/Client/OfficeInterop.fs
@@ -108,11 +108,15 @@ let addAnnotationColumn (colName:string) =
//create an empty column to insert
let testCol = createEmptyMatrixForTables 1 rowCount ""
- let _ =
+ let createdCol =
annotationTable.columns.add(
colCount,
values = U4.Case1 testCol, name=colName
)
+ let autofitRange = createdCol.getRange()
+
+ autofitRange.format.autofitColumns()
+ autofitRange.format.autofitRows()
sprintf "%s column was added." colName
)
)
diff --git a/src/Client/Update.fs b/src/Client/Update.fs
index 136a149d..a64e0de5 100644
--- a/src/Client/Update.fs
+++ b/src/Client/Update.fs
@@ -177,9 +177,27 @@ let handleTermSearchMsg (termSearchMsg: TermSearchMsg) (currentState:TermSearchS
let handleAdvancedTermSearchMsg (advancedTermSearchMsg: AdvancedSearchMsg) (currentState:AdvancedSearchState) : AdvancedSearchState * Cmd =
match advancedTermSearchMsg with
- | ToggleModal ->
+ | ResetAdvancedSearchOptions ->
let nextState = {
currentState with
+ AdvancedSearchOptions = AdvancedTermSearchOptions.init()
+ ShowAdvancedSearchResults = false
+ }
+
+ nextState,Cmd.none
+
+ | AdvancedSearchResultSelected selectedTerm ->
+ let nextState = {
+ currentState with
+ SelectedResult = Some selectedTerm
+ }
+
+ nextState,Cmd.none
+
+ | ToggleModal modalId ->
+ let nextState = {
+ currentState with
+ ModalId = modalId
HasModalVisible = (not currentState.HasModalVisible)
}
@@ -192,6 +210,7 @@ let handleAdvancedTermSearchMsg (advancedTermSearchMsg: AdvancedSearchMsg) (curr
}
nextState,Cmd.none
+
| OntologySuggestionUsed suggestion ->
let nextAdvancedSearchOptions = {
@@ -214,10 +233,28 @@ let handleAdvancedTermSearchMsg (advancedTermSearchMsg: AdvancedSearchMsg) (curr
nextState,Cmd.none
- | AdvancedSearchResultUsed (res) ->
- let nextState = AdvancedSearchState.init()
+ | StartAdvancedSearch ->
+
+ let nextState = {
+ currentState with
+ ShowAdvancedSearchResults = true
+ HasAdvancedSearchResultsLoading = true
- nextState,Cmd.ofMsg (res |> TermSuggestionUsed |> TermSearch)
+ }
+
+ let nextCmd =
+ currentState.AdvancedSearchOptions
+ |> GetNewAdvancedTermSearchResults
+ |> Request
+ |> Api
+ |> Cmd.ofMsg
+
+ nextState,nextCmd
+
+ | ResetAdvancedSearchState ->
+ let nextState = AdvancedSearchState.init()
+
+ nextState,Cmd.none
| NewAdvancedSearchResults results ->
let nextState = {
@@ -229,6 +266,14 @@ let handleAdvancedTermSearchMsg (advancedTermSearchMsg: AdvancedSearchMsg) (curr
nextState,Cmd.none
+ | ChangePageinationIndex index ->
+ let nextState = {
+ currentState with
+ AdvancedSearchResultPageinationIndex = index
+ }
+
+ nextState,Cmd.none
+
let handleDevMsg (devMsg: DevMsg) (currentState:DevState) : DevState * Cmd =
match devMsg with
| GenericLog (level,logText) ->
@@ -642,7 +687,7 @@ let handleAddBuildingBlockMsg (addBuildingBlockMsg:AddBuildingBlockMsg) (current
nextState,Cmd.none
| BuildingBlockNameSuggestionUsed nameSuggestion ->
-
+
let nextBB = {
currentState.CurrentBuildingBlock with
Name = nameSuggestion
diff --git a/src/Client/Views/BaseView.fs b/src/Client/Views/BaseView.fs
index f807ce9e..32fc1aa5 100644
--- a/src/Client/Views/BaseView.fs
+++ b/src/Client/Views/BaseView.fs
@@ -14,13 +14,14 @@ open CustomComponents
let createNavigationTab (pageLink: Routing.Page) (model:Model) (dispatch:Msg-> unit) =
let isActive = (model.PageState.CurrentPage = pageLink)
- Tabs.tab [Tabs.Tab.IsActive isActive] [
+ Tabs.tab [Tabs.Tab.IsActive isActive;] [
a [ Href (Routing.Page.toPath pageLink)
Style [
if isActive then
BorderColor model.SiteStyleState.ColorMode.Accent
BackgroundColor model.SiteStyleState.ColorMode.BodyBackground
Color model.SiteStyleState.ColorMode.Accent
+ BorderBottomColor model.SiteStyleState.ColorMode.BodyBackground
else
BorderBottomColor model.SiteStyleState.ColorMode.Accent
]
diff --git a/src/Client/index.html b/src/Client/index.html
index 81eb5148..feb715f0 100644
--- a/src/Client/index.html
+++ b/src/Client/index.html
@@ -8,6 +8,49 @@
+