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

[MERGE] fix with dev

parents bbd5a4e5 657b356f
...@@ -189,10 +189,13 @@ performAction p@{ reload: (_ /\ setReload) ...@@ -189,10 +189,13 @@ performAction p@{ reload: (_ /\ setReload)
performAction p RefreshTree performAction p RefreshTree
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)
...@@ -36,8 +39,9 @@ instance eqNodeAction :: Eq NodeAction where ...@@ -36,8 +39,9 @@ instance eqNodeAction :: Eq NodeAction where
eq Delete Delete = true eq Delete Delete = true
eq Share Share = true eq Share Share = true
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,86 +132,91 @@ settingsBox FolderPublic = SettingsBox { ...@@ -126,86 +132,91 @@ 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
, Folder , Folder
, Annuaire , Annuaire
] ]
, Delete , Delete
] ]
} }
settingsBox Corpus = SettingsBox { settingsBox Corpus =
show: true SettingsBox { show : true
, edit : true , edit : true
, doc : Documentation Corpus , doc : Documentation Corpus
, buttons : [ SearchBox , buttons : [ SearchBox
, Add [ NodeList , Add [ NodeList
, Graph , Graph
, Dashboard , Dashboard
] ]
, Upload , Upload
, Download , Download
--, Share --, Share
--, Move --, Move
--, Clone --, Clone
, Link Annuaire , Link Annuaire
, Delete , Delete
] ]
} }
settingsBox Texts = SettingsBox { settingsBox Texts =
show: true SettingsBox { show : true
, edit : false , edit : false
, doc : Documentation Texts , doc : Documentation Texts
, buttons : [ Upload , buttons : [ Refresh
, Download , Upload
-- , Delete , Download
] -- , 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
, Delete , Config
] , Download -- TODO as GEXF or JSON
} , 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
, Delete , Delete
] ]
} }
settingsBox _ = SettingsBox { settingsBox _ =
show: false SettingsBox { show : false
, edit : false , edit : false
, doc : Documentation NodeUser , doc : Documentation NodeUser
, buttons : [] , buttons : []
} }
...@@ -12,7 +12,8 @@ import Prelude hiding (div) ...@@ -12,7 +12,8 @@ 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.Types as GT import Gargantext.Routes as GR
import Gargantext.Types as GT
data Action = CreateSubmit String GT.NodeType data Action = CreateSubmit String GT.NodeType
| DeleteNode | DeleteNode
...@@ -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"
......
...@@ -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,19 +167,25 @@ formCpt = R.hooksComponent "G.C.Login.form" cpt where ...@@ -167,19 +167,25 @@ 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 {}
] ]
, H.div {} , H.div {}
[ csrfTokenInput {} [ csrfTokenInput {}
, formGroup [ H.p {} [ H.text (fst error) ], usernameInput username ] , formGroup [ H.p {} [ H.text (fst error) ], usernameInput username ]
, formGroup [ passwordInput password, clearfix {} ] , formGroup [ passwordInput password, clearfix {} ]
, 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
&& fst username /= "" && fst username /= ""
...@@ -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
......
...@@ -47,21 +47,21 @@ data SessionRoute ...@@ -47,21 +47,21 @@ data SessionRoute
instance showAppRoute :: Show AppRoute where instance showAppRoute :: Show AppRoute where
show Home = "Home" show Home = "Home"
show Login = "Login" show Login = "Login"
show (Folder s i) = "Folder" <> show i <> " (" <> show s <> ")" show (Folder s i) = "Folder" <> show i <> " (" <> show s <> ")"
show (FolderPrivate s i) = "FolderPrivate" <> show i <> " (" <> show s <> ")" show (FolderPrivate s i) = "FolderPrivate" <> show i <> " (" <> show s <> ")"
show (FolderPublic s i) = "FolderPublic" <> show i <> " (" <> show s <> ")" show (FolderPublic s i) = "FolderPublic" <> show i <> " (" <> show s <> ")"
show (FolderShared s i) = "FolderShared" <> show i <> " (" <> show s <> ")" show (FolderShared s i) = "FolderShared" <> show i <> " (" <> show s <> ")"
show (Team s i) = "Team" <> show i <> " (" <> show s <> ")" show (Team s i) = "Team" <> show i <> " (" <> show s <> ")"
show (Corpus s i) = "Corpus" <> show i <> " (" <> show s <> ")" show (Corpus s i) = "Corpus" <> show i <> " (" <> show s <> ")"
show (Document _ s i) = "Document" <> show i <> " (" <> show s <> ")" show (Document _ s i) = "Document" <> show i <> " (" <> show s <> ")"
show (CorpusDocument s _ _ i) = "CorpusDocument" <> show i <> " (" <> show s <> ")" show (CorpusDocument s _ _ i) = "CorpusDocument" <> show i <> " (" <> show s <> ")"
show (PGraphExplorer s i) = "graphExplorer" <> show i <> " (" <> show s <> ")" show (PGraphExplorer s i) = "graphExplorer" <> show i <> " (" <> show s <> ")"
show (Dashboard s i) = "Dashboard" <> show i <> " (" <> show s <> ")" show (Dashboard s i) = "Dashboard" <> show i <> " (" <> show s <> ")"
show (Texts s i) = "texts" <> show i <> " (" <> show s <> ")" show (Texts s i) = "texts" <> show i <> " (" <> show s <> ")"
show (Lists s i) = "lists" <> show i <> " (" <> show s <> ")" show (Lists s i) = "lists" <> show i <> " (" <> show s <> ")"
show (Annuaire s i) = "Annuaire" <> show i <> " (" <> show s <> ")" show (Annuaire s i) = "Annuaire" <> show i <> " (" <> show s <> ")"
show (UserPage s i) = "User" <> show i <> " (" <> show s <> ")" show (UserPage s i) = "User" <> show i <> " (" <> show s <> ")"
show (ContactPage s a i) = "Contact" <> show a <> "::" <> show i <> " (" <> show s <> ")" show (ContactPage s a i) = "Contact" <> show a <> "::" <> show i <> " (" <> show s <> ")"
appPath :: AppRoute -> String appPath :: AppRoute -> String
appPath Home = "" appPath Home = ""
......
...@@ -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