Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
d9c780b5
Commit
d9c780b5
authored
Sep 27, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/425-dev-terms-page-reset' into dev-merge
parents
fb6f33c4
796e8e18
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+8
-4
Search.purs
src/Gargantext/Components/NgramsTable/Search.purs
+9
-3
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
d9c780b5
...
...
@@ -43,6 +43,7 @@ import Gargantext.Components.NgramsTable.Tree (renderNgramsItem, renderNgramsTre
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table (changePage)
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types (Params)
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (AffRESTError, RESTError, logRESTError)
import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, ngramsRepoElementToNgramsElement, normNgram, patchSetFromMap, singletonNgramsTablePatch, tablePatchHasNgrams, toVersioned)
...
...
@@ -407,13 +408,13 @@ type Props =
| PropsNoReload )
type LoadedNgramsTableHeaderProps =
( searchQuery :: T.Box SearchQuery )
( searchQuery :: T.Box SearchQuery
, params :: T.Box Params
)
loadedNgramsTableHeader :: R2.Leaf LoadedNgramsTableHeaderProps
loadedNgramsTableHeader = R2.leaf loadedNgramsTableHeaderCpt
loadedNgramsTableHeaderCpt :: R.Component LoadedNgramsTableHeaderProps
loadedNgramsTableHeaderCpt = here.component "loadedNgramsTableHeader" cpt where
cpt { searchQuery } _ = pure $
cpt { searchQuery
, params
} _ = pure $
R.fragment
[
...
...
@@ -435,6 +436,7 @@ loadedNgramsTableHeaderCpt = here.component "loadedNgramsTableHeader" cpt where
NTS.searchInput
{ key: "search-input"
, searchQuery
, params
}
]
...
...
@@ -541,6 +543,7 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
performAction
$ CoreAction
$ Synchronize { afterSync: afterSync' }
changePage 1 params
-- autoUpdate :: Array R.Element
...
...
@@ -753,6 +756,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
where
cpt props@{ cacheState, path, treeEdit } _ = do
searchQuery <- T.useFocused (_.searchQuery) (\a b -> b { searchQuery = a }) path
params <- T.useFocused (_.params) (\a b -> b { params = a }) path
cacheState' <- T.useLive T.unequal cacheState
-- onCancelRef <- R.useRef Nothing
-- onNgramsClickRef <- R.useRef Nothing
...
...
@@ -774,12 +778,12 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
case cacheState' of
NT.CacheOn -> pure $ R.fragment
[ loadedNgramsTableHeader { searchQuery }
[ loadedNgramsTableHeader { searchQuery
, params
}
, ngramsTreeEdit (treeEdit)
, mainNgramsTableCacheOn (Record.merge props { state })
]
NT.CacheOff -> pure $ R.fragment
[loadedNgramsTableHeader { searchQuery
}
[loadedNgramsTableHeader { searchQuery
, params
}
, ngramsTreeEdit (treeEdit)
, mainNgramsTableCacheOff (Record.merge props { state })
]
...
...
src/Gargantext/Components/NgramsTable/Search.purs
View file @
d9c780b5
...
...
@@ -7,6 +7,8 @@ import Data.Foldable (intercalate)
import Data.Nullable (Nullable, null)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.Table (changePage)
import Gargantext.Components.Table.Types (Params)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -18,6 +20,7 @@ here = R2.here "Gargantext.Components.NgramsTable.Search"
type SearchInputProps =
( searchQuery :: T.Box String
, params :: T.Box Params
)
-- "key": to prevent refreshing & losing input
...
...
@@ -26,14 +29,14 @@ searchInput = R2.leafComponent searchInputCpt
searchInputCpt :: R.Component ( key :: String | SearchInputProps )
searchInputCpt = here.component "searchInput" cpt
where
cpt { searchQuery } _ = do
cpt { searchQuery
, params
} _ = do
inputRef <- R.useRef null
pure $ R2.row
[ H.div { className: "col-12" }
[ H.div { className: "input-group" }
[ searchFieldInput { inputRef, searchQuery } []
, searchButton { inputRef, searchQuery } []
, searchButton { inputRef, searchQuery
, params
} []
]
]
]
...
...
@@ -41,6 +44,7 @@ searchInputCpt = here.component "searchInput" cpt
type SearchButtonProps =
( inputRef :: R.Ref (Nullable DOM.Element)
, searchQuery :: T.Box String
, params :: T.Box Params
)
searchButton :: R2.Component SearchButtonProps
...
...
@@ -48,7 +52,7 @@ searchButton = R.createElement searchButtonCpt
searchButtonCpt :: R.Component SearchButtonProps
searchButtonCpt = here.component "searchButton" cpt where
cpt { inputRef, searchQuery } _ = do
cpt { inputRef, searchQuery
, params
} _ = do
-- | States
-- |
searchQuery' <- T.useLive T.unequal searchQuery
...
...
@@ -59,9 +63,11 @@ searchButtonCpt = here.component "searchButton" cpt where
onReset _ = do
R2.setInputValue inputRef ""
T.write_ "" searchQuery
changePage 1 params
onSubmit _ = do
T.write_ (R2.getInputValue inputRef) searchQuery
changePage 1 params
-- | Render
-- |
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment