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
9b2392d9
Commit
9b2392d9
authored
Nov 30, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-node-calc-parser
parents
6e5b1704
453b3298
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
33 deletions
+87
-33
package.json
package.json
+1
-1
FolderView.purs
src/Gargantext/Components/FolderView.purs
+2
-2
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+14
-0
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+5
-3
Phylo.purs
src/Gargantext/Components/Nodes/Corpus/Phylo.purs
+2
-2
JSON.purs
src/Gargantext/Components/PhyloExplorer/JSON.purs
+3
-1
Layout.purs
src/Gargantext/Components/PhyloExplorer/Layout.purs
+10
-6
Types.purs
src/Gargantext/Components/PhyloExplorer/Types.purs
+43
-15
Router.purs
src/Gargantext/Components/Router.purs
+7
-3
No files found.
package.json
View file @
9b2392d9
{
{
"name"
:
"Gargantext"
,
"name"
:
"Gargantext"
,
"version"
:
"0.0.4.
8.5
"
,
"version"
:
"0.0.4.
9.1
"
,
"scripts"
:
{
"scripts"
:
{
"generate-purs-packages-nix"
:
"./nix/generate-purs-packages.nix"
,
"generate-purs-packages-nix"
:
"./nix/generate-purs-packages.nix"
,
"generate-psc-packages-nix"
:
"./nix/generate-packages-json.bash"
,
"generate-psc-packages-nix"
:
"./nix/generate-packages-json.bash"
,
...
...
src/Gargantext/Components/FolderView.purs
View file @
9b2392d9
...
@@ -122,7 +122,7 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
...
@@ -122,7 +122,7 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
makeParentFolder linkHandlers Nothing _ _ true = [ H.button {className: "btn btn-primary", on: { click: \_ -> linkHandlers.goToRoute Home}} [ H.i { className: "fa fa-folder-open" } []
makeParentFolder linkHandlers Nothing _ _ true = [ H.button {className: "btn btn-primary", on: { click: \_ -> linkHandlers.goToRoute Home}} [ H.i { className: "fa fa-folder-open" } []
, H.br {}
, H.br {}
, H.text ".."] ]
, H.text ".."] ]
makeParentFolder linkHandlers Nothing _ true _ = [ H.button {className: "btn btn-primary", on: { click: \_ -> linkHandlers.goToPreviousPage } } [ H.i { className: "fa fa-folder-open" } []
makeParentFolder linkHandlers Nothing _ true _ = [ H.button {className: "btn btn-primary", on: { click: \_ -> linkHandlers.goToPreviousPage
unit
} } [ H.i { className: "fa fa-folder-open" } []
, H.br {}
, H.br {}
, H.text ".."] ]
, H.text ".."] ]
makeParentFolder _ Nothing _ _ _ = []
makeParentFolder _ Nothing _ _ _ = []
...
@@ -249,7 +249,7 @@ backButtonCpt = R.hooksComponent "backButton" cpt where
...
@@ -249,7 +249,7 @@ backButtonCpt = R.hooksComponent "backButton" cpt where
pure $
pure $
H.button {
H.button {
className: "btn btn-primary"
className: "btn btn-primary"
, on: { click: \_ -> goToPreviousPage }
, on: { click: \_ -> goToPreviousPage
unit
}
} [
} [
H.i { className: "fa fa-arrow-left", title: "Previous view"} []
H.i { className: "fa fa-arrow-left", title: "Previous view"} []
]
]
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
9b2392d9
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer where
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer where
import Gargantext.Prelude hiding (max, min)
import Gargantext.Prelude hiding (max, min)
import Control.Bind ((=<<))
import DOM.Simple.Types (Element)
import DOM.Simple.Types (Element)
import Data.Array as A
import Data.Array as A
import Data.FoldableWithIndex (foldMapWithIndex)
import Data.FoldableWithIndex (foldMapWithIndex)
...
@@ -20,6 +21,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
...
@@ -20,6 +21,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Data.Louvain as Louvain
import Gargantext.Data.Louvain as Louvain
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Sigmax.Sigma (startForceAtlas2)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -58,7 +60,19 @@ type GraphWriteProps =
...
@@ -58,7 +60,19 @@ type GraphWriteProps =
| Props
| Props
)
)
type LayoutWithKeyProps =
( key :: String
| LayoutProps )
--------------------------------------------------------------
--------------------------------------------------------------
explorerLayoutWithKey :: R2.Component LayoutWithKeyProps
explorerLayoutWithKey = R.createElement explorerLayoutWithKeyCpt
explorerLayoutWithKeyCpt :: R.Component LayoutWithKeyProps
explorerLayoutWithKeyCpt = here.component "explorerLayoutWithKey" cpt where
cpt { boxes, graphId, session } _ = do
pure $ explorerLayout { boxes, graphId, session } []
explorerLayout :: R2.Component LayoutProps
explorerLayout :: R2.Component LayoutProps
explorerLayout = R.createElement explorerLayoutCpt
explorerLayout = R.createElement explorerLayoutCpt
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt :: R.Component LayoutProps
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
9b2392d9
...
@@ -126,6 +126,7 @@ tableContainerCpt { dispatch
...
@@ -126,6 +126,7 @@ tableContainerCpt { dispatch
R2.row [ H.div {className: "col-md-2", style: {marginTop: "6px"}}
R2.row [ H.div {className: "col-md-2", style: {marginTop: "6px"}}
[ H.div {} syncResetButton
[ H.div {} syncResetButton
, if A.null props.tableBody && searchQuery /= "" then
, if A.null props.tableBody && searchQuery /= "" then
-- , if (not $ Set.member (normNgram tabNgramType searchQuery) ngramsSelection) && searchQuery /= "" then
H.li { className: "list-group-item" } [
H.li { className: "list-group-item" } [
H.button { className: "btn btn-primary"
H.button { className: "btn btn-primary"
, on: { click: const $ dispatch
, on: { click: const $ dispatch
...
@@ -202,9 +203,9 @@ tableContainerCpt { dispatch
...
@@ -202,9 +203,9 @@ tableContainerCpt { dispatch
setTermSizeFilter x = T.modify (_ { termSizeFilter = x }) path
setTermSizeFilter x = T.modify (_ { termSizeFilter = x }) path
setSelection = dispatch <<< setTermListSetA ngramsTableCache ngramsSelection
setSelection = dispatch <<< setTermListSetA ngramsTableCache ngramsSelection
editor = H.div {} $ maybe []
f
ngramsParent
editor = H.div {} $ maybe []
edit
ngramsParent
where
where
f
ngrams = [ H.p {} [H.text $ "Editing " <> ngramsTermText ngrams]
edit
ngrams = [ H.p {} [H.text $ "Editing " <> ngramsTermText ngrams]
, NTC.renderNgramsTree { ngramsTable
, NTC.renderNgramsTree { ngramsTable
, ngrams
, ngrams
, ngramsStyle: []
, ngramsStyle: []
...
@@ -481,6 +482,7 @@ mkDispatch { filteredRows
...
@@ -481,6 +482,7 @@ mkDispatch { filteredRows
pure unit
pure unit
Just parent -> do
Just parent -> do
here.log2 "[performAction] AddTermChildren, parent" parent
here.log2 "[performAction] AddTermChildren, parent" parent
here.log2 "[performAction] AddTermChildren, ngramsChildren" ngramsChildren
let pc = patchSetFromMap ngramsChildren
let pc = patchSetFromMap ngramsChildren
pe = NgramsPatch { patch_list: mempty, patch_children: pc }
pe = NgramsPatch { patch_list: mempty, patch_children: pc }
pt = singletonNgramsTablePatch parent pe
pt = singletonNgramsTablePatch parent pe
...
@@ -494,7 +496,7 @@ mkDispatch { filteredRows
...
@@ -494,7 +496,7 @@ mkDispatch { filteredRows
in
in
singletonNgramsTablePatch h pp
singletonNgramsTablePatch h pp
here.log2 "[performAction] pt with patchSetFromMap" $ pt <> ppt
here.log2 "[performAction] pt with patchSetFromMap" $ pt <> ppt
commitPatch (pt
<> ppt
) state
commitPatch (pt
{-<> ppt-}
) state
performAction (CoreAction a) = coreDispatch path state a
performAction (CoreAction a) = coreDispatch path state a
...
...
src/Gargantext/Components/Nodes/Corpus/Phylo.purs
View file @
9b2392d9
...
@@ -55,8 +55,8 @@ fetchPhyloJSON :: Aff (Either String PhyloDataSet)
...
@@ -55,8 +55,8 @@ fetchPhyloJSON :: Aff (Either String PhyloDataSet)
fetchPhyloJSON =
fetchPhyloJSON =
let
let
-- @WIP remove dumb data
-- @WIP remove dumb data
url = "http://localhost:5000/js/knowledge-phylomemy.json"
--
url = "http://localhost:5000/js/knowledge-phylomemy.json"
--
url = "http://localhost:5000/js/vaccines_countries_06_2021.json"
url = "http://localhost:5000/js/vaccines_countries_06_2021.json"
request = AX.defaultRequest
request = AX.defaultRequest
{ url = url
{ url = url
, method = Left GET
, method = Left GET
...
...
src/Gargantext/Components/PhyloExplorer/JSON.purs
View file @
9b2392d9
...
@@ -77,7 +77,9 @@ data RawObject
...
@@ -77,7 +77,9 @@ data RawObject
, lbl :: String
, lbl :: String
, penwidth :: String
, penwidth :: String
, role :: String
, role :: String
, seaLvl :: String
-- @WIP: not in API; but present in certain data (eg. "Knowledge
-- visualisation")
, seaLvl :: Maybe String
, source :: String
, source :: String
, strFrom :: Maybe String
, strFrom :: Maybe String
, strTo :: Maybe String
, strTo :: Maybe String
...
...
src/Gargantext/Components/PhyloExplorer/Layout.purs
View file @
9b2392d9
...
@@ -5,14 +5,15 @@ module Gargantext.Components.PhyloExplorer.Layout
...
@@ -5,14 +5,15 @@ module Gargantext.Components.PhyloExplorer.Layout
import Gargantext.Prelude
import Gargantext.Prelude
import DOM.Simple (document, window)
import DOM.Simple (document, window)
import Data.
Array as Array
import Data.
Tuple.Nested ((/\))
import Gargantext.Components.PhyloExplorer.Draw (drawPhylo, highlightSource, setGlobalD3Reference, setGlobalDependencies, unhide)
import Gargantext.Components.PhyloExplorer.Draw (drawPhylo, highlightSource, setGlobalD3Reference, setGlobalDependencies, unhide)
import Gargantext.Components.PhyloExplorer.Types (PhyloDataSet(..))
import Gargantext.Components.PhyloExplorer.Types (PhyloDataSet(..)
, Source(..), sortSources
)
import Gargantext.Utils (nbsp)
import Gargantext.Utils (nbsp)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Graphics.D3.Base (d3)
import Graphics.D3.Base (d3)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.PhyloExplorer"
here = R2.here "Gargantext.Components.PhyloExplorer"
...
@@ -28,7 +29,10 @@ layoutCpt = here.component "layout" cpt where
...
@@ -28,7 +29,10 @@ layoutCpt = here.component "layout" cpt where
cpt { phyloDataSet: (PhyloDataSet o)
cpt { phyloDataSet: (PhyloDataSet o)
} _ = do
} _ = do
-- States
-- States
sources /\ sourcesBox <- R2.useBox' (mempty :: Array Source)
R.useEffectOnce' $ do
R.useEffectOnce' $ do
(sortSources >>> flip T.write_ sourcesBox) o.sources
unhide document o.name
unhide document o.name
setGlobalD3Reference window d3
setGlobalD3Reference window d3
setGlobalDependencies window (PhyloDataSet o)
setGlobalDependencies window (PhyloDataSet o)
...
@@ -108,11 +112,11 @@ layoutCpt = here.component "layout" cpt where
...
@@ -108,11 +112,11 @@ layoutCpt = here.component "layout" cpt where
[ H.text "unselect source ✕" ]
[ H.text "unselect source ✕" ]
]
]
<>
<>
flip
Array.mapWithIndex o.
sources
flip
map
sources
( \
idx val
->
( \
(Source { id, label })
->
H.option
H.option
{ value: id
x
}
{ value: id }
[ H.text
va
l ]
[ H.text
labe
l ]
)
)
,
,
...
...
src/Gargantext/Components/PhyloExplorer/Types.purs
View file @
9b2392d9
module Gargantext.Components.PhyloExplorer.Types
module Gargantext.Components.PhyloExplorer.Types
( PhyloDataSet(..)
( PhyloDataSet(..)
, parsePhyloJSONSet
, Branch(..), Period(..), Group(..)
, Branch(..), Period(..), Group(..)
, Link(..), AncestorLink(..), BranchLink(..)
, Link(..), AncestorLink(..), BranchLink(..)
, GlobalTerm(..)
, GlobalTerm(..)
, parsePhyloJSONSet
, Source(..)
, sortSources
) where
) where
import Gargantext.Prelude
import Gargantext.Prelude
...
@@ -61,7 +63,8 @@ parsePhyloJSONSet (PhyloJSONSet o) = PhyloDataSet
...
@@ -61,7 +63,8 @@ parsePhyloJSONSet (PhyloJSONSet o) = PhyloDataSet
, links
, links
, name : o.name
, name : o.name
, nbBranches : parseInt o.phyloBranches
, nbBranches : parseInt o.phyloBranches
, nbDocs : parseInt o.phyloDocs
-- @WIP remotely stringify as a Double instead of an Int (?)
, nbDocs : (parseFloat >>> parseInt') o.phyloDocs
, nbFoundations : parseInt o.phyloFoundations
, nbFoundations : parseInt o.phyloFoundations
, nbGroups : parseInt o.phyloGroups
, nbGroups : parseInt o.phyloGroups
, nbPeriods : parseInt o.phyloPeriods
, nbPeriods : parseInt o.phyloPeriods
...
@@ -217,7 +220,7 @@ parseLinks
...
@@ -217,7 +220,7 @@ parseLinks
, label : ""
, label : ""
, to : o.head
, to : o.head
}
}
parse _ = Nothing
parse _
= Nothing
-----------------------------------------------------------
-----------------------------------------------------------
...
@@ -252,7 +255,7 @@ parseAncestorLinks
...
@@ -252,7 +255,7 @@ parseAncestorLinks
, label : ""
, label : ""
, to : o.head
, to : o.head
}
}
parse _ = Nothing
parse _
= Nothing
-----------------------------------------------------------
-----------------------------------------------------------
...
@@ -276,14 +279,14 @@ parseBranchLinks
...
@@ -276,14 +279,14 @@ parseBranchLinks
-- bc. BranchToGroup as 1-1 relation with "edgeType=branchLink"
-- bc. BranchToGroup as 1-1 relation with "edgeType=branchLink"
filter :: RawEdge -> Boolean
filter :: RawEdge -> Boolean
filter (BranchToGroup o) = o.edgeType == "branchLink"
filter (BranchToGroup o) = o.edgeType == "branchLink"
filter _
= false
filter _ = false
parse :: RawEdge -> Maybe BranchLink
parse :: RawEdge -> Maybe BranchLink
parse (BranchToGroup o) = Just $ BranchLink
parse (BranchToGroup o) = Just $ BranchLink
{ from : o.tail
{ from : o.tail
, to : o.head
, to : o.head
}
}
parse _ = Nothing
parse _
= Nothing
-----------------------------------------------------------
-----------------------------------------------------------
...
@@ -296,6 +299,40 @@ derive instance Generic GlobalTerm _
...
@@ -296,6 +299,40 @@ derive instance Generic GlobalTerm _
derive instance Eq GlobalTerm
derive instance Eq GlobalTerm
instance Show GlobalTerm where show = genericShow
instance Show GlobalTerm where show = genericShow
-----------------------------------------------------------
newtype Source = Source
{ label :: String
, id :: Int
}
derive instance Generic Source _
derive instance Eq Source
instance Show Source where show = genericShow
parseSources :: String -> Array String
parseSources
= String.replaceAll (String.Pattern "[") (String.Replacement "")
>>> String.replaceAll (String.Pattern "]") (String.Replacement "")
>>> String.replaceAll (String.Pattern "\"") (String.Replacement "")
>>> String.split (String.Pattern ",")
>>> Array.filter (\s -> not eq 0 $ String.length s)
-- @WIP: as some "Draw.js" business's methods still use `source` as an unsorted
-- `Array String`, we have to dissociate the parsing and sorting
-- computation (hence this second method to use for sorting purposes)
sortSources :: Array String -> Array Source
sortSources
= Array.mapWithIndex setSource
>>> Array.sortWith getLabel
where
setSource :: Int -> String -> Source
setSource id label = Source { id, label }
getLabel :: Source -> String
getLabel (Source { label }) = label
-----------------------------------------------------------
-----------------------------------------------------------
...
@@ -308,15 +345,6 @@ parseInt' n = maybe 0 identity $ Int.fromNumber n
...
@@ -308,15 +345,6 @@ parseInt' n = maybe 0 identity $ Int.fromNumber n
parseFloat :: String -> Number
parseFloat :: String -> Number
parseFloat s = maybe 0.0 identity $ Number.fromString s
parseFloat s = maybe 0.0 identity $ Number.fromString s
parseSources :: String -> Array String
parseSources
= String.replace (String.Pattern "[") (String.Replacement "")
>>> String.replace (String.Pattern "]") (String.Replacement "")
>>> String.split (String.Pattern ",")
>>> Array.filter (\s -> not eq 0 $ String.length s)
>>> Array.sort
parseBB :: String -> Array Number
parseBB :: String -> Array Number
parseBB
parseBB
= String.split (String.Pattern ",")
= String.split (String.Pattern ",")
...
...
src/Gargantext/Components/Router.purs
View file @
9b2392d9
...
@@ -427,9 +427,13 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
...
@@ -427,9 +427,13 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
, nodeId } _ = do
, nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed (Record.merge { content: \session ->
pure $ authed (Record.merge { content: \session ->
GraphExplorer.explorerLayout { boxes
GraphExplorer.explorerLayoutWithKey { boxes
, graphId: nodeId
, graphId: nodeId
, session } [] } sessionProps) []
, key: "graphId-" <> show nodeId
, session } [] } sessionProps) []
-- GraphExplorer.explorerLayout { boxes
-- , graphId: nodeId
-- , session } [] } sessionProps) []
phyloExplorer :: R2.Component SessionNodeProps
phyloExplorer :: R2.Component SessionNodeProps
phyloExplorer = R.createElement phyloExplorerCpt
phyloExplorer = R.createElement phyloExplorerCpt
phyloExplorerCpt :: R.Component SessionNodeProps
phyloExplorerCpt :: R.Component SessionNodeProps
...
...
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