Commit ae221fac authored by Karen Konou's avatar Karen Konou

Tidy

parent b41ffafb
Pipeline #7255 passed with stages
in 19 minutes and 13 seconds
...@@ -197,7 +197,6 @@ docViewCpt = R2.hereComponent here "docView" hCpt ...@@ -197,7 +197,6 @@ docViewCpt = R2.hereComponent here "docView" hCpt
T2.reload reloadForest T2.reload reloadForest
goToRoute $ Routes.Corpus (sessionId session) id goToRoute $ Routes.Corpus (sessionId session) id
-- handleRESTError hp errors eTask -- handleRESTError hp errors eTask
-- \t -> liftEffect $ launchDocumentCreationProgress -- \t -> liftEffect $ launchDocumentCreationProgress
-- errors -- errors
...@@ -270,8 +269,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt ...@@ -270,8 +269,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
, hasCollapsibleBackground: false , hasCollapsibleBackground: false
, size: LargeModalSize , size: LargeModalSize
} }
[ [ DFC.documentFormCreation
DFC.documentFormCreation
{ callback: createDocumentCallback { callback: createDocumentCallback
, status: onDocumentCreationPending ? Deferred $ Enabled , status: onDocumentCreationPending ? Deferred $ Enabled
} }
...@@ -284,8 +282,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt ...@@ -284,8 +282,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
, hasCollapsibleBackground: false , hasCollapsibleBackground: false
, size: MediumModalSize , size: MediumModalSize
} }
[ [ subcorpusCreation
subcorpusCreation
{ callback: createSubcorpusCallback { callback: createSubcorpusCallback
, query' , query'
, reuseParentList , reuseParentList
...@@ -337,7 +334,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt ...@@ -337,7 +334,7 @@ docViewCpt = R2.hereComponent here "docView" hCpt
--------------------------------------------------- ---------------------------------------------------
type SearchBarProps = type SearchBarProps =
( query :: T.Box Query, isSubcorpusModalVisibleBox :: T.Box Boolean ) (query :: T.Box Query, isSubcorpusModalVisibleBox :: T.Box Boolean)
searchBar :: R2.Component SearchBarProps searchBar :: R2.Component SearchBarProps
searchBar = R.createElement searchBarCpt searchBar = R.createElement searchBarCpt
...@@ -345,24 +342,26 @@ searchBar = R.createElement searchBarCpt ...@@ -345,24 +342,26 @@ searchBar = R.createElement searchBarCpt
searchBarCpt :: R.Component SearchBarProps searchBarCpt :: R.Component SearchBarProps
searchBarCpt = here.component "searchBar" cpt searchBarCpt = here.component "searchBar" cpt
where where
cpt { query, isSubcorpusModalVisibleBox} _children = do cpt { query, isSubcorpusModalVisibleBox } _children = do
query' <- T.useLive T.unequal query query' <- T.useLive T.unequal query
queryText <- T.useBox query' queryText <- T.useBox query'
queryText' <- T.useLive T.unequal queryText queryText' <- T.useLive T.unequal queryText
pure $ R.fragment [ pure $ R.fragment
H.div {className: "input-group px-5"} [ H.div { className: "input-group px-5" }
[ H.input { className: "form-control" [ H.input
{ className: "form-control"
, id: "docs-input-search" , id: "docs-input-search"
, defaultValue: query' , defaultValue: query'
, on: { change: onSearchChange queryText , on:
, keyUp: onSearchKeyup query queryText' } { change: onSearchChange queryText
, keyUp: onSearchKeyup query queryText'
}
, placeholder: "Search in documents" , placeholder: "Search in documents"
, type: "text" } , type: "text"
, H.div {className: "input-group-append"} }
[ , H.div { className: "input-group-append" }
if query' /= "" [ if query' /= "" then
then
R.fragment R.fragment
[ clearButton query [ clearButton query
, searchButton query queryText' , searchButton query queryText'
...@@ -405,12 +404,17 @@ searchBarCpt = here.component "searchBar" cpt ...@@ -405,12 +404,17 @@ searchBarCpt = here.component "searchBar" cpt
[ H.span { className: "text-danger fa fa-times" } [] ] [ H.span { className: "text-danger fa fa-times" } [] ]
subCorpusButton modalVisible queryText' query = subCorpusButton modalVisible queryText' query =
H.button { className: "input-group-text btn btn-light text-secondary" H.button
, on: { click: \_ -> do { className: "input-group-text btn btn-light text-secondary"
, on:
{ click: \_ -> do
T.write_ queryText' query T.write_ queryText' query
T.write_ true modalVisible } T.write_ true modalVisible
, type: "submit" } }
[ H.span {className: "fa fa-filter"} [] ] , type: "submit"
, title: "Create a subcorpus"
}
[ H.span { className: "fa fa-filter" } [] ]
mock :: Boolean mock :: Boolean
mock = false mock = false
......
...@@ -22,26 +22,25 @@ subcorpusCreation :: R2.Leaf Props ...@@ -22,26 +22,25 @@ subcorpusCreation :: R2.Leaf Props
subcorpusCreation = R2.leaf component subcorpusCreation = R2.leaf component
component :: R.Component Props component :: R.Component Props
component = R.hooksComponent "subcorpusCreation" cpt where component = R.hooksComponent "subcorpusCreation" cpt
cpt {query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback} _ = do where
pure $ H.div {} [ cpt { query', reuseParentList, reuseParentList', onSubcorpusCreationPending', callback } _ = do
H.div {className: "form-group"} [ pure $ H.div {}
H.label {} [ H.text $ "Creating subcorpus from query: " <> query' ] [ H.div { className: "form-group" }
[ H.label {} [ H.text $ "Creating subcorpus from query: " <> query' ]
] ]
, , H.div { className: "form-check" }
H.div {className: "form-check" } [ [ B.formCheckbox
B.formCheckbox
{ value: reuseParentList' { value: reuseParentList'
, callback: \_ -> T.modify_ not reuseParentList , callback: \_ -> T.modify_ not reuseParentList
} }
, H.label { className: "form-check-label"} [H.text "Reuse parent list?"] , H.label { className: "form-check-label" } [ H.text "Reuse parent list?" ]
] ]
, , B.button
B.button
{ callback: \_ -> callback query' reuseParentList' { callback: \_ -> callback query' reuseParentList'
, type: "submit" , type: "submit"
, variant: ButtonVariant Primary , variant: ButtonVariant Primary
, status: if query' == "" then Disabled else if onSubcorpusCreationPending' then Deferred else Enabled , status: if query' == "" then Disabled else if onSubcorpusCreationPending' then Deferred else Enabled
} }
[ H.text "Create!"] [ H.text "Create!" ]
] ]
...@@ -124,6 +124,7 @@ newtype SubcorpusParams = SubcorpusParams ...@@ -124,6 +124,7 @@ newtype SubcorpusParams = SubcorpusParams
{ query :: Query { query :: Query
, reuseParentList :: Boolean , reuseParentList :: Boolean
} }
derive instance Eq SubcorpusParams derive instance Eq SubcorpusParams
derive instance Generic SubcorpusParams _ derive instance Generic SubcorpusParams _
derive newtype instance JSON.ReadForeign SubcorpusParams derive newtype instance JSON.ReadForeign SubcorpusParams
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment