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
0df854d6
Commit
0df854d6
authored
Dec 02, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Annuaire] Route of Table changed, need to adapt NodeContact type.
parent
1acb85b6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
71 additions
and
25 deletions
+71
-25
Config.purs
src/Gargantext/Config.purs
+48
-14
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+2
-2
Renders.purs
...argantext/Pages/Annuaire/User/Contacts/Specs/Renders.purs
+7
-6
Types.purs
src/Gargantext/Pages/Annuaire/User/Contacts/Types.purs
+3
-1
Layout.purs
src/Gargantext/Pages/Layout.purs
+5
-0
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+3
-2
Router.purs
src/Gargantext/Router.purs
+3
-0
No files found.
src/Gargantext/Config.purs
View file @
0df854d6
...
...
@@ -105,6 +105,12 @@ pathUrl c (Tab t o l s) i =
<> "&limit=" <> show l <> os
where
os = maybe "" (\x -> "&order=" <> show x) s
pathUrl c (Children n o l s) i =
pathUrl c (NodeAPI Node) i <>
"/" <> "children?type=" <> show n <> "&offset=" <> show o
<> "&limit=" <> show l <> os
where
os = maybe "" (\x -> "&order=" <> show x) s
pathUrl c (Ngrams t listid) i =
pathUrl c (NodeAPI Node) i <> "/" <> "listGet?ngramsType=" <> show t <> listid'
where
...
...
@@ -112,6 +118,9 @@ pathUrl c (Ngrams t listid) i =
pathUrl c Auth Nothing = c.prePath <> "auth"
pathUrl c Auth (Just _) = "impossible" -- TODO better types
pathUrl c (NodeAPI nt) i = c.prePath <> nodeTypeUrl nt <> (maybe "" (\i' -> "/" <> show i') i)
------------------------------------------------------------
class ToUrl a where
...
...
@@ -130,7 +139,9 @@ instance toUrlPath :: ToUrl Path where
data NodeType = NodeUser
| Annuaire
| NodeContact
| Corpus
-- | NodeDocument
| CorpusV3
| Dashboard
| Url_Document
...
...
@@ -142,9 +153,30 @@ data NodeType = NodeUser
| Nodes
| Tree
instance showNodeType :: Show NodeType where
show NodeUser = "NodeUser"
show Annuaire = "Annuaire"
show NodeContact = "NodeDocument"
show Corpus = "NodeCorpus"
show CorpusV3 = "NodeCorpusV3"
show Dashboard = "NodeDashboard"
show Url_Document = "NodeDashboard"
--show NodeDocument = "NodeDocument"
show Error = "NodeError"
show Folder = "NodeFolder"
show Graph = "NodeGraph"
show Individu = "NodeIndividu"
show Node = "Node"
show Nodes = "Nodes"
show Tree = "NodeTree"
data Path
= Auth
| Tab TabType Offset Limit (Maybe OrderBy)
| Tab TabType Offset Limit (Maybe OrderBy)
| Children NodeType Offset Limit (Maybe OrderBy)
| Ngrams TabType (Maybe TermList)
| NodeAPI NodeType
...
...
@@ -193,22 +225,24 @@ nodeTypeUrl Individu = "individu"
nodeTypeUrl Node = "node"
nodeTypeUrl Nodes = "nodes"
nodeTypeUrl NodeUser = "user"
nodeTypeUrl NodeContact = "contact"
nodeTypeUrl Tree = "tree"
readNodeType :: String -> NodeType
readNodeType "NodeAnnuaire" = Annuaire
readNodeType "NodeDashboard" = Dashboard
readNodeType "Document" = Url_Document
readNodeType "NodeFolder" = Folder
readNodeType "NodeGraph" = Graph
readNodeType "Individu" = Individu
readNodeType "Node" = Node
readNodeType "Nodes" = Nodes
readNodeType "NodeCorpus" = Corpus
readNodeType "NodeCorpusV3" = CorpusV3
readNodeType "NodeUser" = NodeUser
readNodeType "Tree" = Tree
readNodeType _ = Error
readNodeType "NodeAnnuaire" = Annuaire
readNodeType "NodeDashboard" = Dashboard
readNodeType "Document" = Url_Document
readNodeType "NodeFolder" = Folder
readNodeType "NodeGraph" = Graph
readNodeType "Individu" = Individu
readNodeType "Node" = Node
readNodeType "Nodes" = Nodes
readNodeType "NodeCorpus" = Corpus
readNodeType "NodeCorpusV3" = CorpusV3
readNodeType "NodeUser" = NodeUser
readNodeType "NodeContact" = NodeContact
readNodeType "Tree" = Tree
readNodeType _ = Error
{-
------------------------------------------------------------
instance ordNodeType :: Ord NodeType where
...
...
src/Gargantext/Pages/Annuaire.purs
View file @
0df854d6
...
...
@@ -168,7 +168,7 @@ renderContactCells :: Maybe Contact -> Array ReactElement
renderContactCells Nothing = []
renderContactCells (Just (Contact { id, hyperdata : (HyperdataContact contact) })) =
[ text ""
, a [ href (toUrl Front Node
User
(Just id)) ] [ text $ maybe "name" identity contact.title ]
, a [ href (toUrl Front Node
Contact
(Just id)) ] [ text $ maybe "name" identity contact.title ]
, text $ maybe "ecole" identity contact.source
, text "" -- $ maybe' contact.groupe
, text "" -- $ maybe' contact.groupe
...
...
@@ -226,7 +226,7 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where
pure $ AnnuaireTable { annuaireTable : rows}
------------------------------------------------------------------------
loadPage :: PageParams -> Aff AnnuaireTable
loadPage {nodeId, params} = get $ toUrl Back (
Tab TabDocs
0 10 Nothing) (Just nodeId)
loadPage {nodeId, params} = get $ toUrl Back (
Children NodeContact
0 10 Nothing) (Just nodeId)
-- TODO Tab TabDocs is not the right API call
-- TODO params, see loadPage in Documents
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Specs/Renders.purs
View file @
0df854d6
...
...
@@ -12,7 +12,7 @@ import Data.Unfoldable (class Unfoldable)
import Prelude (identity)
import Prelude (($), (<<<), (<$>), flip, class Ord)
import React (ReactElement)
import React.DOM (div, h3, img, li, span, text, ul)
import React.DOM (div, h3, img, li, span, text, ul
, text
)
import React.DOM.Props (_id, className, src)
import Thermite (Render)
...
...
@@ -38,7 +38,8 @@ display title elems =
[ div [className "col-md-12"]
[ div [className "row"]
[ div [className "col-md-2"]
[ img [src "/images/Gargantextuel-212x300.jpg"] ]
[ ]
-- [ img [src "/images/Gargantextuel-212x300.jpg"] ]
, div [className "col-md-1"] []
, div [className "col-mdData.Unfoldable-8"] elems
]
...
...
@@ -56,8 +57,8 @@ mapMyMap f m = toUnfoldable
infixl 4 mapMyMap as <.~$>
contactInfos :: HyperdataContact -> ReactElement
contactInfos
hyperdata
=
ul [className "list-group"] []
{- $
contactInfos
(HyperdataContact hyperdata)
=
ul [className "list-group"] (infoRender (Tuple "Name" $ maybe "no title" identity hyperdata.role))
{- $
listInfo <.~$> hyperdata
where
checkMaybe (Nothing) = empty
...
...
@@ -72,6 +73,6 @@ listElement = li [className "list-group-item justify-content-between"]
infoRender :: Tuple String String -> Array ReactElement
infoRender (Tuple title content) =
[ span [] [text title]
, span [
className "badge badge-default badge-pill"
] [text content]
[ span [
className "badge badge-default badge-pill"
] [text title]
, span [] [text content]
]
src/Gargantext/Pages/Annuaire/User/Contacts/Types.purs
View file @
0df854d6
...
...
@@ -30,6 +30,7 @@ data HyperdataContact =
, uniqIdBdd :: Maybe String
, title :: Maybe String
, source :: Maybe String
, role :: Maybe String
}
instance decodeHyperdataContact :: DecodeJson HyperdataContact
...
...
@@ -41,7 +42,8 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
uniqIdBdd <- obj .?? "uniqIdBdd"
title <- obj .?? "title"
source <- obj .?? "source"
pure $ HyperdataContact {bdd, uniqId, uniqIdBdd, title, source}
role <- obj .?? "role"
pure $ HyperdataContact {bdd, uniqId, uniqIdBdd, title, source, role}
data HyperData c s =
...
...
src/Gargantext/Pages/Layout.purs
View file @
0df854d6
...
...
@@ -43,6 +43,11 @@ dispatchAction dispatcher _ (UserPage id) = do
-- dispatcher $ UserPageA TODO
dispatcher $ UserPageA $ C.FetchContact id
dispatchAction dispatcher _ (ContactPage id) = do
dispatcher $ SetRoute $ ContactPage id
-- dispatcher $ UserPageA TODO
dispatcher $ UserPageA $ C.FetchContact id
dispatchAction dispatcher _ (Annuaire id) = do
dispatcher $ SetRoute $ Annuaire id
...
...
src/Gargantext/Pages/Layout/Specs.purs
View file @
0df854d6
...
...
@@ -58,12 +58,13 @@ pagesComponent s = case s.currentRoute of
selectSpec (Corpus i) = layout0 $ cmapProps (const {nodeId: i}) $ noState Corpus.layout
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec (Document i) = layout0 $ focus _documentViewState _documentViewAction Annotation.docview
selectSpec (PGraphExplorer i)
= layout1 $
focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec (Document i)
= layout0 $ focus _documentViewState _documentViewAction Annotation.docview
selectSpec (PGraphExplorer i)
= layout1 $
focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
selectSpec (UserPage i) = layout0 $ focus _userPageState _userPageAction C.layoutUser
selectSpec (ContactPage i) = layout0 $ focus _userPageState _userPageAction C.layoutUser
-- selectSpec _ = simpleSpec defaultPerformAction defaultRender
...
...
src/Gargantext/Router.purs
View file @
0df854d6
...
...
@@ -24,6 +24,7 @@ data Routes
| Dashboard
| Annuaire Int
| UserPage Int
| ContactPage Int
routing :: Match Routes
routing =
...
...
@@ -37,6 +38,7 @@ routing =
<|> PGraphExplorer <$> (route "graph" *> int )
<|> Annuaire <$> (route "annuaire" *> int)
<|> UserPage <$> (route "user" *> int)
<|> ContactPage <$> (route "contact" *> int)
<|> Home <$ lit ""
where
...
...
@@ -50,6 +52,7 @@ instance showRoutes :: Show Routes where
show AddCorpus = "AddCorpus"
show SearchView = "Search"
show (UserPage i) = "User" <> show i
show (ContactPage i) = "Contact" <> show i
show (Document i) = "Document"
show (Corpus i) = "Corpus" <> show i
show (Annuaire i) = "Annuaire" <> show i
...
...
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