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
Christian Merten
purescript-gargantext
Commits
8846d516
Commit
8846d516
authored
Jul 15, 2024
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'testing' into stable
parents
1352a7bf
702e218f
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
161 additions
and
26 deletions
+161
-26
install
bin/install
+0
-0
repl
bin/repl
+3
-0
package.json
package.json
+1
-1
repl
repl
+0
-1
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+8
-6
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+1
-0
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+67
-4
GraphQL.purs
src/Gargantext/Components/GraphQL.purs
+1
-1
Context.purs
src/Gargantext/Components/GraphQL/Context.purs
+4
-2
Endpoints.purs
src/Gargantext/Components/GraphQL/Endpoints.purs
+4
-3
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+1
-1
DocList.purs
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
+71
-7
No files found.
install
→
bin/
install
View file @
8846d516
File moved
bin/repl
0 → 100755
View file @
8846d516
#!/bin/bash
nix run .#repl
package.json
View file @
8846d516
{
"name"
:
"Gargantext"
,
"version"
:
"0.0.7.1.
6.5
"
,
"version"
:
"0.0.7.1.
11
"
,
"scripts"
:
{
"build"
:
"spago build"
,
"bundle"
:
"spago bundle --module Main --outfile dist/bundle.js"
,
...
...
repl
deleted
100755 → 0
View file @
1352a7bf
nix-shell --run repl
src/Gargantext/Components/FacetsTable.purs
View file @
8846d516
...
...
@@ -253,12 +253,13 @@ type PageGQLParams =
( corpusId :: Int
, params :: T.Params
, ngramsTerms :: Array String
, session :: Session )
, session :: Session
, logic :: Boolean )
initialPageGQL :: { corpusId :: Int, ngramsTerms :: Array String, session :: Session }
initialPageGQL :: { corpusId :: Int, ngramsTerms :: Array String, session :: Session
, logic :: Boolean
}
-> Record PageGQLParams
initialPageGQL { corpusId, ngramsTerms, session } =
{ corpusId, ngramsTerms, params: T.initialParams, session }
initialPageGQL { corpusId, ngramsTerms, session
, logic
} =
{ corpusId, ngramsTerms, params: T.initialParams, session
, logic
}
loadPageGQL :: Record PageGQLParams -> AffRESTError Rows
...
...
@@ -266,9 +267,10 @@ loadPageGQL { corpusId
-- NOTE: unused
-- , params: { limit, offset, orderBy }
, ngramsTerms
, session } = do
, session
, logic } = do
eResult <- GQLE.getContextsForNgrams session corpusId ngramsTerms
eResult <- GQLE.getContextsForNgrams session corpusId ngramsTerms
logic
pure $ (\res -> Docs { docs: gqlContextToDocumentsView <$> Seq.fromFoldable res }) <$> eResult
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
8846d516
...
...
@@ -149,6 +149,7 @@ settingsBoxLens Calc =
, Add [ Calc
, Notes ]
, Move moveFrameParameters
, ShareURL
, Delete ]
settingsBoxLens Corpus =
_buttons .~ [ Add [ Graph
...
...
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
View file @
8846d516
...
...
@@ -14,7 +14,7 @@ import Data.Set as Set
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.Bootstrap.Types (
ButtonVariant(..),
Variant(..))
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..), initialPageGQL, loadPageGQL, publicationDate)
import Gargantext.Components.GraphExplorer.Store as GraphStore
import Gargantext.Components.GraphExplorer.Types (CorpusId, DocId, GraphSideDoc(..), ListId)
...
...
@@ -63,6 +63,8 @@ docListWrapperCpt = here.component "wrapper" cpt where
selectedNgramsTerms <- T.useBox []
buttonState <- T.useBox false
-- | Helpers
-- |
let
...
...
@@ -89,6 +91,7 @@ docListWrapperCpt = here.component "wrapper" cpt where
, selectedNgramsTerms
, session
, showDoc
, buttonState
}
_ /\ _ ->
...
...
@@ -109,6 +112,7 @@ type ListProps =
, selectedNgramsTerms :: T.Box (Array SigmaxT.Label)
, session :: Session
, showDoc :: T.Box (Maybe GraphSideDoc)
, buttonState :: T.Box Boolean
)
docList :: R2.Leaf ListProps
...
...
@@ -132,6 +136,7 @@ docListCpt = here.component "main" cpt where
, selectedNgramsTerms
, session
, showDoc
, buttonState
} _ = do
-- | States
-- |
...
...
@@ -141,10 +146,13 @@ docListCpt = here.component "main" cpt where
selectedNgramsTerms' <- T.useLive T.unequal selectedNgramsTerms
buttonState' <- R2.useLive' buttonState
path' /\ path
<- R2.useBox' $ initialPageGQL { corpusId: nodeId
, ngramsTerms: A.fromFoldable selectedNgramsTerms'
, session }
, session
, logic: buttonState' }
state' /\ state <-
R2.useBox' Nothing
...
...
@@ -174,7 +182,14 @@ docListCpt = here.component "main" cpt where
useUpdateEffect1' selectedNgramsTerms' $
flip T.write_ path $ initialPageGQL { corpusId: nodeId
, ngramsTerms: A.fromFoldable selectedNgramsTerms'
, session }
, session
, logic: buttonState' }
useUpdateEffect1' buttonState' $
T.write_ (initialPageGQL { corpusId: nodeId
, ngramsTerms: A.fromFoldable selectedNgramsTerms'
, session
, logic: buttonState' }) path
-- (on fetch success, extract existing docs)
useUpdateEffect1' state' do
...
...
@@ -239,7 +254,12 @@ docListCpt = here.component "main" cpt where
H.div {}
[
H.h6 {} [ H.text $ show (Seq.length results) <> " related documents"]
H.ul { className: "flex-row list-group vertical-align-middle" }
[ H.li {} [ andOrButton { state: buttonState } ]
, H.li {} [ H.h6 {} [ H.text $ show (Seq.length results) <> " related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> pure unit} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> pure unit} ]
]
, H.ul
{ className: intercalate " "
[ "graph-doc-list"
...
...
@@ -348,3 +368,46 @@ itemCpt = here.component "item" cpt where
]
]
]
---------------------------------------------------------
type AndOrButtonProps =
( state :: T.Box Boolean
)
andOrButton :: R2.Leaf AndOrButtonProps
andOrButton = R2.leaf andOrButtonCpt
andOrButtonCpt :: R.Component AndOrButtonProps
andOrButtonCpt = here.component "andOrButton" cpt
where
cpt { state } _ = do
state' <- R2.useLive' state
pure $
H.div
{ className: intercalate " "
[ "btn-group"
, "align-items-center"
]
, role: "group"
}
[
B.button
{ className: "btn-sm"
, callback: \_ -> T.write_ false state
, variant: state' ?
OutlinedButtonVariant Secondary $
ButtonVariant Secondary
}
[ H.text "OR" ]
,
B.button
{ className: "btn-sm"
, callback: \_ -> T.write_ true state
, variant: state' ?
ButtonVariant Secondary $
OutlinedButtonVariant Secondary
}
[ H.text "AND" ]
]
src/Gargantext/Components/GraphQL.purs
View file @
8846d516
...
...
@@ -148,7 +148,7 @@ type Schema
= { annuaire_contacts :: { contact_id :: Int } -> Array AnnuaireContact
, context_ngrams :: { context_id :: Int, list_id :: Int } -> Array String
, contexts :: { context_id :: Int, node_id :: Int } -> Array GQLCTX.NodeContext
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: Array String } -> Array GQLCTX.Context
, contexts_for_ngrams :: { corpus_id :: Int, ngrams_terms :: Array String
, and_logic :: String
} -> Array GQLCTX.Context
, imt_schools :: {} -> Array GQLIMT.School
, languages :: {} -> Array GQLNLP.Language
, node_children :: { node_id :: Int, child_type :: NodeType } -> Array GQLNode.Node
...
...
src/Gargantext/Components/GraphQL/Context.purs
View file @
8846d516
...
...
@@ -89,7 +89,8 @@ nodeContextQuery
type ContextsForNgramsQuery
= { contexts_for_ngrams :: Args
{ corpus_id :: Var "corpus_id" Int
, ngrams_terms :: Var "ngrams_terms" NgramsTerms }
, ngrams_terms :: Var "ngrams_terms" NgramsTerms
, and_logic :: Var "and_logic" String }
{ c_id :: Unit
, c_score :: Unit
, c_date :: Unit
...
...
@@ -124,7 +125,8 @@ contextsForNgramsQuery :: ContextsForNgramsQuery
contextsForNgramsQuery
= { contexts_for_ngrams:
{ corpus_id: Var :: _ "corpus_id" Int
, ngrams_terms: Var :: _ "ngrams_terms" NgramsTerms } =>>
, ngrams_terms: Var :: _ "ngrams_terms" NgramsTerms
, and_logic: Var :: _ "and_logic" String } =>>
GGQL.getFieldsStandard (Proxy :: _ Context)
}
...
...
src/Gargantext/Components/GraphQL/Endpoints.purs
View file @
8846d516
...
...
@@ -190,10 +190,11 @@ getNodeContext session context_id node_id = do
Just context -> pure $ Right context -- TODO: error handling
type ContextsForNgramsGQL = { contexts_for_ngrams :: Array GQLCTX.Context }
getContextsForNgrams :: Session -> CorpusId -> Array String -> AffRESTError (Array GQLCTX.Context)
getContextsForNgrams session corpus_id ngrams_terms = do
getContextsForNgrams :: Session -> CorpusId -> Array String ->
Boolean ->
AffRESTError (Array GQLCTX.Context)
getContextsForNgrams session corpus_id ngrams_terms
logic
= do
let query = GQLCTX.contextsForNgramsQuery `withVars` { corpus_id
, ngrams_terms: GQLCTX.NgramsTerms ngrams_terms }
, ngrams_terms: GQLCTX.NgramsTerms ngrams_terms
, and_logic: show logic }
eRes <- queryGql session "get contexts for ngrams" query
pure $ rmap _.contexts_for_ngrams eRes
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
8846d516
...
...
@@ -213,7 +213,7 @@ type NgramsDocLoadProps =
loaderNgramsDocList :: Record NgramsDocLoadProps -> AffRESTError (Array GQLCTX.Context)
loaderNgramsDocList { corpusId, ngrams: NormNgramsTerm ngrams, session } =
getContextsForNgrams session corpusId [ngrams]
getContextsForNgrams session corpusId [ngrams]
false
type NgramsDocListLoadedProps =
( contexts :: Array GQLCTX.Context
...
...
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
View file @
8846d516
...
...
@@ -11,7 +11,7 @@ import Data.Sequence as Seq
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.Bootstrap.Types (
ButtonVariant(..),
Variant(..))
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..), publicationDate, initialPageGQL, loadPageGQL)
import Gargantext.Components.PhyloExplorer.Store as PhyloStore
import Gargantext.Components.PhyloExplorer.Types (CorpusId, DocId, FrameDoc(..), ListId)
...
...
@@ -51,6 +51,8 @@ docListWrapperCpt = here.component "wrapper" cpt where
listId <- R2.useLive' store.listId
selectedTerm <- R2.useLive' store.selectedTerm
buttonState <- T.useBox false
query' /\ query <- R2.useBox' Nothing
-- | Helpers
...
...
@@ -90,6 +92,7 @@ docListWrapperCpt = here.component "wrapper" cpt where
, listId
, frameDoc: store.frameDoc
, frontends: defaultFrontends
, buttonState
}
]
...
...
@@ -102,6 +105,7 @@ type ListProps =
, session :: Session
, frameDoc :: T.Box (Maybe FrameDoc)
, frontends :: Frontends
, buttonState :: T.Box Boolean
)
docList :: R2.Leaf ListProps
...
...
@@ -125,15 +129,12 @@ docListCpt = here.component "main" cpt where
, listId
, frameDoc
, frontends
, buttonState
} _ = do
-- | States
-- |
path' /\ path <- R2.useBox' $ initialPageGQL { corpusId: nodeId
, ngramsTerms: q'
, session }
state' /\ state <-
R2.useBox' Nothing
...
...
@@ -143,6 +144,14 @@ docListCpt = here.component "main" cpt where
frameDoc' <-
R2.useLive' frameDoc
buttonState' <-
R2.useLive' buttonState
path' /\ path <- R2.useBox' $ initialPageGQL { corpusId: nodeId
, ngramsTerms: q'
, session
, logic: buttonState' }
-- | Hooks
-- |
...
...
@@ -160,7 +169,14 @@ docListCpt = here.component "main" cpt where
useUpdateEffect1' query $
T.write_ (initialPageGQL { corpusId: nodeId
, ngramsTerms: q'
, session }) path
, session
, logic: buttonState' }) path
useUpdateEffect1' buttonState' $
T.write_ (initialPageGQL { corpusId: nodeId
, ngramsTerms: q'
, session
, logic: buttonState' }) path
-- (on fetch success, extract existing docs)
useUpdateEffect1' state' case state' of
...
...
@@ -223,7 +239,12 @@ docListCpt = here.component "main" cpt where
R2.when (not $ eq results Seq.empty) $
H.div {}
[
H.h6 {} [ H.text $ show (Seq.length results) <> " related documents"]
H.ul { className: "flex-row list-group vertical-align-middle" }
[ H.li {} [ andOrButton { state: buttonState } ]
, H.li {} [ H.h6 {} [ H.text $ show (Seq.length results) <> " related documents" ] ]
, H.li {} [ B.iconButton { name: "search", title: "Search the web", callback: \_ -> pure unit} ]
, H.li {} [ B.iconButton { name: "wikipedia-w", title: "Search Wikipedia", callback: \_ -> pure unit} ]
]
,
H.ul
{ className: intercalate " "
...
...
@@ -334,3 +355,46 @@ itemCpt = here.component "item" cpt where
]
]
]
---------------------------------------------------------
type AndOrButtonProps =
( state :: T.Box Boolean
)
andOrButton :: R2.Leaf AndOrButtonProps
andOrButton = R2.leaf andOrButtonCpt
andOrButtonCpt :: R.Component AndOrButtonProps
andOrButtonCpt = here.component "andOrButton" cpt
where
cpt { state } _ = do
state' <- R2.useLive' state
pure $
H.div
{ className: intercalate " "
[ "btn-group"
, "align-items-center"
]
, role: "group"
}
[
B.button
{ className: "btn-sm"
, callback: \_ -> T.write_ false state
, variant: state' ?
OutlinedButtonVariant Secondary $
ButtonVariant Secondary
}
[ H.text "OR" ]
,
B.button
{ className: "btn-sm"
, callback: \_ -> T.write_ true state
, variant: state' ?
ButtonVariant Secondary $
OutlinedButtonVariant Secondary
}
[ H.text "AND" ]
]
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