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
b96ba4b5
Commit
b96ba4b5
authored
Nov 23, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graphql] node csv upload with graphql
parent
01136431
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+17
-11
No files found.
src/Gargantext/Components/Nodes/Frame.purs
View file @
b96ba4b5
...
...
@@ -11,9 +11,11 @@ import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Nullable (Nullable, null, toMaybe)
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..))
import Gargantext.Components.GraphQL.Endpoints (getNodeParent)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (RESTError, logRESTError)
...
...
@@ -146,18 +148,22 @@ importIntoListButtonCpt = here.component "importIntoListButton" cpt where
--task = GT.AsyncTaskWithType { task, typ: GT.ListCSVUpload }
launchAff_ $ do
-- Get corpus_id
eCorpusNodes <- getNodeParent session nodeId Corpus
case eCorpusNodes of
Left err -> liftEffect $ here.log2 "[importIntoListButton] error parsing corpus" err
Right corpusNodes -> do
case A.uncons corpusNodes of
Nothing -> liftEffect $ here.log2 "[importIntoListButton] corpusNodes empty" corpusNodes
Just { head: corpusNode } -> do
-- Use that corpus id
csv <- EC.downloadCSV base frame_id
liftEffect $ here.log2 "[importIntoListButton] CSV: " csv
corpusNodes <- getNodeParent session nodeId Corpus
case A.uncons corpusNodes of
Nothing -> liftEffect $ here.log2 "[importIntoListButton] corpusNodes empty" corpusNodes
Just { head: corpusNode } -> do
-- Use that corpus id
eCsv <- EC.downloadCSV base frame_id
case eCsv of
Left err -> liftEffect $ here.log2 "[importIntoListButton] error with csv" err
Right csv -> do
let uploadPath = GR.NodeAPI NodeList (Just corpusNode.id) $ GT.asyncTaskTypePath GT.ListCSVUpload
eTask <- postWwwUrlencoded session uploadPath csv
eTask :: Either RESTError GT.AsyncTaskWithType <- postWwwUrlencoded
session
uploadPath
[ Tuple "_wf_data" (Just csv.body)
, Tuple "_wf_filetype" (Just $ show CSV)
, Tuple "_wf_name" (Just frame_id) ]
pure unit
type NodeFrameVisioProps =
...
...
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