Commit 88e1d796 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[REFACT][Tree] NodeType Download refactored

parent 74c8c60b
...@@ -322,7 +322,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -322,7 +322,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
cpt p _ = do cpt p _ = do
renameBoxOpen <- R.useState' false renameBoxOpen <- R.useState' false
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' {action: Nothing, id: p.id, name: p.name, nodeType: p.nodeType} nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' {action: Nothing, id: p.id, name: p.name, nodeType: p.nodeType}
search <- R.useState' $ defaultSearch { node_id = Just p.id } search <- R.useState' $ defaultSearch { node_id = Just p.id }
pure $ H.div tooltipProps $ pure $ H.div tooltipProps $
[ H.div { className: "popup-container" } [ H.div { className: "popup-container" }
[ H.div { className: "panel panel-default" } [ H.div { className: "panel panel-default" }
...@@ -583,25 +583,43 @@ reallyDelete d = H.div {className: "panel-footer"} ...@@ -583,25 +583,43 @@ reallyDelete d = H.div {className: "panel-footer"}
-- | Action : Download -- | Action : Download
actionDownload :: NodeType -> ID -> Session -> R.Hooks R.Element actionDownload :: NodeType -> ID -> Session -> R.Hooks R.Element
actionDownload NodeList id session = do actionDownload NodeList id session = downloadButton href label info
let href = url session $ Routes.NodeAPI GT.NodeList (Just id) "" where
pure $ R.fragment [ href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
H.span { className: "row" } label = "Download list"
[ H.a { className: "btn btn-default" info = "Info about the JSON format"
, href
, target: "_blank" } [ H.text "Download list" ] actionDownload GT.Graph id session = downloadButton href label info
] where
] href = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
actionDownload GT.Graph id session = do label = "Download GEXF"
pure $ R.fragment [ H.div { className: "gexf" } info = "Info about the GEXF format"
[ H.a { className: "btn btn-default"
, href: url session $ Routes.NodeAPI GT.Graph (Just id) "gexf" actionDownload _ _ _ = pure $ fragmentPT $ "Soon, you will be able to dowload your file here "
, target: "_blank" } [ H.text "Download GEXF" ]
type Href = String
type Label = String
type Info = String
downloadButton :: Href -> Label -> Info -> R.Hooks R.Element
downloadButton href label info = do
pure $ R.fragment [ H.div { className: "row"}
[ H.div { className: "col-md-2"} []
, H.div { className: "col-md-7 flex-center"}
[ H.p {} [H.text info] ]
] ]
, H.span { className: "row" }
[ H.div { className: "panel-footer"}
[ H.div { className: "col-md-3"} []
, H.div { className: "col-md-3 flex-center"}
[ H.a { className: "btn btn-default"
, href
, target: "_blank" }
[ H.text label ]
]
]
]
] ]
actionDownload _ _ _ = do
pure $ fragmentPT $ "Soon, you will be able to dowload your file here "
-- | Action: Show Documentation -- | Action: Show Documentation
......
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