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
c3e4b105
Commit
c3e4b105
authored
Dec 04, 2018
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
partial user profile
parent
113500f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
15 deletions
+50
-15
Config.purs
src/Gargantext/Config.purs
+1
-1
Renders.purs
...argantext/Pages/Annuaire/User/Contacts/Specs/Renders.purs
+34
-7
Types.purs
src/Gargantext/Pages/Annuaire/User/Contacts/Types.purs
+15
-7
No files found.
src/Gargantext/Config.purs
View file @
c3e4b105
...
...
@@ -25,7 +25,7 @@ endConfig = endConfig' V10
endConfig' :: ApiVersion -> EndConfig
endConfig' v = { front : frontRelative
, back : back
Local v
}
, back : back
Dev v
}
------------------------------------------------------------------------
frontRelative :: Config
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Specs/Renders.purs
View file @
c3e4b105
...
...
@@ -5,7 +5,7 @@ import Gargantext.Pages.Annuaire.User.Contacts.Types
import Data.List (List, zipWith, catMaybes, toUnfoldable)
import Data.Map (Map, empty, keys, values, lookup)
import Data.Maybe (Maybe(..),
m
aybe)
import Data.Maybe (Maybe(..),
fromM
aybe)
import Data.Set (toUnfoldable) as S
import Data.Tuple (Tuple(..), uncurry)
import Data.Unfoldable (class Unfoldable)
...
...
@@ -15,14 +15,15 @@ import React (ReactElement)
import React.DOM (div, h3, img, li, span, text, ul, text)
import React.DOM.Props (_id, className, src)
import Thermite (Render)
import Data.Newtype (unwrap)
import Data.String
render :: Render State {} Action
render dispatch _ state _ =
[
div [className "col-md-12"]
$ case state.contact of
(Just (Contact contact)) -> display (
maybe "no name" identity
contact.name) (contactInfos contact.hyperdata)
(Just (Contact contact)) -> display (
fromMaybe "no name"
contact.name) (contactInfos contact.hyperdata)
Nothing -> display "Contact not found" []
]
...
...
@@ -41,7 +42,7 @@ display title elems =
--[ ]
[ img [src "/images/Gargantextuel-212x300.jpg"] ]
, div [className "col-md-1"] []
, div [className "col-md
Data.Unfoldable
-8"] elems
, div [className "col-md-8"] elems
]
]
]
...
...
@@ -56,10 +57,36 @@ mapMyMap f m = toUnfoldable
infixl 4 mapMyMap as <.~$>
getFirstName obj = fromMaybe "no title" $ getFirstName' <$> obj
getFirstName' = fromMaybe "no first name" <<< _.firstName <<< unwrap
getLastName obj = fromMaybe "no title" $ getLastName' <$> obj
getLastName' = fromMaybe "no last name" <<< _.lastName <<< unwrap
getRole obj = joinWith ", " $ getRole' <$> (fromMaybe [] obj)
getRole' = fromMaybe "no role" <<< _.role <<< unwrap
-- getTouch :: Maybe (Array ContactWhere) -> Array ContactTouch
-- getTouch obj = (_.touch <<< unwrap) <$>
-- where
-- ary = fromMaybe [] obj
-- getPhone :: Maybe (Array ContactWhere) -> String
-- getPhone obj = fromMaybe "" $ getPhone' <$> (getTouch obj)
-- getPhone' :: ContactTouch -> String
-- getPhone' = fromMaybe "no phone" <<< _.phone <<< unwrap
-- getMail obj = fromMaybe "" $ getMail' <$> (getTouch obj)
-- getMail' = fromMaybe "no mail" <<< _.mail <<< unwrap
contactInfos :: HyperdataContact -> Array ReactElement
contactInfos (HyperdataContact {who:who,ou:ou}) =
[ ul [className "list-group"] (infoRender (Tuple "Last Name" $ maybe "no title" (\(ContactWho {lastName:lastName}) -> maybe "no lastName" identity lastName) who))
, ul [className "list-group"] (infoRender (Tuple "First name" $ maybe "no title" (\(ContactWho {firstName:firstName}) -> maybe "no firstName" identity firstName) who))
contactInfos (HyperdataContact {who:who, ou:ou}) =
[ ul [className "list-group"] (infoRender (Tuple "Last Name" $ getLastName who))
, ul [className "list-group"] (infoRender (Tuple "First name" $ getFirstName who))
, ul [className "list-group"] (infoRender (Tuple "Role" $ getRole ou))
-- , ul [className "list-group"] (infoRender (Tuple "Phone" $ getPhone "Phone" ou))
-- , ul [className "list-group"] (infoRender (Tuple "Mail" $ getMail "Mail"))
]
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Types.purs
View file @
c3e4b105
...
...
@@ -13,8 +13,9 @@ import React.DOM (div)
import Gargantext.Components.Tab as Tab
import Gargantext.Utils.DecodeMaybe ((.?|))
import Data.Newtype
data
Contact = Contact {
newtype
Contact = Contact {
id :: Int
, typename :: Maybe Int
, userId :: Maybe Int
...
...
@@ -24,7 +25,9 @@ data Contact = Contact {
, hyperdata :: HyperdataContact
}
data ContactWho =
derive instance newtypeContact :: Newtype Contact _
newtype ContactWho =
ContactWho { idWho :: Maybe String
, firstName :: Maybe String
, lastName :: Maybe String
...
...
@@ -32,6 +35,8 @@ data ContactWho =
, freetags :: Maybe (Array String)
}
derive instance newtypeContactWho :: Newtype ContactWho _
instance decodeContactWho :: DecodeJson ContactWho
where
decodeJson json = do
...
...
@@ -43,7 +48,7 @@ instance decodeContactWho :: DecodeJson ContactWho
freetags <- obj .?? "freetags"
pure $ ContactWho {idWho, firstName, lastName, keywords, freetags}
data
ContactWhere =
newtype
ContactWhere =
ContactWhere { organization :: Maybe (Array String)
, labTeamDepts :: Maybe (Array String)
...
...
@@ -58,7 +63,7 @@ data ContactWhere =
, entry :: Maybe String
, exit :: Maybe String
}
derive instance newtypeContactWhere :: Newtype ContactWhere _
instance decodeContactWhere :: DecodeJson ContactWhere
where
...
...
@@ -75,11 +80,12 @@ instance decodeContactWhere :: DecodeJson ContactWhere
exit <- obj .?? "exit"
pure $ ContactWhere {organization, labTeamDepts, role, office, country, city, touch, entry, exit}
data
ContactTouch =
newtype
ContactTouch =
ContactTouch { mail :: Maybe String
, phone :: Maybe String
, url :: Maybe String
}
derive instance newtypeContactTouch :: Newtype ContactTouch _
instance decodeContactTouch :: DecodeJson ContactTouch
where
...
...
@@ -91,7 +97,7 @@ instance decodeContactTouch :: DecodeJson ContactTouch
pure $ ContactTouch {mail, phone, url}
data
HyperdataContact =
newtype
HyperdataContact =
HyperdataContact { bdd :: Maybe String
, who :: Maybe ContactWho
, ou :: Maybe (Array ContactWhere)
...
...
@@ -101,6 +107,7 @@ data HyperdataContact =
, uniqId :: Maybe String
, uniqIdBdd :: Maybe String
}
derive instance newtypeHyperdataContact :: Newtype HyperdataContact _
instance decodeHyperdataContact :: DecodeJson HyperdataContact
where
...
...
@@ -114,10 +121,11 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
lastValidation <- obj .?? "lastValidation"
uniqId <- obj .?? "uniqId"
uniqIdBdd <- obj .?? "uniqIdBdd"
pure $ HyperdataContact {bdd, who, ou, title, source, lastValidation, uniqId, uniqIdBdd}
data
HyperData c s =
newtype
HyperData c s =
HyperData
{ common :: c
, shared :: s
...
...
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