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
9e778543
Unverified
Commit
9e778543
authored
Feb 27, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename TermType as TermSize and use a min/max API for sizes
parent
37be629b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+8
-8
Config.purs
src/Gargantext/Config.purs
+6
-3
Types.purs
src/Gargantext/Types.purs
+9
-9
No files found.
src/Gargantext/Components/NgramsTable.purs
View file @
9e778543
...
@@ -56,7 +56,7 @@ import React.DOM.Props as DOM
...
@@ -56,7 +56,7 @@ import React.DOM.Props as DOM
import Thermite (PerformAction, Render, Spec, StateCoTransformer, defaultPerformAction, modifyState_, simpleSpec, createClass)
import Thermite (PerformAction, Render, Spec, StateCoTransformer, defaultPerformAction, modifyState_, simpleSpec, createClass)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Types (TermList(..), Term
Type, readTermList, readTermType, termLists, termTyp
es)
import Gargantext.Types (TermList(..), Term
Size, readTermList, readTermSize, termLists, termSiz
es)
import Gargantext.Config (toUrl, End(..), Path(..), TabType(..), OrderBy(..))
import Gargantext.Config (toUrl, End(..), Path(..), TabType(..), OrderBy(..))
import Gargantext.Config.REST (get, put)
import Gargantext.Config.REST (get, put)
import Gargantext.Components.AutoUpdate (autoUpdateElt)
import Gargantext.Components.AutoUpdate (autoUpdateElt)
...
@@ -71,7 +71,7 @@ type PageParams =
...
@@ -71,7 +71,7 @@ type PageParams =
, tabType :: TabType
, tabType :: TabType
, searchQuery :: String
, searchQuery :: String
, termListFilter :: Maybe TermList -- Nothing means all
, termListFilter :: Maybe TermList -- Nothing means all
, term
TypeFilter :: Maybe TermTyp
e -- Nothing means all
, term
SizeFilter :: Maybe TermSiz
e -- Nothing means all
}
}
initialPageParams :: Int -> Array Int -> TabType -> PageParams
initialPageParams :: Int -> Array Int -> TabType -> PageParams
...
@@ -80,7 +80,7 @@ initialPageParams nodeId listIds tabType =
...
@@ -80,7 +80,7 @@ initialPageParams nodeId listIds tabType =
, listIds
, listIds
, params: T.initialParams
, params: T.initialParams
, tabType
, tabType
, term
Typ
eFilter: Nothing
, term
Siz
eFilter: Nothing
, termListFilter: Nothing
, termListFilter: Nothing
, searchQuery: ""
, searchQuery: ""
}
}
...
@@ -465,8 +465,8 @@ tableContainer { pageParams
...
@@ -465,8 +465,8 @@ tableContainer { pageParams
[ select [ _id "picktermtype"
[ select [ _id "picktermtype"
, className "form-control custom-select"
, className "form-control custom-select"
-- , value ?
-- , value ?
, onChange (\e -> setTerm
TypeFilter $ readTermTyp
e $ unsafeEventValue e)
, onChange (\e -> setTerm
SizeFilter $ readTermSiz
e $ unsafeEventValue e)
] $ map optps1 term
Typ
es
] $ map optps1 term
Siz
es
]
]
, li [className " list-group-item"] [ props.pageSizeControl ]
, li [className " list-group-item"] [ props.pageSizeControl ]
]
]
...
@@ -509,7 +509,7 @@ tableContainer { pageParams
...
@@ -509,7 +509,7 @@ tableContainer { pageParams
setPageParams f = loaderDispatch $ Loader.SetPath $ f pageParams
setPageParams f = loaderDispatch $ Loader.SetPath $ f pageParams
setSearchQuery x = setPageParams $ _ { searchQuery = x }
setSearchQuery x = setPageParams $ _ { searchQuery = x }
setTermListFilter x = setPageParams $ _ { termListFilter = x }
setTermListFilter x = setPageParams $ _ { termListFilter = x }
setTerm
TypeFilter x = setPageParams $ _ { termTyp
eFilter = x }
setTerm
SizeFilter x = setPageParams $ _ { termSiz
eFilter = x }
putTable :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType} -> Versioned NgramsTablePatch -> Aff (Versioned NgramsTablePatch)
putTable :: {nodeId :: Int, listIds :: Array Int, tabType :: TabType} -> Versioned NgramsTablePatch -> Aff (Versioned NgramsTablePatch)
putTable {nodeId, listIds, tabType} =
putTable {nodeId, listIds, tabType} =
...
@@ -621,12 +621,12 @@ ngramsTableSpec = simpleSpec performAction render
...
@@ -621,12 +621,12 @@ ngramsTableSpec = simpleSpec performAction render
}
}
loadPage :: PageParams -> Aff VersionedNgramsTable
loadPage :: PageParams -> Aff VersionedNgramsTable
loadPage { nodeId, listIds, termListFilter, term
Typ
eFilter
loadPage { nodeId, listIds, termListFilter, term
Siz
eFilter
, searchQuery, tabType, params: {offset, limit, orderBy}} =
, searchQuery, tabType, params: {offset, limit, orderBy}} =
get $ toUrl Back
get $ toUrl Back
(GetNgrams { tabType, offset, limit, listIds
(GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy
, orderBy: convOrderBy <$> orderBy
, termListFilter, term
Typ
eFilter
, termListFilter, term
Siz
eFilter
, searchQuery
, searchQuery
})
})
(Just nodeId)
(Just nodeId)
...
...
src/Gargantext/Config.purs
View file @
9e778543
...
@@ -133,14 +133,17 @@ pathUrl c (GetNgrams
...
@@ -133,14 +133,17 @@ pathUrl c (GetNgrams
, limit: l
, limit: l
, listIds
, listIds
, termListFilter: tlf
, termListFilter: tlf
, term
TypeFilter: tt
f
, term
SizeFilter: ts
f
, searchQuery: q
, searchQuery: q
}) i =
}) i =
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsGet t
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsGet t
<> offsetUrl o <> limitUrl l
<> offsetUrl o <> limitUrl l
<> foldMap (\x -> "&list=" <> show x) listIds
<> foldMap (\x -> "&list=" <> show x) listIds
<> foldMap (\x -> "&listType=" <> show x) tlf
<> foldMap (\x -> "&listType=" <> show x) tlf
<> foldMap (\x -> "&termType=" <> show x) ttf
<> foldMap (\x -> case x of
MonoTerm -> "&minTermSize=0&maxTermSize=1"
MultiTerm -> "&minTermSize=2"
) tsf
<> if q == "" then "" else ("&search=" <> q)
<> if q == "" then "" else ("&search=" <> q)
pathUrl c (PutNgrams t listid) i =
pathUrl c (PutNgrams t listid) i =
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsPut t <> listid'
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsPut t <> listid'
...
@@ -219,7 +222,7 @@ data Path
...
@@ -219,7 +222,7 @@ data Path
, orderBy :: Maybe OrderBy
, orderBy :: Maybe OrderBy
, listIds :: Array ListId
, listIds :: Array ListId
, termListFilter :: Maybe TermList
, termListFilter :: Maybe TermList
, term
TypeFilter :: Maybe TermTyp
e
, term
SizeFilter :: Maybe TermSiz
e
, searchQuery :: String
, searchQuery :: String
}
}
| PutNgrams TabType (Maybe ListId)
| PutNgrams TabType (Maybe ListId)
...
...
src/Gargantext/Types.purs
View file @
9e778543
...
@@ -6,21 +6,21 @@ import Data.Maybe (Maybe(..))
...
@@ -6,21 +6,21 @@ import Data.Maybe (Maybe(..))
import Data.Either (Either(..))
import Data.Either (Either(..))
import Gargantext.Prelude
import Gargantext.Prelude
data Term
Typ
e = MonoTerm | MultiTerm
data Term
Siz
e = MonoTerm | MultiTerm
derive instance eqTerm
Type :: Eq TermTyp
e
derive instance eqTerm
Size :: Eq TermSiz
e
instance showTerm
Type :: Show TermTyp
e where
instance showTerm
Size :: Show TermSiz
e where
show MonoTerm = "MonoTerm"
show MonoTerm = "MonoTerm"
show MultiTerm = "MultiTerm"
show MultiTerm = "MultiTerm"
readTerm
Type :: String -> Maybe TermTyp
e
readTerm
Size :: String -> Maybe TermSiz
e
readTerm
Typ
e "MonoTerm" = Just MonoTerm
readTerm
Siz
e "MonoTerm" = Just MonoTerm
readTerm
Typ
e "MultiTerm" = Just MultiTerm
readTerm
Siz
e "MultiTerm" = Just MultiTerm
readTerm
Typ
e _ = Nothing
readTerm
Siz
e _ = Nothing
term
Types :: Array { desc :: String, mval :: Maybe TermTyp
e }
term
Sizes :: Array { desc :: String, mval :: Maybe TermSiz
e }
term
Typ
es = [ { desc: "All types", mval: Nothing }
term
Siz
es = [ { desc: "All types", mval: Nothing }
, { desc: "One-word terms", mval: Just MonoTerm }
, { desc: "One-word terms", mval: Just MonoTerm }
, { desc: "Multi-word terms", mval: Just MultiTerm }
, { desc: "Multi-word terms", mval: Just MultiTerm }
]
]
...
...
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