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
8e98fe89
Commit
8e98fe89
authored
Jul 29, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DocsTable] mQuery -> query to be a String
parent
2c7fecfd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+15
-15
Config.purs
src/Gargantext/Config.purs
+2
-2
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
8e98fe89
...
@@ -86,12 +86,12 @@ type PageLoaderProps =
...
@@ -86,12 +86,12 @@ type PageLoaderProps =
, tabType :: TabType
, tabType :: TabType
, listId :: Int
, listId :: Int
, corpusId :: Maybe Int
, corpusId :: Maybe Int
,
mQuery :: M
Query
,
query ::
Query
}
}
type DocumentIdsDeleted = Set Int
type DocumentIdsDeleted = Set Int
type LocalCategories = Map Int Category
type LocalCategories = Map Int Category
type
MQuery = Maybe
String
type
Query =
String
_documentIdsDeleted = prop (SProxy :: SProxy "documentIdsDeleted")
_documentIdsDeleted = prop (SProxy :: SProxy "documentIdsDeleted")
_localCategories = prop (SProxy :: SProxy "localCategories")
_localCategories = prop (SProxy :: SProxy "localCategories")
...
@@ -164,14 +164,14 @@ docViewSpec p = R.createElement el p []
...
@@ -164,14 +164,14 @@ docViewSpec p = R.createElement el p []
cpt p _children = do
cpt p _children = do
documentIdsDeleted <- R.useState' (mempty :: DocumentIdsDeleted)
documentIdsDeleted <- R.useState' (mempty :: DocumentIdsDeleted)
localCategories <- R.useState' (mempty :: LocalCategories)
localCategories <- R.useState' (mempty :: LocalCategories)
mQuery <- R.useState' (Nothing :: M
Query)
query <- R.useState' ("" ::
Query)
tableParams <- R.useState' T.initialParams
tableParams <- R.useState' T.initialParams
pure $ layoutDocview documentIdsDeleted localCategories
mQ
uery tableParams p
pure $ layoutDocview documentIdsDeleted localCategories
q
uery tableParams p
-- | Main layout of the Documents Tab of a Corpus
-- | Main layout of the Documents Tab of a Corpus
layoutDocview :: R.State DocumentIdsDeleted -> R.State LocalCategories -> R.State
M
Query -> R.State T.Params -> Props -> R.Element
layoutDocview :: R.State DocumentIdsDeleted -> R.State LocalCategories -> R.State Query -> R.State T.Params -> Props -> R.Element
layoutDocview documentIdsDeleted@(_ /\ setDocumentIdsDeleted) localCategories (
mQuery /\ setM
Query) tableParams@(params /\ _) p = R.createElement el p []
layoutDocview documentIdsDeleted@(_ /\ setDocumentIdsDeleted) localCategories (
query /\ set
Query) tableParams@(params /\ _) p = R.createElement el p []
where
where
el = R.hooksComponent "LayoutDocView" cpt
el = R.hooksComponent "LayoutDocView" cpt
cpt {nodeId, tabType, listId, corpusId, totalRecords, chart} _children = do
cpt {nodeId, tabType, listId, corpusId, totalRecords, chart} _children = do
...
@@ -181,10 +181,10 @@ layoutDocview documentIdsDeleted@(_ /\ setDocumentIdsDeleted) localCategories (m
...
@@ -181,10 +181,10 @@ layoutDocview documentIdsDeleted@(_ /\ setDocumentIdsDeleted) localCategories (m
, H.div {}
, H.div {}
[ H.input { type: "text"
[ H.input { type: "text"
, onChange: onChangeQuery
, onChange: onChangeQuery
, placeholder:
maybe "" identity mQ
uery}
, placeholder:
q
uery}
]
]
, H.div {className: "col-md-12"}
, H.div {className: "col-md-12"}
[ pageLoader localCategories tableParams {nodeId, totalRecords, tabType, listId, corpusId,
mQ
uery}
[ pageLoader localCategories tableParams {nodeId, totalRecords, tabType, listId, corpusId,
q
uery}
]
]
, H.div {className: "col-md-1 col-md-offset-11"}
, H.div {className: "col-md-1 col-md-offset-11"}
[ H.button { className: "btn"
[ H.button { className: "btn"
...
@@ -198,7 +198,7 @@ layoutDocview documentIdsDeleted@(_ /\ setDocumentIdsDeleted) localCategories (m
...
@@ -198,7 +198,7 @@ layoutDocview documentIdsDeleted@(_ /\ setDocumentIdsDeleted) localCategories (m
]
]
]
]
onChangeQuery = mkEffectFn1 $ \e -> do
onChangeQuery = mkEffectFn1 $ \e -> do
set
MQuery $ const $ if (unsafeEventValue e) == "" then Nothing else Ju
st $ unsafeEventValue e
set
Query $ con
st $ unsafeEventValue e
onClickTrashAll nodeId = mkEffectFn1 $ \_ -> do
onClickTrashAll nodeId = mkEffectFn1 $ \_ -> do
launchAff $ deleteAllDocuments nodeId
launchAff $ deleteAllDocuments nodeId
-- TODO
-- TODO
...
@@ -211,11 +211,11 @@ type PageParams = { nodeId :: Int
...
@@ -211,11 +211,11 @@ type PageParams = { nodeId :: Int
, listId :: Int
, listId :: Int
, corpusId :: Maybe Int
, corpusId :: Maybe Int
, tabType :: TabType
, tabType :: TabType
,
mQuery :: Maybe String
,
query :: Query
, params :: T.Params}
, params :: T.Params}
loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, tabType,
mQ
uery, listId, corpusId, params: {limit, offset, orderBy}} = do
loadPage {nodeId, tabType,
q
uery, listId, corpusId, params: {limit, offset, orderBy}} = do
logs "loading documents page: loadPage with Offset and limit"
logs "loading documents page: loadPage with Offset and limit"
-- res <- get $ toUrl Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
-- res <- get $ toUrl Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let url = (toUrl Back Node (Just nodeId)) <> "/search"
let url = (toUrl Back Node (Just nodeId)) <> "/search"
...
@@ -224,7 +224,7 @@ loadPage {nodeId, tabType, mQuery, listId, corpusId, params: {limit, offset, ord
...
@@ -224,7 +224,7 @@ loadPage {nodeId, tabType, mQuery, listId, corpusId, params: {limit, offset, ord
, limit
, limit
, orderBy: convOrderBy <$> orderBy
, orderBy: convOrderBy <$> orderBy
, tabType
, tabType
,
mQ
uery
,
q
uery
}
}
let docs = res2corpus <$> res
let docs = res2corpus <$> res
pure $
pure $
...
@@ -266,7 +266,7 @@ renderPage (localCategories /\ setLocalCategories) (_ /\ setTableParams) p res =
...
@@ -266,7 +266,7 @@ renderPage (localCategories /\ setLocalCategories) (_ /\ setTableParams) p res =
cpt {nodeId, corpusId, listId} _children = do
cpt {nodeId, corpusId, listId} _children = do
pure $ R2.buff $ T.tableElt
pure $ R2.buff $ T.tableElt
{ rows
{ rows
-- , setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType, listId, corpusId, params,
mQ
uery})
-- , setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType, listId, corpusId, params,
q
uery})
, setParams: \params -> setTableParams $ const params
, setParams: \params -> setTableParams $ const params
, container: T.defaultContainer { title: "Documents" }
, container: T.defaultContainer { title: "Documents" }
, colNames:
, colNames:
...
@@ -314,8 +314,8 @@ pageLoader :: R.State LocalCategories -> R.State T.Params -> PageLoaderProps ->
...
@@ -314,8 +314,8 @@ pageLoader :: R.State LocalCategories -> R.State T.Params -> PageLoaderProps ->
pageLoader localCategories tableParams@(pageParams /\ _) p = R.createElement el p []
pageLoader localCategories tableParams@(pageParams /\ _) p = R.createElement el p []
where
where
el = R.hooksComponent "PageLoader" cpt
el = R.hooksComponent "PageLoader" cpt
cpt p@{nodeId, listId, corpusId, tabType,
mQ
uery} _children = do
cpt p@{nodeId, listId, corpusId, tabType,
q
uery} _children = do
useLoader {nodeId, listId, corpusId, tabType,
mQ
uery, params: pageParams} loadPage $ \{loaded} ->
useLoader {nodeId, listId, corpusId, tabType,
q
uery, params: pageParams} loadPage $ \{loaded} ->
renderPage localCategories tableParams p loaded
renderPage localCategories tableParams p loaded
---------------------------------------------------------
---------------------------------------------------------
...
...
src/Gargantext/Config.purs
View file @
8e98fe89
...
@@ -144,7 +144,7 @@ data TabPostQuery = TabPostQuery {
...
@@ -144,7 +144,7 @@ data TabPostQuery = TabPostQuery {
, limit :: Int
, limit :: Int
, orderBy :: Maybe OrderBy
, orderBy :: Maybe OrderBy
, tabType :: TabType
, tabType :: TabType
,
mQuery :: Maybe
String
,
query ::
String
}
}
instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where
instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where
...
@@ -153,7 +153,7 @@ instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where
...
@@ -153,7 +153,7 @@ instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where
~> "offset" := post.offset
~> "offset" := post.offset
~> "limit" := post.limit
~> "limit" := post.limit
~> "orderBy" := show post.orderBy
~> "orderBy" := show post.orderBy
~> "query" := post.
mQ
uery
~> "query" := post.
q
uery
~> jsonEmptyObject
~> jsonEmptyObject
pathUrl :: Config -> Path -> Maybe Id -> UrlPath
pathUrl :: Config -> Path -> Maybe Id -> UrlPath
...
...
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