Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
d06028b8
Commit
d06028b8
authored
Dec 15, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tree] fix tree reload after file upload
parent
95d4771f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
57 deletions
+68
-57
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+14
-9
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+34
-30
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+1
-0
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+0
-3
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+19
-15
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
d06028b8
...
...
@@ -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)
, setPopoverRef } = do
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
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
d06028b8
...
...
@@ -28,6 +28,7 @@ data Action = AddNode String GT.NodeType
| UploadArbitraryFile (Maybe String) UploadFileBlob
| DownloadNode
| RefreshTree
| ClosePopover
| ShareTeam String
| AddContact AddContactParams
...
...
@@ -55,22 +56,23 @@ setTreeOut a _ = a
instance showShow :: 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 (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 RefreshTree = "RefreshTree"
show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
show (LinkNode _ ) = "LinkNode"
show NoAction = "NoAction"
show RefreshTree = "RefreshTree"
show ClosePopover = "ClosePopover"
show DownloadNode = "Download"
show (MoveNode _ ) = "MoveNode"
show (MergeNode _ ) = "MergeNode"
show (LinkNode _ ) = "LinkNode"
show NoAction = "NoAction"
-----------------------------------------------------------------------
icon :: Action -> String
...
...
@@ -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:[] }})
...
...
@@ -95,20 +98,21 @@ 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 (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 RefreshTree = "Refresh Tree !"
text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !"
text NoAction = "No Action"
text RefreshTree = "Refresh Tree !"
text ClosePopover = "Close Popover !"
text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !"
text NoAction = "No Action"
-----------------------------------------------------------------------
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
d06028b8
...
...
@@ -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 =
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
d06028b8
...
...
@@ -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" }
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
d06028b8
...
...
@@ -27,25 +27,27 @@ data NodeAction = Documentation NodeType
| Link { subTreeParams :: SubTreeParams }
| Clone
| AddingContact
| CloseNodePopover
------------------------------------------------------------------------
instance eqNodeAction :: Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y)
eq SearchBox SearchBox = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq (Move x) (Move y) = x == y
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Link x) (Link y) = x == y
eq (Add x) (Add y) = x == y
eq (Merge x) (Merge y) = x == y
eq Config Config = true
eq (Publish x) (Publish y) = x == y
eq AddingContact AddingContact = true
eq _ _ = false
eq SearchBox SearchBox = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq (Move x) (Move y) = x == y
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Link x) (Link y) = x == y
eq (Add x) (Add y) = x == y
eq (Merge x) (Merge y) = x == y
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
show (Documentation x) = "Documentation of " <> show x
...
...
@@ -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 _ = ""
------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment