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
63692972
Verified
Commit
63692972
authored
Apr 25, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-spago-next' into dev-add-edge-weight-control
parents
ea4995de
7c2a3b97
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
354 additions
and
157 deletions
+354
-157
package.json
package.json
+1
-1
Store.purs
src/Gargantext/Components/App/Store.purs
+7
-2
Breadcrumb.purs
src/Gargantext/Components/Forest/Breadcrumb.purs
+126
-74
Types.purs
...ext/Components/Forest/Tree/Node/Action/Contact/Types.purs
+4
-2
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+35
-4
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+1
-0
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+14
-0
GraphQL.purs
src/Gargantext/Components/GraphQL.purs
+4
-1
Endpoints.purs
src/Gargantext/Components/GraphQL/Endpoints.purs
+14
-4
Node.purs
src/Gargantext/Components/GraphQL/Node.purs
+7
-1
Tree.purs
src/Gargantext/Components/GraphQL/Tree.purs
+3
-2
Login.purs
src/Gargantext/Components/Login.purs
+10
-6
LoginForm.purs
src/Gargantext/Components/Login/LoginForm.purs
+21
-6
Router.purs
src/Gargantext/Components/Router.purs
+54
-21
TreeSearch.purs
src/Gargantext/Components/TreeSearch.purs
+11
-10
Ends.purs
src/Gargantext/Ends.purs
+1
-0
Router.purs
src/Gargantext/Router.purs
+1
-0
Routes.purs
src/Gargantext/Routes.purs
+11
-1
Types.purs
src/Gargantext/Sessions/Types.purs
+0
-3
Types.purs
src/Gargantext/Types.purs
+22
-19
SimpleJSON.purs
src/Gargantext/Utils/SimpleJSON.purs
+7
-0
No files found.
package.json
View file @
63692972
{
{
"name"
:
"Gargantext"
,
"name"
:
"Gargantext"
,
"version"
:
"0.0.
6.9.9.9.9
.1"
,
"version"
:
"0.0.
7
.1"
,
"scripts"
:
{
"scripts"
:
{
"build"
:
"spago build"
,
"build"
:
"spago build"
,
"bundle"
:
"spago bundle --module Main --outfile dist/bundle.js"
,
"bundle"
:
"spago bundle --module Main --outfile dist/bundle.js"
,
...
...
src/Gargantext/Components/App/Store.purs
View file @
63692972
...
@@ -10,22 +10,24 @@ module Gargantext.Components.App.Store
...
@@ -10,22 +10,24 @@ module Gargantext.Components.App.Store
) where
) where
import Gargantext.Prelude
import Data.Map (Map)
import Data.Map (Map)
import Data.Map as Map
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Data.Set as Set
import Data.Tuple (Tuple)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Lang as Lang
import Gargantext.Components.Lang as Lang
import Gargantext.Components.Nodes.Lists.SidePanel as ListsSP
import Gargantext.Components.Nodes.Lists.SidePanel as ListsSP
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Themes as Themes
import Gargantext.Components.Themes as Themes
import Gargantext.Ends (Backend)
import Gargantext.Ends (Backend)
import Gargantext.Prelude
import Gargantext.Routes (AppRoute(Home), Tile)
import Gargantext.Routes (AppRoute(Home), Tile)
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
import Gargantext.Types (FrontendError, Handed(RightHanded),
ID,
SidePanelState(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Stores as Stores
import Gargantext.Utils.Stores as Stores
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
...
@@ -45,6 +47,7 @@ type Store =
...
@@ -45,6 +47,7 @@ type Store =
, graphVersion :: T2.ReloadS
, graphVersion :: T2.ReloadS
, handed :: T.Box Handed
, handed :: T.Box Handed
, lang :: T.Box Lang.LandingLang
, lang :: T.Box Lang.LandingLang
, loginRedirect :: T.Box (Maybe (Tuple String ID))
, pinnedTreeId :: T.Box (Map String Int)
, pinnedTreeId :: T.Box (Map String Int)
, reloadForest :: T2.ReloadS
, reloadForest :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
...
@@ -73,6 +76,7 @@ type State =
...
@@ -73,6 +76,7 @@ type State =
, graphVersion :: T2.Reload
, graphVersion :: T2.Reload
, handed :: Handed
, handed :: Handed
, lang :: Lang.LandingLang
, lang :: Lang.LandingLang
, loginRedirect :: Maybe (Tuple String ID)
, pinnedTreeId :: Map String Int
, pinnedTreeId :: Map String Int
, reloadForest :: T2.Reload
, reloadForest :: T2.Reload
, reloadMainPage :: T2.Reload
, reloadMainPage :: T2.Reload
...
@@ -102,6 +106,7 @@ options =
...
@@ -102,6 +106,7 @@ options =
, graphVersion : T2.newReload
, graphVersion : T2.newReload
, handed : RightHanded
, handed : RightHanded
, lang : Lang.LL_EN
, lang : Lang.LL_EN
, loginRedirect : Nothing
, pinnedTreeId : Map.empty
, pinnedTreeId : Map.empty
, reloadForest : T2.newReload
, reloadForest : T2.newReload
, reloadMainPage : T2.newReload
, reloadMainPage : T2.newReload
...
...
src/Gargantext/Components/Forest/Breadcrumb.purs
View file @
63692972
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Action/Contact/Types.purs
View file @
63692972
...
@@ -17,9 +17,11 @@ instance JSON.ReadForeign AddContactParams where readImpl = GUSJ.taggedSumRep
...
@@ -17,9 +17,11 @@ instance JSON.ReadForeign AddContactParams where readImpl = GUSJ.taggedSumRep
instance JSON.WriteForeign AddContactParams where
instance JSON.WriteForeign AddContactParams where
writeImpl (AddContactParams { firstname, lastname }) =
writeImpl (AddContactParams { firstname, lastname }) =
JSON.writeImpl { type: "AddContactParams"
JSON.writeImpl { type: "AddContactParams"
, values: { firstname, lastname } }
, firstname
, lastname }
writeImpl (AddContactParamsAdvanced { firstname, lastname }) =
writeImpl (AddContactParamsAdvanced { firstname, lastname }) =
JSON.writeImpl { type: "AddContactParamsAdvanced"
JSON.writeImpl { type: "AddContactParamsAdvanced"
, values: { firstname, lastname } }
, firstname
, lastname }
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
63692972
...
@@ -20,7 +20,7 @@ import Gargantext.Hooks.Loader (useLoader)
...
@@ -20,7 +20,7 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, post)
import Gargantext.Sessions (Session, get, post)
import Gargantext.Types (ID)
import Gargantext.Types (ID
, NodeID, NodeType
)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.SimpleJSON as GUSJ
import Gargantext.Utils.SimpleJSON as GUSJ
...
@@ -44,8 +44,9 @@ getCompletionsReq { session } =
...
@@ -44,8 +44,9 @@ getCompletionsReq { session } =
------------------------------------------------------------------------
------------------------------------------------------------------------
data ShareNodeParams = ShareTeamParams { username :: String }
data ShareNodeParams =
| SharePublicParams { node_id :: Int }
ShareTeamParams { username :: String }
| SharePublicParams { node_id :: Int }
derive instance Eq ShareNodeParams
derive instance Eq ShareNodeParams
derive instance Generic ShareNodeParams _
derive instance Generic ShareNodeParams _
instance JSON.ReadForeign ShareNodeParams where readImpl = GUSJ.taggedSumRep
instance JSON.ReadForeign ShareNodeParams where readImpl = GUSJ.taggedSumRep
...
@@ -144,6 +145,36 @@ publishNodeCpt = here.component "publishNode" cpt
...
@@ -144,6 +145,36 @@ publishNodeCpt = here.component "publishNode" cpt
, session
, session
, subTreeParams
, subTreeParams
} []
} []
-- footer
-- footer
, button ]
, button ]
------------------------------------------------------------------------
type ShareURL =
( nodeType :: NodeType
, id :: ID
, session :: Session)
shareURL :: R2.Component ShareURL
shareURL = R.createElement shareURLcpt
shareURLcpt :: R.Component ShareURL
shareURLcpt = R2.hereComponent here "shareURL" hCpt
where
hCpt hp {nodeType, id, session} _ = do
useLoader { errorHandler: Just errorHandler
, herePrefix: hp
, loader: loadUrl
, path: {nodeType, id, session}
, render: \url -> shareURLInner {url} [] }
errorHandler err = here.warn2 "[ShareURL] RESTError" err
shareURLInner :: R2.Component ( url :: String )
shareURLInner = R.createElement shareURLInnercpt
shareURLInnercpt :: R.Component ( url :: String )
shareURLInnercpt = here.component "shareURLInner" cpt
where
cpt { url } _ = do
pure $ Tools.panel { mError: Nothing } [ H.div {} [ H.text url ] ]
loadUrl :: { session :: Session, id :: NodeID, nodeType :: NodeType } -> AffRESTError String
loadUrl { session, id, nodeType } = get session $ GR.ShareURL id nodeType
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
63692972
...
@@ -363,6 +363,7 @@ panelActionCpt = here.component "panelAction" cpt
...
@@ -363,6 +363,7 @@ panelActionCpt = here.component "panelAction" cpt
cpt { action: SearchBox, dispatch, id, session } _ =
cpt { action: SearchBox, dispatch, id, session } _ =
pure $ actionSearch { dispatch, id: Just id, session } []
pure $ actionSearch { dispatch, id: Just id, session } []
cpt { action : Share, id, session } _ = pure $ Share.shareNode { id, session } []
cpt { action : Share, id, session } _ = pure $ Share.shareNode { id, session } []
cpt { action: ShareURL, id, nodeType, session } _ = pure $ Share.shareURL { nodeType, id, session } []
cpt { action: Upload, dispatch, id, nodeType, session} _ =
cpt { action: Upload, dispatch, id, nodeType, session} _ =
pure $ actionUpload { dispatch, id, nodeType, session } []
pure $ actionUpload { dispatch, id, nodeType, session } []
cpt { action: WriteNodesDocuments, dispatch, id, session } _ =
cpt { action: WriteNodesDocuments, dispatch, id, session } _ =
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
63692972
...
@@ -29,6 +29,7 @@ data NodeAction = Add (Array NodeType)
...
@@ -29,6 +29,7 @@ data NodeAction = Add (Array NodeType)
| ReloadWithSettings
| ReloadWithSettings
| Reconstruct
| Reconstruct
| SearchBox
| SearchBox
| ShareURL
| Share
| Share
| Upload
| Upload
| WriteNodesDocuments -- https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/331
| WriteNodesDocuments -- https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/331
...
@@ -51,6 +52,7 @@ instance Eq NodeAction where
...
@@ -51,6 +52,7 @@ instance Eq NodeAction where
eq Refresh Refresh = true
eq Refresh Refresh = true
eq ReloadWithSettings ReloadWithSettings = true
eq ReloadWithSettings ReloadWithSettings = true
eq SearchBox SearchBox = true
eq SearchBox SearchBox = true
eq ShareURL ShareURL = true
eq Share Share = true
eq Share Share = true
eq Upload Upload = true
eq Upload Upload = true
eq WriteNodesDocuments WriteNodesDocuments = true
eq WriteNodesDocuments WriteNodesDocuments = true
...
@@ -73,6 +75,7 @@ instance Show NodeAction where
...
@@ -73,6 +75,7 @@ instance Show NodeAction where
show Refresh = "Refresh"
show Refresh = "Refresh"
show ReloadWithSettings = "Reload (with settings)"
show ReloadWithSettings = "Reload (with settings)"
show SearchBox = "SearchBox"
show SearchBox = "SearchBox"
show ShareURL = "Share URL"
show Share = "Share"
show Share = "Share"
show Upload = "Upload"
show Upload = "Upload"
show WriteNodesDocuments = "WriteNodesDocuments"
show WriteNodesDocuments = "WriteNodesDocuments"
...
@@ -94,6 +97,7 @@ glyphiconNodeAction Reconstruct = "cogs"
...
@@ -94,6 +97,7 @@ glyphiconNodeAction Reconstruct = "cogs"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction Refresh = "refresh"
glyphiconNodeAction ReloadWithSettings = "reload-with-settings"
glyphiconNodeAction ReloadWithSettings = "reload-with-settings"
glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction SearchBox = "search"
glyphiconNodeAction ShareURL = "share-alt"
glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction Share = "user-plus"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction Upload = "upload"
glyphiconNodeAction WriteNodesDocuments = "bars"
glyphiconNodeAction WriteNodesDocuments = "bars"
...
@@ -160,6 +164,7 @@ settingsBoxLens Corpus =
...
@@ -160,6 +164,7 @@ settingsBoxLens Corpus =
, Move moveParameters
, Move moveParameters
, Upload
, Upload
, SearchBox
, SearchBox
, ShareURL
, WriteNodesDocuments
, WriteNodesDocuments
-- , Download
-- , Download
, Link (linkParams Annuaire)
, Link (linkParams Annuaire)
...
@@ -180,6 +185,7 @@ settingsBoxLens Folder =
...
@@ -180,6 +185,7 @@ settingsBoxLens Folder =
-- , NodeFrameNotebook
-- , NodeFrameNotebook
]
]
, Move moveParameters
, Move moveParameters
, ShareURL
, Delete
, Delete
]
]
settingsBoxLens FolderPrivate =
settingsBoxLens FolderPrivate =
...
@@ -203,6 +209,7 @@ settingsBoxLens Graph =
...
@@ -203,6 +209,7 @@ settingsBoxLens Graph =
, Config
, Config
, Download -- TODO as GEXF or JSON
, Download -- TODO as GEXF or JSON
-- , Publish publishParams
-- , Publish publishParams
, ShareURL
, Delete
, Delete
]
]
settingsBoxLens NodeFile =
settingsBoxLens NodeFile =
...
@@ -214,6 +221,7 @@ settingsBoxLens NodeFrameNotebook =
...
@@ -214,6 +221,7 @@ settingsBoxLens NodeFrameNotebook =
-- , NodeFrameNotebook
-- , NodeFrameNotebook
]
]
, Move moveFrameParameters
, Move moveFrameParameters
, ShareURL
, Delete
, Delete
]
]
settingsBoxLens NodeFrameVisio =
settingsBoxLens NodeFrameVisio =
...
@@ -221,6 +229,7 @@ settingsBoxLens NodeFrameVisio =
...
@@ -221,6 +229,7 @@ settingsBoxLens NodeFrameVisio =
, Notes
, Notes
, Calc
, Calc
]
]
, ShareURL
, Delete
, Delete
]
]
settingsBoxLens NodeList =
settingsBoxLens NodeList =
...
@@ -228,6 +237,7 @@ settingsBoxLens NodeList =
...
@@ -228,6 +237,7 @@ settingsBoxLens NodeList =
, Config
, Config
, Upload
, Upload
, Download
, Download
, ShareURL
, Merge {subTreeParams : SubTreeParams { showtypes: [ FolderPrivate
, Merge {subTreeParams : SubTreeParams { showtypes: [ FolderPrivate
, FolderShared
, FolderShared
, Team
, Team
...
@@ -259,6 +269,7 @@ settingsBoxLens NodeTexts =
...
@@ -259,6 +269,7 @@ settingsBoxLens NodeTexts =
_buttons .~ [ ReloadWithSettings
_buttons .~ [ ReloadWithSettings
-- , Upload
-- , Upload
, Download
, Download
, ShareURL
-- , Delete
-- , Delete
]
]
settingsBoxLens NodeUser =
settingsBoxLens NodeUser =
...
@@ -272,10 +283,12 @@ settingsBoxLens Notes =
...
@@ -272,10 +283,12 @@ settingsBoxLens Notes =
, Corpus
, Corpus
]
]
, Move moveFrameParameters
, Move moveFrameParameters
, ShareURL
, Delete
, Delete
]
]
settingsBoxLens Phylo =
settingsBoxLens Phylo =
_buttons .~ [ Reconstruct
_buttons .~ [ Reconstruct
, ShareURL
, Delete
, Delete
]
]
settingsBoxLens Team =
settingsBoxLens Team =
...
@@ -290,6 +303,7 @@ settingsBoxLens Team =
...
@@ -290,6 +303,7 @@ settingsBoxLens Team =
, NodeFrameVisio
, NodeFrameVisio
]
]
, Share
, Share
, ShareURL
, ManageTeam
, ManageTeam
, Delete
, Delete
]
]
...
...
src/Gargantext/Components/GraphQL.purs
View file @
63692972
...
@@ -21,7 +21,9 @@ import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM, UserPubmed
...
@@ -21,7 +21,9 @@ import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM, UserPubmed
import Gargantext.Config.REST as REST
import Gargantext.Config.REST as REST
import Gargantext.Ends (Backend(..))
import Gargantext.Ends (Backend(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Types (NodeType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.BaseClients.Urql (UrqlClient, createClient)
import GraphQL.Client.BaseClients.Urql (UrqlClient, createClient)
import GraphQL.Client.Query (decodeGqlRes) --, mutationJson)
import GraphQL.Client.Query (decodeGqlRes) --, mutationJson)
...
@@ -149,7 +151,8 @@ type Schema
...
@@ -149,7 +151,8 @@ type Schema
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: Array String } -> Array GQLCTX.Context
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: Array String } -> Array GQLCTX.Context
, imt_schools :: {} -> Array GQLIMT.School
, imt_schools :: {} -> Array GQLIMT.School
, languages :: {} -> Array GQLNLP.Language
, languages :: {} -> Array GQLNLP.Language
, node_parent :: { node_id :: Int, parent_type :: String } -> Array GQLNode.Node -- TODO: parent_type :: NodeType
, node_children :: { node_id :: Int, child_type :: NodeType } -> Array GQLNode.Node
, node_parent :: { node_id :: Int, parent_type :: NodeType } -> Array GQLNode.Node
, nodes :: { node_id :: Int } -> Array GQLNode.Node
, nodes :: { node_id :: Int } -> Array GQLNode.Node
, nodes_corpus :: { corpus_id :: Int } -> Array GQLNode.Corpus
, nodes_corpus :: { corpus_id :: Int } -> Array GQLNode.Corpus
, user_infos :: { user_id :: Int } -> Array UserInfo
, user_infos :: { user_id :: Int } -> Array UserInfo
...
...
src/Gargantext/Components/GraphQL/Endpoints.purs
View file @
63692972
...
@@ -12,7 +12,7 @@ import Gargantext.Components.GraphQL.Contact (AnnuaireContact, annuaireContactQu
...
@@ -12,7 +12,7 @@ import Gargantext.Components.GraphQL.Contact (AnnuaireContact, annuaireContactQu
import Gargantext.Components.GraphQL.Context as GQLCTX
import Gargantext.Components.GraphQL.Context as GQLCTX
import Gargantext.Components.GraphQL.IMT as GQLIMT
import Gargantext.Components.GraphQL.IMT as GQLIMT
import Gargantext.Components.GraphQL.NLP as GQLNLP
import Gargantext.Components.GraphQL.NLP as GQLNLP
import Gargantext.Components.GraphQL.Node (Corpus, Node, nodeParentQuery, nodesQuery, nodesCorpusQuery)
import Gargantext.Components.GraphQL.Node (Corpus, Node, node
ChildrenQuery, node
ParentQuery, nodesQuery, nodesCorpusQuery)
import Gargantext.Components.GraphQL.Team (Team, teamQuery)
import Gargantext.Components.GraphQL.Team (Team, teamQuery)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery, BreadcrumbInfo, breadcrumbQuery)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery, BreadcrumbInfo, breadcrumbQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQuery)
...
@@ -20,6 +20,7 @@ import Gargantext.Components.Lang (Lang)
...
@@ -20,6 +20,7 @@ import Gargantext.Components.Lang (Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Types (CorpusId, NodeType)
import Gargantext.Types (CorpusId, NodeType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -64,11 +65,20 @@ getNodeParent :: Session -> Int -> NodeType -> AffRESTError (Array Node)
...
@@ -64,11 +65,20 @@ getNodeParent :: Session -> Int -> NodeType -> AffRESTError (Array Node)
getNodeParent session nodeId parentType = do
getNodeParent session nodeId parentType = do
eRes <- queryGql session "get node parent" $
eRes <- queryGql session "get node parent" $
nodeParentQuery `withVars` { id: nodeId
nodeParentQuery `withVars` { id: nodeId
, parent_type:
show parentType } -- TODO: remove "show"
, parent_type:
parentType }
-- liftEffect $ here.log2 "[getNodeParent] node_parent" node_parent
-- liftEffect $ here.log2 "[getNodeParent] node_parent" node_parent
--pure node_parent
--pure node_parent
pure $ rmap _.node_parent eRes
pure $ rmap _.node_parent eRes
getNodeChildren :: Session -> Int -> NodeType -> AffRESTError (Array Node)
getNodeChildren session nodeId childType = do
eRes <- queryGql session "get node child" $
nodeChildrenQuery `withVars` { id: nodeId
, child_type: childType }
-- liftEffect $ here.log2 "[getNodeParent] node_parent" node_parent
--pure node_parent
pure $ rmap _.node_children eRes
getUser :: Session -> Int -> AffRESTError User
getUser :: Session -> Int -> AffRESTError User
getUser session id = do
getUser session id = do
eRes <- queryGql session "get user" $ userQuery `withVars` { id }
eRes <- queryGql session "get user" $ userQuery `withVars` { id }
...
@@ -218,7 +228,7 @@ getContextNgrams session context_id list_id = do
...
@@ -218,7 +228,7 @@ getContextNgrams session context_id list_id = do
pure $ rmap (\{ context_ngrams } -> NormNgramsTerm <$> context_ngrams) eRes
pure $ rmap (\{ context_ngrams } -> NormNgramsTerm <$> context_ngrams) eRes
getBreadcrumb :: Session -> Int -> AffRESTError BreadcrumbInfo
getBreadcrumb :: Session -> Int -> AffRESTError BreadcrumbInfo
getBreadcrumb session id = do
getBreadcrumb session
node_
id = do
eRes <- queryGql session "get breadcrumb branch" $ breadcrumbQuery `withVars` { id }
eRes <- queryGql session "get breadcrumb branch" $ breadcrumbQuery `withVars` {
node_
id }
-- liftEffect $ here.log2 "[getBreadcrumb] breadcrumb" tree_branch
-- liftEffect $ here.log2 "[getBreadcrumb] breadcrumb" tree_branch
pure $ rmap _.tree_branch eRes
pure $ rmap _.tree_branch eRes
src/Gargantext/Components/GraphQL/Node.purs
View file @
63692972
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphQL.Node where
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphQL.Node where
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Utils.GraphQL as GGQL
import Gargantext.Utils.GraphQL as GGQL
import Gargantext.Types (NodeType)
import GraphQL.Client.Args (Args, (=>>))
import GraphQL.Client.Args (Args, (=>>))
import GraphQL.Client.Variable (Var(..))
import GraphQL.Client.Variable (Var(..))
import Type.Proxy (Proxy(..))
import Type.Proxy (Proxy(..))
...
@@ -46,6 +47,11 @@ nodesCorpusQuery = { nodes_corpus: { corpus_id: Var :: _ "id" Int } =>>
...
@@ -46,6 +47,11 @@ nodesCorpusQuery = { nodes_corpus: { corpus_id: Var :: _ "id" Int } =>>
}
}
nodeParentQuery = { node_parent: { node_id: Var :: _ "id" Int
nodeParentQuery = { node_parent: { node_id: Var :: _ "id" Int
, parent_type: Var :: _ "parent_type"
String } =>> -- TODO parent_type :: NodeType
, parent_type: Var :: _ "parent_type"
NodeType } =>>
GGQL.getFieldsStandard (Proxy :: _ Node)
GGQL.getFieldsStandard (Proxy :: _ Node)
}
}
nodeChildrenQuery = { node_children: { node_id: Var :: _ "id" Int
, child_type: Var :: _ "child_type" NodeType } =>>
GGQL.getFieldsStandard (Proxy :: _ Node)
}
src/Gargantext/Components/GraphQL/Tree.purs
View file @
63692972
...
@@ -3,6 +3,7 @@ module Gargantext.Components.GraphQL.Tree where
...
@@ -3,6 +3,7 @@ module Gargantext.Components.GraphQL.Tree where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Gargantext.Routes (AppRoute)
import Gargantext.Types (NodeType)
import Gargantext.Types (NodeType)
import GraphQL.Client.Args ((=>>))
import GraphQL.Client.Args ((=>>))
import GraphQL.Client.Variable (Var(..))
import GraphQL.Client.Variable (Var(..))
...
@@ -42,7 +43,7 @@ treeFirstLevelQuery = { tree: { root_id: Var :: _ "id" Int} =>>
...
@@ -42,7 +43,7 @@ treeFirstLevelQuery = { tree: { root_id: Var :: _ "id" Int} =>>
}
}
}
}
breadcrumbQuery = { tree_branch: { node_id: Var :: _ "
id" Int
} =>>
breadcrumbQuery = { tree_branch: { node_id: Var :: _ "
node_id" Int
} =>>
{ parents:
{ parents:
{ name: unit
{ name: unit
, node_type: unit
, node_type: unit
...
@@ -50,4 +51,4 @@ breadcrumbQuery = { tree_branch: { node_id: Var :: _ "id" Int} =>>
...
@@ -50,4 +51,4 @@ breadcrumbQuery = { tree_branch: { node_id: Var :: _ "id" Int} =>>
, parent_id: unit
, parent_id: unit
}
}
}
}
}
}
\ No newline at end of file
src/Gargantext/Components/Login.purs
View file @
63692972
...
@@ -21,20 +21,22 @@ import Data.Array (head)
...
@@ -21,20 +21,22 @@ import Data.Array (head)
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.String as DST
import Data.String as DST
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Milliseconds(..), delay, launchAff_)
import Effect.Aff (Milliseconds(..), delay, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.Login.PasswordForm as PasswordForm
import Gargantext.Components.Login.LoginForm as LoginForm
import Gargantext.Components.Login.LoginForm as LoginForm
import Gargantext.Components.Login.PasswordForm as PasswordForm
import Gargantext.Components.Login.Types (FormType(..))
import Gargantext.Components.Login.Types (FormType(..))
import Gargantext.Components.NgramsTable.Loader as NTL
import Gargantext.Components.NgramsTable.Loader as NTL
import Gargantext.Ends (Backend(..))
import Gargantext.Ends (Backend(..))
import Gargantext.Hooks.Loader as GHL
import Gargantext.Hooks.Loader as GHL
import Gargantext.Sessions (Session(..), Sessions, Action(Logout), unSessions)
import Gargantext.Sessions (Session(..), Sessions, Action(Logout), unSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Types (ID)
import Gargantext.Utils ((?))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
...
@@ -51,10 +53,11 @@ here = R2.here "Gargantext.Components.Login"
...
@@ -51,10 +53,11 @@ here = R2.here "Gargantext.Components.Login"
-- if not logged user can not save his work
-- if not logged user can not save his work
type Props =
type Props =
( backend :: T.Box (Maybe Backend)
( backend :: T.Box (Maybe Backend)
, backends :: Array Backend
, backends :: Array Backend
, sessions :: T.Box Sessions
, sessions :: T.Box Sessions
, visible :: T.Box Boolean
, visible :: T.Box Boolean
, loginRedirect :: T.Box (Maybe (Tuple String ID))
)
)
login :: R2.Leaf Props
login :: R2.Leaf Props
...
@@ -82,7 +85,7 @@ loginContainer :: R2.Leaf Props
...
@@ -82,7 +85,7 @@ loginContainer :: R2.Leaf Props
loginContainer = R2.leaf loginContainerCpt
loginContainer = R2.leaf loginContainerCpt
loginContainerCpt :: R.Component Props
loginContainerCpt :: R.Component Props
loginContainerCpt = here.component "container" cpt where
loginContainerCpt = here.component "container" cpt where
cpt props@{ sessions, visible } _ = do
cpt props@{ sessions, visible
, loginRedirect
} _ = do
-- | States
-- | States
-- |
-- |
mBackend <- R2.useLive' props.backend
mBackend <- R2.useLive' props.backend
...
@@ -109,6 +112,7 @@ loginContainerCpt = here.component "container" cpt where
...
@@ -109,6 +112,7 @@ loginContainerCpt = here.component "container" cpt where
, formType
, formType
, sessions
, sessions
, visible
, visible
, loginRedirect
}
}
ForgotPassword ->
ForgotPassword ->
PasswordForm.component
PasswordForm.component
...
...
src/Gargantext/Components/Login/LoginForm.purs
View file @
63692972
...
@@ -6,8 +6,9 @@ import Gargantext.Prelude
...
@@ -6,8 +6,9 @@ import Gargantext.Prelude
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Foldable (foldl, intercalate)
import Data.Foldable (foldl, intercalate)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..)
, fromMaybe
)
import Data.String as String
import Data.String as String
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
...
@@ -18,9 +19,12 @@ import Gargantext.Components.Login.Types (AuthRequest(..), FormType(..))
...
@@ -18,9 +19,12 @@ import Gargantext.Components.Login.Types (AuthRequest(..), FormType(..))
import Gargantext.Ends (Backend)
import Gargantext.Ends (Backend)
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Sessions (Session, Sessions, postAuthRequest)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, Sessions, postAuthRequest, sessionId)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Types (ID, NodeType(..))
import Gargantext.Utils ((?))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
...
@@ -33,10 +37,11 @@ here :: R2.Here
...
@@ -33,10 +37,11 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Login.Form"
here = R2.here "Gargantext.Components.Login.Form"
type Props =
type Props =
( backend :: Backend
( backend :: Backend
, formType :: T.Box FormType
, formType :: T.Box FormType
, sessions :: T.Box Sessions
, sessions :: T.Box Sessions
, visible :: T.Box Boolean
, visible :: T.Box Boolean
, loginRedirect :: T.Box (Maybe (Tuple String ID))
)
)
component :: R2.Leaf Props
component :: R2.Leaf Props
...
@@ -47,6 +52,7 @@ componentCpt = here.component "main" cpt where
...
@@ -47,6 +52,7 @@ componentCpt = here.component "main" cpt where
, formType
, formType
, sessions
, sessions
, visible
, visible
, loginRedirect
} _ = do
} _ = do
-- | States
-- | States
-- |
-- |
...
@@ -56,6 +62,8 @@ componentCpt = here.component "main" cpt where
...
@@ -56,6 +62,8 @@ componentCpt = here.component "main" cpt where
onPending' /\ onPending
onPending' /\ onPending
<- R2.useBox' false
<- R2.useBox' false
loginRedirect' <- R2.useLive' loginRedirect
-- | Hooks
-- | Hooks
-- |
-- |
{ state
{ state
...
@@ -65,6 +73,8 @@ componentCpt = here.component "main" cpt where
...
@@ -65,6 +73,8 @@ componentCpt = here.component "main" cpt where
fv <- useFormValidation
fv <- useFormValidation
{ goToRoute } <- useLinkHandler
-- | Behaviors
-- | Behaviors
-- |
-- |
let
let
...
@@ -96,6 +106,11 @@ componentCpt = here.component "main" cpt where
...
@@ -96,6 +106,11 @@ componentCpt = here.component "main" cpt where
Right session_ -> liftEffect
Right session_ -> liftEffect
$ Sessions.change (Sessions.Login session_) sessions
$ Sessions.change (Sessions.Login session_) sessions
*> T.write_ false visible
*> T.write_ false visible
*> case loginRedirect' of
Just (nodeType /\ nodeId) -> do
T.write_ Nothing loginRedirect
goToRoute $ fromMaybe GR.Login $ GR.nodeTypeAppRoute (fromMaybe Node $ read nodeType) (sessionId session_) nodeId
Nothing -> pure unit
T.write_ false onPending
T.write_ false onPending
...
...
src/Gargantext/Components/Router.purs
View file @
63692972
module Gargantext.Components.Router (router) where
module Gargantext.Components.Router
( router
, shareCpt
)
where
import Gargantext.Prelude
import Gargantext.Prelude
import DOM.Simple as DOM
import DOM.Simple as DOM
import Data.Array (filter, length)
import Data.Array (filter,
head,
length)
import Data.Array as A
import Data.Array as A
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Map as M
import Data.Map as M
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Tuple (Tuple(..))
import Data.UUID (UUID)
import Data.UUID (UUID)
import Data.UUID as UUID
import Data.UUID as UUID
import Effect (Effect)
import Effect (Effect)
...
@@ -16,7 +21,6 @@ import Gargantext.Components.ErrorsView as ErrorsView
...
@@ -16,7 +21,6 @@ import Gargantext.Components.ErrorsView as ErrorsView
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.Forest.Breadcrumb as Breadcrumb
import Gargantext.Components.Forest.Breadcrumb as Breadcrumb
import Gargantext.Components.ForgotPassword (forgotPasswordLayout)
import Gargantext.Components.ForgotPassword (forgotPasswordLayout)
-- import Gargantext.Components.GraphQL.Node (Node)
import Gargantext.Components.Login (login)
import Gargantext.Components.Login (login)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire.User (userLayout)
import Gargantext.Components.Nodes.Annuaire.User (userLayout)
...
@@ -38,13 +42,14 @@ import Gargantext.Components.TreeSearch (treeSearch)
...
@@ -38,13 +42,14 @@ import Gargantext.Components.TreeSearch (treeSearch)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Context.Session as SessionContext
import Gargantext.Context.Session as SessionContext
import Gargantext.Ends (Backend)
import Gargantext.Ends (Backend)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler)
import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (AppRoute, Tile)
import Gargantext.Routes (AppRoute
(..)
, Tile)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Sessions (Session, sessionId
, unSessions
)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Types (CorpusId, Handed(..), ListId, NodeID, NodeType(..), SessionId, SidePanelState(..))
import Gargantext.Types (CorpusId, Handed(..), ListId, NodeID, NodeType(..), SessionId, SidePanelState(..)
, ID
)
import Gargantext.Utils ((?))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix (getElementById)
import Gargantext.Utils.Reactix (getElementById)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -177,8 +182,7 @@ mainPageCpt = here.component "mainPage" cpt where
...
@@ -177,8 +182,7 @@ mainPageCpt = here.component "mainPage" cpt where
H.div { className: "router__body main-page" }
H.div { className: "router__body main-page" }
[
[
Breadcrumb.component
Breadcrumb.component { }
{ boxes }
,
,
H.div
H.div
{ className: intercalate " "
{ className: intercalate " "
...
@@ -358,6 +362,7 @@ renderRouteCpt = R.memo' $ here.component "renderRoute" cpt where
...
@@ -358,6 +362,7 @@ renderRouteCpt = R.memo' $ here.component "renderRoute" cpt where
GR.NodeTexts s n -> texts (sessionNodeProps s n) []
GR.NodeTexts s n -> texts (sessionNodeProps s n) []
GR.UserPage s n -> user (sessionNodeProps s n) []
GR.UserPage s n -> user (sessionNodeProps s n) []
GR.ForgotPassword p -> forgotPassword {boxes, params: p} []
GR.ForgotPassword p -> forgotPassword {boxes, params: p} []
GR.Share t n -> share {boxes, nodeType: t, nodeId: n} []
]
]
--------------------------------------------------------------
--------------------------------------------------------------
...
@@ -481,7 +486,6 @@ type CorpusDocumentProps =
...
@@ -481,7 +486,6 @@ type CorpusDocumentProps =
corpusDocument :: R2.Component CorpusDocumentProps
corpusDocument :: R2.Component CorpusDocumentProps
corpusDocument = R.createElement corpusDocumentCpt
corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt where
corpusDocumentCpt = here.component "corpusDocument" cpt where
cpt props@{ corpusId, listId, nodeId } _ = do
cpt props@{ corpusId, listId, nodeId } _ = do
...
@@ -490,16 +494,16 @@ corpusDocumentCpt = here.component "corpusDocument" cpt where
...
@@ -490,16 +494,16 @@ corpusDocumentCpt = here.component "corpusDocument" cpt where
authedProps =
authedProps =
Record.merge
Record.merge
{ content:
{ content:
\session ->
\session ->
Document.node
Document.node
{ mCorpusId: Just corpusId
{ mCorpusId: Just corpusId
, listId
, listId
, nodeId
, nodeId
, key: show (sessionId session) <> "-" <> show nodeId
, key: show (sessionId session) <> "-" <> show nodeId
}
}
}
}
sessionProps
sessionProps
pure $ authed authedProps []
pure $ authed authedProps []
...
@@ -524,7 +528,6 @@ type DocumentProps =
...
@@ -524,7 +528,6 @@ type DocumentProps =
document :: R2.Component DocumentProps
document :: R2.Component DocumentProps
document = R.createElement documentCpt
document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps
documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt where
documentCpt = here.component "document" cpt where
cpt props@{ listId, nodeId } _ = do
cpt props@{ listId, nodeId } _ = do
...
@@ -616,12 +619,13 @@ listsCpt = here.component "lists" cpt where
...
@@ -616,12 +619,13 @@ listsCpt = here.component "lists" cpt where
--------------------------------------------------------------
--------------------------------------------------------------
login' :: Boxes -> R.Element
login' :: Boxes -> R.Element
login' { backend, sessions, showLogin: visible } =
login' { backend, sessions, showLogin: visible
, loginRedirect
} =
login
login
{ backend
{ backend
, backends: A.fromFoldable defaultBackends
, backends: A.fromFoldable defaultBackends
, sessions
, sessions
, visible
, visible
, loginRedirect
}
}
--------------------------------------------------------------
--------------------------------------------------------------
...
@@ -767,3 +771,32 @@ forgotPasswordCpt = here.component "forgotPassword" cpt where
...
@@ -767,3 +771,32 @@ forgotPasswordCpt = here.component "forgotPassword" cpt where
let uuid = fromMaybe "" $ M.lookup "uuid" params
let uuid = fromMaybe "" $ M.lookup "uuid" params
pure $ forgotPasswordLayout { server, uuid } []
pure $ forgotPasswordLayout { server, uuid } []
--------------------------------------------------------------
type ShareProps = (nodeType :: String, nodeId :: ID | Props)
share :: R2.Component ShareProps
share = R.createElement shareCpt
shareCpt :: R.Component ShareProps
shareCpt = here.component "share" cpt where
cpt { nodeType, nodeId, boxes} _ = do
{ goToRoute } <- useLinkHandler
sessions' <- T.useLive T.unequal boxes.sessions
case unSessions sessions' of
[] -> do
R.useEffect' $ T.write_ true boxes.showLogin
R.useEffect' $ T.write_ (Just (Tuple nodeType nodeId)) boxes.loginRedirect
R.useEffect' $ goToRoute Login
pure $ H.text "no session"
s -> case head s of
Just s' -> do
R.useEffect' $ goToRoute $ fromMaybe Login $ GR.nodeTypeAppRoute (fromMaybe Node $ read nodeType) (sessionId s') nodeId
pure $ H.text $ "session route: " <> (show $ fromMaybe Login $ GR.nodeTypeAppRoute (fromMaybe Node $ read nodeType) (sessionId s') nodeId)
Nothing -> do
R.useEffect' $ T.write_ true boxes.showLogin
R.useEffect' $ T.write_ (Just (Tuple nodeType nodeId)) boxes.loginRedirect
R.useEffect' $ goToRoute Login
pure $ H.text "no session"
src/Gargantext/Components/TreeSearch.purs
View file @
63692972
...
@@ -169,14 +169,15 @@ treeSearchRenderContainerCpt = here.component "treeSearchRenderContainer" cpt wh
...
@@ -169,14 +169,15 @@ treeSearchRenderContainerCpt = here.component "treeSearchRenderContainer" cpt wh
treeSearchRender :: R2.Leaf RenderProps
treeSearchRender :: R2.Leaf RenderProps
treeSearchRender = R2.leaf treeSearchRenderCpt
treeSearchRender = R2.leaf treeSearchRenderCpt
treeSearchRenderCpt :: R.Component RenderProps
treeSearchRenderCpt :: R.Component RenderProps
treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
cpt { visible, session, searchData, goToRoute } _ = do
cpt { visible, session, searchData, goToRoute } _ = do
{ route } <- AppStore.use
route' <- T.useLive T.unequal route
pure $ H.div {className: "search-modal__results"} (results searchData)
pure $ H.div {className: "search-modal__results"} (results
route'
searchData)
where
where
results s = map searchResult s
results
route'
s = map searchResult s
where
where
searchResult sd = H.div
searchResult sd = H.div
{ className: "result py-1"}
{ className: "result py-1"}
...
@@ -195,9 +196,9 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
...
@@ -195,9 +196,9 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
, H.div {}
, H.div {}
[
[
H.text " Path: "
H.text " Path: "
, breadcrumbView {
nodeId: sd.id
, breadcrumbView {
format: "text"
,
session: Just session
,
route: route'
,
format: "text"
,
session
}
}
]
]
]
]
...
@@ -218,10 +219,10 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
...
@@ -218,10 +219,10 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
H.span { className: "node-path small" }
H.span { className: "node-path small" }
[
[
H.text " — "
H.text " — "
, breadcrumbView {
nodeId: sd.id
, breadcrumbView {
format: "text"
, session: Just session
, route: route'
, format: "text"
, session: session
}
}
]
]
]
]
...
...
src/Gargantext/Ends.purs
View file @
63692972
...
@@ -217,6 +217,7 @@ sessionPath (R.ChartHash { chartType, listId, tabType } i) =
...
@@ -217,6 +217,7 @@ sessionPath (R.ChartHash { chartType, listId, tabType } i) =
-- sessionPath (R.NodeAPI (NodeContact s a i) i) = sessionPath $ "annuaire/" <> show a <> "/contact/" <> show i
-- sessionPath (R.NodeAPI (NodeContact s a i) i) = sessionPath $ "annuaire/" <> show a <> "/contact/" <> show i
sessionPath (R.PhyloAPI nId) = "node/" <> show nId <> "/phylo"
sessionPath (R.PhyloAPI nId) = "node/" <> show nId <> "/phylo"
sessionPath R.Members = "members"
sessionPath R.Members = "members"
sessionPath (R.ShareURL i t) = "shareurl?type=" <> show t <> "&id=" <> show i
------- misc routing stuff
------- misc routing stuff
...
...
src/Gargantext/Router.purs
View file @
63692972
...
@@ -39,6 +39,7 @@ router = oneOf
...
@@ -39,6 +39,7 @@ router = oneOf
, RouteFrameCode <$> (route "code" *> sid) <*> int
, RouteFrameCode <$> (route "code" *> sid) <*> int
, RouteFrameVisio <$> (route "visio" *> sid) <*> int
, RouteFrameVisio <$> (route "visio" *> sid) <*> int
, RouteFile <$> (route "file" *> sid) <*> int
, RouteFile <$> (route "file" *> sid) <*> int
, Share <$> (route "share" *> str) <*> int
, Home <$ lit ""
, Home <$ lit ""
]
]
where
where
...
...
src/Gargantext/Routes.purs
View file @
63692972
...
@@ -2,11 +2,16 @@ module Gargantext.Routes where
...
@@ -2,11 +2,16 @@ module Gargantext.Routes where
import Prelude
import Prelude
import Data.Argonaut as Argonaut
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.UUID (UUID)
import Data.UUID (UUID)
import Data.Map as M
import Data.Map as M
import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType, Id, Limit, ListId, DocId, NgramsGetOpts, NgramsGetTableAllOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList)
import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType, Id, Limit, ListId, DocId, NgramsGetOpts, NgramsGetTableAllOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.SimpleJSON (encodeJsonArgonaut)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import Simple.JSON as JSON
data AppRoute
data AppRoute
= Annuaire SessionId Int
= Annuaire SessionId Int
...
@@ -25,7 +30,6 @@ data AppRoute
...
@@ -25,7 +30,6 @@ data AppRoute
| Lists SessionId Int
| Lists SessionId Int
| Login
| Login
| NodeTexts SessionId Int
| NodeTexts SessionId Int
| TreeFlat SessionId Int String
| PGraphExplorer SessionId Int
| PGraphExplorer SessionId Int
| PhyloExplorer SessionId Int
| PhyloExplorer SessionId Int
| RouteFile SessionId Int
| RouteFile SessionId Int
...
@@ -34,7 +38,9 @@ data AppRoute
...
@@ -34,7 +38,9 @@ data AppRoute
| RouteFrameVisio SessionId Int
| RouteFrameVisio SessionId Int
| RouteFrameWrite SessionId Int
| RouteFrameWrite SessionId Int
| Team SessionId Int
| Team SessionId Int
| TreeFlat SessionId Int String
| UserPage SessionId Int
| UserPage SessionId Int
| Share String Int
derive instance Eq AppRoute
derive instance Eq AppRoute
...
@@ -65,6 +71,7 @@ instance Show AppRoute where
...
@@ -65,6 +71,7 @@ instance Show AppRoute where
show (RouteFrameCode s i) = "code" <> show i <> " (" <> show s <> ")"
show (RouteFrameCode s i) = "code" <> show i <> " (" <> show s <> ")"
show (RouteFrameVisio s i) = "visio" <> show i <> " (" <> show s <> ")"
show (RouteFrameVisio s i) = "visio" <> show i <> " (" <> show s <> ")"
show (RouteFile s i) = "file" <> show i <> " (" <> show s <> ")"
show (RouteFile s i) = "file" <> show i <> " (" <> show s <> ")"
show (Share n i) = "share" <> show n <> show i
appPath :: AppRoute -> String
appPath :: AppRoute -> String
...
@@ -94,6 +101,7 @@ appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i
...
@@ -94,6 +101,7 @@ appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i
appPath (RouteFrameCode s i) = "code/" <> show s <> "/" <> show i
appPath (RouteFrameCode s i) = "code/" <> show s <> "/" <> show i
appPath (RouteFrameVisio s i) = "visio/" <> show s <> "/" <> show i
appPath (RouteFrameVisio s i) = "visio/" <> show s <> "/" <> show i
appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i
appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i
appPath (Share n i) = "share/" <> show n <> "/" <> show i
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
...
@@ -117,6 +125,7 @@ nodeTypeAppRoute GT.NodeFrameVisio s i = Just $ RouteFrameVisio s i
...
@@ -117,6 +125,7 @@ nodeTypeAppRoute GT.NodeFrameVisio s i = Just $ RouteFrameVisio s i
nodeTypeAppRoute _ _ _ = Nothing
nodeTypeAppRoute _ _ _ = Nothing
data SessionRoute
data SessionRoute
= Tab TabType (Maybe Id)
= Tab TabType (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
...
@@ -141,6 +150,7 @@ data SessionRoute
...
@@ -141,6 +150,7 @@ data SessionRoute
-- | AnnuaireContact AnnuaireId DocId
-- | AnnuaireContact AnnuaireId DocId
| PhyloAPI Id
| PhyloAPI Id
| Members
| Members
| ShareURL Id NodeType
------------------------------------------------------
------------------------------------------------------
...
...
src/Gargantext/Sessions/Types.purs
View file @
63692972
...
@@ -62,9 +62,7 @@ instance JSON.WriteForeign Session where
...
@@ -62,9 +62,7 @@ instance JSON.WriteForeign Session where
JSON.writeImpl { backend, caches: caches', token, treeId, username, userId }
JSON.writeImpl { backend, caches: caches', token, treeId, username, userId }
where
where
caches' = JSON.writeImpl $ Object.fromFoldable (GUT.first show <$> Map.toUnfoldable caches :: Array (Tuple String NT.CacheState))
caches' = JSON.writeImpl $ Object.fromFoldable (GUT.first show <$> Map.toUnfoldable caches :: Array (Tuple String NT.CacheState))
instance Eq Session where eq = genericEq
instance Eq Session where eq = genericEq
instance Show Session where
instance Show Session where
show (Session {backend, username}) = username <> "@" <> (cleanBackendUrl backend)
show (Session {backend, username}) = username <> "@" <> (cleanBackendUrl backend)
...
@@ -74,7 +72,6 @@ cleanBackendUrl (Backend {baseUrl}) =
...
@@ -74,7 +72,6 @@ cleanBackendUrl (Backend {baseUrl}) =
$ DST.replace (DST.Pattern "https://") (DST.Replacement "") baseUrl
$ DST.replace (DST.Pattern "https://") (DST.Replacement "") baseUrl
instance ToUrl Session SessionRoute where toUrl (Session {backend}) r = backendUrl backend (sessionPath r)
instance ToUrl Session SessionRoute where toUrl (Session {backend}) r = backendUrl backend (sessionPath r)
instance ToUrl Session NodePath where toUrl (Session {backend}) np = backendUrl backend (nodePath np)
instance ToUrl Session NodePath where toUrl (Session {backend}) np = backendUrl backend (nodePath np)
instance ToUrl Session String where toUrl = sessionUrl
instance ToUrl Session String where toUrl = sessionUrl
...
...
src/Gargantext/Types.purs
View file @
63692972
...
@@ -2,6 +2,7 @@ module Gargantext.Types where
...
@@ -2,6 +2,7 @@ module Gargantext.Types where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Argonaut as Argonaut
import Data.Array as A
import Data.Array as A
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
...
@@ -16,6 +17,7 @@ import Foreign as F
...
@@ -16,6 +17,7 @@ import Foreign as F
import Gargantext.Components.Lang (class Translate, Lang(..))
import Gargantext.Components.Lang (class Translate, Lang(..))
import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Utils.Glyphicon (classNamePrefix, glyphiconToCharCode)
import Gargantext.Utils.Glyphicon (classNamePrefix, glyphiconToCharCode)
import Gargantext.Utils.SimpleJSON (encodeJsonArgonaut)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import Prim.Row (class Union)
import Prim.Row (class Union)
...
@@ -169,6 +171,8 @@ instance JSON.ReadForeign NodeType where
...
@@ -169,6 +171,8 @@ instance JSON.ReadForeign NodeType where
Nothing -> F.fail $ F.ErrorAtProperty s $ F.ForeignError "unknown property"
Nothing -> F.fail $ F.ErrorAtProperty s $ F.ForeignError "unknown property"
Just nt -> pure nt
Just nt -> pure nt
instance JSON.WriteForeign NodeType where writeImpl = JSON.writeImpl <<< show
instance JSON.WriteForeign NodeType where writeImpl = JSON.writeImpl <<< show
instance Argonaut.EncodeJson NodeType where encodeJson = encodeJsonArgonaut
instance ArgGql String NodeType
instance ArgGql NodeType NodeType
instance ArgGql NodeType NodeType
instance VarTypeName NodeType where
instance VarTypeName NodeType where
varTypeName _ = "NodeType!"
varTypeName _ = "NodeType!"
...
@@ -237,32 +241,31 @@ prettyNodeType Url_Document = "Document"
...
@@ -237,32 +241,31 @@ prettyNodeType Url_Document = "Document"
instance Read NodeType where
instance Read NodeType where
read "NodeUser" = Just NodeUser
read "Calc" = Just Calc
read "Context" = Just Context
read "Document" = Just Url_Document
read "Individu" = Just Individu
read "Node" = Just Node
read "NodeAnnuaire" = Just Annuaire
read "NodeContact" = Just NodeContact
read "NodeCorpus" = Just Corpus
read "NodeDashboard" = Just Dashboard
read "NodeFile" = Just NodeFile
read "NodeFolder" = Just Folder
read "NodeFolder" = Just Folder
read "NodeFolderPrivate" = Just FolderPrivate
read "NodeFolderPrivate" = Just FolderPrivate
read "NodeFolderShared" = Just FolderShared
read "NodeFolderPublic" = Just FolderPublic
read "NodeFolderPublic" = Just FolderPublic
read "Node
Annuaire" = Just Annuaire
read "Node
FolderShared" = Just FolderShared
read "Node
Dashboard" = Just Dashboard
read "Node
FrameNotebook" = Just NodeFrameNotebook
read "
Document" = Just Url_Document
read "
NodeFrameVisio" = Just NodeFrameVisio
read "NodeGraph" = Just Graph
read "NodeGraph" = Just Graph
read "NodeList" = Just NodeList
read "NodePhylo" = Just Phylo
read "NodePhylo" = Just Phylo
read "Individu" = Just Individu
read "Node" = Just Node
read "Nodes" = Just Nodes
read "Context" = Just Context
read "NodeCorpus" = Just Corpus
read "NodeContact" = Just NodeContact
read "Tree" = Just Tree
read "NodeTeam" = Just Team
read "NodeTeam" = Just Team
read "NodeList" = Just NodeList
read "NodeTexts" = Just NodeTexts
read "NodeTexts" = Just NodeTexts
read "Annuaire" = Just Annuaire
read "NodeUser" = Just NodeUser
read "Notes" = Just Notes
read "Nodes" = Just Nodes
read "Calc" = Just Calc
read "Notes" = Just Notes
read "NodeFrameNotebook" = Just NodeFrameNotebook
read "Tree" = Just Tree
read "NodeFrameVisio" = Just NodeFrameVisio
read "NodeFile" = Just NodeFile
-- TODO NodePublic read ?
-- TODO NodePublic read ?
read _ = Nothing
read _ = Nothing
...
...
src/Gargantext/Utils/SimpleJSON.purs
View file @
63692972
...
@@ -4,6 +4,8 @@ import Prelude
...
@@ -4,6 +4,8 @@ import Prelude
import Control.Alt ((<|>))
import Control.Alt ((<|>))
import Control.Monad.Except (throwError, withExcept)
import Control.Monad.Except (throwError, withExcept)
import Data.Argonaut as Argonaut
import Data.Either (fromRight)
import Data.Generic.Rep as GR
import Data.Generic.Rep as GR
import Data.List as L
import Data.List as L
import Data.List.Types (NonEmptyList(..))
import Data.List.Types (NonEmptyList(..))
...
@@ -96,3 +98,8 @@ instance untaggedSumRepArgument ::
...
@@ -96,3 +98,8 @@ instance untaggedSumRepArgument ::
throwJSONError :: forall a. Foreign.ForeignError -> Foreign.F a
throwJSONError :: forall a. Foreign.ForeignError -> Foreign.F a
throwJSONError err =
throwJSONError err =
throwError $ NonEmptyList $ NonEmpty err L.Nil
throwError $ NonEmptyList $ NonEmpty err L.Nil
-- A SimpleJSON.ReadForeign instance should is also compatible with argonaut
encodeJsonArgonaut :: forall a. JSON.WriteForeign a => a -> Argonaut.Json
encodeJsonArgonaut x = fromRight Argonaut.jsonEmptyObject $ Argonaut.jsonParser $ JSON.writeJSON x
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