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
5f98197e
Commit
5f98197e
authored
Jul 21, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[upload] more upload work
parent
6fc84226
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
FolderView.purs
src/Gargantext/Components/FolderView.purs
+3
-3
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+1
-1
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+1
-1
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+8
-6
No files found.
src/Gargantext/Components/FolderView.purs
View file @
5f98197e
...
@@ -270,7 +270,7 @@ performAction = performAction' where
...
@@ -270,7 +270,7 @@ performAction = performAction' where
performAction' (SharePublic { params }) p = sharePublic params p
performAction' (SharePublic { params }) p = sharePublic params p
performAction' (AddContact params) p = addContact params p
performAction' (AddContact params) p = addContact params p
performAction' (AddNode name nodeType) p = addNode' name nodeType p
performAction' (AddNode name nodeType) p = addNode' name nodeType p
performAction' (UploadFile nodeType fileType mName
blob) p = uploadFile' nodeType fileType mName blob
p
performAction' (UploadFile nodeType fileType mName
contents) p = uploadFile' nodeType fileType mName contents
p
performAction' (UploadArbitraryFile mName blob) p = uploadArbitraryFile' mName blob p
performAction' (UploadArbitraryFile mName blob) p = uploadArbitraryFile' mName blob p
performAction' DownloadNode _ = liftEffect $ log "[performAction] DownloadNode"
performAction' DownloadNode _ = liftEffect $ log "[performAction] DownloadNode"
performAction' (MoveNode {params}) p = moveNode params p
performAction' (MoveNode {params}) p = moveNode params p
...
@@ -316,8 +316,8 @@ performAction = performAction' where
...
@@ -316,8 +316,8 @@ performAction = performAction' where
addContact params p@{ nodeId: id } =
addContact params p@{ nodeId: id } =
void $ Contact.contactReq p.session id params
void $ Contact.contactReq p.session id params
uploadFile' nodeType fileType mName
blob
p@{ tasks, nodeId: id } = do
uploadFile' nodeType fileType mName
contents
p@{ tasks, nodeId: id } = do
task <- uploadFile p.session nodeType id fileType {mName,
blob
}
task <- uploadFile p.session nodeType id fileType {mName,
contents
}
liftEffect $ do
liftEffect $ do
GAT.insert id task tasks
GAT.insert id task tasks
log2 "[performAction] UploadFile, uploaded, task:" task
log2 "[performAction] UploadFile, uploaded, task:" task
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
5f98197e
...
@@ -276,7 +276,7 @@ performAction (ShareTeam username) p = shareTeam username p
...
@@ -276,7 +276,7 @@ performAction (ShareTeam username) p = shareTeam username p
performAction (SharePublic { params }) p = sharePublic params p
performAction (SharePublic { params }) p = sharePublic params p
performAction (AddContact params) p = addContact params p
performAction (AddContact params) p = addContact params p
performAction (AddNode name nodeType) p = addNode' name nodeType p
performAction (AddNode name nodeType) p = addNode' name nodeType p
performAction (UploadFile nodeType fileType mName
blob) p = uploadFile' nodeType fileType mName blob
p
performAction (UploadFile nodeType fileType mName
contents) p = uploadFile' nodeType fileType mName contents
p
performAction (UploadArbitraryFile mName blob) p = uploadArbitraryFile' mName blob p
performAction (UploadArbitraryFile mName blob) p = uploadArbitraryFile' mName blob p
performAction DownloadNode _ = liftEffect $ log "[performAction] DownloadNode"
performAction DownloadNode _ = liftEffect $ log "[performAction] DownloadNode"
performAction (MoveNode {params}) p = moveNode params p
performAction (MoveNode {params}) p = moveNode params p
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
5f98197e
...
@@ -28,7 +28,7 @@ data Action = AddNode String GT.NodeType
...
@@ -28,7 +28,7 @@ data Action = AddNode String GT.NodeType
| RenameNode String
| RenameNode String
| UpdateNode UpdateNodeParams
| UpdateNode UpdateNodeParams
| DoSearch GT.AsyncTaskWithType
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String)
UploadFileBlob
| UploadFile GT.NodeType FileType (Maybe String)
String
| UploadArbitraryFile (Maybe String) UploadFileBlob
| UploadArbitraryFile (Maybe String) UploadFileBlob
| DownloadNode
| DownloadNode
| RefreshTree
| RefreshTree
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
5f98197e
...
@@ -202,8 +202,9 @@ uploadButtonCpt = here.component "uploadButton" cpt
...
@@ -202,8 +202,9 @@ uploadButtonCpt = here.component "uploadButton" cpt
case fileType' of
case fileType' of
Arbitrary ->
Arbitrary ->
dispatch $ UploadArbitraryFile (Just name) blob
dispatch $ UploadArbitraryFile (Just name) blob
_ ->
_ -> do
dispatch $ UploadFile nodeType fileType' (Just name) blob
contents <- readAsText blob
dispatch $ UploadFile nodeType fileType' (Just name) contents
liftEffect $ do
liftEffect $ do
T.write_ Nothing mFile
T.write_ Nothing mFile
T.write_ CSV fileType
T.write_ CSV fileType
...
@@ -313,10 +314,10 @@ uploadFile :: Session
...
@@ -313,10 +314,10 @@ uploadFile :: Session
-> GT.NodeType
-> GT.NodeType
-> ID
-> ID
-> FileType
-> FileType
-> {
blob :: UploadFileBlob
, mName :: Maybe String}
-> {
contents :: String
, mName :: Maybe String}
-> Aff GT.AsyncTaskWithType
-> Aff GT.AsyncTaskWithType
uploadFile session nodeType id fileType {
mName, blob: UploadFileBlob blob
} = do
uploadFile session nodeType id fileType {
mName, contents
} = do
contents <- readAsText blob
--
contents <- readAsText blob
task <- postWwwUrlencoded session p (bodyParams contents)
task <- postWwwUrlencoded session p (bodyParams contents)
pure $ GT.AsyncTaskWithType {task, typ: GT.Form}
pure $ GT.AsyncTaskWithType {task, typ: GT.Form}
--postMultipartFormData session p fileContents
--postMultipartFormData session p fileContents
...
@@ -453,6 +454,7 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
...
@@ -453,6 +454,7 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
onClick mFile' uploadType' e = do
onClick mFile' uploadType' e = do
let {name, blob} = unsafePartial $ fromJust mFile'
let {name, blob} = unsafePartial $ fromJust mFile'
void $ launchAff do
void $ launchAff do
_ <- dispatch $ UploadFile nodeType uploadType' (Just name) blob
contents <- readAsText blob
_ <- dispatch $ UploadFile nodeType uploadType' (Just name) contents
liftEffect $ do
liftEffect $ do
T.write_ Nothing mFile
T.write_ Nothing mFile
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