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
133
Issues
133
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
266248f8
Verified
Commit
266248f8
authored
Apr 07, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "[refactor] one method to fetch corpus and list in CodeSection"
This reverts commit
b731bf1b
.
parent
b731bf1b
Pipeline
#7514
passed with stages
in 24 minutes and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
34 deletions
+32
-34
.gitignore
.gitignore
+0
-4
CodeSection.purs
src/Gargantext/Components/Corpus/CodeSection.purs
+32
-30
No files found.
.gitignore
View file @
266248f8
...
...
@@ -49,8 +49,4 @@ bundle.js
/dist/bundle.min.js*
# IDE specific
.idea/
.vscode
# parcel
.parcel-cache/
src/Gargantext/Components/Corpus/CodeSection.purs
View file @
266248f8
...
...
@@ -418,7 +418,21 @@ loadCorpus { nodeId, session } = do
case res of
Left err -> pure $ Left err
Right (NodePoly { parentId: corpusId } :: NodePoly {}) -> do
fetchCorpusNode session corpusId
eCorpusNode <- get session $ corpusNodeRoute (fromMaybe 0 corpusId) ""
eDefaultListIds <-
(get session $ defaultListIdsRoute (fromMaybe 0 corpusId))
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
case eCorpusNode of
Left err -> pure $ Left err
Right corpusNode -> do
case eDefaultListIds of
Left err -> pure $ Left err
Right defaultListIds -> do
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure $ Right { corpusId: (fromMaybe 0 corpusId), corpusNode, defaultListId }
Nothing ->
pure $ Left $ CustomError "Missing default list"
-- (NodePoly {parentId: corpusId} :: NodePoly {}) <- get session nodePolyRoute
-- corpusNode <- get session $ corpusNodeRoute corpusId ""
...
...
@@ -431,6 +445,8 @@ loadCorpus { nodeId, session } = do
-- throwError $ error "Missing default list"
where
nodePolyRoute = NodeAPI Corpus (Just nodeId) ""
corpusNodeRoute = NodeAPI Corpus <<< Just
defaultListIdsRoute = Children NodeList 0 1 Nothing <<< Just
loadCorpusWithChild :: Record LoadProps -> AffRESTError CorpusData
loadCorpusWithChild { nodeId: childId, session } = do
...
...
@@ -440,38 +456,24 @@ loadCorpusWithChild { nodeId: childId, session } = do
Left err -> pure $ Left err
Right listNode -> do
let (NodePoly { parentId: corpusId } :: NodePoly {}) = listNode
fetchCorpusNode session corpusId
where
listNodeRoute = NodeAPI Node <<< Just
fetchCorpusNode session corpusId = do
eCorpusNode <- get session $ corpusNodeRoute defaultCorpusId ""
case eCorpusNode of
Left err -> pure $ Left err
Right corpusNode -> do
eDefaultListId <- fetchDefaultList session defaultCorpusId
case eDefaultListId of
eCorpusNode <- get session $ corpusNodeRoute (fromMaybe 0 corpusId) ""
case eCorpusNode of
Left err -> pure $ Left err
Right defaultListId ->
pure $ Right { corpusId: defaultCorpusId, corpusNode, defaultListId }
Right corpusNode -> do
eDefaultListIds <-
(get session $ defaultListIdsRoute (fromMaybe 0 corpusId))
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
case eDefaultListIds of
Left err -> pure $ Left err
Right defaultListIds -> do
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure $ Right { corpusId: fromMaybe 0 corpusId, corpusNode, defaultListId }
Nothing ->
throwError $ error "Missing default list"
where
defaultCorpusId = fromMaybe 0 corpusId
corpusNodeRoute = NodeAPI Corpus <<< Just
fetchDefaultList :: Session -> ID -> AffRESTError ID
fetchDefaultList session corpusId = do
eDefaultListIds <-
(get session $ defaultListIdsRoute corpusId)
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
case eDefaultListIds of
Left err -> pure $ Left err
Right defaultListIds -> do
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure $ Right defaultListId
Nothing ->
pure $ Left $ CustomError "Missing default list"
where
listNodeRoute = NodeAPI Node <<< Just
defaultListIdsRoute = Children NodeList 0 1 Nothing <<< Just
type LoadWithReloadProps =
...
...
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