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
a949177d
Commit
a949177d
authored
Jul 02, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[forest] fix mPanelAction
parent
fbeac876
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
79 deletions
+88
-79
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+21
-16
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+32
-27
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+20
-16
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+15
-20
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
a949177d
...
@@ -18,23 +18,28 @@ linkNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
...
@@ -18,23 +18,28 @@ linkNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
linkNodeReq session fromId toId =
linkNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("link/" <> show toId)
put_ session $ NodeAPI GT.Node (Just fromId) ("link/" <> show toId)
linkNode :: Record SubTreeParamsIn -> R.
Hooks R.
Element
linkNode :: Record SubTreeParamsIn -> R.Element
linkNode p
@{dispatch, subTreeParams, id, nodeType, session} = do
linkNode p
= R.createElement linkNodeCpt p []
action@(valAction /\ setAction) :: R.State Action <- R.useState' (LinkNode {params:Nothing})
linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt = R.hooksComponent "G.C.F.T.N.A.L.linkNode" cpt
where
cpt p@{dispatch, subTreeParams, id, nodeType, session} _ = do
let button = case valAction of
action@(valAction /\ setAction) :: R.State Action <- R.useState' (LinkNode {params:Nothing})
LinkNode {params} -> case params of
Just val -> submitButton (LinkNode {params: Just val}) dispatch
Nothing -> H.div {} []
_ -> H.div {} []
pure $ panel [ subTreeView { action
let button = case valAction of
, dispatch
LinkNode {params} -> case params of
, id
Just val -> submitButton (LinkNode {params: Just val}) dispatch
, nodeType
Nothing -> H.div {} []
, session
_ -> H.div {} []
, subTreeParams
}
] button
pure $ panel [
subTreeView { action
, dispatch
, id
, nodeType
, session
, subTreeParams
}
] button
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
a949177d
...
@@ -19,34 +19,39 @@ mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
...
@@ -19,34 +19,39 @@ mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
mergeNodeReq session fromId toId =
mergeNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("merge/" <> show toId)
put_ session $ NodeAPI GT.Node (Just fromId) ("merge/" <> show toId)
mergeNode :: Record SubTreeParamsIn -> R.Hooks R.Element
mergeNode :: Record SubTreeParamsIn -> R.Element
mergeNode p@{dispatch, subTreeParams, id, nodeType, session} = do
mergeNode p = R.createElement mergeNodeCpt p []
action@(valAction /\ setAction) :: R.State Action <- R.useState' (MergeNode {params:Nothing})
merge <- R.useState' false
mergeNodeCpt :: R.Component SubTreeParamsIn
options <- R.useState' (Set.singleton GT.MapTerm)
mergeNodeCpt = R.hooksComponent "G.C.F.T.N.A.M.mergeNode" cpt
where
cpt p@{dispatch, subTreeParams, id, nodeType, session} _ = do
action@(valAction /\ setAction) :: R.State Action <- R.useState' (MergeNode {params:Nothing})
let button = case valAction of
merge <- R.useState' false
MergeNode {params} -> case params of
options <- R.useState' (Set.singleton GT.MapTerm)
Just val -> submitButton (MergeNode {params: Just val}) dispatch
Nothing -> H.div {} []
_ -> H.div {} []
pure $ panel [ subTreeView { action
let button = case valAction of
, dispatch
MergeNode {params} -> case params of
, id
Just val -> submitButton (MergeNode {params: Just val}) dispatch
, nodeType
Nothing -> H.div {} []
, session
_ -> H.div {} []
, subTreeParams
}
, H.div { className:"panel panel-primary"}
[ H.text "Merge which list?"
, checkboxes [GT.MapTerm, GT.CandidateTerm, GT.StopTerm] options
]
, H.div { className:"panel panel-primary"}
[ H.text "Title"
, H.div {className: "checkbox"}
[checkbox merge, H.text "Merge data?"]
]
] button
pure $ panel [
subTreeView { action
, dispatch
, id
, nodeType
, session
, subTreeParams
}
, H.div { className:"panel panel-primary"}
[ H.text "Merge which list?"
, checkboxes [GT.MapTerm, GT.CandidateTerm, GT.StopTerm] options
]
, H.div { className:"panel panel-primary"}
[ H.text "Title"
, H.div {className: "checkbox"}
[checkbox merge, H.text "Merge data?"]
]
] button
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
a949177d
...
@@ -18,22 +18,26 @@ moveNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
...
@@ -18,22 +18,26 @@ moveNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
moveNodeReq session fromId toId =
moveNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
moveNode :: Record SubTreeParamsIn -> R.Hooks R.Element
moveNode :: Record SubTreeParamsIn -> R.Element
moveNode p@{dispatch, subTreeParams, id, nodeType, session} = do
moveNode p = R.createElement moveNodeCpt p []
action@(valAction /\ setAction) :: R.State Action <- R.useState' (MoveNode {params: Nothing})
let button = case valAction of
moveNodeCpt :: R.Component SubTreeParamsIn
MoveNode {params} -> case params of
moveNodeCpt = R.hooksComponent "G.C.F.T.N.A.M.moveNode" cpt
Just val -> submitButton (MoveNode {params: Just val}) dispatch
where
Nothing -> H.div {} []
cpt p@{dispatch, subTreeParams, id, nodeType, session} _ = do
_ -> H.div {} []
action@(valAction /\ setAction) :: R.State Action <- R.useState' (MoveNode {params: Nothing})
pure $ panel [ subTreeView { action
let button = case valAction of
, dispatch
MoveNode {params} -> case params of
, id
Just val -> submitButton (MoveNode {params: Just val}) dispatch
, nodeType
Nothing -> H.div {} []
, session
_ -> H.div {} []
, subTreeParams
}
] button
pure $ panel [ subTreeView { action
, dispatch
, id
, nodeType
, session
, subTreeParams
}
] button
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
a949177d
...
@@ -3,9 +3,10 @@ module Gargantext.Components.Forest.Tree.Node.Box where
...
@@ -3,9 +3,10 @@ module Gargantext.Components.Forest.Tree.Node.Box where
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe(..), isJust)
import Data.Maybe (Maybe(..), isJust)
import Data.String as S
import Data.String as S
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Uncurried (mkEffectFn1)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -62,6 +63,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
...
@@ -62,6 +63,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.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" }
...
@@ -138,8 +142,8 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
...
@@ -138,8 +142,8 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
-> R.Element
-> R.Element
panelBody nodePopupState {dispatch: d, nodeType} =
panelBody nodePopupState {dispatch: d, nodeType} =
H.div {className: "panel-body flex-space-between"}
H.div {className: "panel-body flex-space-between"}
$ [ H.p { "style": {"margin":"10px"}} []
$ [ H.p { "style": {"margin":"10px"}
} []
, H.div { className: "flex-center"
}
, H.div { className: "flex-center"
}
[ buttonClick { action: doc
[ buttonClick { action: doc
, state: nodePopupState
, state: nodePopupState
, nodeType
, nodeType
...
@@ -206,29 +210,20 @@ buttonClickCpt = R.hooksComponent "G.C.F.T.N.B.buttonClick" cpt
...
@@ -206,29 +210,20 @@ buttonClickCpt = R.hooksComponent "G.C.F.T.N.B.buttonClick" cpt
(action == (Just todo) )
(action == (Just todo) )
, id: show todo
, id: show todo
, title: show todo
, title: show todo
, on
Click : mkEffectFn1 $ \_ -> {-undo *>-} doToDo
, on
: { click: \_ -> doToDo }
}
}
[]
[]
]
]
where
where
-- FIXME
-- If uncommenting the code below
-- then mpanelAction state is not
-- updated and leads to some bug (state of subtree
-- not updated and search value not initilized)
-- else current action' forces the user to click twice when
-- changing the action button.
action' = if isJust action {-== (Just todo)-}
then Nothing
else (Just todo)
{- -- This shows the Help of this button
{- -- This shows the Help of this button
undo = setNodePopup
undo = setNodePopup
$ const (node { action = Nothing })
$ const (node { action = Nothing })
-}
-}
doToDo = setNodePopup $ const
(node { action = action' })
doToDo = setNodePopup $ const
$ node { action = Just todo }
iconAStyle :: GT.NodeType -> NodeAction -> { color :: String
iconAStyle :: GT.NodeType -> NodeAction -> {
color :: String
, paddingTop :: String
, paddingTop :: String
, paddingBottom :: String
, paddingBottom :: String
}
}
...
@@ -272,7 +267,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
...
@@ -272,7 +267,7 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
cpt {action: Upload, dispatch, id, nodeType, session} _ = actionUpload nodeType id session dispatch
cpt {action: Upload, dispatch, id, nodeType, session} _ = actionUpload nodeType id session dispatch
cpt {action: Delete, nodeType, dispatch} _ = actionDelete nodeType dispatch
cpt {action: Delete, nodeType, dispatch} _ = actionDelete nodeType dispatch
cpt {action: Add xs, dispatch, id, name, node
Popup: p, node
Type} _ = do
cpt {action: Add xs, dispatch, id, name, nodeType} _ = do
pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs}
pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs}
cpt {action: Refresh , dispatch, id, nodeType, session} _ = update nodeType dispatch
cpt {action: Refresh , dispatch, id, nodeType, session} _ = update nodeType dispatch
...
@@ -283,13 +278,13 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
...
@@ -283,13 +278,13 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
-----------
-----------
-- Functions using SubTree
-- Functions using SubTree
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
mergeNode {dispatch, id, nodeType, session, subTreeParams}
pure $
mergeNode {dispatch, id, nodeType, session, subTreeParams}
cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do
moveNode {dispatch, id, nodeType, session, subTreeParams}
pure $
moveNode {dispatch, id, nodeType, session, subTreeParams}
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
linkNode {dispatch, id, nodeType, session, subTreeParams}
pure $
linkNode {dispatch, id, nodeType, session, subTreeParams}
-----------
-----------
cpt {action : Share, dispatch, id, name } _ = do
cpt {action : Share, dispatch, id, name } _ = do
...
...
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