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
...@@ -55,22 +56,23 @@ setTreeOut a _ = a ...@@ -55,22 +56,23 @@ setTreeOut a _ = a
instance showShow :: Show Action where instance showShow :: Show Action where
show (AddNode _ _ ) = "AddNode" show (AddNode _ _ ) = "AddNode"
show (DeleteNode _ ) = "DeleteNode" show (DeleteNode _ ) = "DeleteNode"
show (RenameNode _ ) = "RenameNode" show (RenameNode _ ) = "RenameNode"
show (UpdateNode _ ) = "UpdateNode" show (UpdateNode _ ) = "UpdateNode"
show (ShareTeam _ ) = "ShareTeam" show (ShareTeam _ ) = "ShareTeam"
show (AddContact _ ) = "AddContact" show (AddContact _ ) = "AddContact"
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 ClosePopover = "ClosePopover"
show (MoveNode _ ) = "MoveNode" show DownloadNode = "Download"
show (MergeNode _ ) = "MergeNode" show (MoveNode _ ) = "MoveNode"
show (LinkNode _ ) = "LinkNode" show (MergeNode _ ) = "MergeNode"
show NoAction = "NoAction" show (LinkNode _ ) = "LinkNode"
show NoAction = "NoAction"
----------------------------------------------------------------------- -----------------------------------------------------------------------
icon :: Action -> String icon :: Action -> String
...@@ -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:[] }})
...@@ -95,20 +98,21 @@ icon NoAction = "hand-o-right" ...@@ -95,20 +98,21 @@ icon NoAction = "hand-o-right"
-- icon _ = "hand-o-right" -- icon _ = "hand-o-right"
text :: Action -> String text :: Action -> String
text (AddNode _ _ ) = "Add !" text (AddNode _ _ ) = "Add !"
text (DeleteNode _ ) = "Delete !" text (DeleteNode _ ) = "Delete !"
text (RenameNode _ ) = "Rename !" text (RenameNode _ ) = "Rename !"
text (UpdateNode _ ) = "Update !" text (UpdateNode _ ) = "Update !"
text (ShareTeam _ ) = "Share with team !" text (ShareTeam _ ) = "Share with team !"
text (AddContact _ ) = "Add contact !" 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 ClosePopover = "Close Popover !"
text (MoveNode _ ) = "Move !" text DownloadNode = "Download !"
text (MergeNode _ ) = "Merge !" text (MoveNode _ ) = "Move !"
text (LinkNode _ ) = "Link !" text (MergeNode _ ) = "Merge !"
text NoAction = "No Action" text (LinkNode _ ) = "Link !"
text NoAction = "No Action"
----------------------------------------------------------------------- -----------------------------------------------------------------------
...@@ -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,25 +27,27 @@ data NodeAction = Documentation NodeType ...@@ -27,25 +27,27 @@ 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
eq (Documentation x) (Documentation y) = true && (x == y) eq (Documentation x) (Documentation y) = true && (x == y)
eq SearchBox SearchBox = true eq SearchBox SearchBox = true
eq Download Download = true eq Download Download = true
eq Upload Upload = true eq Upload Upload = true
eq Refresh Refresh = true eq Refresh Refresh = true
eq (Move x) (Move y) = x == y eq (Move x) (Move y) = x == y
eq Clone Clone = true eq Clone Clone = true
eq Delete Delete = true eq Delete Delete = true
eq Share Share = true eq Share Share = true
eq (Link x) (Link y) = x == y eq (Link x) (Link y) = x == y
eq (Add x) (Add y) = x == y eq (Add x) (Add y) = x == y
eq (Merge x) (Merge y) = x == y eq (Merge x) (Merge y) = x == y
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 _ _ = false eq CloseNodePopover CloseNodePopover = true
eq _ _ = false
instance showNodeAction :: Show NodeAction where instance showNodeAction :: Show NodeAction where
show (Documentation x) = "Documentation of " <> show x show (Documentation x) = "Documentation of " <> show x
...@@ -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