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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
606de8e2
Commit
606de8e2
authored
Oct 10, 2019
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEBUG] fix the effect that was the problem
parent
97d89bae
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
26 deletions
+29
-26
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+2
-7
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+3
-2
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+4
-2
Table.purs
src/Gargantext/Components/Table.purs
+15
-13
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+5
-2
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
606de8e2
...
...
@@ -274,17 +274,12 @@ page params layout documents = R.createElement pageCpt {params, layout, document
pageCpt :: R.Memo PageProps
pageCpt = R.memo' $ R.hooksComponent "G.C.DocsTable.pageCpt" cpt where
cpt { layout: {session, nodeId, corpusId, listId, totalRecords}
, documents, params: (_ /\ setParams) } _children = do
cpt { layout: {session, nodeId, corpusId, listId, totalRecords}, documents, params } _ = do
localCategories <- R.useState' (mempty :: LocalCategories)
pure $ T.table
{ rows: rows localCategories
-- , setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType, listId, corpusId, params, query})
, setParams: setParams <<< const
, container: T.defaultContainer { title: "Documents" }
, colNames
, totalRecords
}
, params, colNames, totalRecords }
where
sid = sessionId session
gi Favorite = "glyphicon glyphicon-star"
...
...
src/Gargantext/Components/FacetsTable.purs
View file @
606de8e2
...
...
@@ -278,9 +278,10 @@ pageCpt :: R.Component PageProps
pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
where
cpt {totalRecords, container, deletions, documents, session, path: path@({nodeId, listId, query} /\ setPath)} _ = do
T.table { rows, container, colNames, totalRecords,
setP
arams }
T.table { rows, container, colNames, totalRecords,
p
arams }
where
setParams params = setPath (_ {params = params})
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
params = (fst path).params /\ setParams
colNames = T.ColumnName <$> [ "", "Date", "Title", "Source", "Authors", "Delete" ]
-- TODO: how to interprete other scores?
gi Favorite = "glyphicon glyphicon-star-empty"
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
606de8e2
...
...
@@ -19,6 +19,7 @@ import Data.Monoid.Additive (Additive(..))
import Data.Ord.Down (Down(..))
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..), snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -243,13 +244,14 @@ ngramsTableSpec session ntype setPath = simpleSpec performAction render
{ ngramsTablePatch, ngramsParent, ngramsChildren }
_reactChildren =
[ autoUpdateElt { duration: 3000, effect: dispatch Refresh }
, R2.scuff $ T.table { rows,
setP
arams, container, colNames, totalRecords}
, R2.scuff $ T.table { rows,
p
arams, container, colNames, totalRecords}
]
where
totalRecords = 47361 -- TODO
colNames = T.ColumnName <$> ["Map", "Stop", "Terms", "Score (Occurrences)"] -- see convOrderBy
container = tableContainer {pageParams, setPath, dispatch, ngramsParent, ngramsChildren, ngramsTable}
setParams params = setPath $ const (pageParams {params = params})
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
params = pageParams.params /\ setParams
ngramsTable = applyNgramsTablePatch ngramsTablePatch initTable
orderWith =
case convOrderBy <$> pageParams.params.orderBy of
...
...
src/Gargantext/Components/Table.purs
View file @
606de8e2
...
...
@@ -5,6 +5,7 @@ import Data.Array (filter)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Reactix as R
...
...
@@ -50,7 +51,7 @@ derive instance eqOrderByDirection :: Eq a => Eq (OrderByDirection a)
type Props =
( colNames :: Array ColumnName
, totalRecords :: Int
,
setParams :: Params -> Effect Unit
,
params :: R.State Params
, rows :: Rows
, container :: Record TableContainerProps -> R.Element
)
...
...
@@ -124,14 +125,14 @@ table props = R.createElement tableCpt props []
tableCpt :: R.Component Props
tableCpt = R.hooksComponent "Table" cpt
where
cpt {container, colNames, totalRecords, rows,
setP
arams} _ = do
cpt {container, colNames, totalRecords, rows,
p
arams} _ = do
(pageSize /\ setPageSize) <- R.useState' PS10
(page /\ setPage) <- R.useState' 1
(orderBy /\ setOrderBy) <- R.useState' Nothing
let state = {pageSize, orderBy, page}
let ps = pageSizes2Int pageSize
let totalPages = (totalRecords / ps) + min 1 (totalRecords `mod` ps)
-- R.useEffect1' state $ setParams (
stateParams state)
R.useEffect1' state $ when (fst params /= stateParams state) $ (snd params) (const $
stateParams state)
pure $ container
{ pageSizeControl: sizeDD pageSize setPageSize
, pageSizeDescription: textDescription page pageSize totalRecords
...
...
@@ -139,16 +140,17 @@ tableCpt = R.hooksComponent "Table" cpt
, tableHead: H.tr {} (colHeader setOrderBy orderBy <$> colNames)
, tableBody: map (H.tr {} <<< map (\c -> H.td {} [c]) <<< _.row) rows
}
colHeader :: (R2.Setter OrderBy) -> OrderBy -> ColumnName -> R.Element
colHeader setOrderBy currentOrderBy c = H.th {scope: "col"} [ H.b {} cs ]
where
lnk mc = effectLink (setOrderBy (const mc))
cs :: Array R.Element
cs =
case currentOrderBy of
Just (ASC d) | c == d -> [lnk (Just (DESC c)) "DESC ", lnk Nothing (columnName c)]
Just (DESC d) | c == d -> [lnk (Just (ASC c)) "ASC ", lnk Nothing (columnName c)]
_ -> [lnk (Just (ASC c)) (columnName c)]
where
colHeader :: (R2.Setter OrderBy) -> OrderBy -> ColumnName -> R.Element
colHeader setOrderBy orderBy c = H.th {scope: "col"} [ H.b {} cs ]
where
lnk mc = effectLink (setOrderBy (const mc))
cs :: Array R.Element
cs =
case orderBy of
Just (ASC d) | c == d -> [lnk (Just (DESC c)) "DESC ", lnk Nothing (columnName c)]
Just (DESC d) | c == d -> [lnk (Just (ASC c)) "ASC ", lnk Nothing (columnName c)]
_ -> [lnk (Just (ASC c)) (columnName c)]
defaultContainer :: {title :: String} -> Record TableContainerProps -> R.Element
defaultContainer {title} props = R.fragment
...
...
src/Gargantext/Pages/Annuaire.purs
View file @
606de8e2
...
...
@@ -5,6 +5,7 @@ import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Array (head)
import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.Table as T
import Gargantext.Ends (url)
...
...
@@ -101,13 +102,15 @@ pageCpt = R.staticComponent "LoadedAnnuairePage" cpt
where
cpt { session, annuairePath, pagePath
, table: (AnnuaireTable {annuaireTable}) } _ = do
T.table { rows,
setP
arams, container, colNames, totalRecords }
T.table { rows,
p
arams, container, colNames, totalRecords }
where
totalRecords = 4361 -- TODO
rows = (\c -> {row: contactCells session c, delete: false}) <$> annuaireTable
setParams params = snd pagePath $ const {params, nodeId: fst annuairePath}
container = T.defaultContainer { title: "Annuaire" } -- TODO
colNames = T.ColumnName <$> [ "", "Name", "Company", "Service", "Role"]
setParams f = snd pagePath $ \{nodeId, params} ->
{params: f params, nodeId: fst annuairePath}
params = T.initialParams /\ setParams
contactCells :: Session -> Maybe Contact -> Array R.Element
contactCells session = maybe [] render
...
...
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