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
00098c86
Commit
00098c86
authored
3 years ago
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GraphQL] user fetched via the user_info endpoint
parent
2dab4e56
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
449 additions
and
312 deletions
+449
-312
GraphQL.purs
src/Gargantext/Components/GraphQL.purs
+3
-2
User.purs
src/Gargantext/Components/GraphQL/User.purs
+119
-34
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+14
-14
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+21
-177
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+283
-75
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+9
-10
No files found.
src/Gargantext/Components/GraphQL.purs
View file @
00098c86
...
...
@@ -6,7 +6,7 @@ import Data.List.Types (NonEmptyList)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Foreign (unsafeToForeign, ForeignError)
import Gargantext.Components.GraphQL.User (User)
import Gargantext.Components.GraphQL.User (User
, UserInfo
)
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.Args (type (==>))
...
...
@@ -53,5 +53,6 @@ queryGql name q = do
-- Schema
type Schema
= { users :: { user_id :: Int } ==> Array User
= { user_infos :: { user_id :: Int } ==> Array UserInfo
, users :: { user_id :: Int } ==> Array User
}
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/GraphQL/User.purs
View file @
00098c86
module Gargantext.Components.GraphQL.User where
import Data.Maybe (Maybe(..), maybe)
import Data.Array as A
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Gargantext.Prelude
import Type.Proxy (Proxy(..))
type UserInfo
= { ui_id :: Int
, ui_username :: String
, ui_email :: String
, ui_title :: Maybe String
, ui_source :: Maybe String
, ui_cwFirstName :: Maybe String
, ui_cwLastName :: Maybe String
, ui_cwOrganization :: Array String
, ui_cwLabTeamDepts :: Array String
, ui_cwOffice :: Maybe String
, ui_cwCity :: Maybe String
, ui_cwCountry :: Maybe String
, ui_cwRole :: Maybe String
, ui_cwTouchPhone :: Maybe String
, ui_cwTouchMail :: Maybe String }
_ui_cwFirstName :: Lens' UserInfo String
_ui_cwFirstName = lens getter setter
where
getter ({ ui_cwFirstName: val }) = fromMaybe "" val
setter ui val = ui { ui_cwFirstName = Just val }
_ui_cwLastName :: Lens' UserInfo String
_ui_cwLastName = lens getter setter
where
getter ({ ui_cwLastName: val }) = fromMaybe "" val
setter ui val = ui { ui_cwLastName = Just val }
_ui_cwCity :: Lens' UserInfo String
_ui_cwCity = lens getter setter
where
getter ({ ui_cwCity: val }) = fromMaybe "" val
setter ui val = ui { ui_cwCity = Just val }
_ui_cwCountry :: Lens' UserInfo String
_ui_cwCountry = lens getter setter
where
getter ({ ui_cwCountry: val }) = fromMaybe "" val
setter ui val = ui { ui_cwCountry = Just val }
_ui_cwLabTeamDepts :: Lens' UserInfo (Array String)
_ui_cwLabTeamDepts = lens getter setter
where
getter ({ ui_cwLabTeamDepts: val }) = val
setter ui val = ui { ui_cwLabTeamDepts = val }
_ui_cwLabTeamDeptsFirst :: Lens' UserInfo String
_ui_cwLabTeamDeptsFirst = lens getter setter
where
getter ({ ui_cwLabTeamDepts: val }) = fromMaybe "" $ A.head val
setter ui val = ui { ui_cwLabTeamDepts = fromMaybe [val] $ A.updateAt 0 val ui.ui_cwLabTeamDepts }
_ui_cwOffice :: Lens' UserInfo String
_ui_cwOffice = lens getter setter
where
getter ({ ui_cwOffice: val }) = fromMaybe "" val
setter ui val = ui { ui_cwOffice = Just val }
_ui_cwOrganization :: Lens' UserInfo (Array String)
_ui_cwOrganization = lens getter setter
where
getter ({ ui_cwOrganization: val }) = val
setter ui val = ui { ui_cwOrganization = val }
_ui_cwOrganizationFirst :: Lens' UserInfo String
_ui_cwOrganizationFirst = lens getter setter
where
getter ({ ui_cwOrganization: val }) = fromMaybe "" $ A.head val
setter ui val = ui { ui_cwOrganization = fromMaybe [val] $ A.updateAt 0 val ui.ui_cwOrganization }
_ui_cwRole :: Lens' UserInfo String
_ui_cwRole = lens getter setter
where
getter ({ ui_cwRole: val }) = fromMaybe "" val
setter ui val = ui { ui_cwRole = Just val }
_ui_cwTouchMail :: Lens' UserInfo String
_ui_cwTouchMail = lens getter setter
where
getter ({ ui_cwTouchMail: val }) = fromMaybe "" val
setter ui val = ui { ui_cwTouchMail = Just val }
_ui_cwTouchPhone :: Lens' UserInfo String
_ui_cwTouchPhone = lens getter setter
where
getter ({ ui_cwTouchPhone: val }) = fromMaybe "" val
setter ui val = ui { ui_cwTouchPhone = Just val }
type User
= { u_id :: Int
, u_hyperdata ::
{
_hu_
shared :: Maybe
{
_hc_
title :: Maybe String
,
_hc_
source :: Maybe String
,
_hc_
who :: Maybe
{
_cw_
firstName :: Maybe String
,
_cw_
lastName :: Maybe String
{ shared :: Maybe
{ title :: Maybe String
, source :: Maybe String
, who :: Maybe
{ firstName :: Maybe String
, lastName :: Maybe String
}
,
_hc_where
:: Array
{
_cw_
organization :: Array String }
,
"where"
:: Array
{ organization :: Array String }
}
}
, u_username :: String
...
...
@@ -28,28 +108,33 @@ showUser { u_id
showMUser u = maybe "" showUser u
-- Symbols
u_id :: Proxy "u_id"
u_id = Proxy
u_hyperdata :: Proxy "u_hyperdata"
u_hyperdata = Proxy
u_username :: Proxy "u_username"
u_username = Proxy
u_email :: Proxy "u_email"
u_email = Proxy
_hu_shared :: Proxy "shared"
_hu_shared = Proxy
_hc_source :: Proxy "_hc_source"
_hc_source = Proxy
_hc_title :: Proxy "_hc_title"
_hc_title = Proxy
_hc_who :: Proxy "_hc_who"
_hc_who = Proxy
_hc_where :: Proxy "_cw_where"
_hc_where = Proxy
_cw_firstName :: Proxy "_cw_firstName"
_cw_firstName = Proxy
_cw_lastName :: Proxy "_cw_lastName"
_cw_lastName = Proxy
_cw_organization :: Proxy "_cw_organization"
_cw_organization = Proxy
ui_id :: Proxy "ui_id"
ui_id = Proxy
ui_username :: Proxy "ui_username"
ui_username = Proxy
ui_email :: Proxy "ui_email"
ui_email = Proxy
ui_title :: Proxy "ui_title"
ui_title = Proxy
ui_source :: Proxy "ui_source"
ui_source = Proxy
ui_cwFirstName :: Proxy "ui_cwFirstName"
ui_cwFirstName = Proxy
ui_cwLastName :: Proxy "ui_cwLastName"
ui_cwLastName = Proxy
ui_cwCity :: Proxy "ui_cwCity"
ui_cwCity = Proxy
ui_cwCountry :: Proxy "ui_cwCountry"
ui_cwCountry = Proxy
ui_cwLabTeamDepts :: Proxy "ui_cwLabTeamDepts"
ui_cwLabTeamDepts = Proxy
ui_cwOrganization :: Proxy "ui_cwOrganization"
ui_cwOrganization = Proxy
ui_cwOffice :: Proxy "ui_cwOffice"
ui_cwOffice = Proxy
ui_cwRole :: Proxy "ui_cwRole"
ui_cwRole = Proxy
ui_cwTouchMail :: Proxy "ui_cwTouchMail"
ui_cwTouchMail = Proxy
ui_cwTouchPhone :: Proxy "ui_cwTouchPhone"
ui_cwTouchPhone = Proxy
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
00098c86
...
...
@@ -11,6 +11,7 @@ import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.GraphQL.User (UserInfo)
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData)
...
...
@@ -50,13 +51,13 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps =
( boxes :: Boxes
, cacheState :: T.Box LTypes.CacheState
,
contactData :: ContactData
, frontends :: Frontends
, nodeId :: Int
, session :: Session
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
( boxes
:: Boxes
, cacheState
:: T.Box LTypes.CacheState
,
defaultListId :: Int
, frontends
:: Frontends
, nodeId
:: Int
, session
:: Session
, sidePanel
:: T.Box (Maybe (Record TextsT.SidePanel))
)
tabs :: R2.Leaf TabsProps
...
...
@@ -68,21 +69,21 @@ tabsCpt = here.component "tabs" cpt where
yearFilter <- T.useBox (Nothing :: Maybe Year)
pure $ Tab.tabs { activeTab, tabs: tabs' yearFilter props }
tabs' yearFilter props@{ boxes, sidePanel } =
tabs' yearFilter props@{ boxes,
defaultListId,
sidePanel } =
[ "Documents" /\ docs
, "Patents" /\ ngramsView (viewProps Patents)
, "Books" /\ ngramsView (viewProps Books)
, "Communication" /\ ngramsView (viewProps Communication)
, "Trash" /\ docs -- TODO pass-in trash mode
] where
viewProps mode = Record.merge props { defaultListId: props.contactData.defaultListId
, mode }
totalRecords = 4736 -- TODO lol
viewProps mode = Record.merge props { mode }
totalRecords = 4736 -- TODO lol
docs = DT.docViewLayout (Record.merge { boxes, sidePanel } $ Record.merge dtCommon dtExtra)
dtCommon = RX.pick props :: Record DTCommon
dtExtra =
{ chart: mempty
, listId: props.contactData.defaultListId
--, listId: props.contactData.defaultListId
, listId: defaultListId
, mCorpusId: Nothing
, showSearch: true
, tabType: TabPairing TabDocs
...
...
@@ -100,8 +101,7 @@ type DTCommon =
)
type NgramsViewTabsProps =
( defaultListId :: Int
, mode :: Mode
( mode :: Mode
| TabsProps )
ngramsView :: R2.Leaf NgramsViewTabsProps
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
00098c86
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
00098c86
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
00098c86
...
...
@@ -47,14 +47,14 @@ modeTabType' Patents = CTabAuthors
modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps =
(
boxes
:: Boxes
, cacheState :: T.Box LTypes.CacheState
,
contactData :: ContactData'
, frontends :: Frontends
, nodeId :: Int
, session :: Session
, sidePanel :: T.Box (Maybe (Record TTypes.SidePanel))
type TabsProps =
( boxes
:: Boxes
, cacheState
:: T.Box LTypes.CacheState
,
defaultListId :: Int
, frontends
:: Frontends
, nodeId
:: Int
, session
:: Session
, sidePanel
:: T.Box (Maybe (Record TTypes.SidePanel))
)
tabs :: R2.Leaf TabsProps
...
...
@@ -64,7 +64,7 @@ tabsCpt = here.component "tabs" cpt
where
cpt { boxes
, cacheState
,
contactData: {defaultListId}
,
defaultListId
, frontends
, nodeId
, session
...
...
@@ -134,7 +134,6 @@ type NgramsViewTabsProps = (
ngramsView :: R2.Component NgramsViewTabsProps
ngramsView = R.createElement ngramsViewCpt
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = here.component "ngramsView" cpt
where
...
...
This diff is collapsed.
Click to expand it.
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