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

Merge branch 'dev-frame-calc-corpus-csv-upload' of...

Merge branch 'dev-frame-calc-corpus-csv-upload' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents 0d593c99 e19a451d
...@@ -94,7 +94,7 @@ asyncTaskTTriggersMainPageReload :: GT.AsyncTaskWithType -> Boolean ...@@ -94,7 +94,7 @@ asyncTaskTTriggersMainPageReload :: GT.AsyncTaskWithType -> Boolean
asyncTaskTTriggersMainPageReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersMainPageReload typ asyncTaskTTriggersMainPageReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersMainPageReload typ
asyncTaskTriggersTreeReload :: GT.AsyncTaskType -> Boolean asyncTaskTriggersTreeReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersTreeReload GT.Form = true asyncTaskTriggersTreeReload GT.CorpusFormUpload = true
asyncTaskTriggersTreeReload GT.UploadFile = true asyncTaskTriggersTreeReload GT.UploadFile = true
asyncTaskTriggersTreeReload _ = false asyncTaskTriggersTreeReload _ = false
......
...@@ -8,6 +8,11 @@ import Data.Traversable (traverse_) ...@@ -8,6 +8,11 @@ import Data.Traversable (traverse_)
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode) import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode)
...@@ -35,10 +40,6 @@ import Gargantext.Types as GT ...@@ -35,10 +40,6 @@ import Gargantext.Types as GT
import Gargantext.Utils.Popover as Popover import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
foreign import back :: Effect Unit foreign import back :: Effect Unit
foreign import link :: String -> Effect Unit foreign import link :: String -> Effect Unit
......
...@@ -22,7 +22,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), re ...@@ -22,7 +22,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), re
import Gargantext.Components.Forest.Tree.Node.Action.Share as Share import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Update (updateRequest) import Gargantext.Components.Forest.Tree.Node.Action.Update (updateRequest)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile, uploadArbitraryFile) import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile, uploadArbitraryFile, uploadFrameCalc)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID) import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..)) import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError) import Gargantext.Config.REST (RESTError)
...@@ -283,6 +283,12 @@ uploadArbitraryFile' mName blob p@{ boxes: { errors, tasks }, session, tree: (NT ...@@ -283,6 +283,12 @@ uploadArbitraryFile' mName blob p@{ boxes: { errors, tasks }, session, tree: (NT
GAT.insert id task tasks GAT.insert id task tasks
here.log2 "[uploadArbitraryFile'] UploadArbitraryFile, uploaded, task:" task here.log2 "[uploadArbitraryFile'] UploadArbitraryFile, uploaded, task:" task
uploadFrameCalc' p@{ boxes: { errors, tasks }, session, tree: (NTree (LNode { id }) _) } = do
eTask <- uploadFrameCalc session id
handleRESTError errors eTask $ \task -> liftEffect $ do
GAT.insert id task tasks
here.log2 "[performAction] UploadFrameCalc, uploaded, task:" task
moveNode params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params where moveNode params p@{ boxes: { errors, forestOpen }, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do f (SubTreeOut { in: in', out }) = do
eTask <- moveNodeReq session in' out eTask <- moveNodeReq session in' out
...@@ -313,6 +319,7 @@ performAction (ShareTeam username) p = shareTeam userna ...@@ -313,6 +319,7 @@ performAction (ShareTeam username) p = shareTeam userna
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 UploadFrameCalc p = uploadFrameCalc' p
performAction (UploadFile nodeType fileType mName contents selection) p = performAction (UploadFile nodeType fileType mName contents selection) p =
uploadFile' nodeType fileType mName contents p selection uploadFile' nodeType fileType mName contents p selection
performAction (UploadArbitraryFile mName blob selection) p = performAction (UploadArbitraryFile mName blob selection) p =
......
...@@ -123,7 +123,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -123,7 +123,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, nodeType , nodeType
, session } [] , session } []
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType } , fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType } []
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t , H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie , barType: Pie
, errors , errors
......
...@@ -18,7 +18,6 @@ type Props = ...@@ -18,7 +18,6 @@ type Props =
, session :: Session , session :: Session
) )
subTreeOut :: Action -> Maybe SubTreeOut subTreeOut :: Action -> Maybe SubTreeOut
subTreeOut (MoveNode {params}) = params subTreeOut (MoveNode {params}) = params
subTreeOut (MergeNode {params}) = params subTreeOut (MergeNode {params}) = params
...@@ -45,6 +44,7 @@ icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams ...@@ -45,6 +44,7 @@ icon (SharePublic _ ) = glyphiconNodeAction (Publish { subTreeParams
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 UploadFrameCalc = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh icon RefreshTree = glyphiconNodeAction Refresh
icon ClosePopover = glyphiconNodeAction CloseNodePopover icon ClosePopover = glyphiconNodeAction CloseNodePopover
icon DownloadNode = glyphiconNodeAction Download icon DownloadNode = glyphiconNodeAction Download
...@@ -67,6 +67,7 @@ text (SharePublic _ ) = "Publish !" ...@@ -67,6 +67,7 @@ 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 UploadFrameCalc = "Upload frame calc"
text RefreshTree = "Refresh Tree !" text RefreshTree = "Refresh Tree !"
text ClosePopover = "Close Popover !" text ClosePopover = "Close Popover !"
text DownloadNode = "Download !" text DownloadNode = "Download !"
......
...@@ -18,6 +18,7 @@ data Action = AddNode String GT.NodeType ...@@ -18,6 +18,7 @@ data Action = AddNode String GT.NodeType
| DoSearch GT.AsyncTaskWithType | DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String) String Selection | UploadFile GT.NodeType FileType (Maybe String) String Selection
| UploadArbitraryFile (Maybe String) UploadFileBlob Selection | UploadArbitraryFile (Maybe String) UploadFileBlob Selection
| UploadFrameCalc
| DownloadNode | DownloadNode
| RefreshTree | RefreshTree
| ClosePopover | ClosePopover
...@@ -42,6 +43,7 @@ instance Eq Action where ...@@ -42,6 +43,7 @@ instance Eq Action where
eq (UploadFile nt1 ft1 s1 _ _) (UploadFile nt2 ft2 s2 _ _) = eq (UploadFile nt1 ft1 s1 _ _) (UploadFile nt2 ft2 s2 _ _) =
(eq nt1 nt2) && (eq ft1 ft2) && (eq s1 s2) (eq nt1 nt2) && (eq ft1 ft2) && (eq s1 s2)
eq (UploadArbitraryFile s1 _ _) (UploadArbitraryFile s2 _ _) = eq s1 s2 eq (UploadArbitraryFile s1 _ _) (UploadArbitraryFile s2 _ _) = eq s1 s2
eq UploadFrameCalc UploadFrameCalc = true
eq DownloadNode DownloadNode = true eq DownloadNode DownloadNode = true
eq RefreshTree RefreshTree = true eq RefreshTree RefreshTree = true
eq ClosePopover ClosePopover = true eq ClosePopover ClosePopover = true
...@@ -65,6 +67,7 @@ instance Show Action where ...@@ -65,6 +67,7 @@ instance Show Action where
show (DoSearch _ ) = "SearchQuery" show (DoSearch _ ) = "SearchQuery"
show (UploadFile _ _ _ _ _) = "UploadFile" show (UploadFile _ _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _ _) = "UploadArbitraryFile" show (UploadArbitraryFile _ _ _) = "UploadArbitraryFile"
show UploadFrameCalc = "UploadFrameCalc"
show RefreshTree = "RefreshTree" show RefreshTree = "RefreshTree"
show ClosePopover = "ClosePopover" show ClosePopover = "ClosePopover"
show DownloadNode = "Download" show DownloadNode = "Download"
......
...@@ -24,8 +24,8 @@ import Gargantext.Components.ListSelection.Types (Selection(..)) ...@@ -24,8 +24,8 @@ import Gargantext.Components.ListSelection.Types (Selection(..))
import Gargantext.Components.ListSelection.Types as ListSelection import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (RESTError) import Gargantext.Config.REST (RESTError)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), postWwwUrlencoded) import Gargantext.Types (ID, NodeType(..))
import Gargantext.Types (NodeType(..), ID) import Gargantext.Sessions (Session, postWwwUrlencoded, post)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial, unsafeCrashWith) import Partial.Unsafe (unsafePartial, unsafeCrashWith)
...@@ -55,7 +55,8 @@ actionUploadCpt = here.component "actionUpload" cpt where ...@@ -55,7 +55,8 @@ actionUploadCpt = here.component "actionUpload" cpt where
cpt { nodeType: Corpus, dispatch, id, session } _ = cpt { nodeType: Corpus, dispatch, id, session } _ =
pure $ uploadFileView { dispatch, id, nodeType: GT.Corpus, session } pure $ uploadFileView { dispatch, id, nodeType: GT.Corpus, session }
cpt { nodeType: NodeList, dispatch, id, session } _ = cpt { nodeType: NodeList, dispatch, id, session } _ =
pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList, session } pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList, session } []
cpt props@{ nodeType: NodeFrameCalc } _ = pure $ uploadFrameCalcView props []
cpt props@{ nodeType: _ } _ = pure $ actionUploadOther props [] cpt props@{ nodeType: _ } _ = pure $ actionUploadOther props []
{- {-
...@@ -143,7 +144,7 @@ uploadFileViewCpt = here.component "uploadFileView" cpt ...@@ -143,7 +144,7 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
, mFile , mFile
, nodeType , nodeType
, selection , selection
} } []
] ]
pure $ panel bodies footer pure $ panel bodies footer
...@@ -170,8 +171,8 @@ type UploadButtonProps = ...@@ -170,8 +171,8 @@ type UploadButtonProps =
, selection :: T.Box ListSelection.Selection , selection :: T.Box ListSelection.Selection
) )
uploadButton :: Record UploadButtonProps -> R.Element uploadButton :: R2.Component UploadButtonProps
uploadButton props = R.createElement uploadButtonCpt props [] uploadButton = R.createElement uploadButtonCpt
uploadButtonCpt :: R.Component UploadButtonProps uploadButtonCpt :: R.Component UploadButtonProps
uploadButtonCpt = here.component "uploadButton" cpt uploadButtonCpt = here.component "uploadButton" cpt
where where
...@@ -222,8 +223,8 @@ type FileTypeProps = ...@@ -222,8 +223,8 @@ type FileTypeProps =
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
) )
fileTypeView :: Record FileTypeProps -> R.Element fileTypeView :: R2.Component FileTypeProps
fileTypeView p = R.createElement fileTypeViewCpt p [] fileTypeView = R.createElement fileTypeViewCpt
fileTypeViewCpt :: R.Component FileTypeProps fileTypeViewCpt :: R.Component FileTypeProps
fileTypeViewCpt = here.component "fileTypeView" cpt fileTypeViewCpt = here.component "fileTypeView" cpt
where where
...@@ -236,7 +237,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt ...@@ -236,7 +237,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt
case droppedFile' of case droppedFile' of
Nothing -> pure $ H.div {} [] Nothing -> pure $ H.div {} []
Just df@(DroppedFile _) -> Just df ->
pure $ H.div tooltipProps [ H.div { className: "card"} pure $ H.div tooltipProps [ H.div { className: "card"}
[ panelHeading [ panelHeading
, panelBody df , panelBody df
...@@ -303,6 +304,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt ...@@ -303,6 +304,7 @@ fileTypeViewCpt = here.component "fileTypeView" cpt
] ]
newtype FileUploadQuery = FileUploadQuery { newtype FileUploadQuery = FileUploadQuery {
fileType :: FileType fileType :: FileType
} }
...@@ -338,20 +340,20 @@ uploadFile { contents, fileType: CSV, id, nodeType: NodeList, mName, session } = ...@@ -338,20 +340,20 @@ uploadFile { contents, fileType: CSV, id, nodeType: NodeList, mName, session } =
, Tuple "_wtf_filetype" (Just $ show NodeList) , Tuple "_wtf_filetype" (Just $ show NodeList)
, Tuple "_wtf_name" mName ] , Tuple "_wtf_name" mName ]
eTask <- postWwwUrlencoded session url body eTask <- postWwwUrlencoded session url body
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.Form }) <$> eTask pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.ListCSVUpload }) <$> eTask
uploadFile { contents, fileType, id, nodeType, mName, session } = do uploadFile { contents, fileType, id, nodeType, mName, session } = do
-- contents <- readAsText blob -- contents <- readAsText blob
eTask :: Either RESTError GT.AsyncTask <- postWwwUrlencoded session p bodyParams eTask :: Either RESTError GT.AsyncTask <- postWwwUrlencoded session p bodyParams
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.Form }) <$> eTask pure $ (\task -> GT.AsyncTaskWithType { task, typ }) <$> eTask
--postMultipartFormData session p fileContents --postMultipartFormData session p fileContents
where where
p = case nodeType of Tuple typ p = case nodeType of
Corpus -> GR.NodeAPI nodeType (Just id) $ GT.asyncTaskTypePath GT.Form Corpus -> Tuple GT.CorpusFormUpload (GR.NodeAPI nodeType (Just id) $ GT.asyncTaskTypePath GT.CorpusFormUpload)
Annuaire -> GR.NodeAPI nodeType (Just id) "annuaire" Annuaire -> Tuple GT.UploadFile (GR.NodeAPI nodeType (Just id) "annuaire")
NodeList -> case fileType of NodeList -> case fileType of
JSON -> GR.NodeAPI nodeType (Just id) $ GT.asyncTaskTypePath GT.ListUpload JSON -> Tuple GT.ListUpload (GR.NodeAPI nodeType (Just id) $ GT.asyncTaskTypePath GT.ListUpload)
_ -> GR.NodeAPI nodeType (Just id) "" _ -> Tuple GT.UploadFile (GR.NodeAPI nodeType (Just id) "")
_ -> GR.NodeAPI nodeType (Just id) "" _ -> Tuple GT.UploadFile (GR.NodeAPI nodeType (Just id) "")
bodyParams = [ Tuple "_wf_data" (Just contents) bodyParams = [ Tuple "_wf_data" (Just contents)
, Tuple "_wf_filetype" (Just $ show fileType) , Tuple "_wf_filetype" (Just $ show fileType)
...@@ -377,7 +379,7 @@ uploadArbitraryDataURL session id mName contents' = do ...@@ -377,7 +379,7 @@ uploadArbitraryDataURL session id mName contents' = do
let re = fromRight' (\_ -> unsafeCrashWith "Unexpected Left") $ DSR.regex "data:.*;base64," DSRF.noFlags let re = fromRight' (\_ -> unsafeCrashWith "Unexpected Left") $ DSR.regex "data:.*;base64," DSRF.noFlags
contents = DSR.replace re "" contents' contents = DSR.replace re "" contents'
eTask :: Either RESTError GT.AsyncTask <- postWwwUrlencoded session p (bodyParams contents) eTask :: Either RESTError GT.AsyncTask <- postWwwUrlencoded session p (bodyParams contents)
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.Form }) <$> eTask pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.UploadFile }) <$> eTask
where where
p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFile p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFile
...@@ -387,12 +389,12 @@ uploadArbitraryDataURL session id mName contents' = do ...@@ -387,12 +389,12 @@ uploadArbitraryDataURL session id mName contents' = do
------------------------------------------------------------------------ ------------------------------------------------------------------------
uploadTermListView :: Record Props -> R.Element uploadTermListView :: R2.Component Props
uploadTermListView props = R.createElement uploadTermListViewCpt props [] uploadTermListView = R.createElement uploadTermListViewCpt
uploadTermListViewCpt :: R.Component Props uploadTermListViewCpt :: R.Component Props
uploadTermListViewCpt = here.component "uploadTermListView" cpt uploadTermListViewCpt = here.component "uploadTermListView" cpt
where where
cpt {dispatch, id, nodeType} _ = do cpt { dispatch, nodeType } _ = do
let defaultUploadType = JSON let defaultUploadType = JSON
mFile <- T.useBox (Nothing :: Maybe UploadFile) mFile <- T.useBox (Nothing :: Maybe UploadFile)
uploadType <- T.useBox defaultUploadType uploadType <- T.useBox defaultUploadType
...@@ -410,7 +412,6 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt ...@@ -410,7 +412,6 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt
, on: { change: onUploadTypeChange uploadType } } (opt <$> [ CSV, JSON ]) , on: { change: onUploadTypeChange uploadType } } (opt <$> [ CSV, JSON ])
let footer = H.div {} [ uploadTermButton { dispatch let footer = H.div {} [ uploadTermButton { dispatch
, id
, mFile , mFile
, nodeType , nodeType
, uploadType , uploadType
...@@ -447,7 +448,6 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt ...@@ -447,7 +448,6 @@ uploadTermListViewCpt = here.component "uploadTermListView" cpt
type UploadTermButtonProps = type UploadTermButtonProps =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, id :: Int
, mFile :: T.Box (Maybe UploadFile) , mFile :: T.Box (Maybe UploadFile)
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, uploadType :: T.Box FileType , uploadType :: T.Box FileType
...@@ -484,3 +484,40 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt ...@@ -484,3 +484,40 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
_ <- dispatch $ UploadFile nodeType uploadType' (Just name) contents (SelectedLists []) _ <- dispatch $ UploadFile nodeType uploadType' (Just name) contents (SelectedLists [])
liftEffect $ do liftEffect $ do
T.write_ Nothing mFile T.write_ Nothing mFile
------------------------------------------------------------------------
uploadFrameCalcView :: R2.Component Props
uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt
uploadFrameCalcViewCpt :: R.Component Props
uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
where
cpt { dispatch } _ = do
let bodies =
[ R2.row
[ H.div { className: "col-12 flex-space-around" }
[ H.h4 {}
[ H.text "This will upload current calc as Corpus CSV" ]
]
]
]
let footer = H.div {}
[ H.button { className: "btn btn-primary"
, on: { click: onClick } }
[ H.text "Upload!" ]
]
pure $ panel bodies footer
where
onClick _ = do
void $ launchAff do
dispatch UploadFrameCalc
uploadFrameCalc :: Session
-> ID
-> Aff (Either RESTError GT.AsyncTaskWithType)
uploadFrameCalc session id = do
let p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFrameCalc
eTask <- post session p ([] :: Array String)
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.UploadFrameCalc }) <$> eTask
...@@ -5,6 +5,10 @@ import Gargantext.Prelude ...@@ -5,6 +5,10 @@ import Gargantext.Prelude
import Data.Array as A import Data.Array as A
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.App.Data (Boxes) import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView) import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Contact as Contact import Gargantext.Components.Forest.Tree.Node.Action.Contact as Contact
...@@ -23,15 +27,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload) ...@@ -23,15 +27,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS) import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox) import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus) import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT) import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, textInputBox)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (ID, Name, prettyNodeType) import Gargantext.Types (ID, Name, prettyNodeType)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Glyphicon (glyphicon, glyphiconActive) import Gargantext.Utils.Glyphicon (glyphicon, glyphiconActive)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Box" here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
...@@ -203,6 +204,6 @@ panelActionCpt = here.component "panelAction" cpt ...@@ -203,6 +204,6 @@ panelActionCpt = here.component "panelAction" cpt
cpt { action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } [] cpt { action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType, session } _ = cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } [] pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action: SearchBox, boxes, id, session, dispatch } _ = cpt { action: SearchBox, boxes, dispatch, id, session } _ =
pure $ actionSearch { boxes, dispatch, id: (Just id), session } [] pure $ actionSearch { boxes, dispatch, id: Just id, session } []
cpt _ _ = pure $ H.div {} [] cpt _ _ = pure $ H.div {} []
...@@ -323,7 +323,8 @@ settingsBox NodeFrameCalc = ...@@ -323,7 +323,8 @@ settingsBox NodeFrameCalc =
SettingsBox { show : true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation NodeFrameCalc , doc : Documentation NodeFrameCalc
, buttons : [ Add [ NodeFrameCalc , buttons : [ Upload
, Add [ NodeFrameCalc
, NodeFrameWrite , NodeFrameWrite
] ]
, Move moveFrameParameters , Move moveFrameParameters
......
module Gargantext.Components.Forest.Tree.Node.Tools.Sync where module Gargantext.Components.Forest.Tree.Node.Tools.Sync where
import Gargantext.Prelude import Gargantext.Prelude (Unit, bind, discard, pure, unit, ($), (<>), (==))
( Unit, bind, discard, pure, unit, ($), (<>), (==) )
import Effect.Aff (Aff, launchAff_) import Effect.Aff (Aff, launchAff_)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
......
...@@ -79,8 +79,6 @@ module Gargantext.Components.NgramsTable.Core ...@@ -79,8 +79,6 @@ module Gargantext.Components.NgramsTable.Core
) )
where where
import Gargantext.Prelude
import Control.Monad.State (class MonadState, execState) import Control.Monad.State (class MonadState, execState)
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Data.Array (head) import Data.Array (head)
...@@ -127,21 +125,23 @@ import Effect.Exception.Unsafe (unsafeThrow) ...@@ -127,21 +125,23 @@ import Effect.Exception.Unsafe (unsafeThrow)
import FFI.Simple.Functions (delay) import FFI.Simple.Functions (delay)
import Foreign as F import Foreign as F
import Foreign.Object as FO import Foreign.Object as FO
import Reactix (Component, Element, createElement) as R
import Reactix.DOM.HTML as H
import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Table as T import Gargantext.Components.Table as T
import Gargantext.Components.Table.Types as T import Gargantext.Components.Table.Types as T
import Gargantext.Config.REST (RESTError) import Gargantext.Config.REST (RESTError)
import Gargantext.Config.Utils (handleRESTError) import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..)) import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, post, put) import Gargantext.Sessions (Session, get, post, put)
import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CTabNgramType(..), FrontendError, ListId, OrderBy(..), ScoreType(..), TabSubType(..), TabType(..), TermList(..), TermSize(..)) import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CTabNgramType(..), FrontendError, ListId, OrderBy(..), ScoreType(..), TabSubType(..), TabType(..), TermList(..), TermSize(..))
import Gargantext.Utils.Either (eitherMap) import Gargantext.Utils.Either (eitherMap)
import Gargantext.Utils.KarpRabin (indicesOfAny) import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON import Simple.JSON as JSON
import Toestand as T import Toestand as T
......
...@@ -3,8 +3,6 @@ module Gargantext.Components.Nodes.Annuaire.User.Contact ...@@ -3,8 +3,6 @@ module Gargantext.Components.Nodes.Annuaire.User.Contact
, contactLayout , contactLayout
) where ) where
import Gargantext.Prelude
import Data.Either (Either) import Data.Either (Either)
import Data.Lens as L import Data.Lens as L
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
...@@ -19,6 +17,7 @@ import Gargantext.Components.Nodes.Lists.Types as LT ...@@ -19,6 +17,7 @@ import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Config.REST (RESTError) import Gargantext.Config.REST (RESTError)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put, sessionId) import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..)) import Gargantext.Types (NodeType(..))
......
module Gargantext.Config.REST where module Gargantext.Config.REST where
import Gargantext.Prelude
import Affjax (Error(..), defaultRequest, request) import Affjax (Error(..), defaultRequest, request)
import Affjax as Affjax import Affjax as Affjax
import Affjax.RequestBody (formData, formURLEncoded, string) import Affjax.RequestBody (formData, formURLEncoded, string)
...@@ -19,6 +17,7 @@ import Data.Tuple (Tuple) ...@@ -19,6 +17,7 @@ import Data.Tuple (Tuple)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Foreign as Foreign import Foreign as Foreign
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Simple.JSON as JSON import Simple.JSON as JSON
import Web.XHR.FormData as XHRFormData import Web.XHR.FormData as XHRFormData
......
...@@ -655,7 +655,7 @@ modeFromString _ = Nothing ...@@ -655,7 +655,7 @@ modeFromString _ = Nothing
-- corresponds to /add/form/async or /add/query/async -- corresponds to /add/form/async or /add/query/async
data AsyncTaskType = AddNode data AsyncTaskType = AddNode
| Form -- this is file upload too | CorpusFormUpload -- this is file upload too
| GraphRecompute | GraphRecompute
| ListUpload | ListUpload
| ListCSVUpload -- legacy v3 CSV upload for lists | ListCSVUpload -- legacy v3 CSV upload for lists
...@@ -663,6 +663,7 @@ data AsyncTaskType = AddNode ...@@ -663,6 +663,7 @@ data AsyncTaskType = AddNode
| UpdateNgramsCharts | UpdateNgramsCharts
| UpdateNode | UpdateNode
| UploadFile | UploadFile
| UploadFrameCalc
derive instance Generic AsyncTaskType _ derive instance Generic AsyncTaskType _
instance JSON.ReadForeign AsyncTaskType where instance JSON.ReadForeign AsyncTaskType where
...@@ -674,7 +675,7 @@ instance Show AsyncTaskType where ...@@ -674,7 +675,7 @@ instance Show AsyncTaskType where
asyncTaskTypePath :: AsyncTaskType -> String asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath AddNode = "async/nobody/" asyncTaskTypePath AddNode = "async/nobody/"
asyncTaskTypePath Form = "add/form/async/" asyncTaskTypePath CorpusFormUpload = "add/form/async/"
asyncTaskTypePath GraphRecompute = "async/recompute/" asyncTaskTypePath GraphRecompute = "async/recompute/"
asyncTaskTypePath ListUpload = "add/form/async/" asyncTaskTypePath ListUpload = "add/form/async/"
asyncTaskTypePath ListCSVUpload = "csv/add/form/async/" asyncTaskTypePath ListCSVUpload = "csv/add/form/async/"
...@@ -682,6 +683,7 @@ asyncTaskTypePath Query = "query/" ...@@ -682,6 +683,7 @@ asyncTaskTypePath Query = "query/"
asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/" asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/"
asyncTaskTypePath UpdateNode = "update/" asyncTaskTypePath UpdateNode = "update/"
asyncTaskTypePath UploadFile = "async/file/add/" asyncTaskTypePath UploadFile = "async/file/add/"
asyncTaskTypePath UploadFrameCalc = "add/framecalc/async/"
type AsyncTaskID = String type AsyncTaskID = String
......
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