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
5bf63770
Unverified
Commit
5bf63770
authored
5 years ago
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corpus.Document: cleanup
parent
3bcb795f
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
43 deletions
+2
-43
Document.purs
src/Gargantext/Pages/Corpus/Document.purs
+2
-43
No files found.
src/Gargantext/Pages/Corpus/Document.purs
View file @
5bf63770
module Gargantext.Pages.Corpus.Document where
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Generic.Rep (class Generic)
import Data.Lens (Lens', lens, (?~))
...
...
@@ -26,34 +25,19 @@ import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Types (TermList(..))
import Gargantext.Utils.Reactix ( scuff )
nge :: String -> Tuple String NgramsElement
nge word = Tuple word elem where
elem = NgramsElement
{ ngrams: word, list: StopTerm
, occurrences: 1, parent: Nothing
, root: Nothing, children: Set.empty }
testTable :: NgramsTable
testTable = NgramsTable $ Map.fromFoldable $ nge <$> words
where words = [ "the", "quick", "brown", "fox", "jumped", "over", "lazy", "dog" ]
type State =
{ document :: Maybe (NodePoly Document)
, ngramsTable :: Maybe NgramsTable
, inputValue :: String
}
initialState :: {} -> State
initialState {} =
{ document: Nothing
, ngramsTable: (Just testTable)
, inputValue: ""
, ngramsTable: Nothing
}
data Action
= Load Int Int
| ChangeString String
| SetInput String
newtype Status = Status { failed :: Int
, succeeded :: Int
...
...
@@ -289,13 +273,9 @@ performAction (Load lId nId) _ _ = do
, termListFilter : Nothing
, termSizeFilter : Nothing
}
void $ modifyState $ _document ?~ node
void $ modifyState $ _ngramsTable ?~ table
logs $ "Node Document " <> show nId <> " fetched."
performAction (ChangeString ps) _ _ = pure unit
performAction (SetInput ps) _ _ = void <$> modifyState $ _ { inputValue = ps }
getNode :: Maybe Int -> Aff (NodePoly Document)
getNode = get <<< toUrl Back Node
...
...
@@ -306,7 +286,6 @@ _document = lens (\s -> s.document) (\s ss -> s{document = ss})
_ngramsTable :: Lens' State (Maybe NgramsTable)
_ngramsTable = lens (\s -> s.ngramsTable) (\s ss -> s{ngramsTable = ss})
------------------------------------------------------------------------
docview :: Spec State {} Action
...
...
@@ -325,12 +304,10 @@ docview = simpleSpec performAction render
[ li' [ span [] [text' document.source]
, badge "source"
]
-- TODO add href to /author/ if author present in
, li' [ span [] [text' document.authors]
, badge "authors"
]
, li' [ span [] [text' document.publication_date]
, badge "date"
]
...
...
@@ -349,23 +326,5 @@ docview = simpleSpec performAction render
li' = li [className "list-group-item justify-content-between"]
text' x = text $ maybe "Nothing" identity x
badge s = span [className "badge badge-default badge-pill"] [text s]
NodePoly {hyperdata : Document document} =
NodePoly {hyperdata : Document document} =
maybe defaultNodeDocument identity state.document
findInDocument :: (Document -> Maybe String) -> State -> Maybe String
findInDocument f state =
do (NodePoly d) <- state.document
f d.hyperdata
aryPS :: Array String
aryPS = ["Map", "Main", "Stop"]
aryPS1 :: Array String
aryPS1 = ["Nothing Selected","STOPLIST", "MAINLIST", "MAPLIST"]
optps :: String -> ReactElement
optps val = option [ value val ] [text val]
unsafeEventValue :: forall event. event -> String
unsafeEventValue e = (unsafeCoerce e).target.value
This diff is collapsed.
Click to expand it.
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