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
8ae2ec0e
Commit
8ae2ec0e
authored
Oct 14, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
[MERGE] conflict with REST and Sessions fix.
parents
11f4718e
7dcf1f97
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
+28
-21
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+12
-6
Table.purs
src/Gargantext/Components/Table.purs
+12
-11
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+4
-4
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
8ae2ec0e
...
@@ -16,7 +16,7 @@ import Data.Set as Set
...
@@ -16,7 +16,7 @@ import Data.Set as Set
import Data.Symbol (SProxy(..))
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..), fst)
import Data.Tuple (Tuple(..), fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log)
import DOM.Simple.Console (log
, log3
)
import DOM.Simple.Event as DE
import DOM.Simple.Event as DE
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
...
@@ -27,6 +27,10 @@ import Reactix.DOM.HTML as H
...
@@ -27,6 +27,10 @@ import Reactix.DOM.HTML as H
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, trashCategory, decodeCategory, putCategories)
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, trashCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Components.Loader (loader)
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, trashCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T
import Gargantext.Ends (url)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
...
@@ -219,7 +223,7 @@ type PageParams = { nodeId :: Int
...
@@ -219,7 +223,7 @@ type PageParams = { nodeId :: Int
loadPage :: Session -> PageParams -> Aff (Array DocumentsView)
loadPage :: Session -> PageParams -> Aff (Array DocumentsView)
loadPage session {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orderBy}} = do
loadPage session {nodeId, tabType, query, listId, corpusId, params: {limit, offset, orderBy}} = do
liftEffect $ log
"loading documents page: loadPage with Offset and limit"
liftEffect $ log
3 "loading documents page: loadPage with Offset and limit" offset limit
-- res <- get $ toUrl endConfigStateful Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
-- res <- get $ toUrl endConfigStateful Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let p = NodeAPI Node (Just nodeId) "table"
let p = NodeAPI Node (Just nodeId) "table"
res <- post session p $ TabPostQuery {
res <- post session p $ TabPostQuery {
...
@@ -257,10 +261,12 @@ pageLayout :: Record PageLayoutProps -> R.Element
...
@@ -257,10 +261,12 @@ pageLayout :: Record PageLayoutProps -> R.Element
pageLayout props = R.createElement pageLayoutCpt props []
pageLayout props = R.createElement pageLayoutCpt props []
pageLayoutCpt :: R.Memo PageLayoutProps
pageLayoutCpt :: R.Memo PageLayoutProps
pageLayoutCpt = R.memo' $ R.hooksComponent "G.C.DocsTable.pageLayout" cpt where
pageLayoutCpt = R.memo' $ R.staticComponent "G.C.DocsTable.pageLayout" cpt where
cpt props@{session, nodeId, listId, corpusId, tabType, query, params} _ = do
cpt props@{session, nodeId, listId, corpusId, tabType, query, params} _ =
useLoader {nodeId, listId, corpusId, tabType, query, params: fst params} (loadPage session) $
loader path (loadPage session) paint
\loaded -> page params props loaded
where
path = {nodeId, listId, corpusId, tabType, query, params: fst params}
paint loaded = page params props loaded
type PageProps =
type PageProps =
( params :: R.State T.Params
( params :: R.State T.Params
...
...
src/Gargantext/Components/Table.purs
View file @
8ae2ec0e
...
@@ -7,6 +7,7 @@ import Data.Generic.Rep.Show (genericShow)
...
@@ -7,6 +7,7 @@ import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -126,16 +127,16 @@ tableCpt :: R.Component Props
...
@@ -126,16 +127,16 @@ tableCpt :: R.Component Props
tableCpt = R.hooksComponent "Table" cpt
tableCpt = R.hooksComponent "Table" cpt
where
where
cpt {container, colNames, totalRecords, rows, params} _ = do
cpt {container, colNames, totalRecords, rows, params} _ = do
(pageSize
/\ setPageSize) <- R.useState' PS10
pageSize@(pageSize'
/\ setPageSize) <- R.useState' PS10
(page /\ setPage) <- R.useState' 1
(page /\ setPage) <- R.useState' 1
(orderBy /\ setOrderBy) <- R.useState' Nothing
(orderBy /\ setOrderBy) <- R.useState' Nothing
let state = {pageSize, orderBy, page}
let state = {pageSize
: pageSize'
, orderBy, page}
let ps = pageSizes2Int pageSize
let ps = pageSizes2Int pageSize
'
let totalPages = (totalRecords / ps) + min 1 (totalRecords `mod` ps)
let totalPages = (totalRecords / ps) + min 1 (totalRecords `mod` ps)
R.useEffect1' state $ when (fst params /= stateParams state) $ (snd params) (const $ stateParams state)
R.useEffect1' state $ when (fst params /= stateParams state) $ (snd params) (const $ stateParams state)
pure $ container
pure $ container
{ pageSizeControl: sizeDD pageSize
setPageSize
{ pageSizeControl: sizeDD pageSize
, pageSizeDescription: textDescription page pageSize totalRecords
, pageSizeDescription: textDescription page pageSize
'
totalRecords
, paginationLinks: pagination setPage totalPages page
, paginationLinks: pagination setPage totalPages page
, tableHead: H.tr {} (colHeader setOrderBy orderBy <$> colNames)
, tableHead: H.tr {} (colHeader setOrderBy orderBy <$> colNames)
, tableBody: map (H.tr {} <<< map (\c -> H.td {} [c]) <<< _.row) rows
, tableBody: map (H.tr {} <<< map (\c -> H.td {} [c]) <<< _.row) rows
...
@@ -178,12 +179,15 @@ graphContainer {title} props =
...
@@ -178,12 +179,15 @@ graphContainer {title} props =
-- , props.pageSizeDescription
-- , props.pageSizeDescription
-- , props.paginationLinks
-- , props.paginationLinks
sizeDD :: PageSizes -> R2.Setter PageSizes -> R.Element
sizeDD :: R.State PageSizes -> R.Element
sizeDD ps setPageSize = H.span {} [ R2.select { className, defaultValue: ps, on: {change} } sizes ]
sizeDD (ps /\ setPageSize) =
H.span {} [ R2.select { className, defaultValue: ps, on: {change} } sizes ]
where
where
className = "form-control"
className = "form-control"
change e = setPageSize $ const (string2PageSize $ R2.unsafeEventValue e)
change e = setPageSize $ const (string2PageSize $ R2.unsafeEventValue e)
sizes = map (optps ps) pageSizes
sizes = map option pageSizes
option size = H.option {value} [H.text value]
where value = show size
textDescription :: Int -> PageSizes -> Int -> R.Element
textDescription :: Int -> PageSizes -> Int -> R.Element
textDescription currPage pageSize totalRecords =
textDescription currPage pageSize totalRecords =
...
@@ -276,6 +280,3 @@ string2PageSize "50" = PS50
...
@@ -276,6 +280,3 @@ string2PageSize "50" = PS50
string2PageSize "100" = PS100
string2PageSize "100" = PS100
string2PageSize "200" = PS200
string2PageSize "200" = PS200
string2PageSize _ = PS10
string2PageSize _ = PS10
optps :: PageSizes -> PageSizes -> R.Element
optps _cv val = H.option {value: show val} [R2.showText val]
src/Gargantext/Utils/Reactix.purs
View file @
8ae2ec0e
...
@@ -18,8 +18,8 @@ import FFI.Simple ((...), defineProperty, delay, args2, args3)
...
@@ -18,8 +18,8 @@ import FFI.Simple ((...), defineProperty, delay, args2, args3)
import React (class ReactPropFields, Children, ReactClass, ReactElement)
import React (class ReactPropFields, Children, ReactClass, ReactElement)
import React as React
import React as React
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML (ElemFactory, text)
import Reactix.DOM.HTML (ElemFactory,
createDOM,
text)
import Reactix.React (react
, createDOMElement
)
import Reactix.React (react)
import Reactix.SyntheticEvent as RE
import Reactix.SyntheticEvent as RE
import Reactix.Utils (currySecond, hook, tuple)
import Reactix.Utils (currySecond, hook, tuple)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
...
@@ -88,10 +88,10 @@ overState :: forall t. (t -> t) -> R.State t -> Effect Unit
...
@@ -88,10 +88,10 @@ overState :: forall t. (t -> t) -> R.State t -> Effect Unit
overState f (_state /\ setState) = setState f
overState f (_state /\ setState) = setState f
select :: ElemFactory
select :: ElemFactory
select = createDOM
Element
"select"
select = createDOM "select"
menu :: ElemFactory
menu :: ElemFactory
menu = createDOM
Element
"menu"
menu = createDOM "menu"
effToggler :: forall e. R.State Boolean -> EffectFn1 e Unit
effToggler :: forall e. R.State Boolean -> EffectFn1 e Unit
effToggler (value /\ setValue) = mkEffectFn1 $ \e -> setValue $ const $ not value
effToggler (value /\ setValue) = mkEffectFn1 $ \e -> setValue $ const $ not value
...
...
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