Commit d06028b8 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[tree] fix tree reload after file upload

parent 95d4771f
......@@ -583,8 +583,9 @@ performAction (UploadFile nodeType fileType mName blob) { asyncTasks: (_ /\ disp
} =
do
task <- uploadFile session nodeType id fileType {mName, blob}
liftEffect $ dispatch $ GAT.Insert id task
liftEffect $ log2 "Uploaded, task:" task
liftEffect $ do
dispatch $ GAT.Insert id task
log2 "[performAction] UploadFile, uploaded, task:" task
performAction (UploadArbitraryFile mName blob) { asyncTasks: (_ /\ dispatch)
, session
......@@ -592,8 +593,9 @@ performAction (UploadArbitraryFile mName blob) { asyncTasks: (_ /\ dispatch)
} =
do
task <- uploadArbitraryFile session id { blob, mName }
liftEffect $ dispatch $ GAT.Insert id task
liftEffect $ log2 "Uploaded, task:" task
liftEffect $ do
dispatch $ GAT.Insert id task
log2 "[performAction] UploadArbitraryFile, uploaded, task:" task
-------
performAction DownloadNode _ = do
......@@ -621,14 +623,17 @@ performAction (LinkNode {nodeType, params}) p@{session} = do
performAction RefreshTree p
-------
performAction RefreshTree { reloadTree: (_ /\ setReload)
performAction RefreshTree p@{ reloadTree: (_ /\ setReload)
, setPopoverRef } = do
liftEffect $ do
setReload (_ + 1)
case R.readRef setPopoverRef of
Nothing -> pure unit
Just setPopover -> setPopover false
performAction ClosePopover p
-------
performAction NoAction _ = do
liftEffect $ log "[performAction] NoAction"
performAction ClosePopover { setPopoverRef } = do
liftEffect $ do
case R.readRef setPopoverRef of
Nothing -> pure unit
Just setPopover -> setPopover false
......@@ -28,6 +28,7 @@ data Action = AddNode String GT.NodeType
| UploadArbitraryFile (Maybe String) UploadFileBlob
| DownloadNode
| RefreshTree
| ClosePopover
| ShareTeam String
| AddContact AddContactParams
......@@ -66,6 +67,7 @@ instance showShow :: Show Action where
show (UploadFile _ _ _ _) = "UploadFile"
show (UploadArbitraryFile _ _) = "UploadArbitraryFile"
show RefreshTree = "RefreshTree"
show ClosePopover = "ClosePopover"
show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
......@@ -85,6 +87,7 @@ icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon (UploadArbitraryFile _ _ ) = 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:[] }})
......@@ -106,6 +109,7 @@ text (DoSearch _ ) = "Launch search !"
text (UploadFile _ _ _ _) = "Upload File !"
text (UploadArbitraryFile _ _) = "Upload arbitrary file !"
text RefreshTree = "Refresh Tree !"
text ClosePopover = "Close Popover !"
text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
......
......@@ -175,6 +175,7 @@ uploadButtonCpt = R.hooksComponentWithModule thisModule "uploadButton" cpt
setMFile $ const $ Nothing
setFileType $ const $ CSV
setLang $ const $ EN
dispatch ClosePopover
-- START File Type View
type FileTypeProps =
......
......@@ -65,9 +65,6 @@ nodePopupCpt = R.hooksComponentWithModule thisModule "nodePopupView" cpt
search <- R.useState'
$ defaultSearch { node_id = Just p.id }
R.useEffect' $ do
log2 "[nodePopup] nodePopupState" $ fst nodePopupState
pure $ H.div tooltipProps $
[ H.div { className: "popup-container" }
[ H.div { className: "panel panel-default" }
......
......@@ -27,6 +27,7 @@ data NodeAction = Documentation NodeType
| Link { subTreeParams :: SubTreeParams }
| Clone
| AddingContact
| CloseNodePopover
------------------------------------------------------------------------
instance eqNodeAction :: Eq NodeAction where
......@@ -45,6 +46,7 @@ instance eqNodeAction :: Eq NodeAction where
eq Config Config = true
eq (Publish x) (Publish y) = x == y
eq AddingContact AddingContact = true
eq CloseNodePopover CloseNodePopover = true
eq _ _ = false
instance showNodeAction :: Show NodeAction where
......@@ -63,6 +65,7 @@ instance showNodeAction :: Show NodeAction where
show (Merge t) = "Merge with subtree" <> show t
show (Publish x) = "Publish" <> show x
show AddingContact = "AddingContact"
show CloseNodePopover = "CloseNodePopover"
glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction (Documentation _) = "question-circle"
......@@ -79,6 +82,7 @@ glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction AddingContact = "user-plus"
glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction (Publish _) = fldr FolderPublic true
glyphiconNodeAction CloseNodePopover = "close"
glyphiconNodeAction _ = ""
------------------------------------------------------------------------
......
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