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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
77683cc7
Commit
77683cc7
authored
Apr 24, 2024
by
Karen Konou
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 548-dev-node-url-share
parents
8c77a71b
ea54fd82
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
218 additions
and
134 deletions
+218
-134
package.json
package.json
+1
-1
Breadcrumb.purs
src/Gargantext/Components/Forest/Breadcrumb.purs
+124
-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
+3
-2
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
Router.purs
src/Gargantext/Components/Router.purs
+11
-14
TreeSearch.purs
src/Gargantext/Components/TreeSearch.purs
+11
-10
Routes.purs
src/Gargantext/Routes.purs
+7
-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 @
77683cc7
{
"name"
:
"Gargantext"
,
"version"
:
"0.0.7"
,
"version"
:
"0.0.7
.1
"
,
"scripts"
:
{
"generate-purs-packages-nix"
:
"./nix/generate-purs-packages.nix"
,
"generate-psc-packages-nix"
:
"./nix/generate-packages-json.bash"
,
...
...
src/Gargantext/Components/Forest/Breadcrumb.purs
View file @
77683cc7
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Action/Contact/Types.purs
View file @
77683cc7
...
...
@@ -17,9 +17,11 @@ instance JSON.ReadForeign AddContactParams where readImpl = GUSJ.taggedSumRep
instance JSON.WriteForeign AddContactParams where
writeImpl (AddContactParams { firstname, lastname }) =
JSON.writeImpl { type: "AddContactParams"
, values: { firstname, lastname } }
, firstname
, lastname }
writeImpl (AddContactParamsAdvanced { firstname, lastname }) =
JSON.writeImpl { type: "AddContactParamsAdvanced"
, values: { firstname, lastname } }
, firstname
, lastname }
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
77683cc7
...
...
@@ -44,8 +44,9 @@ getCompletionsReq { session } =
------------------------------------------------------------------------
data ShareNodeParams = ShareTeamParams { username :: String }
| SharePublicParams { node_id :: Int }
data ShareNodeParams =
ShareTeamParams { username :: String }
| SharePublicParams { node_id :: Int }
derive instance Eq ShareNodeParams
derive instance Generic ShareNodeParams _
instance JSON.ReadForeign ShareNodeParams where readImpl = GUSJ.taggedSumRep
...
...
src/Gargantext/Components/GraphQL.purs
View file @
77683cc7
...
...
@@ -21,7 +21,9 @@ import Gargantext.Components.GraphQL.User (User, UserInfo, UserInfoM, UserPubmed
import Gargantext.Config.REST as REST
import Gargantext.Ends (Backend(..))
import Gargantext.Prelude
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..))
import Gargantext.Types (NodeType)
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.Args (type (==>))
import GraphQL.Client.BaseClients.Urql (UrqlClient, createClient)
...
...
@@ -150,7 +152,8 @@ type Schema
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: Array String } ==> Array GQLCTX.Context
, imt_schools :: {} ==> Array GQLIMT.School
, 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_corpus :: { corpus_id :: Int } ==> Array GQLNode.Corpus
, user_infos :: { user_id :: Int } ==> Array UserInfo
...
...
src/Gargantext/Components/GraphQL/Endpoints.purs
View file @
77683cc7
...
...
@@ -12,7 +12,7 @@ import Gargantext.Components.GraphQL.Contact (AnnuaireContact, annuaireContactQu
import Gargantext.Components.GraphQL.Context as GQLCTX
import Gargantext.Components.GraphQL.IMT as GQLIMT
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.Tree (TreeFirstLevel, treeFirstLevelQuery, BreadcrumbInfo, breadcrumbQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQuery)
...
...
@@ -20,6 +20,7 @@ import Gargantext.Components.Lang (Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Prelude
import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (Session(..))
import Gargantext.Types (CorpusId, NodeType)
import Gargantext.Utils.Reactix as R2
...
...
@@ -64,11 +65,20 @@ getNodeParent :: Session -> Int -> NodeType -> AffRESTError (Array Node)
getNodeParent session nodeId parentType = do
eRes <- queryGql session "get node parent" $
nodeParentQuery `withVars` { id: nodeId
, parent_type:
show parentType } -- TODO: remove "show"
, parent_type:
parentType }
-- liftEffect $ here.log2 "[getNodeParent] node_parent" node_parent
--pure node_parent
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 id = do
eRes <- queryGql session "get user" $ userQuery `withVars` { id }
...
...
@@ -218,7 +228,7 @@ getContextNgrams session context_id list_id = do
pure $ rmap (\{ context_ngrams } -> NormNgramsTerm <$> context_ngrams) eRes
getBreadcrumb :: Session -> Int -> AffRESTError BreadcrumbInfo
getBreadcrumb session id = do
eRes <- queryGql session "get breadcrumb branch" $ breadcrumbQuery `withVars` { id }
getBreadcrumb session
node_
id = do
eRes <- queryGql session "get breadcrumb branch" $ breadcrumbQuery `withVars` {
node_
id }
-- liftEffect $ here.log2 "[getBreadcrumb] breadcrumb" tree_branch
pure $ rmap _.tree_branch eRes
src/Gargantext/Components/GraphQL/Node.purs
View file @
77683cc7
...
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphQL.Node where
import Gargantext.Prelude
import Gargantext.Utils.GraphQL as GGQL
import Gargantext.Types (NodeType)
import GraphQL.Client.Args (Args, (=>>))
import GraphQL.Client.Variable (Var(..))
import Type.Proxy (Proxy(..))
...
...
@@ -46,6 +47,11 @@ nodesCorpusQuery = { nodes_corpus: { corpus_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)
}
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 @
77683cc7
...
...
@@ -3,6 +3,7 @@ module Gargantext.Components.GraphQL.Tree where
import Gargantext.Prelude
import Data.Maybe (Maybe)
import Gargantext.Routes (AppRoute)
import Gargantext.Types (NodeType)
import GraphQL.Client.Args ((=>>))
import GraphQL.Client.Variable (Var(..))
...
...
@@ -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:
{ name: unit
, node_type: unit
...
...
@@ -50,4 +51,4 @@ breadcrumbQuery = { tree_branch: { node_id: Var :: _ "id" Int} =>>
, parent_id: unit
}
}
}
\ No newline at end of file
}
src/Gargantext/Components/Router.purs
View file @
77683cc7
...
...
@@ -182,8 +182,7 @@ mainPageCpt = here.component "mainPage" cpt where
H.div { className: "router__body main-page" }
[
Breadcrumb.component
{ boxes }
Breadcrumb.component { }
,
H.div
{ className: intercalate " "
...
...
@@ -487,7 +486,6 @@ type CorpusDocumentProps =
corpusDocument :: R2.Component CorpusDocumentProps
corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt where
cpt props@{ corpusId, listId, nodeId } _ = do
...
...
@@ -496,16 +494,16 @@ corpusDocumentCpt = here.component "corpusDocument" cpt where
authedProps =
Record.merge
{ content:
\session ->
Document.node
{ mCorpusId: Just corpusId
, listId
, nodeId
, key: show (sessionId session) <> "-" <> show nodeId
}
}
sessionProps
{ content:
\session ->
Document.node
{ mCorpusId: Just corpusId
, listId
, nodeId
, key: show (sessionId session) <> "-" <> show nodeId
}
}
sessionProps
pure $ authed authedProps []
...
...
@@ -530,7 +528,6 @@ type DocumentProps =
document :: R2.Component DocumentProps
document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt where
cpt props@{ listId, nodeId } _ = do
...
...
src/Gargantext/Components/TreeSearch.purs
View file @
77683cc7
...
...
@@ -169,14 +169,15 @@ treeSearchRenderContainerCpt = here.component "treeSearchRenderContainer" cpt wh
treeSearchRender :: R2.Leaf RenderProps
treeSearchRender = R2.leaf treeSearchRenderCpt
treeSearchRenderCpt :: R.Component RenderProps
treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
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
results s = map searchResult s
results
route'
s = map searchResult s
where
searchResult sd = H.div
{ className: "result py-1"}
...
...
@@ -195,9 +196,9 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
, H.div {}
[
H.text " Path: "
, breadcrumbView {
nodeId: sd.id
,
session: Just session
,
format: "text"
, breadcrumbView {
format: "text"
,
route: route'
,
session
}
]
]
...
...
@@ -218,10 +219,10 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
H.span { className: "node-path small" }
[
H.text " — "
, breadcrumbView {
nodeId: sd.id
, session: Just session
, format: "text"
}
, breadcrumbView {
format: "text"
, route: route'
, session: session
}
]
]
...
...
src/Gargantext/Routes.purs
View file @
77683cc7
...
...
@@ -2,11 +2,16 @@ module Gargantext.Routes where
import Prelude
import Data.Argonaut as Argonaut
import Data.Maybe (Maybe(..))
import Data.UUID (UUID)
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 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
= Annuaire SessionId Int
...
...
@@ -25,7 +30,6 @@ data AppRoute
| Lists SessionId Int
| Login
| NodeTexts SessionId Int
| TreeFlat SessionId Int String
| PGraphExplorer SessionId Int
| PhyloExplorer SessionId Int
| RouteFile SessionId Int
...
...
@@ -34,6 +38,7 @@ data AppRoute
| RouteFrameVisio SessionId Int
| RouteFrameWrite SessionId Int
| Team SessionId Int
| TreeFlat SessionId Int String
| UserPage SessionId Int
| Share String Int
...
...
@@ -120,6 +125,7 @@ nodeTypeAppRoute GT.NodeFrameVisio s i = Just $ RouteFrameVisio s i
nodeTypeAppRoute _ _ _ = Nothing
data SessionRoute
= Tab TabType (Maybe Id)
| Children NodeType Offset Limit (Maybe OrderBy) (Maybe Id)
...
...
src/Gargantext/Sessions/Types.purs
View file @
77683cc7
...
...
@@ -62,9 +62,7 @@ instance JSON.WriteForeign Session where
JSON.writeImpl { backend, caches: caches', token, treeId, username, userId }
where
caches' = JSON.writeImpl $ Object.fromFoldable (GUT.first show <$> Map.toUnfoldable caches :: Array (Tuple String NT.CacheState))
instance Eq Session where eq = genericEq
instance Show Session where
show (Session {backend, username}) = username <> "@" <> (cleanBackendUrl backend)
...
...
@@ -74,7 +72,6 @@ cleanBackendUrl (Backend {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 NodePath where toUrl (Session {backend}) np = backendUrl backend (nodePath np)
instance ToUrl Session String where toUrl = sessionUrl
...
...
src/Gargantext/Types.purs
View file @
77683cc7
...
...
@@ -2,6 +2,7 @@ module Gargantext.Types where
import Gargantext.Prelude
import Data.Argonaut as Argonaut
import Data.Array as A
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
...
...
@@ -16,6 +17,7 @@ import Foreign as F
import Gargantext.Components.Lang (class Translate, Lang(..))
import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Utils.Glyphicon (classNamePrefix, glyphiconToCharCode)
import Gargantext.Utils.SimpleJSON (encodeJsonArgonaut)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import Prim.Row (class Union)
...
...
@@ -169,6 +171,8 @@ instance JSON.ReadForeign NodeType where
Nothing -> F.fail $ F.ErrorAtProperty s $ F.ForeignError "unknown property"
Just nt -> pure nt
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 VarTypeName NodeType where
varTypeName _ = "NodeType!"
...
...
@@ -237,32 +241,31 @@ prettyNodeType Url_Document = "Document"
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 "NodeFolderPrivate" = Just FolderPrivate
read "NodeFolderShared" = Just FolderShared
read "NodeFolderPublic" = Just FolderPublic
read "Node
Annuaire" = Just Annuaire
read "Node
Dashboard" = Just Dashboard
read "
Document" = Just Url_Document
read "Node
FolderShared" = Just FolderShared
read "Node
FrameNotebook" = Just NodeFrameNotebook
read "
NodeFrameVisio" = Just NodeFrameVisio
read "NodeGraph" = Just Graph
read "NodeList" = Just NodeList
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 "NodeList" = Just NodeList
read "NodeTexts" = Just NodeTexts
read "Annuaire" = Just Annuaire
read "Notes" = Just Notes
read "Calc" = Just Calc
read "NodeFrameNotebook" = Just NodeFrameNotebook
read "NodeFrameVisio" = Just NodeFrameVisio
read "NodeFile" = Just NodeFile
read "NodeUser" = Just NodeUser
read "Nodes" = Just Nodes
read "Notes" = Just Notes
read "Tree" = Just Tree
-- TODO NodePublic read ?
read _ = Nothing
...
...
src/Gargantext/Utils/SimpleJSON.purs
View file @
77683cc7
...
...
@@ -4,6 +4,8 @@ import Prelude
import Control.Alt ((<|>))
import Control.Monad.Except (throwError, withExcept)
import Data.Argonaut as Argonaut
import Data.Either (fromRight)
import Data.Generic.Rep as GR
import Data.List as L
import Data.List.Types (NonEmptyList(..))
...
...
@@ -96,3 +98,8 @@ instance untaggedSumRepArgument ::
throwJSONError :: forall a. Foreign.ForeignError -> Foreign.F a
throwJSONError err =
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