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
91bfb1fc
Commit
91bfb1fc
authored
May 11, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] CreateNode Async (not connected in Tree yet).
parent
1ee7d341
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
16 deletions
+31
-16
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+5
-2
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+12
-1
Routes.purs
src/Gargantext/Routes.purs
+12
-12
Types.purs
src/Gargantext/Types.purs
+2
-1
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
91bfb1fc
...
...
@@ -189,10 +189,13 @@ performAction p@{ reload: (_ /\ setReload)
performAction p RefreshTree
performAction p@{ openNodes: (_ /\ setOpenNodes)
, reload: (_ /\ setReload)
, reload: (_ /\ setReload)
, tasks: (_ /\ setAsyncTasks)
, session
, tree: (NTree (LNode {id}) _) } (CreateSubmit name nodeType) = do
void $ createNode session id $ CreateValue {name, nodeType}
-- task <- createNodeAsync session id $ CreateValue {name, nodeType}
task <- createNode session id $ CreateValue {name, nodeType}
-- liftEffect $ setAsyncTasks $ A.cons task
liftEffect do
setOpenNodes (Set.insert (mkNodeId session id))
performAction p RefreshTree
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
91bfb1fc
...
...
@@ -12,7 +12,8 @@ import Prelude hiding (div)
import Gargantext.Components.Lang (Lang)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, put, post, delete)
import Gargantext.Types as GT
import Gargantext.Routes as GR
import Gargantext.Types as GT
data Action = CreateSubmit String GT.NodeType
| DeleteNode
...
...
@@ -61,6 +62,16 @@ type UploadFile = {
createNode :: Session -> ID -> CreateValue -> Aff (Array ID)
createNode session parentId = post session $ NodeAPI GT.Node (Just parentId) ""
createNodeAsync :: Session
-> ID
-> CreateValue
-> Aff GT.AsyncTaskWithType
createNodeAsync session parentId q = do
task <- post session p q
pure $ GT.AsyncTaskWithType {task, typ: GT.CreateNode}
where
p = GR.NodeAPI GT.Node (Just parentId) (GT.asyncTaskTypePath GT.CreateNode)
renameNode :: Session -> ID -> RenameValue -> Aff (Array ID)
renameNode session renameNodeId = put session $ NodeAPI GT.Node (Just renameNodeId) "rename"
...
...
src/Gargantext/Routes.purs
View file @
91bfb1fc
...
...
@@ -47,21 +47,21 @@ data SessionRoute
instance showAppRoute :: Show AppRoute where
show Home = "Home"
show Login = "Login"
show (Folder
s i) = "Folder"
<> show i <> " (" <> show s <> ")"
show (FolderPrivate s i) = "FolderPrivate"
<> show i <> " (" <> show s <> ")"
show (FolderPublic
s i)
= "FolderPublic" <> show i <> " (" <> show s <> ")"
show (FolderShared
s i)
= "FolderShared" <> show i <> " (" <> show s <> ")"
show (Team
s i) = "Team"
<> show i <> " (" <> show s <> ")"
show (Corpus
s i) = "Corpus"
<> show i <> " (" <> show s <> ")"
show (Document
_ s i) = "Document"
<> show i <> " (" <> show s <> ")"
show (Folder
s i) = "Folder"
<> show i <> " (" <> show s <> ")"
show (FolderPrivate s i) = "FolderPrivate" <> show i <> " (" <> show s <> ")"
show (FolderPublic
s i)
= "FolderPublic" <> show i <> " (" <> show s <> ")"
show (FolderShared
s i)
= "FolderShared" <> show i <> " (" <> show s <> ")"
show (Team
s i) = "Team"
<> show i <> " (" <> show s <> ")"
show (Corpus
s i) = "Corpus"
<> show i <> " (" <> show s <> ")"
show (Document
_ s i) = "Document"
<> show i <> " (" <> show s <> ")"
show (CorpusDocument s _ _ i) = "CorpusDocument" <> show i <> " (" <> show s <> ")"
show (PGraphExplorer s i) = "graphExplorer" <> show i <> " (" <> show s <> ")"
show (Dashboard s i) = "Dashboard" <> show i <> " (" <> show s <> ")"
show (Texts
s i) = "texts"
<> show i <> " (" <> show s <> ")"
show (Lists
s i) = "lists"
<> show i <> " (" <> show s <> ")"
show (Annuaire
s i) = "Annuaire"
<> show i <> " (" <> show s <> ")"
show (UserPage
s i) = "User"
<> show i <> " (" <> show s <> ")"
show (ContactPage
s a i) = "Contact"
<> show a <> "::" <> show i <> " (" <> show s <> ")"
show (Texts
s i) = "texts"
<> show i <> " (" <> show s <> ")"
show (Lists
s i) = "lists"
<> show i <> " (" <> show s <> ")"
show (Annuaire
s i) = "Annuaire"
<> show i <> " (" <> show s <> ")"
show (UserPage
s i) = "User"
<> show i <> " (" <> show s <> ")"
show (ContactPage
s a i) = "Contact"
<> show a <> "::" <> show i <> " (" <> show s <> ")"
appPath :: AppRoute -> String
appPath Home = ""
...
...
src/Gargantext/Types.purs
View file @
91bfb1fc
...
...
@@ -464,13 +464,14 @@ modeFromString _ = Nothing
-- Async tasks
-- corresponds to /add/form/async or /add/query/async
data AsyncTaskType = Form | GraphT | Query
data AsyncTaskType = Form | GraphT | Query
| CreateNode
derive instance genericAsyncTaskType :: Generic AsyncTaskType _
asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath Form = "add/form/async/"
asyncTaskTypePath Query = "query/"
asyncTaskTypePath GraphT = "async/"
asyncTaskTypePath CreateNode = "async/nobody/"
type AsyncTaskID = String
...
...
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