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
165c83d5
Commit
165c83d5
authored
Oct 15, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Backends manager.
parent
a4e388b1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
43 deletions
+96
-43
Forest.purs
src/Gargantext/Components/Forest.purs
+1
-1
NodeActions.purs
src/Gargantext/Components/Forest/NodeActions.purs
+7
-5
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+37
-18
Login.purs
src/Gargantext/Components/Login.purs
+48
-19
Utils.purs
src/Gargantext/Utils.purs
+3
-0
No files found.
src/Gargantext/Components/Forest.purs
View file @
165c83d5
...
...
@@ -34,7 +34,7 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
plus :: R2.Setter Boolean -> R.Element
plus showLogin =
H.button {on: {click}}
[ H.i { className: "glyphicon glyphicon-
log-in
"} [] ]
[ H.i { className: "glyphicon glyphicon-
plus
"} [] ]
where
click _ = do
showLogin (const true)
src/Gargantext/Components/Forest/NodeActions.purs
View file @
165c83d5
...
...
@@ -9,11 +9,13 @@ import Reactix.DOM.HTML as H
import Effect.Aff (Aff, launchAff, runAff)
data NodeAction = Rename
| Documentation NodeType
| Add (Array NodeType)
| Search
| Download | Upload | Refresh
| Move | Clone | Delete
| Share
| Disconnect
data ButtonType = Edit | Click | Pop
...
...
@@ -59,14 +61,15 @@ nodeActions NodeUser = [ Add [ FolderPrivate
, FolderTeam
, FolderPublic
]
, Disconnect
, Delete
]
nodeActions FolderPrivate = [Add [Folder, Corpus]]
nodeActions FolderTeam = [Add [Folder, Corpus]]
nodeActions FolderPublic = [Add [Folder, Corpus]]
nodeActions FolderPrivate = [
Add [Folder, Corpus]]
nodeActions FolderTeam = [
Add [Folder, Corpus]]
nodeActions FolderPublic = [
Add [Folder, Corpus]]
nodeActions Folder = [Add [Corpus], Rename, Delete]
nodeActions Folder = [
Add [Corpus], Rename, Delete]
nodeActions Corpus = [ Rename
, Search, Upload, Download
...
...
@@ -84,4 +87,3 @@ nodeActions _ = []
---------------------------------------------------------
src/Gargantext/Components/Forest/Tree.purs
View file @
165c83d5
...
...
@@ -32,7 +32,7 @@ import Gargantext.Routes as Routes
import Gargantext.Routes (AppRoute, SessionRoute(..))
import Gargantext.Sessions (Session, sessionId, get, put, post, postWwwUrlencoded, delete)
import Gargantext.Types (class ToQuery, toQuery, NodeType(..), NodePath(..), readNodeType)
import Gargantext.Utils (id)
import Gargantext.Utils (id
, glyphicon
)
import Gargantext.Utils.Reactix as R2
import Gargantext.Components.Forest.NodeActions
...
...
@@ -313,7 +313,6 @@ type NodePopupProps =
)
iconAStyle = {color:"black", paddingTop: "6px", paddingBottom: "6px"}
glyphicon t = "glyphitem glyphicon glyphicon-" <> t
nodePopupView :: (Action -> Aff Unit)
-> Record NodePopupProps
...
...
@@ -348,7 +347,9 @@ nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
panelHeading renameBoxOpen@(open /\ _) =
H.div {className: "panel-heading"}
[ H.div {className: "row" }
[ H.div {className: rowClass open} [ renameBox d {id, name} renameBoxOpen ]
[ H.div {className: "col-md-1"} []
, buttonClick d (Documentation nodeType)
, H.div {className: rowClass open} [ renameBox d {id, name} renameBoxOpen ]
, if not (null edits) then editIcon renameBoxOpen else H.div {} []
, H.div {className: "col-md-2"}
[ H.a {className: "btn text-danger glyphitem glyphicon glyphicon-remove-circle"
...
...
@@ -378,7 +379,7 @@ nodePopupView d p (Just NodePopup /\ setPopupOpen) = R.createElement el p []
, border: "none"}}
((map (\a -> buttonPop a setPopupOpen) pops)
<>
(map (
\a -> buttonClick a
d) clicks))
(map (
buttonClick
d) clicks))
nodePopupView _ p _ = R.createElement el p []
...
...
@@ -387,12 +388,30 @@ nodePopupView _ p _ = R.createElement el p []
cpt _ _ = pure $ H.div {} []
-- buttonAction :: NodeAction -> R.Element
buttonClick _ (Documentation x ) = H.div {className: "col-md-1"}
[ H.a { style: iconAStyle
, className: (glyphicon "question-sign")
, id: "doc"
, title: "Documentation"
}
-- , onClick: mkEffectFn1 $ \_ -> launchAff $ d $ DeleteNode}
[]
]
buttonClick d Disconnect = H.div {className: "col-md-4"}
[ H.a { style: iconAStyle
, className: (glyphicon "log-out")
, id: "log-out"
, title: "Log Out"
-- , onClick: mkEffectFn1 $ \_ -> launchAff $ d $ DeleteNode}
}
[]
]
buttonClick Delete d = H.div {className: "col-md-4"}
[ H.a {style: iconAStyle
buttonClick d Delete = H.div {className: "col-md-4"}
[ H.a { style: iconAStyle
, className: (glyphicon "trash")
, id: "rename2"
, title: "Delete"
...
...
@@ -400,15 +419,15 @@ buttonClick Delete d = H.div {className: "col-md-4"}
[]
]
buttonClick
Upload _
= H.div {className: "col-md-4"}
[ H.a {style: iconAStyle
buttonClick
_ Upload
= H.div {className: "col-md-4"}
[ H.a {
style: iconAStyle
, className: (glyphicon "upload")
, id: "upload"
, title: "Upload [WIP]"}
[]
]
buttonClick
Download _
= H.div {className: "col-md-4"}
buttonClick
_ Download
= H.div {className: "col-md-4"}
[ H.a {style: iconAStyle
, className: (glyphicon "download")
, id: "download"
...
...
@@ -421,7 +440,7 @@ buttonClick _ _ = H.div {} []
buttonPop (Add _) f = H.div {className: "col-md-4"}
[ H.a {style: iconAStyle
[ H.a {
style: iconAStyle
, className: (glyphicon "plus")
, id: "create"
, title: "Create"
...
...
src/Gargantext/Components/Login.purs
View file @
165c83d5
...
...
@@ -3,11 +3,12 @@
-- Select a backend and log into it
module Gargantext.Components.Login where
import Prelude (Unit, bind, const, discard, pure, flip, show, ($), (<>), (*>), (<$>))
import Prelude (Unit, bind, const, discard, pure, flip, show, ($), (<>), (*>), (<$>)
, (>)
)
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import DOM.Simple.Console (log)
import Data.Sequence as DS
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Aff (launchAff_)
...
...
@@ -18,9 +19,9 @@ import Reactix.DOM.HTML as H
import Gargantext.Components.Forms (clearfix, card, cardBlock, cardGroup, center, formGroup)
import Gargantext.Components.Login.Types (AuthRequest(..))
import Gargantext.Ends (Backend(..))
import Gargantext.Sessions (Session, Sessions, postAuthRequest, unSessions)
import Gargantext.Sessions (Session, Sessions
(..)
, postAuthRequest, unSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Utils (csrfMiddlewareToken)
import Gargantext.Utils (csrfMiddlewareToken
, glyphicon
)
import Gargantext.Utils.Reactix as R2
-- TODO: ask for login (modal) or account creation after 15 mn when user
...
...
@@ -48,12 +49,19 @@ modalCpt = R.hooksComponent "G.C.Login.modal" cpt where
[ H.div { className: "modal-dialog", role: "document"}
[ H.div { className: "modal-content" }
[ H.div { className: "modal-header" }
[ H.h5 { className: "modal-title" } []
[ logo
, H.h2 { className: "center modal-title" } [H.text "Backends manager"]
, H.button { "type": "button", className: "close"
, "data": { dismiss: "modal" } }
[ H.span { on: {click} } [ H.text "X" ] ] ]
, H.div { className: "modal-body" } children ] ] ] ]
modalClass s = "modal myModal" <> if s then "" else " fade"
logo =
H.div {className: "col-md-10 col-md-push-1"}
[ H.h2 {className: "text-primary center m-a-2"}
[ H.i {className: "material-icons md-36"} [ H.text "control_point" ]
, H.span {className: "icon-text"} [ H.text "Gargantext" ] ] ]
login :: Record Props -> R.Element
...
...
@@ -79,23 +87,50 @@ chooserCpt :: R.Component ChooserProps
chooserCpt = R.staticComponent "G.C.Login.chooser" cpt where
cpt :: Record ChooserProps -> Array R.Element -> R.Element
cpt {backend, backends, sessions} _ =
H.ul {}
[ renderSessions sessions, renderBackends backends backend ]
R.fragment $ new <> active
where
active = if DS.length ss > 0 then [ H.h3 {} [H.text "Active connection(s)"]
, H.ul {} [ renderSessions sessions]
] else [] where
Sessions {sessions:ss} = fst sessions
new = [ H.h3 {} [H.text "New connection(s)"]
, H.ul {} [renderBackends backends backend ]
]
renderSessions :: R2.Reductor Sessions Sessions.Action -> R.Element
renderSessions sessions = R.fragment (renderSession <$> unSessions (fst sessions))
renderSessions sessions = R.fragment (renderSession
sessions
<$> unSessions (fst sessions))
renderSession :: Session -> R.Element
renderSession session = H.li {} [ H.text $ "Active session: " <> show session ]
renderSession :: R2.Reductor Sessions Sessions.Action -> Session -> R.Element
renderSession sessions session = H.li {} $ [ H.text $ "Active session: " <> show session ]
<> [ H.a { on : {click}
, className: glyphicon "log-out"
, id : "log-out"
, title: "Log out"
} [] ]
where
click _ = (snd sessions) (Sessions.Logout session)
renderBackends :: Array Backend -> R.State (Maybe Backend) -> R.Element
renderBackends backends state = R.fragment $ (flip renderBackend $ state) <$> backends
{-
renderBackend :: Backend -> R.State (Maybe Backend) -> R.Element
renderBackend backend@(Backend {name}) state =
H.li {} [ H.a {on: {click}, className: glyphicon "log-in"} [ H.text $ "Connect to " <> name ] ] where
click _ = (snd state) (const $ Just backend)
-}
renderBackend :: Backend -> R.State (Maybe Backend) -> R.Element
renderBackend backend@(Backend {name}) state =
H.li {} [ H.a {on: {click}} [ H.text $ "Connect to " <> name ] ] where
H.li {} $ [ H.a { on : {click}
-- , className: glyphicon "log-in"
-- , id : "log-in"
} [ H.text $ " Connect to " <> name ] ] <> [ H.a { on : {click}, className : glyphicon "log-in", title: "Log In"} []]
where
click _ = (snd state) (const $ Just backend)
type FormProps =
( backend :: Backend
, sessions :: R2.Reductor Sessions Sessions.Action
...
...
@@ -112,8 +147,7 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
username <- R.useState' ""
password <- R.useState' ""
pure $ H.div {className: "row"}
[ logo
, cardGroup
[ cardGroup
[ card
[ cardBlock
[ center
...
...
@@ -141,11 +175,6 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
(snd sessions) (Sessions.Login sess)
(snd error) (const "")
(snd visible) (const false)
logo =
H.div {className: "col-md-10 col-md-push-1"}
[ H.h2 {className: "text-primary center m-a-2"}
[ H.i {className: "material-icons md-36"} [ H.text "control_point" ]
, H.span {className: "icon-text"} [ H.text "Gargantext" ] ] ]
csrfTokenInput :: {} -> R.Element
csrfTokenInput _ =
...
...
src/Gargantext/Utils.purs
View file @
165c83d5
...
...
@@ -38,3 +38,6 @@ csrfMiddlewareToken = "Wy52D2nor8kC1r1Y4GrsrSIxQ2eqW8UwkdiQQshMoRwobzU4uldknRUhP
_unit :: forall s. Lens' s Unit
_unit = lens (\_ -> unit) (\s _ -> s)
glyphicon t = "glyphitem glyphicon glyphicon-" <> t
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