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
1
Merge Requests
1
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
caef0e8b
Commit
caef0e8b
authored
Jun 15, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NodePoly] Maybe ParentID in NodePoly
parent
70f28cf3
Pipeline
#2909
failed with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
Types.purs
src/Gargantext/Components/Document/Types.purs
+2
-2
Node.purs
src/Gargantext/Components/Node.purs
+6
-6
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+6
-6
No files found.
src/Gargantext/Components/Document/Types.purs
View file @
caef0e8b
...
...
@@ -86,7 +86,7 @@ defaultNodeDocumentV3 =
NodePoly { id : 0
, typename : 0
, userId : 0
, parentId : 0
, parentId :
Just
0
, name : "Default name"
, date : "Default date"
, hyperdata : defaultDocumentV3
...
...
@@ -148,7 +148,7 @@ defaultNodeDocument =
NodePoly { id : 0
, typename : 0
, userId : 0
, parentId : 0
, parentId :
Just
0
, name : "Default name"
, date : "Default date"
, hyperdata : defaultDocument
...
...
src/Gargantext/Components/Node.purs
View file @
caef0e8b
module Gargantext.Components.Node
where
import Data.Generic.Rep (class Generic)
import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Simple.JSON as JSON
import Gargantext.Prelude
type NodePolyCommon a =
( id :: Int
, typename :: Int
...
...
@@ -18,7 +18,7 @@ type NodePolyCommon a =
newtype NodePoly a =
NodePoly { userId :: Int
, parentId :: Int
, parentId ::
Maybe
Int
| NodePolyCommon a
}
derive instance Generic (NodePoly a) _
...
...
@@ -26,7 +26,7 @@ derive instance Newtype (NodePoly a) _
instance Eq a => Eq (NodePoly a) where eq = genericEq
instance JSON.ReadForeign a => JSON.ReadForeign (NodePoly a) where
readImpl f = do
inst :: { user_id :: Int, parent_id :: Int | NodePolyCommon a } <- JSON.readImpl f
inst :: { user_id :: Int, parent_id ::
Maybe
Int | NodePolyCommon a } <- JSON.readImpl f
pure $ NodePoly { id: inst.id
, typename: inst.typename
, userId: inst.user_id
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
caef0e8b
...
...
@@ -387,8 +387,8 @@ loadCorpus {nodeId, session} = do
case res of
Left err -> pure $ Left err
Right (NodePoly {parentId: corpusId} :: NodePoly {}) -> do
eCorpusNode <- get session $ corpusNodeRoute
corpusId
""
eDefaultListIds <- (get session $ defaultListIdsRoute
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
...
...
@@ -398,7 +398,7 @@ loadCorpus {nodeId, session} = do
Right defaultListIds -> do
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
pure $ Right { corpusId, corpusNode, defaultListId }
pure $ Right { corpusId
: (fromMaybe 0 corpusId)
, corpusNode, defaultListId }
Nothing ->
pure $ Left $ CustomError "Missing default list"
...
...
@@ -425,18 +425,18 @@ loadCorpusWithChild { nodeId: childId, session } = do
Left err -> pure $ Left err
Right listNode -> do
let (NodePoly {parentId: corpusId} :: NodePoly {}) = listNode
eCorpusNode <- get session $ corpusNodeRoute
corpusId
""
eCorpusNode <- get session $ corpusNodeRoute
(fromMaybe 0 corpusId)
""
case eCorpusNode of
Left err -> pure $ Left err
Right corpusNode -> do
eDefaultListIds <- (get session $ defaultListIdsRoute
corpusId
)
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, corpusNode, defaultListId }
pure $ Right { corpusId
: fromMaybe 0 corpusId
, corpusNode, defaultListId }
Nothing ->
throwError $ error "Missing default list"
where
...
...
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