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
138
Issues
138
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
ee9bfb7f
Commit
ee9bfb7f
authored
Oct 30, 2020
by
Nicolas Pouillard
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document: setting a listterm now targets the root of the ngrams group
parent
7f127b60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+8
-1
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+14
-5
No files found.
src/Gargantext/Components/NgramsTable/Core.purs
View file @
ee9bfb7f
...
@@ -15,6 +15,7 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -15,6 +15,7 @@ module Gargantext.Components.NgramsTable.Core
, NgramsTerm
, NgramsTerm
, normNgram
, normNgram
, ngramsTermText
, ngramsTermText
, findNgramRoot
, findNgramTermList
, findNgramTermList
, Version
, Version
, Versioned(..)
, Versioned(..)
...
@@ -760,8 +761,14 @@ isEmptyNgramsTablePatch {ngramsPatches} = isEmptyPatchMap ngramsPatches
...
@@ -760,8 +761,14 @@ isEmptyNgramsTablePatch {ngramsPatches} = isEmptyPatchMap ngramsPatches
fromNgramsPatches :: NgramsPatches -> NgramsTablePatch
fromNgramsPatches :: NgramsPatches -> NgramsTablePatch
fromNgramsPatches ngramsPatches = {ngramsPatches}
fromNgramsPatches ngramsPatches = {ngramsPatches}
findNgramRoot :: NgramsTable -> NgramsTerm -> NgramsTerm
findNgramRoot (NgramsTable m) n =
fromMaybe n (m.ngrams_repo_elements ^? at n <<< _Just <<< _NgramsRepoElement <<< _root <<< _Just)
findNgramTermList :: NgramsTable -> NgramsTerm -> Maybe TermList
findNgramTermList :: NgramsTable -> NgramsTerm -> Maybe TermList
findNgramTermList (NgramsTable m) n = m.ngrams_repo_elements ^? at n <<< _Just <<< _NgramsRepoElement <<< _list
findNgramTermList (NgramsTable m) n = m.ngrams_repo_elements ^? at r <<< _Just <<< _NgramsRepoElement <<< _list
where
r = findNgramRoot (NgramsTable m) n
singletonNgramsTablePatch :: NgramsTerm -> NgramsPatch -> NgramsTablePatch
singletonNgramsTablePatch :: NgramsTerm -> NgramsPatch -> NgramsTablePatch
singletonNgramsTablePatch n p = fromNgramsPatches $ singletonPatchMap n p
singletonNgramsTablePatch n p = fromNgramsPatches $ singletonPatchMap n p
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
ee9bfb7f
module Gargantext.Components.Nodes.Corpus.Document where
module Gargantext.Components.Nodes.Corpus.Document where
--import Data.Argonaut (encodeJson) -- DEBUG
--import Data.Argonaut.Core (stringifyWithIndent) -- DEBUG
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (fst)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
...
@@ -7,7 +9,7 @@ import Effect.Aff (Aff)
...
@@ -7,7 +9,7 @@ import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Prelude (bind, pure, show, unit, ($), (<>))
import Gargantext.Prelude (bind, pure, show, unit, ($), (<>)
, (<<<)
)
import Gargantext.Components.AutoUpdate (autoUpdate)
import Gargantext.Components.AutoUpdate (autoUpdate)
import Gargantext.Components.Search (SearchType(..))
import Gargantext.Components.Search (SearchType(..))
...
@@ -15,7 +17,7 @@ import Gargantext.Components.Node (NodePoly(..))
...
@@ -15,7 +17,7 @@ import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus.Document.Types (DocPath, Document(..), LoadedData, NodeDocument, Props, State, initialState)
import Gargantext.Components.Nodes.Corpus.Document.Types (DocPath, Document(..), LoadedData, NodeDocument, Props, State, initialState)
import Gargantext.Components.NgramsTable.Core
import Gargantext.Components.NgramsTable.Core
( CoreAction(..), Versioned(..), addNewNgramA, applyNgramsPatches, coreDispatch, loadNgramsTable
( CoreAction(..), Versioned(..), addNewNgramA, applyNgramsPatches, coreDispatch, loadNgramsTable
, replace, setTermListA, syncResetButtons )
, replace, setTermListA, syncResetButtons
, findNgramRoot
)
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
...
@@ -75,7 +77,12 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
...
@@ -75,7 +77,12 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
else []
else []
pure $ H.div {} $
pure $ H.div {} $
autoUpd <> syncResetBtns <> [
autoUpd <> syncResetBtns <>
--DEBUG
--[ H.pre { rows: 30 } [
-- H.text (stringifyWithIndent 2 (encodeJson (fst state)))
-- ] ] <>
[
H.div { className: "container1" }
H.div { className: "container1" }
[
[
R2.row
R2.row
...
@@ -111,8 +118,10 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
...
@@ -111,8 +118,10 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
, text }
, text }
badge s = H.span { className: "badge badge-default badge-pill" } [ H.text s ]
badge s = H.span { className: "badge badge-default badge-pill" } [ H.text s ]
li' = H.li { className: "list-group-item justify-content-between" }
li' = H.li { className: "list-group-item justify-content-between" }
setTermList ngram Nothing newList = dispatch (addNewNgramA ngram newList)
setTermListOrAddA ngram Nothing = addNewNgramA ngram
setTermList ngram (Just oldList) newList = dispatch (setTermListA ngram (replace oldList newList))
setTermListOrAddA ngram (Just oldList) = setTermListA ngram <<< replace oldList
setTermList ngram mOldList = dispatch <<< setTermListOrAddA (findNgramRoot ngrams ngram) mOldList
-- Here the use of findNgramRoot makes that we always target the root of an ngram group.
text' x = H.text $ fromMaybe "Nothing" x
text' x = H.text $ fromMaybe "Nothing" x
NodePoly {hyperdata: Document doc} = document
NodePoly {hyperdata: Document doc} = document
...
...
Nicolas Pouillard
@np
mentioned in issue
#213 (closed)
·
Oct 30, 2020
mentioned in issue
#213 (closed)
mentioned in issue #213
Toggle commit list
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