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
3f66f5fa
Commit
3f66f5fa
authored
Jul 08, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT/Public] unpublished done
parent
dd7ba4de
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
14 deletions
+47
-14
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+7
-4
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+4
-4
Delete.purs
...Gargantext/Components/Forest/Tree/Node/Action/Delete.purs
+8
-5
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+12
-1
Types.purs
src/Gargantext/Types.purs
+16
-0
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
3f66f5fa
...
...
@@ -33,7 +33,7 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, map, pure, void, ($), (+), (<>))
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (OpenNodes, Session, mkNodeId, get)
import Gargantext.Types (ID, Reload)
import Gargantext.Types (ID, Reload
, isPublic, publicize
)
import Gargantext.Types as GT
import Gargantext.Routes as GR
...
...
@@ -192,7 +192,10 @@ toHtml p@{ asyncTasks
} ]
<> childNodes ( Record.merge commonProps
{ asyncTasks
, children: ary
, children: if isPublic nodeType
then map (\t -> map (\(LNode {id:id',name:name',nodeType:nt})
-> (LNode {id:id',name:name',nodeType: publicize nt})) t) ary
else ary
, folderOpen
}
)
...
...
@@ -232,13 +235,13 @@ type PerformActionProps =
performAction :: Action
-> Record PerformActionProps
-> Aff Unit
performAction
DeleteNode
p@{ openNodes: (_ /\ setOpenNodes)
performAction
(DeleteNode nt)
p@{ openNodes: (_ /\ setOpenNodes)
, reload: (_ /\ setReload)
, session
, tree: (NTree (LNode {id}) _)
} =
do
void $ deleteNode session id
void $ deleteNode session
nt
id
liftEffect $ setOpenNodes (Set.delete (mkNodeId session id))
performAction RefreshTree p
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
3f66f5fa
...
...
@@ -20,7 +20,7 @@ type Props =
data Action = AddNode String GT.NodeType
| DeleteNode
| DeleteNode
GT.NodeType
| RenameNode String
| UpdateNode UpdateNodeParams
| ShareTeam String
...
...
@@ -52,7 +52,7 @@ setTreeOut a _ = a
instance showShow :: Show Action where
show (AddNode _ _ )= "AddNode"
show
DeleteNode
= "DeleteNode"
show
(DeleteNode _ )
= "DeleteNode"
show (RenameNode _ )= "RenameNode"
show (UpdateNode _ )= "UpdateNode"
show (ShareTeam _ )= "ShareTeam"
...
...
@@ -69,7 +69,7 @@ instance showShow :: Show Action where
-----------------------------------------------------------------------
icon :: Action -> String
icon (AddNode _ _) = glyphiconNodeAction (Add [])
icon
DeleteNode
= glyphiconNodeAction Delete
icon
(DeleteNode _)
= glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (ShareTeam _) = glyphiconNodeAction Share
...
...
@@ -88,7 +88,7 @@ icon NoAction = "hand-o-right"
text :: Action -> String
text (AddNode _ _ )= "Add !"
text
DeleteNode
= "Delete !"
text
(DeleteNode _ )
= "Delete !"
text (RenameNode _ )= "Rename !"
text (UpdateNode _ )= "Update !"
text (ShareTeam _ )= "Share with team !"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Delete.purs
View file @
3f66f5fa
...
...
@@ -5,7 +5,7 @@ import Data.Maybe (Maybe(..))
import Gargantext.Prelude
import Effect.Aff (Aff)
import Gargantext.Types as GT
import Gargantext.Sessions (Session, delete)
import Gargantext.Sessions (Session, delete
, put_
)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Types (NodeType(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
...
...
@@ -14,8 +14,11 @@ import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Reactix.DOM.HTML as H
-- TODO Delete with asyncTaskWithType
deleteNode :: Session -> GT.ID -> Aff GT.ID
deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
deleteNode :: Session -> NodeType -> GT.ID -> Aff GT.ID
deleteNode session nt nodeId =
case nt of
NodePublic _ -> put_ session $ NodeAPI GT.Node (Just nodeId) "unpublish"
_ -> delete session $ NodeAPI GT.Node (Just nodeId) ""
-- | Action : Delete
actionDelete :: NodeType -> (Action -> Aff Unit) -> R.Hooks R.Element
...
...
@@ -29,7 +32,7 @@ actionDelete NodeUser _ = do
]
(H.div {} [])
actionDelete
_
dispatch = do
actionDelete
nt
dispatch = do
pure $ panel [ H.div {style: {margin: "10px"}}
(map (\t -> H.p {} [H.text t])
[ "Are your sure you want to delete it ?"
...
...
@@ -37,7 +40,7 @@ actionDelete _ dispatch = do
]
)
]
(submitButton
DeleteNode
dispatch)
(submitButton
(DeleteNode nt)
dispatch)
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
3f66f5fa
...
...
@@ -192,7 +192,7 @@ settingsBox Texts =
settingsBox Graph =
SettingsBox { show : true
, edit :
fals
e
, edit :
tru
e
, doc : Documentation Graph
, buttons : [ Refresh
, Config
...
...
@@ -202,6 +202,17 @@ settingsBox Graph =
]
}
settingsBox (NodePublic Graph) =
SettingsBox { show : true
, edit : true
, doc : Documentation Graph
, buttons : [ Download -- TODO as GEXF or JSON
, Delete
]
}
settingsBox NodeList =
SettingsBox { show : true
, edit : false
...
...
src/Gargantext/Types.purs
View file @
3f66f5fa
...
...
@@ -154,6 +154,8 @@ data NodeType = NodeUser
-- TODO Optional Nodes
| NodeFrameWrite
| NodeFrameCalc
| NodePublic NodeType
derive instance eqNodeType :: Eq NodeType
...
...
@@ -182,6 +184,7 @@ instance showNodeType :: Show NodeType where
show Texts = "NodeTexts"
show NodeFrameWrite = "NodeFrameWrite"
show NodeFrameCalc = "NodeFrameCalc"
show (NodePublic nt) = "NodePublic" <> show nt
instance readNodeType :: Read NodeType where
...
...
@@ -207,6 +210,7 @@ instance readNodeType :: Read NodeType where
read "Annuaire" = Just Annuaire
read "NodeFrameWrite" = Just NodeFrameWrite
read "NodeFrameCalc" = Just NodeFrameCalc
-- TODO NodePublic read ?
read _ = Nothing
...
...
@@ -251,10 +255,21 @@ fldr NodeFrameWrite false = "fa fa-file-text"
fldr NodeFrameCalc true = "fa fa-calculator"
fldr NodeFrameCalc false = "fa fa-calculator"
fldr (NodePublic nt) b = fldr nt b
fldr _ true = "fa fa-folder-open"
fldr _ false = "fa fa-folder-o"
publicize :: NodeType -> NodeType
publicize (NodePublic nt) = NodePublic nt
publicize nt = NodePublic nt
isPublic :: NodeType -> Boolean
isPublic (NodePublic _) = true
isPublic FolderPublic = true
isPublic _ = false
{-
------------------------------------------------------------
instance ordNodeType :: Ord NodeType where
...
...
@@ -295,6 +310,7 @@ nodeTypePath Texts = "texts"
nodeTypePath Team = "team"
nodeTypePath NodeFrameWrite = "write"
nodeTypePath NodeFrameCalc = "calc"
nodeTypePath (NodePublic nt) = nodeTypePath nt
------------------------------------------------------------
...
...
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