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
6721d074
Commit
6721d074
authored
Nov 19, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[texts] mCorpusId refactoring
parent
c67e7993
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
34 deletions
+35
-34
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+28
-26
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+1
-1
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+1
-1
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+5
-6
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
6721d074
...
...
@@ -56,10 +56,10 @@ type Path a = (
type LayoutProps = (
cacheState :: R.State NT.CacheState
, corpusId :: Maybe Int
, frontends :: Frontends
, chart :: R.Element
, listId :: Int
, mCorpusId :: Maybe Int
, nodeId :: Int
-- , path :: Record (Path a)
, session :: Session
...
...
@@ -73,10 +73,10 @@ type LayoutProps = (
type PageLayoutProps = (
cacheState :: R.State NT.CacheState
, corpusId :: Maybe Int
, frontends :: Frontends
, key :: String -- NOTE Necessary to clear the component when cache state changes
, listId :: Int
, mCorpusId :: Maybe Int
, nodeId :: Int
, params :: T.Params
, query :: Query
...
...
@@ -113,9 +113,9 @@ docViewCpt :: R.Component Props
docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt where
cpt { layout: { cacheState
, chart
, corpusId
, frontends
, listId
, mCorpusId
, nodeId
, session
, showSearch
...
...
@@ -132,10 +132,10 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt where
, if showSearch then searchBar query else H.div {} []
, H.div {className: "col-md-12"}
[ pageLayout { cacheState
, corpusId
, frontends
, key: "docView-" <> (show $ fst cacheState)
, listId
, mCorpusId
, nodeId
, params
, query: fst query
...
...
@@ -190,16 +190,17 @@ searchBar (query /\ setQuery) = R.createElement el {} []
mock :: Boolean
mock = false
type PageParams =
{ corpusId :: Maybe Int
, listId :: Int
, nodeId :: Int
, tabType :: TabType
, query :: Query
, params :: T.Params}
type PageParams = {
listId :: Int
, mCorpusId :: Maybe Int
, nodeId :: Int
, tabType :: TabType
, query :: Query
, params :: T.Params
}
getPageHash :: Session -> PageParams -> Aff String
getPageHash session {
corpusId, listId, nodeId, query
, tabType } = do
getPageHash session {
nodeId
, tabType } = do
(get session $ tableHashRoute nodeId tabType) :: Aff String
convOrderBy :: Maybe (T.OrderByDirection T.ColumnName) -> Maybe OrderBy
...
...
@@ -235,16 +236,16 @@ pageLayout props = R.createElement pageLayoutCpt props []
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = R.hooksComponentWithModule thisModule "pageLayout" cpt where
cpt props@{ cacheState
, corpusId
, frontends
, listId
, mCorpusId
, nodeId
, params
, query
, session
, sidePanelTriggers
, tabType } _ = do
let path = {
corpusId, list
Id, nodeId, params, query, tabType }
let path = {
listId, mCorpus
Id, nodeId, params, query, tabType }
handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView)
handleResponse (HashedResponse { hash, value: res }) = ret
where
...
...
@@ -341,9 +342,9 @@ pagePaintRaw = R.createElement pagePaintRawCpt
pagePaintRawCpt :: R.Component PagePaintRawProps
pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt where
cpt { documents
, layout: { corpusId
, frontends
, layout: { frontends
, listId
, mCorpusId
, nodeId
, session
, sidePanelTriggers
...
...
@@ -365,7 +366,7 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
trashStyle Trash = {textDecoration: "line-through"}
trashStyle _ = {textDecoration: "none"}
corpusDocument
| Just cid <-
c
orpusId = Routes.CorpusDocument sid cid listId
| Just cid <-
mC
orpusId = Routes.CorpusDocument sid cid listId
| otherwise = Routes.Document sid listId
colNames = T.ColumnName <$> [ "Tag", "Date", "Title", "Source"]
wrapColElts = const identity
...
...
@@ -376,12 +377,13 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
{ row:
T.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } []
, docChooser { listId, mCorpusId
: corpusId
, nodeId: r._id, sidePanelTriggers } []
, docChooser { listId, mCorpusId, nodeId: r._id, sidePanelTriggers } []
--, H.input { type: "checkbox", defaultValue: checked, on: {click: click Trash} }
-- TODO show date: Year-Month-Day only
, H.div { style } [ R2.showText r.date ]
, H.div { style }
[ H.a { href: url frontends $ corpusDocument r._id, target: "_blank"} [ H.text r.title ] ]
, H.div { style } [
H.a { href: url frontends $ corpusDocument r._id, target: "_blank"} [ H.text r.title ]
]
, H.div { style } [ H.text $ if r.source == "" then "Source" else r.source ]
]
, delete: true }
...
...
@@ -423,15 +425,15 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
newtype SearchQuery = SearchQuery
{ query :: Array String
,
parent_id :: Int
newtype SearchQuery = SearchQuery
{
parent_id :: Int
,
query :: Array String
}
instance encodeJsonSQuery :: EncodeJson SearchQuery where
encodeJson (SearchQuery {query, parent_id})
= "query" := query
= "query" := query
~> "parent_id" := parent_id
~> jsonEmptyObject
...
...
@@ -439,8 +441,8 @@ instance encodeJsonSQuery :: EncodeJson SearchQuery where
documentsRoute :: Int -> SessionRoute
documentsRoute nodeId = NodeAPI Node (Just nodeId) "documents"
tableRoute :: forall row. {
nodeId :: Int, tabType :: TabType, listId :: Int
| row} -> SessionRoute
tableRoute {
nodeId, tabType, listId
} = NodeAPI Node (Just nodeId) $ "table" <> "?tabType=" <> (showTabType' tabType) <> "&list=" <> (show listId)
tableRoute :: forall row. {
listId :: Int, nodeId :: Int, tabType :: TabType
| row} -> SessionRoute
tableRoute {
listId, nodeId, tabType
} = NodeAPI Node (Just nodeId) $ "table" <> "?tabType=" <> (showTabType' tabType) <> "&list=" <> (show listId)
tableHashRoute :: Int -> TabType -> SessionRoute
tableHashRoute nodeId tabType = NodeAPI Node (Just nodeId) $ "table/hash" <> "?tabType=" <> (showTabType' tabType)
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
6721d074
...
...
@@ -116,9 +116,9 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
docs = DT.docViewLayout
{ cacheState
, chart
, corpusId: Nothing
, frontends
, listId: defaultListId
, mCorpusId: Nothing
, nodeId
, session
, showSearch: true
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
6721d074
...
...
@@ -181,7 +181,7 @@ loadDocument :: Session -> Int -> Aff NodeDocument
loadDocument session nodeId = get session $ NodeAPI Node (Just nodeId) ""
loadData :: DocPath -> Aff LoadedData
loadData {
session, nodeId, listIds, tabType
} = do
loadData {
listIds, nodeId, session, tabType
} = do
document <- loadDocument session nodeId
ngramsTable <- loadNgramsTable
{ listIds
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
6721d074
...
...
@@ -243,9 +243,9 @@ docViewLayoutRec { cacheState
, sidePanelTriggers } =
{ cacheState
, chart : H.div {} []
, corpusId: Just corpusId
, frontends
, listId
, mCorpusId: Just corpusId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
...
...
@@ -263,9 +263,9 @@ docViewLayoutRec { cacheState
, sidePanelTriggers } =
{ cacheState
, chart : H.div {} []
, corpusId: Just corpusId
, frontends
, listId
, mCorpusId: Just corpusId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
...
...
@@ -283,9 +283,9 @@ docViewLayoutRec { cacheState
, sidePanelTriggers } =
{ cacheState
, chart : H.div {} []
, corpusId: Just corpusId
, frontends
, listId
, mCorpusId: Just corpusId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
...
...
@@ -303,9 +303,9 @@ docViewLayoutRec { cacheState
, sidePanelTriggers } =
{ cacheState
, chart : H.div {} []
, corpusId: Nothing
, frontends
, listId
, mCorpusId: Just corpusId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
...
...
@@ -324,9 +324,9 @@ docViewLayoutRec { cacheState
, sidePanelTriggers } =
{ cacheState
, chart : H.div {} []
, corpusId: Nothing
, frontends
, listId
, mCorpusId: Just corpusId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
...
...
@@ -371,7 +371,6 @@ sidePanelCpt = R.hooksComponentWithModule thisModule "sidePanel" cpt
-- log2 "[sidePanel trigger] trigger corpusId change" corpusId
-- log2 "[sidePanel trigger] trigger listId change" listId
-- log2 "[sidePanel trigger] trigger nodeId change" nodeId
-- TODO work on this?
setMCorpusId $ const $ Just corpusId
setMListId $ const $ Just listId
setMNodeId $ const $ Just nodeId
...
...
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