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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
362ca6e2
Commit
362ca6e2
authored
May 24, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/378-dev-add-sync-ngram-rc0.x' into dev-merge
parents
3ed9ff55
45b2a941
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+25
-11
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
362ca6e2
...
@@ -26,6 +26,8 @@ import Data.Tuple.Nested ((/\))
...
@@ -26,6 +26,8 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.App.Store (Boxes)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), Variant(..))
import Gargantext.Components.NgramsTable.Components as NTC
import Gargantext.Components.NgramsTable.Components as NTC
import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Versioned(..), VersionedNgramsTable, VersionedWithCountNgramsTable, _NgramsElement, _NgramsRepoElement, _NgramsTable, _children, _list, _ngrams, _ngrams_repo_elements, _ngrams_scores, _occurrences, _root, addNewNgramA, applyNgramsPatches, applyPatchSet, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, fromNgramsPatches, ngramsRepoElementToNgramsElement, ngramsTermText, normNgram, patchSetFromMap, replace, setTermListA, singletonNgramsTablePatch, syncResetButtons, toVersioned)
import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Versioned(..), VersionedNgramsTable, VersionedWithCountNgramsTable, _NgramsElement, _NgramsRepoElement, _NgramsTable, _children, _list, _ngrams, _ngrams_repo_elements, _ngrams_scores, _occurrences, _root, addNewNgramA, applyNgramsPatches, applyPatchSet, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, fromNgramsPatches, ngramsRepoElementToNgramsElement, ngramsTermText, normNgram, patchSetFromMap, replace, setTermListA, singletonNgramsTablePatch, syncResetButtons, toVersioned)
import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI)
import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI)
...
@@ -103,6 +105,7 @@ type TableContainerProps =
...
@@ -103,6 +105,7 @@ type TableContainerProps =
, path :: T.Box PageParams
, path :: T.Box PageParams
, tabNgramType :: CTabNgramType
, tabNgramType :: CTabNgramType
, syncResetButton :: Array R.Element
, syncResetButton :: Array R.Element
, addCallback :: String -> Effect Unit
)
)
tableContainer :: Record TableContainerProps -> Record TT.TableContainerProps -> R.Element
tableContainer :: Record TableContainerProps -> Record TT.TableContainerProps -> R.Element
...
@@ -117,6 +120,7 @@ tableContainerCpt { dispatch
...
@@ -117,6 +120,7 @@ tableContainerCpt { dispatch
, queryExactMatches
, queryExactMatches
, tabNgramType
, tabNgramType
, syncResetButton
, syncResetButton
, addCallback
} = here.component "tableContainer" cpt
} = here.component "tableContainer" cpt
where
where
cpt props _ = do
cpt props _ = do
...
@@ -132,16 +136,13 @@ tableContainerCpt { dispatch
...
@@ -132,16 +136,13 @@ tableContainerCpt { dispatch
, if (not queryExactMatches || A.null props.tableBody) && searchQuery /= "" then
, if (not queryExactMatches || A.null props.tableBody) && searchQuery /= "" then
-- , if (not $ Set.member (normNgram tabNgramType searchQuery) ngramsSelection) && searchQuery /= "" then
-- , if (not $ Set.member (normNgram tabNgramType searchQuery) ngramsSelection) && searchQuery /= "" then
H.li { className: "list-group-item" }
H.li { className: "list-group-item" }
[ H.button { className: "btn btn-primary"
[
, on: { click: const $ dispatch
B.button
$ CoreAction
{ variant: ButtonVariant Primary
$ addNewNgramA
, callback: const $ addCallback searchQuery
(normNgram tabNgramType searchQuery)
}
MapTerm
[ H.text ("Add " <> searchQuery) ]
}
] else H.div {} []
}
[ H.text ("Add " <> searchQuery) ]
] else H.div {} []
]
]
, H.div {className: "col-md-2", style: {marginTop : "6px"}}
, H.div {className: "col-md-2", style: {marginTop : "6px"}}
[ H.li {className: "list-group-item"}
[ H.li {className: "list-group-item"}
...
@@ -379,6 +380,17 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
...
@@ -379,6 +380,17 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
, ngramsLocalPatch
, ngramsLocalPatch
, performAction: performAction <<< CoreAction }
, performAction: performAction <<< CoreAction }
addCallback searchQuery = do
-- add new ngram as a "Map Term"
performAction
$ CoreAction
$ addNewNgramA (normNgram tabNgramType searchQuery) MapTerm
-- then sync the ngram list
performAction
$ CoreAction
$ Synchronize { afterSync: afterSync' }
-- autoUpdate :: Array R.Element
-- autoUpdate :: Array R.Element
-- autoUpdate = if withAutoUpdate then
-- autoUpdate = if withAutoUpdate then
-- [ R2.buff
-- [ R2.buff
...
@@ -410,7 +422,9 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
...
@@ -410,7 +422,9 @@ loadedNgramsTableBodyCpt = here.component "loadedNgramsTableBody" cpt where
, path
, path
, queryExactMatches: exactMatches
, queryExactMatches: exactMatches
, syncResetButton: [ syncResetButton ]
, syncResetButton: [ syncResetButton ]
, tabNgramType }
, tabNgramType
, addCallback
}
, params
, params
, rows: filteredConvertedRows
, rows: filteredConvertedRows
, syncResetButton: [ syncResetButton ]
, syncResetButton: [ syncResetButton ]
...
...
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