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
e2f66642
Commit
e2f66642
authored
Sep 11, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into feature/sigmax-graph-explorer
parents
097e80d8
872d4941
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
38 deletions
+81
-38
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+27
-26
Types.purs
src/Gargantext/Components/Search/Types.purs
+38
-8
Table.purs
src/Gargantext/Components/Table.purs
+16
-4
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
e2f66642
...
@@ -245,7 +245,7 @@ loadPage {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orde
...
@@ -245,7 +245,7 @@ loadPage {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orde
convOrderBy _ = DateAsc -- TODO
convOrderBy _ = DateAsc -- TODO
renderPage :: R.State T.Params -> PageLoaderProps -> Array DocumentsView -> R.Element
renderPage :: R.State T.Params -> PageLoaderProps -> Array DocumentsView -> R.Element
renderPage (
_
/\ setTableParams) p res = R.createElement el p []
renderPage (
tableParams
/\ setTableParams) p res = R.createElement el p []
where
where
el = R.hooksComponent "RenderPage" cpt
el = R.hooksComponent "RenderPage" cpt
...
@@ -259,10 +259,11 @@ renderPage (_ /\ setTableParams) p res = R.createElement el p []
...
@@ -259,10 +259,11 @@ renderPage (_ /\ setTableParams) p res = R.createElement el p []
cpt {nodeId, corpusId, listId, totalRecords} _children = do
cpt {nodeId, corpusId, listId, totalRecords} _children = do
localCategories <- R.useState' (mempty :: LocalCategories)
localCategories <- R.useState' (mempty :: LocalCategories)
pure $ R2.buff $ T.tableElt
pure $ R2.buff $ T.tableEltWithInitialState
(T.paramsState tableParams)
{ rows: rows localCategories
{ rows: rows localCategories
-- , setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType, listId, corpusId, params, query})
-- , setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType, listId, corpusId, params, query})
, setParams:
\params -> setTableParams $ const params
, setParams:
setTableParams <<< const
, container: T.defaultContainer { title: "Documents" }
, container: T.defaultContainer { title: "Documents" }
, colNames:
, colNames:
T.ColumnName <$>
T.ColumnName <$>
...
...
src/Gargantext/Components/Search/Types.purs
View file @
e2f66642
...
@@ -17,19 +17,52 @@ import Gargantext.Config.REST (put)
...
@@ -17,19 +17,52 @@ import Gargantext.Config.REST (put)
import Gargantext.Utils (id)
import Gargantext.Utils (id)
import URI.Extra.QueryPairs as QP
import URI.Extra.QueryPairs as QP
data Database = All | PubMed | HAL | IsTex
allDatabases :: Array Database
allDatabases = [All, PubMed
, HAL_EN
, HAL_FR
, IsTex_EN
, IsTex_FR
, Isidore_EN, Isidore_FR]
data Database = All | PubMed
| HAL_EN | HAL_FR
| IsTex_EN | IsTex_FR
| Isidore_EN | Isidore_FR
data Langs = FR | EN
-- | Types needed for now maybe not useful later (we could factorize the Type with Database Lang but no need for now)
instance showLangs :: Show Langs where
show FR = "FR"
show EN = "EN"
instance showDatabase :: Show Database where
instance showDatabase :: Show Database where
show All = "All"
show All = "All"
show PubMed = "PubMed"
show PubMed = "PubMed"
show HAL = "HAL"
show IsTex = "IsTex"
show HAL_EN = "HAL_" <> show EN
show HAL_FR = "HAL_" <> show FR
show IsTex_EN = "IsTex_" <> show EN
show IsTex_FR = "IsTex_" <> show FR
show Isidore_EN = "Isidore_" <> show EN
show Isidore_FR = "Isidore_" <> show FR
readDatabase :: String -> Maybe Database
readDatabase :: String -> Maybe Database
readDatabase "All" = Just All
readDatabase "All" = Just All
readDatabase "PubMed" = Just PubMed
readDatabase "PubMed" = Just PubMed
readDatabase "HAL" = Just HAL
readDatabase "IsTex" = Just IsTex
readDatabase "HAL_EN" = Just HAL_EN
readDatabase "HAL_FR" = Just HAL_FR
readDatabase "IsTex_EN" = Just IsTex_EN
readDatabase "IsTex_FR" = Just IsTex_FR
readDatabase "Isidore_EN" = Just Isidore_EN
readDatabase "Isidore_FR" = Just Isidore_FR
readDatabase _ = Nothing
readDatabase _ = Nothing
derive instance eqDatabase :: Eq Database
derive instance eqDatabase :: Eq Database
...
@@ -38,9 +71,6 @@ instance encodeJsonDatabase :: EncodeJson Database where
...
@@ -38,9 +71,6 @@ instance encodeJsonDatabase :: EncodeJson Database where
encodeJson a = encodeJson (show a)
encodeJson a = encodeJson (show a)
allDatabases :: Array Database
allDatabases = [All, PubMed]
data SearchOrder
data SearchOrder
= DateAsc
= DateAsc
| DateDesc
| DateDesc
...
...
src/Gargantext/Components/Table.purs
View file @
e2f66642
module Gargantext.Components.Table where
module Gargantext.Components.Table where
import Gargantext.Prelude
import Data.Array (filter)
import Data.Array (filter)
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), maybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Utils.Reactix as R2
import React (ReactElement, ReactClass, Children, createElement)
import React (ReactElement, ReactClass, Children, createElement)
import React.DOM (a, b, b', p, i, h3, hr, div, option, select, span, table, tbody, td, text, th, thead, tr)
import React.DOM (a, b, b', p, i, h3, hr, div, option, select, span, table, tbody, td, text, th, thead, tr)
import React.DOM.Props (className, href, onChange, onClick, scope, selected, value, defaultValue, style)
import React.DOM.Props (className, href, onChange, onClick, scope, selected, value, defaultValue, style)
import Thermite (PerformAction, Render, Spec, modifyState_, simpleSpec, StateCoTransformer, createClass)
import Thermite (PerformAction, Render, Spec, modifyState_, simpleSpec, StateCoTransformer, createClass)
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
type TableContainerProps =
type TableContainerProps =
{ pageSizeControl :: ReactElement
{ pageSizeControl :: ReactElement
, pageSizeDescription :: ReactElement
, pageSizeDescription :: ReactElement
...
@@ -130,7 +131,7 @@ tableSpec = simpleSpec performAction render
...
@@ -130,7 +131,7 @@ tableSpec = simpleSpec performAction render
where
where
modifyStateAndReload :: (State -> State) -> Props -> State -> StateCoTransformer State Unit
modifyStateAndReload :: (State -> State) -> Props -> State -> StateCoTransformer State Unit
modifyStateAndReload f {setParams} state = do
modifyStateAndReload f {setParams} state = do
logs "modifyStateAndReload" -- TODO rename
--
logs "modifyStateAndReload" -- TODO rename
modifyState_ f
modifyState_ f
liftEffect $ setParams $ stateParams $ f state
liftEffect $ setParams $ stateParams $ f state
...
@@ -207,12 +208,23 @@ stateParams {pageSize, currentPage, orderBy} = {offset, limit, orderBy}
...
@@ -207,12 +208,23 @@ stateParams {pageSize, currentPage, orderBy} = {offset, limit, orderBy}
limit = pageSizes2Int pageSize
limit = pageSizes2Int pageSize
offset = limit * (currentPage - 1)
offset = limit * (currentPage - 1)
paramsState :: Params -> State
paramsState {offset, limit, orderBy} = {pageSize, currentPage, orderBy}
where
pageSize = string2PageSize $ show limit
currentPage = (offset / limit) + 1
tableClass :: ReactClass {children :: Children | Props'}
tableClass :: ReactClass {children :: Children | Props'}
tableClass = createClass "Table" tableSpec (const initialState)
tableClass = createClass "Table" tableSpec (const initialState)
tableElt :: Props -> ReactElement
tableElt :: Props -> ReactElement
tableElt props = createElement tableClass props []
tableElt props = createElement tableClass props []
tableEltWithInitialState :: State -> Props -> ReactElement
tableEltWithInitialState state props = createElement tc props []
where
tc = createClass "Table" tableSpec (const state)
sizeDD :: PageSizes -> (Action -> Effect Unit) -> ReactElement
sizeDD :: PageSizes -> (Action -> Effect Unit) -> ReactElement
sizeDD ps d
sizeDD ps d
= span []
= span []
...
...
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