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

[MERGE] fix with dev

parents bbd5a4e5 657b356f
...@@ -190,9 +190,12 @@ performAction p@{ reload: (_ /\ setReload) ...@@ -190,9 +190,12 @@ performAction p@{ reload: (_ /\ setReload)
performAction p@{ openNodes: (_ /\ setOpenNodes) performAction p@{ openNodes: (_ /\ setOpenNodes)
, reload: (_ /\ setReload) , reload: (_ /\ setReload)
, tasks: (_ /\ setAsyncTasks)
, session , session
, tree: (NTree (LNode {id}) _) } (CreateSubmit name nodeType) = do , tree: (NTree (LNode {id}) _) } (CreateSubmit name nodeType) = do
void $ createNode session id $ CreateValue {name, nodeType} -- task <- createNodeAsync session id $ CreateValue {name, nodeType}
task <- createNode session id $ CreateValue {name, nodeType}
-- liftEffect $ setAsyncTasks $ A.cons task
liftEffect do liftEffect do
setOpenNodes (Set.insert (mkNodeId session id)) setOpenNodes (Set.insert (mkNodeId session id))
performAction p RefreshTree performAction p RefreshTree
......
...@@ -16,9 +16,12 @@ filterWithRights (show action if user can only) ...@@ -16,9 +16,12 @@ filterWithRights (show action if user can only)
-} -}
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
data Status a = IsBeta a | IsProd a
data NodeAction = Documentation NodeType data NodeAction = Documentation NodeType
| SearchBox | SearchBox
| Download | Upload | Refresh | Download | Upload | Refresh | Config
| Move | Clone | Delete | Move | Clone | Delete
| Share | Link NodeType | Share | Link NodeType
| Add (Array NodeType) | Add (Array NodeType)
...@@ -38,6 +41,7 @@ instance eqNodeAction :: Eq NodeAction where ...@@ -38,6 +41,7 @@ instance eqNodeAction :: Eq NodeAction where
eq (Link x) (Link y) = true && (x == y) eq (Link x) (Link y) = true && (x == y)
eq (Add x) (Add y) = true && (x == y) eq (Add x) (Add y) = true && (x == y)
eq CopyFromCorpus CopyFromCorpus = true eq CopyFromCorpus CopyFromCorpus = true
eq Config Config = true
eq _ _ = false eq _ _ = false
instance showNodeAction :: Show NodeAction where instance showNodeAction :: Show NodeAction where
...@@ -50,6 +54,7 @@ instance showNodeAction :: Show NodeAction where ...@@ -50,6 +54,7 @@ instance showNodeAction :: Show NodeAction where
show Clone = "Clone" show Clone = "Clone"
show Delete = "Delete" show Delete = "Delete"
show Share = "Share" show Share = "Share"
show Config = "Config"
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 CopyFromCorpus = "Copy from corpus" show CopyFromCorpus = "Copy from corpus"
...@@ -64,10 +69,11 @@ glyphiconNodeAction Upload = "upload" ...@@ -64,10 +69,11 @@ glyphiconNodeAction Upload = "upload"
glyphiconNodeAction (Link _) = "transfer" glyphiconNodeAction (Link _) = "transfer"
glyphiconNodeAction Download = "download" glyphiconNodeAction Download = "download"
glyphiconNodeAction CopyFromCorpus = "random" glyphiconNodeAction CopyFromCorpus = "random"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Config = "wrench"
glyphiconNodeAction _ = "" glyphiconNodeAction _ = ""
------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
data SettingsBox = data SettingsBox =
SettingsBox { show :: Boolean SettingsBox { show :: Boolean
...@@ -79,14 +85,14 @@ data SettingsBox = ...@@ -79,14 +85,14 @@ data SettingsBox =
settingsBox :: NodeType -> SettingsBox settingsBox :: NodeType -> SettingsBox
settingsBox NodeUser = SettingsBox { settingsBox NodeUser = SettingsBox {
show: true show : true
, edit : false , edit : false
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [ Delete ] , buttons : [ Delete ]
} }
settingsBox FolderPrivate = SettingsBox { settingsBox FolderPrivate = SettingsBox {
show: true show : true
, edit : false , edit : false
, doc : Documentation FolderPrivate , doc : Documentation FolderPrivate
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -97,7 +103,7 @@ settingsBox FolderPrivate = SettingsBox { ...@@ -97,7 +103,7 @@ settingsBox FolderPrivate = SettingsBox {
} }
settingsBox Team = SettingsBox { settingsBox Team = SettingsBox {
show: true show : true
, edit : true , edit : true
, doc : Documentation Team , doc : Documentation Team
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -108,7 +114,7 @@ settingsBox Team = SettingsBox { ...@@ -108,7 +114,7 @@ settingsBox Team = SettingsBox {
} }
settingsBox FolderShared = SettingsBox { settingsBox FolderShared = SettingsBox {
show: true show : true
, edit : true , edit : true
, doc : Documentation FolderShared , doc : Documentation FolderShared
, buttons : [ Add [Team, FolderShared] , buttons : [ Add [Team, FolderShared]
...@@ -117,7 +123,7 @@ settingsBox FolderShared = SettingsBox { ...@@ -117,7 +123,7 @@ settingsBox FolderShared = SettingsBox {
} }
settingsBox FolderPublic = SettingsBox { settingsBox FolderPublic = SettingsBox {
show: true show : true
, edit : false , edit : false
, doc : Documentation FolderPublic , doc : Documentation FolderPublic
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -126,8 +132,8 @@ settingsBox FolderPublic = SettingsBox { ...@@ -126,8 +132,8 @@ settingsBox FolderPublic = SettingsBox {
] ]
} }
settingsBox Folder = SettingsBox { settingsBox Folder =
show: true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Folder , doc : Documentation Folder
, buttons : [ Add [ Corpus , buttons : [ Add [ Corpus
...@@ -138,8 +144,8 @@ settingsBox Folder = SettingsBox { ...@@ -138,8 +144,8 @@ settingsBox Folder = SettingsBox {
] ]
} }
settingsBox Corpus = SettingsBox { settingsBox Corpus =
show: true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Corpus , doc : Documentation Corpus
, buttons : [ SearchBox , buttons : [ SearchBox
...@@ -157,45 +163,50 @@ settingsBox Corpus = SettingsBox { ...@@ -157,45 +163,50 @@ settingsBox Corpus = SettingsBox {
] ]
} }
settingsBox Texts = SettingsBox { settingsBox Texts =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Texts , doc : Documentation Texts
, buttons : [ Upload , buttons : [ Refresh
, Upload
, Download , Download
-- , Delete -- , Delete
] ]
} }
settingsBox Graph = SettingsBox { settingsBox Graph =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Graph , doc : Documentation Graph
, buttons : [ Download -- TODO as GEXF or JSON , buttons : [ Refresh
, Config
, Download -- TODO as GEXF or JSON
, Delete , Delete
] ]
} }
settingsBox NodeList = SettingsBox { settingsBox NodeList =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation NodeList , doc : Documentation NodeList
, buttons : [ Upload , buttons : [ Refresh
, CopyFromCorpus , Config
, Download , Download
-- , Delete , Upload
, CopyFromCorpus
, Delete
] ]
} }
settingsBox Dashboard = SettingsBox { settingsBox Dashboard =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Dashboard , doc : Documentation Dashboard
, buttons : [] , buttons : []
} }
settingsBox Annuaire = SettingsBox { settingsBox Annuaire =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Annuaire , doc : Documentation Annuaire
, buttons : [ Upload , buttons : [ Upload
...@@ -203,8 +214,8 @@ settingsBox Annuaire = SettingsBox { ...@@ -203,8 +214,8 @@ settingsBox Annuaire = SettingsBox {
] ]
} }
settingsBox _ = SettingsBox { settingsBox _ =
show: false SettingsBox { show : false
, edit : false , edit : false
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [] , buttons : []
......
...@@ -12,6 +12,7 @@ import Prelude hiding (div) ...@@ -12,6 +12,7 @@ import Prelude hiding (div)
import Gargantext.Components.Lang (Lang) import Gargantext.Components.Lang (Lang)
import Gargantext.Routes (SessionRoute(..)) import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, put, post, delete) import Gargantext.Sessions (Session, get, put, post, delete)
import Gargantext.Routes as GR
import Gargantext.Types as GT import Gargantext.Types as GT
data Action = CreateSubmit String GT.NodeType data Action = CreateSubmit String GT.NodeType
...@@ -61,6 +62,16 @@ type UploadFile = { ...@@ -61,6 +62,16 @@ type UploadFile = {
createNode :: Session -> ID -> CreateValue -> Aff (Array ID) createNode :: Session -> ID -> CreateValue -> Aff (Array ID)
createNode session parentId = post session $ NodeAPI GT.Node (Just parentId) "" createNode session parentId = post session $ NodeAPI GT.Node (Just parentId) ""
createNodeAsync :: Session
-> ID
-> CreateValue
-> Aff GT.AsyncTaskWithType
createNodeAsync session parentId q = do
task <- post session p q
pure $ GT.AsyncTaskWithType {task, typ: GT.CreateNode}
where
p = GR.NodeAPI GT.Node (Just parentId) (GT.asyncTaskTypePath GT.CreateNode)
renameNode :: Session -> ID -> RenameValue -> Aff (Array ID) renameNode :: Session -> ID -> RenameValue -> Aff (Array ID)
renameNode session renameNodeId = put session $ NodeAPI GT.Node (Just renameNodeId) "rename" renameNode session renameNodeId = put session $ NodeAPI GT.Node (Just renameNodeId) "rename"
......
...@@ -15,6 +15,7 @@ import Effect.Class (liftEffect) ...@@ -15,6 +15,7 @@ import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1) import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox) import Gargantext.Components.Forest.Tree.Node (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FileType(..), ID, Name, UploadFileContents(..)) import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FileType(..), ID, Name, UploadFileContents(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createNodeView) import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameBox) import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameBox)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFileView, fileTypeView, uploadTermListView, copyFromCorpusView) import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFileView, fileTypeView, uploadTermListView, copyFromCorpusView)
...@@ -27,9 +28,10 @@ import Gargantext.Ends (Frontends, url) ...@@ -27,9 +28,10 @@ import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (AppRoute) import Gargantext.Routes (AppRoute)
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId) import Gargantext.Sessions (Session, sessionId, post)
import Gargantext.Types (NodeType(..)) import Gargantext.Types (NodeType(..))
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Routes as GR
import Gargantext.Utils (glyphicon, glyphiconActive) import Gargantext.Utils (glyphicon, glyphiconActive)
import Gargantext.Utils.Popover as Popover import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -282,15 +284,15 @@ mAppRouteId (Just (Routes.FolderPublic _ id)) = Just id ...@@ -282,15 +284,15 @@ mAppRouteId (Just (Routes.FolderPublic _ id)) = Just id
mAppRouteId (Just (Routes.FolderShared _ id)) = Just id mAppRouteId (Just (Routes.FolderShared _ id)) = Just id
mAppRouteId (Just (Routes.Team _ id)) = Just id mAppRouteId (Just (Routes.Team _ id)) = Just id
mAppRouteId (Just (Routes.Corpus _ id)) = Just id mAppRouteId (Just (Routes.Corpus _ id)) = Just id
mAppRouteId (Just (Routes.Document _ id _)) = Just id
mAppRouteId (Just (Routes.CorpusDocument _ id _ _)) = Just id
mAppRouteId (Just (Routes.PGraphExplorer _ id)) = Just id mAppRouteId (Just (Routes.PGraphExplorer _ id)) = Just id
mAppRouteId (Just (Routes.Dashboard _ id)) = Just id mAppRouteId (Just (Routes.Dashboard _ id)) = Just id
mAppRouteId (Just (Routes.Texts _ id)) = Just id mAppRouteId (Just (Routes.Texts _ id)) = Just id
mAppRouteId (Just (Routes.Lists _ id)) = Just id mAppRouteId (Just (Routes.Lists _ id)) = Just id
mAppRouteId (Just (Routes.Annuaire _ id)) = Just id mAppRouteId (Just (Routes.Annuaire _ id)) = Just id
mAppRouteId (Just (Routes.UserPage _ id)) = Just id mAppRouteId (Just (Routes.UserPage _ id)) = Just id
mAppRouteId (Just (Routes.ContactPage _ id _)) = Just id mAppRouteId (Just (Routes.Document _ id _ )) = Just id
mAppRouteId (Just (Routes.ContactPage _ id _ )) = Just id
mAppRouteId (Just (Routes.CorpusDocument _ id _ _)) = Just id
mAppRouteId _ = Nothing mAppRouteId _ = Nothing
...@@ -352,10 +354,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -352,10 +354,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
] ]
] ]
where where
tooltipProps = { tooltipProps = { className : ""
className: "" , id : "node-popup-tooltip"
, id: "node-popup-tooltip" , title : "Node settings"
, title: "Node settings"
, data: { toggle: "tooltip" , data: { toggle: "tooltip"
, placement: "right"} , placement: "right"}
--, style: { top: y - 65.0, left: x + 10.0 } --, style: { top: y - 65.0, left: x + 10.0 }
...@@ -393,7 +394,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -393,7 +394,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
] ]
editIcon (true /\ _) = H.div {} [] editIcon (true /\ _) = H.div {} []
panelBody :: R.State (Record ActionState) -> Record NodePopupProps -> R.Element panelBody :: R.State (Record ActionState)
-> Record NodePopupProps
-> R.Element
panelBody nodePopupState {dispatch: d, nodeType} = panelBody nodePopupState {dispatch: d, nodeType} =
H.div {className: "panel-body flex-space-between"} H.div {className: "panel-body flex-space-between"}
[ H.div {className: "flex-center"} [buttonClick {action: doc, state: nodePopupState}] [ H.div {className: "flex-center"} [buttonClick {action: doc, state: nodePopupState}]
...@@ -403,18 +406,20 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -403,18 +406,20 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
where where
SettingsBox {edit, doc, buttons} = settingsBox nodeType SettingsBox {edit, doc, buttons} = settingsBox nodeType
mPanelAction :: R.State (Record NodePopupS) -> Record NodePopupProps -> R.State Search -> R.Element mPanelAction :: R.State (Record NodePopupS)
-> Record NodePopupProps
-> R.State Search
-> R.Element
mPanelAction ({action: Nothing} /\ _) _ _ = H.div {} [] mPanelAction ({action: Nothing} /\ _) _ _ = H.div {} []
mPanelAction ({action: Just action} /\ _) p search = mPanelAction ({action: Just action} /\ _) p search =
panelAction { panelAction { action
action , dispatch : p.dispatch
, dispatch: p.dispatch , id : p.id
, id: p.id , name : p.name
, name: p.name
, nodePopup: Just NodePopup , nodePopup: Just NodePopup
, nodeType: p.nodeType , nodeType : p.nodeType
, search , search
, session: p.session , session : p.session
} }
searchIsTexIframe {nodeType} search@(search' /\ _) iframeRef = searchIsTexIframe {nodeType} search@(search' /\ _) iframeRef =
...@@ -459,8 +464,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt ...@@ -459,8 +464,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
type ActionState = type ActionState =
( ( action :: Maybe NodeAction
action :: Maybe NodeAction
, id :: ID , id :: ID
, name :: Name , name :: Name
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
...@@ -468,8 +472,7 @@ type ActionState = ...@@ -468,8 +472,7 @@ type ActionState =
type ButtonClickProps = type ButtonClickProps =
( ( action :: NodeAction
action :: NodeAction
, state :: R.State (Record ActionState) , state :: R.State (Record ActionState)
) )
...@@ -526,64 +529,61 @@ panelAction p = R.createElement panelActionCpt p [] ...@@ -526,64 +529,61 @@ panelAction p = R.createElement panelActionCpt p []
panelActionCpt :: R.Component PanelActionProps panelActionCpt :: R.Component PanelActionProps
panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
where where
cpt {action: Documentation GT.NodeUser} _ = do cpt {action: Documentation nodeType} _ = actionDoc nodeType
pure $ R.fragment [ cpt {action: Download, id, nodeType, session} _ = actionDownload nodeType id session
H.div {style: {margin: "10px"}} [ infoTitle GT.NodeUser
, H.p {} [ H.text "This account is personal"]
, H.p {} [ H.text "See the instances terms of uses."]
]
]
cpt {action: Documentation GT.FolderPrivate} _ = do
pure $ fragmentPT "This folder and its children are private only!"
cpt {action: Documentation GT.FolderPublic} _ = do
pure $ fragmentPT "Soon, you will be able to build public folders to share your work with the world!"
cpt {action: Documentation GT.FolderShared} _ = do
pure $ fragmentPT "Soon, you will be able to build teams folders to share your work"
cpt {action: Documentation x, nodeType} _ = do
pure $ fragmentPT $ "More information on" <> show nodeType
cpt {action: Link _} _ = do
pure $ fragmentPT "Soon, you will be able to link the corpus with your Annuaire (and reciprocally)."
cpt {action: Upload, dispatch, id, nodeType: GT.NodeList, session} _ = do cpt {action: Upload, dispatch, id, nodeType: GT.NodeList, session} _ = do
pure $ uploadTermListView {dispatch, id, nodeType: GT.NodeList, session} pure $ uploadTermListView {dispatch, id, nodeType: GT.NodeList, session}
cpt {action: Upload, dispatch, id, nodeType, session} _ = do cpt {action: Upload, dispatch, id, nodeType, session} _ = do
pure $ uploadFileView {dispatch, id, nodeType, session} pure $ uploadFileView {dispatch, id, nodeType, session}
cpt {action: Download, id, nodeType: NodeList, session} _ = do
let href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
pure $ R.fragment [
H.span { className: "row" }
[ H.a { className: "col-md-12"
, href
, target: "_blank" } [ H.text "Download file" ]
]
]
cpt {action: Download} _ = do
pure $ fragmentPT "Soon, you will be able to dowload your file here"
cpt props@{action: SearchBox, search, session} _ = do cpt props@{action: SearchBox, search, session} _ = do
pure $ R.fragment [ pure $ R.fragment [ H.p {"style": {"margin" :"10px"}}
H.p {"style": {"margin" :"10px"}} [ H.text $ "Search and create a private corpus with the search query as corpus name." ] [ H.text $ "Search and create a private corpus with the search query as corpus name." ]
, searchBar {langs: allLangs, onSearch: onSearch props, search, session} , searchBar {langs: allLangs, onSearch: searchOn props, search, session}
] ]
cpt {action: Delete, nodeType: GT.NodeUser} _ = do cpt {action: Delete, nodeType: GT.NodeUser} _ = do
pure $ R.fragment [ pure $ R.fragment [
H.div {style: {margin: "10px"}} [H.text "Yes, we are RGPD compliant! But you can not delete User Node yet (we are still on development). Thanks for your comprehensin."] H.div {style: {margin: "10px"}} [H.text "Yes, we are RGPD compliant! But you can not delete User Node yet (we are still on development). Thanks for your comprehensin."]
] ]
cpt {action: Delete, dispatch} _ = do cpt {action: Delete, dispatch} _ = do
pure $ R.fragment [ pure $ R.fragment [
H.div {style: {margin: "10px"}} (map (\t -> H.p {} [H.text t]) ["Are your sure you want to delete it ?", "If yes, click again below."]) H.div {style: {margin: "10px"}} (map (\t -> H.p {} [H.text t]) ["Are your sure you want to delete it ?", "If yes, click again below."])
, reallyDelete dispatch , reallyDelete dispatch
] ]
cpt {action: Add xs, dispatch, id, name, nodePopup: p, nodeType} _ = do cpt {action: Add xs, dispatch, id, name, nodePopup: p, nodeType} _ = do
pure $ createNodeView {dispatch, id, name, nodeType, nodeTypes: xs} pure $ createNodeView {dispatch, id, name, nodeType, nodeTypes: xs}
cpt {action: CopyFromCorpus, dispatch, id, nodeType, session} _ = do cpt {action: CopyFromCorpus, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session} pure $ copyFromCorpusView {dispatch, id, nodeType, session}
cpt {action: Link _} _ = pure $ fragmentPT "Soon, you will be able to link the corpus with your Annuaire (and reciprocally)."
{-
cpt {action: Refresh, nodeType: GT.Graph, id, session} _ = do
pure $ H.div {className: "panel-footer"}
[ H.a { type: "button"
, className: "btn glyphicon glyphicon-trash"
, id: "delete"
, title: "Delete"
, on: {click: \_ -> post session (GR.GraphAPI id $ GT.asyncTaskTypePath GT.GraphT) {}
-- TODO pure $ GT.AsyncTaskWithType { task, typ: GT.GraphT }
}
}
[H.text " Yes, delete!"]
]
--}
cpt _ _ = do cpt _ _ = do
pure $ H.div {} [] pure $ H.div {} []
fragmentPT text = H.div {style: {margin: "10px"}} [H.text text]
onSearch :: Record PanelActionProps -> GT.AsyncTaskWithType -> Effect Unit searchOn :: Record PanelActionProps -> GT.AsyncTaskWithType -> Effect Unit
onSearch {dispatch, nodePopup: p} task = do searchOn {dispatch, nodePopup: p} task = do
_ <- launchAff $ dispatch (SearchQuery task) _ <- launchAff $ dispatch (SearchQuery task)
-- close popup -- close popup
-- TODO -- TODO
...@@ -591,11 +591,6 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt ...@@ -591,11 +591,6 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
pure unit pure unit
infoTitle :: GT.NodeType -> R.Element
infoTitle nt = H.div {style: {margin: "10px"}} [ H.h3 {} [H.text "Documentation about " ]
, H.h3 {className: GT.fldr nt true} [ H.text $ show nt ]
]
reallyDelete :: Dispatch -> R.Element reallyDelete :: Dispatch -> R.Element
reallyDelete d = H.div {className: "panel-footer"} reallyDelete d = H.div {className: "panel-footer"}
[ H.a { type: "button" [ H.a { type: "button"
...@@ -606,3 +601,90 @@ reallyDelete d = H.div {className: "panel-footer"} ...@@ -606,3 +601,90 @@ reallyDelete d = H.div {className: "panel-footer"}
} }
[H.text " Yes, delete!"] [H.text " Yes, delete!"]
] ]
-- | Action : Upload
-- | Action : Download
actionDownload :: NodeType -> ID -> Session -> R.Hooks R.Element
actionDownload NodeList id session = downloadButton href label info
where
href = url session $ Routes.NodeAPI GT.NodeList (Just id) ""
label = "Download List"
info = "Info about the List as JSON format"
actionDownload GT.Graph id session = downloadButton href label info
where
href = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
label = "Download Graph"
info = "Info about the Graph as GEXF format"
actionDownload GT.Corpus id session = downloadButton href label info
where
href = url session $ Routes.NodeAPI GT.Corpus (Just id) "export"
label = "Download Corpus"
info = "TODO: fix the backend route"
actionDownload GT.Texts id session = downloadButton href label info
where
href = url session $ Routes.NodeAPI GT.Texts (Just id) ""
label = "Download texts"
info = "TODO: fix the backend route. What is the expected result ?"
actionDownload _ _ _ = pure $ fragmentPT $ "Soon, you will be able to dowload your file here "
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 ]
]
]
]
]
-- | Action: Show Documentation
actionDoc :: NodeType -> R.Hooks R.Element
actionDoc nodeType =
pure $ R.fragment [ H.div { style: {margin: "10px"} }
$ [ infoTitle nodeType ]
<> (map (\info -> H.p {} [H.text info]) $ docOf nodeType)
]
where
infoTitle :: NodeType -> R.Element
infoTitle nt = H.div { style: {margin: "10px"}}
[ H.h3 {} [H.text "Documentation about " ]
, H.h3 {className: GT.fldr nt true} [ H.text $ show nt ]
]
-- | TODO add documentation of all NodeType
docOf :: NodeType -> Array String
docOf GT.NodeUser = [ "This account is personal"
, "See the instances terms of uses."
]
docOf GT.FolderPrivate = ["This folder and its children are private only."]
docOf GT.FolderPublic = ["Soon, you will be able to build public folders to share your work with the world!"]
docOf GT.FolderShared = ["Soon, you will be able to build teams folders to share your work"]
docOf nodeType = ["More information on " <> show nodeType]
fragmentPT text = H.div {style: {margin: "10px"}} [H.text text]
...@@ -69,11 +69,6 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt ...@@ -69,11 +69,6 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
[ RH.div { className: "", role: "tabpanel" } [ RH.div { className: "", role: "tabpanel" }
(Seq.toUnfoldable $ (Seq.map (badge props.selectedNodeIds) (badges props.graph props.selectedNodeIds))) (Seq.toUnfoldable $ (Seq.map (badge props.selectedNodeIds) (badges props.graph props.selectedNodeIds)))
] ]
, RH.div { className: "gexf" } [
RH.a { className: "btn btn-default"
, href: gexfHref props.session props.graphId
, target: "_blank" } [ RH.text "Download GEXF" ]
]
, RH.div { className: "tab-content" } , RH.div { className: "tab-content" }
[ [
removeButton "Remove candidate" CandidateTerm props nodesMap removeButton "Remove candidate" CandidateTerm props nodesMap
...@@ -138,9 +133,6 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt ...@@ -138,9 +133,6 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
snd props.removedNodeIds $ const $ fst props.selectedNodeIds snd props.removedNodeIds $ const $ fst props.selectedNodeIds
snd props.selectedNodeIds $ const SigmaxT.emptyNodeIds snd props.selectedNodeIds $ const SigmaxT.emptyNodeIds
gexfHref :: Session -> Int -> String
gexfHref session graphId = url session $ Routes.NodeAPI GT.Graph (Just graphId) "gexf"
badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element badge :: R.State SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
badge (_ /\ setNodeIds) {id, label} = badge (_ /\ setNodeIds) {id, label} =
......
...@@ -167,7 +167,7 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where ...@@ -167,7 +167,7 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
[ cardGroup [ cardGroup
[ cardBlock [ cardBlock
[ center [ center
[ H.div {className: "text-muted"} [ H.div {}{-className: "text-muted"-}
[ H.text $ "Login to garg://" <> show backend] [ H.text $ "Login to garg://" <> show backend]
, requestAccessLink {} , requestAccessLink {}
] ]
...@@ -178,7 +178,13 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where ...@@ -178,7 +178,13 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where
, center , center
[ H.label {} [ H.label {}
[ H.div {className: "checkbox"} [ H.div {className: "checkbox"}
[ termsCheckbox setBox , H.text "I accept the terms of use ", termsLink {} ] ] [ termsCheckbox setBox
, H.text "I hereby accept "
, H.a { target: "_blank"
, href: "http://gitlab.iscpif.fr/humanities/tofu/tree/master"
} [ H.text "the terms of use" ]
]
]
] ]
] ]
, if checkBox == true , if checkBox == true
...@@ -216,7 +222,7 @@ termsCheckbox setCheckBox = ...@@ -216,7 +222,7 @@ termsCheckbox setCheckBox =
termsLink :: {} -> R.Element termsLink :: {} -> R.Element
termsLink _ = termsLink _ =
H.a { target: "_blank", href: termsUrl } [ H.text " [Read the terms of use]" ] H.a { target: "_blank", href: termsUrl } [ H.text "the terms of use" ]
where termsUrl = "http://gitlab.iscpif.fr/humanities/tofu/tree/master" where termsUrl = "http://gitlab.iscpif.fr/humanities/tofu/tree/master"
requestAccessLink :: {} -> R.Element requestAccessLink :: {} -> R.Element
......
...@@ -464,13 +464,14 @@ modeFromString _ = Nothing ...@@ -464,13 +464,14 @@ modeFromString _ = Nothing
-- Async tasks -- Async tasks
-- corresponds to /add/form/async or /add/query/async -- corresponds to /add/form/async or /add/query/async
data AsyncTaskType = Form | GraphT | Query data AsyncTaskType = Form | GraphT | Query | CreateNode
derive instance genericAsyncTaskType :: Generic AsyncTaskType _ derive instance genericAsyncTaskType :: Generic AsyncTaskType _
asyncTaskTypePath :: AsyncTaskType -> String asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath Form = "add/form/async/" asyncTaskTypePath Form = "add/form/async/"
asyncTaskTypePath Query = "query/" asyncTaskTypePath Query = "query/"
asyncTaskTypePath GraphT = "async/" asyncTaskTypePath GraphT = "async/"
asyncTaskTypePath CreateNode = "async/nobody/"
type AsyncTaskID = String type AsyncTaskID = String
......
module Gargantext.BootstrapNative where module Gargantext.Utils.BootstrapNative where
import Effect (Effect) import Effect (Effect)
......
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