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