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
19f72f96
Commit
19f72f96
authored
Feb 04, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[node] action: fix node name from type when adding new node
parent
60b44ab5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
19 deletions
+38
-19
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+4
-1
Update.purs
...Gargantext/Components/Forest/Tree/Node/Action/Update.purs
+21
-7
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+5
-2
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+8
-9
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
19f72f96
...
...
@@ -72,8 +72,11 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
let
SettingsBox {edit} = settingsBox nt
setNodeType' nt = do
setNodeName $ const $ GT.prettyNodeType nt
setNodeType $ const nt
(maybeChoose /\ nt') = if length nodeTypes > 1
then ([ formChoiceSafe nodeTypes Error setNodeType ] /\ nt)
then ([ formChoiceSafe nodeTypes Error setNodeType
'
] /\ nt)
else ([H.div {} [H.text $ "Creating a node of type "
<> show defaultNt
<> " with name:"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Update.purs
View file @
19f72f96
...
...
@@ -3,16 +3,18 @@ module Gargantext.Components.Forest.Tree.Node.Action.Update where
import Data.Tuple.Nested ((/\))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, submitButton, panel)
import Gargantext.Types (NodeType(..), ID)
import Gargantext.Types as GT
import Gargantext.Prelude (Unit, bind, ($), pure)
import Gargantext.Sessions (Session, post)
import Gargantext.Routes as GR
import Reactix as R
import Reactix.DOM.HTML as H
updateRequest :: UpdateNodeParams -> Session -> ID -> Aff GT.AsyncTaskWithType
...
...
@@ -28,29 +30,41 @@ update :: NodeType
-> R.Hooks R.Element
update NodeList dispatch = do
meth @( methodList /\ setMethod ) <- R.useState' Basic
let setMethod' = setMethod <<< const
pure $ panel [ -- H.text "Update with"
formChoiceSafe [Basic, Advanced, WithModel] Basic setMethod
formChoiceSafe [Basic, Advanced, WithModel] Basic setMethod
'
]
(submitButton (UpdateNode $ UpdateNodeParamsList {methodList}) dispatch)
update Graph dispatch = do
meth @( methodGraph /\ setMethod ) <- R.useState' Order1
let setMethod' = setMethod <<< const
pure $ panel [ -- H.text "Update with"
formChoiceSafe [Order1, Order2] Order1 setMethod
formChoiceSafe [Order1, Order2] Order1 setMethod
'
]
(submitButton (UpdateNode $ UpdateNodeParamsGraph {methodGraph}) dispatch)
update Texts dispatch = do
meth @( methodTexts /\ setMethod ) <- R.useState' NewNgrams
let setMethod' = setMethod <<< const
pure $ panel [ -- H.text "Update with"
formChoiceSafe [NewNgrams, NewTexts, Both] NewNgrams setMethod
formChoiceSafe [NewNgrams, NewTexts, Both] NewNgrams setMethod
'
]
(submitButton (UpdateNode $ UpdateNodeParamsTexts {methodTexts}) dispatch)
update Dashboard dispatch = do
meth @( methodBoard /\ setMethod ) <- R.useState' All
let setMethod' = setMethod <<< const
pure $ panel [ -- H.text "Update with"
formChoiceSafe [All, Sources, Authors, Institutes, Ngrams] All setMethod
formChoiceSafe [All, Sources, Authors, Institutes, Ngrams] All setMethod
'
]
(submitButton (UpdateNode $ UpdateNodeParamsBoard {methodBoard}) dispatch)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
19f72f96
...
...
@@ -80,6 +80,9 @@ uploadFileViewCpt = R.hooksComponentWithModule thisModule "uploadFileView" cpt
fileType@(_ /\ setFileType) <- R.useState' CSV
lang@( _chosenLang /\ setLang) <- R.useState' EN
let setFileType' = setFileType <<< const
let setLang' = setLang <<< const
let bodies =
[ R2.row
[ H.div { className:"col-12 flex-space-around"}
...
...
@@ -99,12 +102,12 @@ uploadFileViewCpt = R.hooksComponentWithModule thisModule "uploadFileView" cpt
, WOS
, PresseRIS
, Arbitrary
] CSV setFileType
] CSV setFileType
'
]
]
, R2.row
[ H.div {className:"col-6 flex-space-around"}
[ formChoiceSafe [EN, FR, No_extraction, Universal] EN setLang ]
[ formChoiceSafe [EN, FR, No_extraction, Universal] EN setLang
'
]
]
]
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
19f72f96
...
...
@@ -144,7 +144,8 @@ formChoiceSafe :: forall a b c
=> Show a
=> Array a
-> a
-> ((b -> a) -> Effect c)
-> (a -> Effect c)
-- -> ((b -> a) -> Effect c)
-> R.Element
formChoiceSafe [] _ _ = H.div {} []
...
...
@@ -160,16 +161,13 @@ formChoice :: forall a b c d
=> Show d
=> Array d
-> b
-> ((c -> b) -> Effect a)
-> (b -> Effect a)
-- -> ((c -> b) -> Effect a)
-> R.Element
formChoice nodeTypes defaultNodeType setNodeType =
H.div { className: "form-group"}
[ R2.select { className: "form-control"
, on: { change: setNodeType
<<< const
<<< fromMaybe defaultNodeType
<<< read
<<< R.unsafeEventValue }
, on: { change: \e -> setNodeType $ fromMaybe defaultNodeType $ read $ R.unsafeEventValue e }
}
(map (\opt -> H.option {} [ H.text $ show opt ]) nodeTypes)
]
...
...
@@ -179,7 +177,8 @@ formChoice nodeTypes defaultNodeType setNodeType =
formButton :: forall a b c
. Show a
=> a
-> ((b -> a) -> Effect c)
-> (a -> Effect c)
-- -> ((b -> a) -> Effect c)
-> R.Element
formButton nodeType setNodeType =
H.div {} [ H.text $ "Confirm the selection of: " <> show nodeType
...
...
@@ -190,7 +189,7 @@ formButton nodeType setNodeType =
, type : "button"
, title: "Form Button"
, style : { width: "100%" }
, on: { click: \_ -> setNodeType
( const nodeType )
}
, on: { click: \_ -> setNodeType
nodeType
}
} [H.text $ "Confirmation"]
------------------------------------------------------------------------
...
...
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