Commit dd7ba4de authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Publish button

parent 99a19646
...@@ -281,6 +281,13 @@ performAction (ShareTeam username) p@{ reload: (_ /\ setReload) ...@@ -281,6 +281,13 @@ performAction (ShareTeam username) p@{ reload: (_ /\ setReload)
do do
void $ Share.share session id $ Share.ShareTeam {username} void $ Share.share session id $ Share.ShareTeam {username}
performAction SharePublic p@{ reload: (_ /\ setReload)
, session
, tree: (NTree (LNode {id}) _)
} =
do
void $ Share.share session id $ Share.SharePublic {rights:"public"}
------- -------
performAction (AddNode name nodeType) p@{ openNodes: (_ /\ setOpenNodes) performAction (AddNode name nodeType) p@{ openNodes: (_ /\ setOpenNodes)
, reload: (_ /\ setReload) , reload: (_ /\ setReload)
......
...@@ -24,6 +24,7 @@ data Action = AddNode String GT.NodeType ...@@ -24,6 +24,7 @@ data Action = AddNode String GT.NodeType
| RenameNode String | RenameNode String
| UpdateNode UpdateNodeParams | UpdateNode UpdateNodeParams
| ShareTeam String | ShareTeam String
| SharePublic
| DoSearch GT.AsyncTaskWithType | DoSearch GT.AsyncTaskWithType
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents | UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| DownloadNode | DownloadNode
...@@ -55,6 +56,7 @@ instance showShow :: Show Action where ...@@ -55,6 +56,7 @@ instance showShow :: Show Action where
show (RenameNode _ )= "RenameNode" show (RenameNode _ )= "RenameNode"
show (UpdateNode _ )= "UpdateNode" show (UpdateNode _ )= "UpdateNode"
show (ShareTeam _ )= "ShareTeam" show (ShareTeam _ )= "ShareTeam"
show (SharePublic )= "SharePublic"
show (DoSearch _ )= "SearchQuery" show (DoSearch _ )= "SearchQuery"
show (UploadFile _ _ _ _)= "UploadFile" show (UploadFile _ _ _ _)= "UploadFile"
show RefreshTree = "RefreshTree" show RefreshTree = "RefreshTree"
...@@ -71,6 +73,7 @@ icon DeleteNode = glyphiconNodeAction Delete ...@@ -71,6 +73,7 @@ icon DeleteNode = glyphiconNodeAction Delete
icon (RenameNode _) = glyphiconNodeAction Config icon (RenameNode _) = glyphiconNodeAction Config
icon (UpdateNode _) = glyphiconNodeAction Refresh icon (UpdateNode _) = glyphiconNodeAction Refresh
icon (ShareTeam _) = glyphiconNodeAction Share icon (ShareTeam _) = glyphiconNodeAction Share
icon (SharePublic ) = glyphiconNodeAction Publish
icon (DoSearch _) = glyphiconNodeAction SearchBox icon (DoSearch _) = glyphiconNodeAction SearchBox
icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload icon (UploadFile _ _ _ _) = glyphiconNodeAction Upload
icon RefreshTree = glyphiconNodeAction Refresh icon RefreshTree = glyphiconNodeAction Refresh
...@@ -88,13 +91,14 @@ text (AddNode _ _ )= "Add !" ...@@ -88,13 +91,14 @@ text (AddNode _ _ )= "Add !"
text DeleteNode = "Delete !" text DeleteNode = "Delete !"
text (RenameNode _ )= "Rename !" text (RenameNode _ )= "Rename !"
text (UpdateNode _ )= "Update !" text (UpdateNode _ )= "Update !"
text (ShareTeam _ )= "Share !" text (ShareTeam _ )= "Share with team !"
text (SharePublic )= "Publish !"
text (DoSearch _ )= "Launch search !" text (DoSearch _ )= "Launch search !"
text (UploadFile _ _ _ _)= "Upload File !" text (UploadFile _ _ _ _)= "Upload File !"
text RefreshTree = "Refresh Tree !" text RefreshTree = "Refresh Tree !"
text DownloadNode = "Download !" text DownloadNode = "Download !"
text (MoveNode _ ) = "Move !" text (MoveNode _ ) = "Move !"
text (MergeNode _ ) = "Merge !" text (MergeNode _ ) = "Merge !"
text (LinkNode _ ) = "Link !" text (LinkNode _ ) = "Link !"
text NoAction = "No Action" text NoAction = "No Action"
----------------------------------------------------------------------- -----------------------------------------------------------------------
...@@ -11,7 +11,7 @@ import Reactix as R ...@@ -11,7 +11,7 @@ import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action (Action) import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView) import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete) import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete)
import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc) import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc)
...@@ -28,7 +28,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Merge (mergeNode) ...@@ -28,7 +28,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Merge (mergeNode)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS) import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox) import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus) import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT) import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT, submitButton)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (Name, ID) import Gargantext.Types (Name, ID)
import Gargantext.Types as GT import Gargantext.Types as GT
...@@ -297,6 +297,11 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt ...@@ -297,6 +297,11 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
, isOpen , isOpen
} }
] ]
cpt {action : Publish, dispatch } _ = do
pure $ H.div {className:"center"} [ submitButton SharePublic dispatch ]
cpt props@{action: SearchBox, id, session, dispatch, nodePopup} _ = cpt props@{action: SearchBox, id, session, dispatch, nodePopup} _ =
actionSearch session (Just id) dispatch nodePopup actionSearch session (Just id) dispatch nodePopup
......
...@@ -20,6 +20,7 @@ data NodeAction = Documentation NodeType ...@@ -20,6 +20,7 @@ data NodeAction = Documentation NodeType
| Download | Upload | Refresh | Config | Download | Upload | Refresh | Config
| Delete | Delete
| Share | Share
| Publish
| Add (Array NodeType) | Add (Array NodeType)
| Merge { subTreeParams :: SubTreeParams } | Merge { subTreeParams :: SubTreeParams }
| Move { subTreeParams :: SubTreeParams } | Move { subTreeParams :: SubTreeParams }
...@@ -41,6 +42,7 @@ instance eqNodeAction :: Eq NodeAction where ...@@ -41,6 +42,7 @@ instance eqNodeAction :: Eq NodeAction where
eq (Add x) (Add y) = x == y eq (Add x) (Add y) = x == y
eq (Merge x) (Merge y) = x == y eq (Merge x) (Merge y) = x == y
eq Config Config = true eq Config Config = true
eq Publish Publish = true
eq _ _ = false eq _ _ = false
instance showNodeAction :: Show NodeAction where instance showNodeAction :: Show NodeAction where
...@@ -57,7 +59,7 @@ instance showNodeAction :: Show NodeAction where ...@@ -57,7 +59,7 @@ instance showNodeAction :: Show NodeAction where
show (Link x) = "Link to " <> show x show (Link x) = "Link to " <> show x
show (Add xs) = foldl (\a b -> a <> show b) "Add " xs show (Add xs) = foldl (\a b -> a <> show b) "Add " xs
show (Merge t) = "Merge with subtree" <> show t show (Merge t) = "Merge with subtree" <> show t
show Publish = "Publish"
glyphiconNodeAction :: NodeAction -> String glyphiconNodeAction :: NodeAction -> String
glyphiconNodeAction (Documentation _) = "question-circle" glyphiconNodeAction (Documentation _) = "question-circle"
...@@ -72,9 +74,9 @@ glyphiconNodeAction Refresh = "refresh" ...@@ -72,9 +74,9 @@ glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Config = "wrench" glyphiconNodeAction Config = "wrench"
glyphiconNodeAction Share = "user-plus" glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction (Move _) = "share-square-o" glyphiconNodeAction (Move _) = "share-square-o"
glyphiconNodeAction Publish = fldr FolderPublic true
glyphiconNodeAction _ = "" glyphiconNodeAction _ = ""
------------------------------------------------------------------------ ------------------------------------------------------------------------
data SettingsBox = data SettingsBox =
SettingsBox { show :: Boolean SettingsBox { show :: Boolean
...@@ -195,6 +197,7 @@ settingsBox Graph = ...@@ -195,6 +197,7 @@ settingsBox Graph =
, buttons : [ Refresh , buttons : [ Refresh
, Config , Config
, Download -- TODO as GEXF or JSON , Download -- TODO as GEXF or JSON
, Publish
, Delete , Delete
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment