Commit fa6012c6 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-merge' into dev

parents b0afd439 28e0d4d7
......@@ -283,10 +283,10 @@ performAction = performAction' where
performAction' (SharePublic { params }) p = sharePublic params p
performAction' (AddContact params) p = addContact params p
performAction' (AddNode name nodeType) p = addNode' name nodeType p
performAction' (UploadFile nodeType fileType mName contents selection) p =
uploadFile' nodeType fileType mName contents p selection
performAction' (UploadArbitraryFile mName blob selection) p =
uploadArbitraryFile' mName blob p selection
performAction' (UploadFile nodeType fileType fileFormat mName contents selection) p =
uploadFile' nodeType fileType fileFormat mName contents p selection
performAction' (UploadArbitraryFile fileFormat mName blob selection) p =
uploadArbitraryFile' fileFormat mName blob p selection
performAction' DownloadNode _ = liftEffect $ here.log "[performAction] DownloadNode"
performAction' (MoveNode {params}) p = moveNode params p
performAction' (MergeNode {params}) p = mergeNode params p
......@@ -333,14 +333,14 @@ performAction = performAction' where
addContact params { nodeId: id, session } =
void $ Contact.contactReq session id params
uploadFile' nodeType fileType mName contents { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadFile { contents, fileType, id, nodeType, mName, selection, session }
uploadFile' nodeType fileType fileFormat mName contents { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadFile { contents, fileType, fileFormat, id, nodeType, mName, selection, session }
handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
here.log2 "[performAction] UploadFile, uploaded, task:" task
uploadArbitraryFile' mName blob { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadArbitraryFile session id { blob, mName } selection
uploadArbitraryFile' fileFormat mName blob { boxes: { errors, tasks }, nodeId: id, session } selection = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection
handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
here.log2 "[performAction] UploadArbitraryFile, uploaded, task:" task
......
......@@ -271,14 +271,14 @@ addNode' name nodeType p@{ boxes: { errors, forestOpen }, session, tree: (NTree
liftEffect $ T.modify_ (openNodesInsert (mkNodeId session id)) forestOpen
refreshTree p
uploadFile' nodeType fileType mName contents p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadFile { contents, fileType, id, mName, nodeType, selection, session }
uploadFile' nodeType fileType fileFormat mName contents p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadFile { contents, fileFormat, fileType, id, mName, nodeType, selection, session }
handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
here.log2 "[uploadFile'] UploadFile, uploaded, task:" task
uploadArbitraryFile' mName blob p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadArbitraryFile session id { blob, mName } selection
uploadArbitraryFile' fileFormat mName blob p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } selection = do
eTask <- uploadArbitraryFile session id { blob, fileFormat, mName } selection
handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
here.log2 "[uploadArbitraryFile'] UploadArbitraryFile, uploaded, task:" task
......@@ -325,10 +325,10 @@ performAction (SharePublic { params }) p = sharePublic para
performAction (AddContact params) p = addContact params p
performAction (AddNode name nodeType) p = addNode' name nodeType p
performAction UploadFrameCalc p = uploadFrameCalc' p
performAction (UploadFile nodeType fileType mName contents selection) p =
uploadFile' nodeType fileType mName contents p selection
performAction (UploadArbitraryFile mName blob selection) p =
uploadArbitraryFile' mName blob p selection
performAction (UploadFile nodeType fileType fileFormat mName contents selection) p =
uploadFile' nodeType fileType fileFormat mName contents p selection
performAction (UploadArbitraryFile fileFormat mName blob selection) p =
uploadArbitraryFile' fileFormat mName blob p selection
performAction DownloadNode _ = liftEffect $ here.log "[performAction] DownloadNode"
performAction (MoveNode {params}) p = moveNode params p
performAction (MergeNode {params}) p = mergeNode params p
......
......@@ -34,48 +34,48 @@ setTreeOut a _ = a
-----------------------------------------------------------------------
icon :: Action -> String
icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon (DeleteNode _) = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (ShareTeam _) = glyphiconNodeAction Share
icon (AddContact _) = glyphiconNodeAction Share
icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ _ ) = glyphiconNodeAction Upload
icon UploadFrameCalc = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon ClosePopover = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DocumentsFromWriteNodes _) = glyphiconNodeAction (WriteNodesDocuments)
icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon (DeleteNode _) = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (ShareTeam _) = glyphiconNodeAction Share
icon (AddContact _) = glyphiconNodeAction Share
icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ _ _ ) = glyphiconNodeAction Upload
icon UploadFrameCalc = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh
icon ClosePopover = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download
icon (MoveNode _ ) = glyphiconNodeAction (Move { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (MergeNode _ ) = glyphiconNodeAction (Merge { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (LinkNode _ ) = glyphiconNodeAction (Link { subTreeParams : SubTreeParams {showtypes:[], valitypes:[] }})
icon (DocumentsFromWriteNodes _) = glyphiconNodeAction (WriteNodesDocuments)
icon NoAction = "hand-o-right"
icon NoAction = "hand-o-right"
-- icon _ = "hand-o-right"
text :: Action -> String
text (AddNode _ _ ) = "Add !"
text (DeleteNode _ ) = "Delete !"
text (RenameNode _ ) = "Rename !"
text (UpdateNode _ ) = "Update !"
text (ShareTeam _ ) = "Share with team !"
text (AddContact _ ) = "Add contact !"
text (SharePublic _ ) = "Publish !"
text (DoSearch _ ) = "Launch search !"
text (UploadFile _ _ _ _ _) = "Upload File !"
text (UploadArbitraryFile _ _ _) = "Upload arbitrary file !"
text UploadFrameCalc = "Upload frame calc"
text RefreshTree = "Refresh Tree !"
text ClosePopover = "Close Popover !"
text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes !"
text NoAction = "No Action"
text (AddNode _ _ ) = "Add !"
text (DeleteNode _ ) = "Delete !"
text (RenameNode _ ) = "Rename !"
text (UpdateNode _ ) = "Update !"
text (ShareTeam _ ) = "Share with team !"
text (AddContact _ ) = "Add contact !"
text (SharePublic _ ) = "Publish !"
text (DoSearch _ ) = "Launch search !"
text (UploadFile _ _ _ _ _ _) = "Upload File !"
text (UploadArbitraryFile _ _ _ _) = "Upload arbitrary file !"
text UploadFrameCalc = "Upload frame calc"
text RefreshTree = "Refresh Tree !"
text ClosePopover = "Close Popover !"
text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !"
text (DocumentsFromWriteNodes _ ) = "Documents from Write Nodes !"
text NoAction = "No Action"
-----------------------------------------------------------------------
......@@ -6,7 +6,7 @@ import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe)
import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactParams)
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types (UpdateNodeParams)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType, UploadFileBlob)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat, FileType, UploadFileBlob)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut)
import Gargantext.Components.ListSelection.Types (Selection)
import Gargantext.Types as GT
......@@ -16,8 +16,8 @@ data Action = AddNode String GT.NodeType
| RenameNode String
| UpdateNode UpdateNodeParams
| DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String) String Selection
| UploadArbitraryFile (Maybe String) UploadFileBlob Selection
| UploadFile GT.NodeType FileType FileFormat (Maybe String) String Selection
| UploadArbitraryFile FileFormat (Maybe String) UploadFileBlob Selection
| UploadFrameCalc
| DownloadNode
| RefreshTree
......@@ -42,9 +42,9 @@ instance Eq Action where
eq (RenameNode s1) (RenameNode s2) = eq s1 s2
eq (UpdateNode un1) (UpdateNode un2) = eq un1 un2
eq (DoSearch at1) (DoSearch at2) = eq at1 at2
eq (UploadFile nt1 ft1 s1 _ _) (UploadFile nt2 ft2 s2 _ _) =
(eq nt1 nt2) && (eq ft1 ft2) && (eq s1 s2)
eq (UploadArbitraryFile s1 _ _) (UploadArbitraryFile s2 _ _) = eq s1 s2
eq (UploadFile nt1 ft1 ff1 s1 _ _) (UploadFile nt2 ft2 ff2 s2 _ _) =
(eq nt1 nt2) && (eq ft1 ft2) && (eq ff1 ff2) && (eq s1 s2)
eq (UploadArbitraryFile ff1 s1 _ _) (UploadArbitraryFile ff2 s2 _ _) = (eq ff1 ff2) && (eq s1 s2)
eq UploadFrameCalc UploadFrameCalc = true
eq DownloadNode DownloadNode = true
eq RefreshTree RefreshTree = true
......@@ -60,22 +60,22 @@ instance Eq Action where
eq _ _ = false
instance Show Action where
show (AddNode _ _ ) = "AddNode"
show (DeleteNode _ ) = "DeleteNode"
show (RenameNode _ ) = "RenameNode"
show (UpdateNode _ ) = "UpdateNode"
show (ShareTeam _ ) = "ShareTeam"
show (AddContact _ ) = "AddContact"
show (SharePublic _ ) = "SharePublic"
show (DoSearch _ ) = "SearchQuery"
show (UploadFile _ _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _ _) = "UploadArbitraryFile"
show UploadFrameCalc = "UploadFrameCalc"
show RefreshTree = "RefreshTree"
show ClosePopover = "ClosePopover"
show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
show (LinkNode _ ) = "LinkNode"
show (DocumentsFromWriteNodes _ ) = "DocumentsFromWriteNodes"
show NoAction = "NoAction"
show (AddNode _ _ ) = "AddNode"
show (DeleteNode _ ) = "DeleteNode"
show (RenameNode _ ) = "RenameNode"
show (UpdateNode _ ) = "UpdateNode"
show (ShareTeam _ ) = "ShareTeam"
show (AddContact _ ) = "AddContact"
show (SharePublic _ ) = "SharePublic"
show (DoSearch _ ) = "SearchQuery"
show (UploadFile _ _ _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _ _ _) = "UploadArbitraryFile"
show UploadFrameCalc = "UploadFrameCalc"
show RefreshTree = "RefreshTree"
show ClosePopover = "ClosePopover"
show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
show (LinkNode _ ) = "LinkNode"
show (DocumentsFromWriteNodes _ ) = "DocumentsFromWriteNodes"
show NoAction = "NoAction"
......@@ -2,6 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Upload where
import Gargantext.Prelude
import Affjax.RequestBody (blob)
import Data.Either (Either, fromRight')
import Data.Eq.Generic (genericEq)
import Data.Foldable (intercalate)
......@@ -17,7 +18,7 @@ import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Gargantext.Components.Forest.Tree.Node.Action (Props)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileBlob(..), readUFBAsBase64, readUFBAsText)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(..), FileType(..), UploadFileBlob(..), readUFBAsBase64, readUFBAsText)
import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, formChoiceSafe, panel)
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.ListSelection as ListSelection
......@@ -99,10 +100,12 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
-- mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing
mFile <- T.useBox (Nothing :: Maybe UploadFile)
fileType <- T.useBox CSV
fileFormat <- T.useBox Plain
lang <- T.useBox EN
selection <- T.useBox ListSelection.MyListsFirst
let setFileType' val = T.write_ val fileType
let setFileFormat' val = T.write_ val fileFormat
let setLang' val = T.write_ val lang
let bodies =
......@@ -124,11 +127,15 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
, WOS
, PresseRIS
, Arbitrary
, ZIP
]
, default: CSV
, callback: setFileType'
, print: show } []
, formChoiceSafe { items: [ Plain
, ZIP ]
, default: Plain
, callback: setFileFormat'
, print: show } []
]
]
, R2.row
......@@ -146,6 +153,7 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
]
let footer = H.div {} [ uploadButton { dispatch
, fileFormat
, fileType
, lang
, mFile
......@@ -170,12 +178,13 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
type UploadButtonProps =
( dispatch :: Action -> Aff Unit
, fileType :: T.Box FileType
, lang :: T.Box Lang
, mFile :: T.Box (Maybe UploadFile)
, nodeType :: GT.NodeType
, selection :: T.Box ListSelection.Selection
( dispatch :: Action -> Aff Unit
, fileFormat :: T.Box FileFormat
, fileType :: T.Box FileType
, lang :: T.Box Lang
, mFile :: T.Box (Maybe UploadFile)
, nodeType :: GT.NodeType
, selection :: T.Box ListSelection.Selection
)
uploadButton :: R2.Component UploadButtonProps
......@@ -184,6 +193,7 @@ uploadButtonCpt :: R.Component UploadButtonProps
uploadButtonCpt = here.component "uploadButton" cpt
where
cpt { dispatch
, fileFormat
, fileType
, lang
, mFile
......@@ -191,6 +201,7 @@ uploadButtonCpt = here.component "uploadButton" cpt
, selection
} _ = do
fileType' <- T.useLive T.unequal fileType
fileFormat' <- T.useLive T.unequal fileFormat
mFile' <- T.useLive T.unequal mFile
selection' <- T.useLive T.unequal selection
onPending /\ onPendingBox <- R2.useBox' false
......@@ -217,6 +228,7 @@ uploadButtonCpt = here.component "uploadButton" cpt
, disabled
, style : { width: "100%" }
, on: { click: onClick
fileFormat'
fileType'
mFile'
selection'
......@@ -228,25 +240,23 @@ uploadButtonCpt = here.component "uploadButton" cpt
where
onClick fileType' mFile' selection' onPendingBox e = do
onClick fileFormat' fileType' mFile' selection' onPendingBox e = do
let { blob, name } = unsafePartial $ fromJust mFile'
T.write_ true onPendingBox
here.log2 "[uploadButton] fileType" fileType'
void $ launchAff do
case fileType' of
Arbitrary ->
dispatch $ UploadArbitraryFile (Just name) blob selection'
ZIP -> do
liftEffect $ here.log "[uploadButton] reading base64"
contents <- readUFBAsBase64 blob
liftEffect $ here.log "[uploadButton] base64 read"
dispatch $ UploadFile nodeType fileType' (Just name) contents selection'
dispatch $ UploadArbitraryFile fileFormat' (Just name) blob selection'
_ -> do
contents <- readUFBAsText blob
dispatch $ UploadFile nodeType fileType' (Just name) contents selection'
contents <- case fileFormat' of
Plain -> readUFBAsText blob
ZIP -> readUFBAsBase64 blob
dispatch $ UploadFile nodeType fileType' fileFormat' (Just name) contents selection'
liftEffect $ do
T.write_ Nothing mFile
T.write_ CSV fileType
T.write_ Plain fileFormat
T.write_ EN lang
T.write_ false onPendingBox
dispatch ClosePopover
......@@ -331,7 +341,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt
T.write_ Nothing droppedFile
launchAff $ do
contents <- readUFBAsText blob
dispatch $ UploadFile nodeType ft Nothing contents (SelectedLists [])
dispatch $ UploadFile nodeType ft Plain Nothing contents (SelectedLists [])
}
} [H.text "Upload"]
Nothing ->
......@@ -354,6 +364,7 @@ instance GT.ToQuery FileUploadQuery where
pair k v = [ QP.keyFromString k /\ (Just $ QP.valueFromString $ show v) ]
uploadFile :: { contents :: String
, fileFormat :: FileFormat
, fileType :: FileType
, id :: ID
, nodeType :: GT.NodeType
......@@ -371,7 +382,7 @@ uploadFile session NodeList id JSON { mName, contents } = do
task <- post session url body
pure $ GT.AsyncTaskWithType { task, typ: GT.Form }
-}
uploadFile { contents, fileType, id, nodeType, mName, session } = do
uploadFile { contents, fileFormat, fileType, id, nodeType, mName, session } = do
-- contents <- readAsText blob
eTask :: Either RESTError GT.AsyncTask <- postWwwUrlencoded session p body
pure $ (\task -> GT.AsyncTaskWithType { task, typ }) <$> eTask
......@@ -379,10 +390,12 @@ uploadFile { contents, fileType, id, nodeType, mName, session } = do
where
bodyParams = [ Tuple "_wf_data" (Just contents)
, Tuple "_wf_filetype" (Just $ show fileType)
, Tuple "_wf_fileformat" (Just $ show fileFormat)
, Tuple "_wf_name" mName
]
csvBodyParams = [ Tuple "_wtf_data" (Just contents)
, Tuple "_wtf_filetype" (Just $ show NodeList)
, Tuple "_wtf_fileformat" (Just $ show fileFormat)
, Tuple "_wtf_name" mName ]
(typ /\ p /\ body) = case nodeType of
......@@ -397,19 +410,20 @@ uploadFile { contents, fileType, id, nodeType, mName, session } = do
uploadArbitraryFile :: Session
-> ID
-> {blob :: UploadFileBlob, mName :: Maybe String}
-> {blob :: UploadFileBlob, fileFormat :: FileFormat, mName :: Maybe String}
-> ListSelection.Selection
-> AffRESTError GT.AsyncTaskWithType
uploadArbitraryFile session id {mName, blob: UploadFileBlob blob} selection = do
uploadArbitraryFile session id { fileFormat, mName, blob: UploadFileBlob blob } selection = do
contents <- readAsDataURL blob
uploadArbitraryData session id mName contents
uploadArbitraryData session id fileFormat mName contents
uploadArbitraryData :: Session
-> ID
-> FileFormat
-> Maybe String
-> String
-> AffRESTError GT.AsyncTaskWithType
uploadArbitraryData session id mName contents' = do
uploadArbitraryData session id fileFormat mName contents' = do
let re = fromRight' (\_ -> unsafeCrashWith "Unexpected Left") $ DSR.regex "data:.*;base64," DSRF.noFlags
contents = DSR.replace re "" contents'
eTask :: Either RESTError GT.AsyncTask <- postWwwUrlencoded session p (bodyParams contents)
......@@ -418,6 +432,7 @@ uploadArbitraryData session id mName contents' = do
p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFile
bodyParams c = [ Tuple "_wfi_b64_data" (Just c)
, Tuple "_wfi_fileformat" (Just $ show fileFormat)
, Tuple "_wfi_name" mName
]
......@@ -515,7 +530,7 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
let {name, blob} = unsafePartial $ fromJust mFile'
void $ launchAff do
contents <- readUFBAsText blob
_ <- dispatch $ UploadFile nodeType uploadType' (Just name) contents (SelectedLists [])
_ <- dispatch $ UploadFile nodeType uploadType' Plain (Just name) contents (SelectedLists [])
liftEffect $ do
T.write_ Nothing mFile
------------------------------------------------------------------------
......
......@@ -13,7 +13,7 @@ import Web.File.Blob (Blob, size)
import Web.File.FileReader.Aff (readAsArrayBuffer, readAsText)
data FileType = CSV | CSV_HAL | WOS | PresseRIS | Arbitrary | JSON | ZIP
data FileType = CSV | CSV_HAL | WOS | PresseRIS | Arbitrary | JSON
derive instance Generic FileType _
instance Eq FileType where eq = genericEq
......@@ -26,9 +26,18 @@ instance Read FileType where
read "PresseRIS" = Just PresseRIS
read "WOS" = Just WOS
read "JSON" = Just JSON
read "ZIP" = Just ZIP
read _ = Nothing
data FileFormat = Plain | ZIP
derive instance Generic FileFormat _
instance Eq FileFormat where eq = genericEq
instance Show FileFormat where show = genericShow
instance Read FileFormat where
read :: String -> Maybe FileFormat
read "Plain" = Just Plain
read "ZIP" = Just ZIP
read _ = Nothing
newtype UploadFileBlob = UploadFileBlob Blob
derive instance Generic UploadFileBlob _
......
......@@ -18,6 +18,7 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryData)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(..))
import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU
......@@ -99,7 +100,7 @@ cameraButton { id
case eClonedGraphId of
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Right clonedGraphId -> do
eRet <- uploadArbitraryData session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
eRet <- uploadArbitraryData session clonedGraphId Plain (Just $ nowStr <> "-" <> "screenshot.png") screen
case eRet of
Left err -> liftEffect $ log2 "[cameraButton] RESTError" err
Right _ret -> do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment