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
bde5be08
Commit
bde5be08
authored
Oct 18, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FOREST][WIP] ergo ok.
parent
f2d39fce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
40 deletions
+96
-40
Forest.purs
src/Gargantext/Components/Forest.purs
+3
-1
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+18
-1
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+2
-4
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+0
-3
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+73
-31
No files found.
src/Gargantext/Components/Forest.purs
View file @
bde5be08
...
@@ -34,7 +34,9 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
...
@@ -34,7 +34,9 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
plus :: R2.Setter Boolean -> R.Element
plus :: R2.Setter Boolean -> R.Element
plus showLogin =
plus showLogin =
H.button {on: {click}}
H.button {on: {click}}
[ H.i { className: glyphicon "plus"} [] ]
[ H.div { "type": "button"
, className: "glyphicon glyphicon-plus"
} [] ]
-- TODO same as the one in the Login Modal (same CSS)
-- TODO same as the one in the Login Modal (same CSS)
-- [ H.i { className: "material-icons md-36"} [] ]
-- [ H.i { className: "material-icons md-36"} [] ]
where
where
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
bde5be08
...
@@ -34,6 +34,10 @@ settingsBox NodeUser = SettingsBox { show : true
...
@@ -34,6 +34,10 @@ settingsBox NodeUser = SettingsBox { show : true
, FolderPublic
, FolderPublic
]
]
, buttons : [Documentation NodeUser
, buttons : [Documentation NodeUser
, Add [ FolderPrivate
, FolderShared
, FolderPublic
]
, Delete
, Delete
]
]
}
}
...
@@ -101,7 +105,6 @@ settingsBox Graph = SettingsBox { show : true
...
@@ -101,7 +105,6 @@ settingsBox Graph = SettingsBox { show : true
, edit : false
, edit : false
, add : [Graph]
, add : [Graph]
, buttons : [ Documentation Graph
, buttons : [ Documentation Graph
, Upload
, Download
, Download
]
]
}
}
...
@@ -138,6 +141,20 @@ data NodeAction = Documentation NodeType
...
@@ -138,6 +141,20 @@ data NodeAction = Documentation NodeType
| Download | Upload | Refresh
| Download | Upload | Refresh
| Move | Clone | Delete
| Move | Clone | Delete
| Share
| Share
| Add (Array NodeType)
instance eqNodeAction :: Eq NodeAction where
eq (Documentation x) (Documentation y) = true && (x == y)
eq Search Search = true
eq Download Download = true
eq Upload Upload = true
eq Refresh Refresh = true
eq Move Move = true
eq Clone Clone = true
eq Delete Delete = true
eq Share Share = true
eq (Add x) (Add y) = true && (x == y)
eq _ _ = false
data ButtonType = Click | Pop
data ButtonType = Click | Pop
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
bde5be08
...
@@ -31,9 +31,9 @@ instance showFileType :: Show FileType where
...
@@ -31,9 +31,9 @@ instance showFileType :: Show FileType where
show = genericShow
show = genericShow
readFileType :: String -> Maybe FileType
readFileType :: String -> Maybe FileType
readFileType "CSV" = Just CSV
readFileType "CSV"
= Just CSV
readFileType "PresseRIS" = Just PresseRIS
readFileType "PresseRIS" = Just PresseRIS
readFileType _ = Nothing
readFileType _
= Nothing
data DroppedFile = DroppedFile {
data DroppedFile = DroppedFile {
...
@@ -51,8 +51,6 @@ newtype UploadFileContents = UploadFileContents String
...
@@ -51,8 +51,6 @@ newtype UploadFileContents = UploadFileContents String
createNode :: Session -> ID -> CreateValue -> Aff ID
createNode :: Session -> ID -> CreateValue -> Aff ID
createNode session parentId = post session $ NodeAPI Node (Just parentId) ""
createNode session parentId = post session $ NodeAPI Node (Just parentId) ""
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
bde5be08
...
@@ -151,6 +151,3 @@ showConfig FolderPublic = H.div {} [H.text "This folder will be public"]
...
@@ -151,6 +151,3 @@ showConfig FolderPublic = H.div {} [H.text "This folder will be public"]
showConfig nt = H.div {} [H.h1 {} [H.text $ "Config of " <> show nt ]]
showConfig nt = H.div {} [H.h1 {} [H.text $ "Config of " <> show nt ]]
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
bde5be08
...
@@ -2,17 +2,17 @@ module Gargantext.Components.Forest.Tree.Node.Box where
...
@@ -2,17 +2,17 @@ module Gargantext.Components.Forest.Tree.Node.Box where
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Data.Array (filter, null)
import Data.Array (filter, null)
import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (Maybe(..), fromJust
, isJust
)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff, runAff)
import Effect.Aff (Aff, launchAff, runAff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1)
import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..))
import FFI.Simple ((..))
import Gargantext.Components.Forest.Tree.Node
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Components.Forest.Tree.Node.Action.Rename
import Gargantext.Components.Forest.Tree.Node.Action.Add
import Gargantext.Components.Forest.Tree.Node.Action.Add
import Gargantext.Components.Forest.Tree.Node.Action.Rename
import Gargantext.Components.Forest.Tree.Node.Action.Upload
import Gargantext.Components.Forest.Tree.Node.Action.Upload
import Gargantext.Components.Forest.Tree.Node
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Routes (AppRoute, SessionRoute(..))
import Gargantext.Routes (AppRoute, SessionRoute(..))
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
...
@@ -62,9 +62,13 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
...
@@ -62,9 +62,13 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
, name: name'} ]
, name: name'} ]
, if showBox then popOverIcon popupOpen else H.div {} []
, if showBox then popOverIcon popupOpen else H.div {} []
, if showBox
, if showBox
then nodePopupView d {id, name:name', nodeType} popupOpen
then nodePopupView d { id
, name:name'
, nodeType
, action: Nothing
} popupOpen
else H.div {} []
else H.div {} []
, addButton popupOpen
--
, addButton popupOpen
, fileTypeView d {id, nodeType} droppedFile isDragOver
, fileTypeView d {id, nodeType} droppedFile isDragOver
]
]
where
where
...
@@ -107,7 +111,12 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
...
@@ -107,7 +111,12 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
let blob = toBlob $ ff
let blob = toBlob $ ff
void $ runAff (\_ -> pure unit) do
void $ runAff (\_ -> pure unit) do
contents <- readAsText blob
contents <- readAsText blob
liftEffect $ setDroppedFile $ const $ Just $ DroppedFile {contents: (UploadFileContents contents), fileType: Just CSV}
liftEffect $ setDroppedFile
$ const
$ Just
$ DroppedFile { contents: (UploadFileContents contents)
, fileType: Just CSV
}
onDragOverHandler (_ /\ setIsDragOver) e = do
onDragOverHandler (_ /\ setIsDragOver) e = do
-- prevent redirection when file is dropped
-- prevent redirection when file is dropped
-- https://stackoverflow.com/a/6756680/941471
-- https://stackoverflow.com/a/6756680/941471
...
@@ -145,15 +154,17 @@ mCorpusId (Just (Routes.CorpusDocument _ id _ _)) = Just id
...
@@ -145,15 +154,17 @@ mCorpusId (Just (Routes.CorpusDocument _ id _ _)) = Just id
mCorpusId _ = Nothing
mCorpusId _ = Nothing
-- | START Popup View
-- | START Popup View
type NodePopupProps =
type NodePopupProps =
( id :: ID
( id :: ID
, name :: Name
, name :: Name
, nodeType :: NodeType
, nodeType :: NodeType
, action :: Maybe NodeAction
)
)
iconAStyle = {color:"black", paddingTop: "6px", paddingBottom: "6px"}
iconAStyle = { color : "black"
, paddingTop : "6px"
, paddingBottom : "6px"}
nodePopupView :: (Action -> Aff Unit)
nodePopupView :: (Action -> Aff Unit)
-> Record NodePopupProps
-> Record NodePopupProps
...
@@ -162,27 +173,33 @@ nodePopupView :: (Action -> Aff Unit)
...
@@ -162,27 +173,33 @@ nodePopupView :: (Action -> Aff Unit)
nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
where
where
el = R.hooksComponent "NodePopupView" cpt
el = R.hooksComponent "NodePopupView" cpt
cpt {id, name, nodeType} _ = do
cpt {id, name, nodeType
, action
} _ = do
renameBoxOpen <- R.useState' false
renameBoxOpen <- R.useState' false
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' {id, name, nodeType, action}
pure $ H.div tooltipProps $
pure $ H.div tooltipProps $
[ H.div {id: "arrow"} []
[ H.div {id: "arrow"} []
, H.div { className: "panel panel-default"
, H.div { className: "panel panel-default"
, style: { border: "1px solid rgba(0,0,0,0.2)"
, style: { border
: "1px solid rgba(0,0,0,0.2)"
, boxShadow : "0 2px 5px rgba(0,0,0,0.2)"
, boxShadow : "0 2px 5px rgba(0,0,0,0.2)"
}
}
}
}
[ panelHeading renameBoxOpen
[ panelHeading renameBoxOpen
, panelBody
, panelBody nodePopupState d
, if isJust nodePopup.action
then H.div { className: glyphicon "remove-circle"
, onClick : setNodePopup $ const {id,name,nodeType,action :Nothing}
} []
else H.div {} []
, panelAction nodeType nodePopup.action d
]
]
]
]
where
where
tooltipProps = { className: ""
tooltipProps = { className: ""
, id: "node-popup-tooltip"
, id: "node-popup-tooltip"
, title: "Node settings"
, title: "Node settings"
, data: {toggle: "tooltip", placement: "right"}
, data: { toggle: "tooltip"
, placement: "right"}
}
}
rowClass true = "col-md-10"
rowClass false = "col-md-10"
SettingsBox {edit, add, buttons} = settingsBox nodeType
SettingsBox {edit, add, buttons} = settingsBox nodeType
...
@@ -190,10 +207,10 @@ nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
...
@@ -190,10 +207,10 @@ nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
H.div {className: "panel-heading"}
H.div {className: "panel-heading"}
[ -- H.h1 {className : "col-md-12"} [H.text "Settings Box"]
[ -- H.h1 {className : "col-md-12"} [H.text "Settings Box"]
H.div {className: "row" }
H.div {className: "row" }
[ H.div {className:
rowClass open
} [ renameBox d {id, name} renameBoxOpen ]
[ H.div {className:
"col-md-10"
} [ renameBox d {id, name} renameBoxOpen ]
, if edit then editIcon renameBoxOpen else H.div {} []
, if edit then editIcon renameBoxOpen else H.div {} []
, H.div {className: "col-md-1"}
, H.div {className: "col-md-1"}
[ H.a {
type
: "button"
[ H.a {
"type"
: "button"
, className: glyphicon "remove-circle"
, className: glyphicon "remove-circle"
, onClick: mkEffectFn1 $ \_ -> setPopupOpen $ const Nothing
, onClick: mkEffectFn1 $ \_ -> setPopupOpen $ const Nothing
, title: "Close"} []
, title: "Close"} []
...
@@ -213,43 +230,63 @@ nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
...
@@ -213,43 +230,63 @@ nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
]
]
editIcon (true /\ _) = H.div {} []
editIcon (true /\ _) = H.div {} []
panelBody =
panelBody
nodePopupState d
=
H.div {className: "panel-body"
H.div {className: "panel-body"
, style: { display:"flex"
, style: { display:"flex"
, justifyContent : "center"
, justifyContent : "center"
, backgroundColor: "white"
, backgroundColor: "white"
, border: "none"}}
, border: "none"
}
}
$
$
(map (buttonClick d) buttons)
[H.div {className: "col-md-1"} []]
<>
<>
(
[if null add then H.div {} [] else buttonPop setPopupOpen]
)
(
map (buttonClick nodePopupState d) buttons
)
nodePopupView _ p _ = R.createElement el p []
nodePopupView _ p _ = R.createElement el p []
where
where
el = R.hooksComponent "CreateNodeView" cpt
el = R.hooksComponent "CreateNodeView" cpt
cpt _ _ = pure $ H.div {} []
cpt _ _ = pure $ H.div {} []
-- buttonAction :: NodeAction -> R.Element
-- buttonAction :: NodeAction -> R.Element
buttonClick
_ (Documentation x
) = H.div {className: "col-md-1"}
buttonClick
({id,name,nodeType,action} /\ setNodePopup) _ todo@(Documentation x
) = H.div {className: "col-md-1"}
[ H.a { style: iconAStyle
[ H.a { style: iconAStyle
, className:
(glyphicon "question-sign")
, className:
"btn glyphitem glyphicon glyphicon-question-sign" <> if action == (Just todo) then " active" else ""
, id: "doc"
, id: "doc"
, title: "Documentation of " <> show x
, title: "Documentation of " <> show x
, onClick : mkEffectFn1 $ \_ -> setNodePopup $ const $ {id,name,nodeType,action:Just todo}
}
}
-- , onClick: mkEffectFn1 $ \_ -> launchAff $ d $ DeleteNode}
[]
[]
]
]
buttonClick
d Delete = H.div {className: "col-md-4
"}
buttonClick
({id,name,nodeType,action} /\ setNodePopup) d Delete = H.div {className: "col-md-1
"}
[ H.a { style: iconAStyle
[ H.a { style: iconAStyle
, className: (glyphicon "trash")
, className: "btn glyphitem glyphicon glyphicon-trash" <> if action == (Just Delete) then " active" else ""
, id: "rename2"
--, className: (glyphicon "trash")
, id: "delete"
, title: "Delete"
, title: "Delete"
, onClick: mkEffectFn1 $ \_ -> launchAff $ d $ DeleteNode}
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const {id, name, nodeType, action : Just Delete}
--, onClick: mkEffectFn1 $ \_ -> launchAff $ d $ DeleteNode}
}
[]
]
buttonClick ({id,name,nodeType,action} /\ setNodePopup) d (Add xs) = H.div {className: "col-md-1"}
[ H.a { style: iconAStyle
, className: "btn glyphitem glyphicon glyphicon-plus" <> if action == (Just $ Add xs) then " active" else ""
--, className: (glyphicon "trash")
, id: "add"
, title: "add"
, onClick: mkEffectFn1 $ \_ -> setNodePopup $ const {id, name, nodeType, action : Just $ Add xs}
--, onClick: mkEffectFn1 $ \_ -> launchAff $ d $ DeleteNode}
}
[]
[]
]
]
buttonClick _ Upload = H.div {className: "col-md-4"}
{-
buttonClick _ _ Upload = H.div {className: "col-md-1"}
[ H.a { style: iconAStyle
[ H.a { style: iconAStyle
, className: (glyphicon "upload")
, className: (glyphicon "upload")
, id: "upload"
, id: "upload"
...
@@ -257,15 +294,15 @@ buttonClick _ Upload = H.div {className: "col-md-4"}
...
@@ -257,15 +294,15 @@ buttonClick _ Upload = H.div {className: "col-md-4"}
[]
[]
]
]
buttonClick _
Download = H.div {className: "col-md-4
"}
buttonClick _
_ Download = H.div {className: "col-md-1
"}
[ H.a {style: iconAStyle
[ H.a {style: iconAStyle
, className: (glyphicon "download")
, className: (glyphicon "download")
, id: "download"
, id: "download"
, title: "Download [WIP]"}
, title: "Download [WIP]"}
[]
[]
]
]
-}
buttonClick _ _ = H.div {} []
buttonClick _ _
_
= H.div {} []
buttonPop f = H.div {className: "col-md-4"}
buttonPop f = H.div {className: "col-md-4"}
...
@@ -280,3 +317,8 @@ buttonPop f = H.div {className: "col-md-4"}
...
@@ -280,3 +317,8 @@ buttonPop f = H.div {className: "col-md-4"}
-- END Popup View
-- END Popup View
panelAction _ (Just (Documentation x)) _ = R.fragment [ H.div {} [H.text "more information"]]
panelAction NodeUser (Just Delete) _ = R.fragment [ H.div {} [H.text "Yes, we are RGPD compliant!"]]
panelAction _ (Just Delete) _ = R.fragment [ H.div {} [H.text "Are your sure you want to delete ?"]]
panelAction _ (Just (Add xs)) _ = R.fragment [ H.div {} [H.text "Adding configuration"]]
panelAction _ _ _ = H.div {} []
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