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
8ba2cb0e
Commit
8ba2cb0e
authored
Aug 27, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graph] screenshot and file endpoint fixes
parent
2f539182
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
24 deletions
+16
-24
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+5
-5
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+4
-4
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+5
-12
Button.purs
src/Gargantext/Components/GraphExplorer/Button.purs
+1
-2
Types.purs
src/Gargantext/Types.purs
+1
-1
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
8ba2cb0e
...
@@ -350,12 +350,12 @@ performAction (UploadFile nodeType fileType mName blob) { session
...
@@ -350,12 +350,12 @@ performAction (UploadFile nodeType fileType mName blob) { session
liftEffect $ onTaskAdd task
liftEffect $ onTaskAdd task
liftEffect $ log2 "Uploaded, task:" task
liftEffect $ log2 "Uploaded, task:" task
performAction (UploadArbitraryFile
nodeType
mName blob) { session
performAction (UploadArbitraryFile mName blob) { session
, tasks: { onTaskAdd }
, tasks: { onTaskAdd }
, tree: (NTree (LNode {id}) _)
, tree: (NTree (LNode {id}) _)
} =
} =
do
do
task <- uploadArbitraryFile session
nodeType
id { blob, mName }
task <- uploadArbitraryFile session id { blob, mName }
liftEffect $ onTaskAdd task
liftEffect $ onTaskAdd task
liftEffect $ log2 "Uploaded, task:" task
liftEffect $ log2 "Uploaded, task:" task
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
8ba2cb0e
...
@@ -25,7 +25,7 @@ data Action = AddNode String GT.NodeType
...
@@ -25,7 +25,7 @@ data Action = AddNode String GT.NodeType
| UpdateNode UpdateNodeParams
| UpdateNode UpdateNodeParams
| DoSearch GT.AsyncTaskWithType
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String) UploadFileBlob
| UploadFile GT.NodeType FileType (Maybe String) UploadFileBlob
| UploadArbitraryFile
GT.NodeType
(Maybe String) UploadFileBlob
| UploadArbitraryFile (Maybe String) UploadFileBlob
| DownloadNode
| DownloadNode
| RefreshTree
| RefreshTree
...
@@ -64,7 +64,7 @@ instance showShow :: Show Action where
...
@@ -64,7 +64,7 @@ instance showShow :: Show Action where
show (SharePublic _ ) = "SharePublic"
show (SharePublic _ ) = "SharePublic"
show (DoSearch _ ) = "SearchQuery"
show (DoSearch _ ) = "SearchQuery"
show (UploadFile _ _ _ _) = "UploadFile"
show (UploadFile _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _
_
) = "UploadArbitraryFile"
show (UploadArbitraryFile _ _) = "UploadArbitraryFile"
show RefreshTree = "RefreshTree"
show RefreshTree = "RefreshTree"
show DownloadNode = "Download"
show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode"
show (MoveNode _ ) = "MoveNode"
...
@@ -83,7 +83,7 @@ icon (AddContact _) = glyphiconNodeAction Share
...
@@ -83,7 +83,7 @@ icon (AddContact _) = glyphiconNodeAction Share
icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _
_
) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ ) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon RefreshTree = glyphiconNodeAction Refresh
icon DownloadNode = glyphiconNodeAction Download
icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
...
@@ -104,7 +104,7 @@ text (AddContact _ ) = "Add contact !"
...
@@ -104,7 +104,7 @@ text (AddContact _ ) = "Add contact !"
text (SharePublic _ ) = "Publish !"
text (SharePublic _ ) = "Publish !"
text (DoSearch _ ) = "Launch search !"
text (DoSearch _ ) = "Launch search !"
text (UploadFile _ _ _ _) = "Upload File !"
text (UploadFile _ _ _ _) = "Upload File !"
text (UploadArbitraryFile _ _
_
) = "Upload arbitrary file !"
text (UploadArbitraryFile _ _) = "Upload arbitrary file !"
text RefreshTree = "Refresh Tree !"
text RefreshTree = "Refresh Tree !"
text DownloadNode = "Download !"
text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MoveNode _ ) = "Move !"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
8ba2cb0e
...
@@ -166,7 +166,7 @@ uploadButtonCpt = R.hooksComponent "G.C.F.T.N.A.U.uploadButton" cpt
...
@@ -166,7 +166,7 @@ uploadButtonCpt = R.hooksComponent "G.C.F.T.N.A.U.uploadButton" cpt
void $ launchAff do
void $ launchAff do
case fileType of
case fileType of
Arbitrary ->
Arbitrary ->
dispatch $ UploadArbitraryFile
nodeType
(Just name) blob
dispatch $ UploadArbitraryFile (Just name) blob
_ ->
_ ->
dispatch $ UploadFile nodeType fileType (Just name) blob
dispatch $ UploadFile nodeType fileType (Just name) blob
liftEffect $ do
liftEffect $ do
...
@@ -296,32 +296,25 @@ uploadFile session nodeType id fileType {mName, blob: UploadFileBlob blob} = do
...
@@ -296,32 +296,25 @@ uploadFile session nodeType id fileType {mName, blob: UploadFileBlob blob} = do
uploadArbitraryFile :: Session
uploadArbitraryFile :: Session
-> GT.NodeType
-> ID
-> ID
-> {blob :: UploadFileBlob, mName :: Maybe String}
-> {blob :: UploadFileBlob, mName :: Maybe String}
-> Aff GT.AsyncTaskWithType
-> Aff GT.AsyncTaskWithType
uploadArbitraryFile session nodeType id {mName, blob: UploadFileBlob blob} = do
uploadArbitraryFile session id {mName, blob: UploadFileBlob blob} = do
if nodeType == Corpus then
pure unit
else
throwError $ error $ "[uploadArbitraryFile] NodeType " <> (show nodeType) <> " not supported"
contents <- readAsDataURL blob
contents <- readAsDataURL blob
uploadArbitraryDataURL session
nodeType
id mName contents
uploadArbitraryDataURL session id mName contents
uploadArbitraryDataURL :: Session
uploadArbitraryDataURL :: Session
-> GT.NodeType
-> ID
-> ID
-> Maybe String
-> Maybe String
-> String
-> String
-> Aff GT.AsyncTaskWithType
-> Aff GT.AsyncTaskWithType
uploadArbitraryDataURL session
nodeType
id mName contents' = do
uploadArbitraryDataURL session id mName contents' = do
let re = unsafePartial $ fromRight $ DSR.regex "data:.*;base64," DSRF.noFlags
let re = unsafePartial $ fromRight $ DSR.regex "data:.*;base64," DSRF.noFlags
contents = DSR.replace re "" contents'
contents = DSR.replace re "" contents'
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 }
where
where
p = GR.NodeAPI
nodeTyp
e (Just id) $ GT.asyncTaskTypePath GT.UploadFile
p = GR.NodeAPI
GT.Nod
e (Just id) $ GT.asyncTaskTypePath GT.UploadFile
bodyParams c = [ Tuple "_wfi_b64_data" (Just c)
bodyParams c = [ Tuple "_wfi_b64_data" (Just c)
, Tuple "_wfi_name" mName
, Tuple "_wfi_name" mName
...
...
src/Gargantext/Components/GraphExplorer/Button.purs
View file @
8ba2cb0e
...
@@ -18,7 +18,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData
...
@@ -18,7 +18,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types as GT
type Props = (
type Props = (
onClick :: forall e. e -> Effect Unit
onClick :: forall e. e -> Effect Unit
...
@@ -58,6 +57,6 @@ cameraButton session id sigmaRef = simpleButton {
...
@@ -58,6 +57,6 @@ cameraButton session id sigmaRef = simpleButton {
screen <- Sigma.takeScreenshot s
screen <- Sigma.takeScreenshot s
log2 "[cameraButton] screenshot" screen
log2 "[cameraButton] screenshot" screen
launchAff_ $ do
launchAff_ $ do
uploadArbitraryDataURL session
GT.Graph
id (Just "screenshot.png") screen
uploadArbitraryDataURL session id (Just "screenshot.png") screen
, text: "Screenshot"
, text: "Screenshot"
}
}
src/Gargantext/Types.purs
View file @
8ba2cb0e
...
@@ -608,7 +608,7 @@ instance decodeJsonAsyncTaskType :: DecodeJson AsyncTaskType where
...
@@ -608,7 +608,7 @@ instance decodeJsonAsyncTaskType :: DecodeJson AsyncTaskType where
asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath Form = "add/form/async/"
asyncTaskTypePath Form = "add/form/async/"
asyncTaskTypePath UploadFile = "a
dd/file/async
/"
asyncTaskTypePath UploadFile = "a
sync/file/add
/"
asyncTaskTypePath Query = "query/"
asyncTaskTypePath Query = "query/"
asyncTaskTypePath GraphT = "async/"
asyncTaskTypePath GraphT = "async/"
asyncTaskTypePath AddNode = "async/nobody/"
asyncTaskTypePath AddNode = "async/nobody/"
...
...
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