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
23cc8537
Commit
23cc8537
authored
Feb 06, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-dashboard-charts
parents
1eae92d9
6eb24204
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
43 deletions
+98
-43
README.md
README.md
+8
-1
docker-env.sh
docker-env.sh
+32
-9
Graph.purs
src/Gargantext/Components/Graph.purs
+13
-13
Search.purs
src/Gargantext/Components/GraphExplorer/Search.purs
+2
-4
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+34
-12
Ends.purs
src/Gargantext/Ends.purs
+2
-2
Utils.purs
src/Gargantext/Utils.purs
+7
-2
No files found.
README.md
View file @
23cc8537
...
...
@@ -88,8 +88,15 @@ Some options:
Once you have node and yarn installed, you may install deps with:
```
shell
yarn
install
&&
yarn
install-ps
yarn
install
&&
yarn
add psc-package
&&
yarn install-ps
&&
yarn build
```
You need to copy index.html:
```
shell
cp
src/index.html dist/
```
(Be careful, to update or upgrade your install, maybe you need to remove
old files in node_modules).
### Development
...
...
docker-env.sh
View file @
23cc8537
...
...
@@ -13,53 +13,76 @@ dockerrun(){
sudo
docker run
-u
"
$UID
"
-e
PATH
=
"
$P
"
-v
$PWD
:/app
-w
/app
"
$@
"
}
NODE
=
node:buster-garg
dockerrunnode
(){
dockerrun
"
$NODE
"
"
$@
"
}
unalias
npm yarn bower pulp repl &>/dev/null
||
:
unset
npm yarn bower pulp repl &>/dev/null
||
:
npm
(){
dockerrun
node npm
"
$@
"
dockerrunnode npm
"
$@
"
}
yarn
(){
dockerrun
node yarn
"
$@
"
dockerrunnode yarn
"
$@
"
}
bower
(){
dockerrun
node bower
"
$@
"
dockerrunnode bower
"
$@
"
}
dependencies
(){
dockerrun
node psc-dependencies
"
$@
"
dockerrunnode psc-dependencies
"
$@
"
}
package
(){
dockerrun
node psc-package
"
$@
"
dockerrunnode psc-package
"
$@
"
}
pulp
(){
dockerrun
node pulp
--psc-package
"
$@
"
dockerrunnode pulp
--psc-package
"
$@
"
}
repl
(){
dockerrun
-ti
node pulp
--psc-package
repl
"
$@
"
dockerrun
-ti
"
$NODE
"
pulp
--psc-package
repl
"
$@
"
}
sass
(){
dockerrunnode yarn sass
}
check
(){
pulp
test
"
$@
"
}
pscpackagehack
(){
cp
$HOME
/bin/psc-package node_modules/.bin
}
setup
(){
yarn
install
&&
yarn rebuild-set
&&
pscpackagehack
&&
yarn install-ps
}
build
(){
pulp browserify
--to
dist/bundle.js
echo
prefer: compile
yarn build
#pulp browserify --to dist/bundle.js
}
compile
(){
yarn compile
}
serve
(){
dockerrun node http-server
-p
2015
--cors
dist
#yarn dev
#dockerrunnode http-server -p 2015 --cors dist
dockerrunnode webpack-dev-server
--env
dev
--mode
development
}
dev
(){
...
...
src/Gargantext/Components/Graph.purs
View file @
23cc8537
...
...
@@ -204,7 +204,7 @@ type SigmaSettings =
-- selected nodes <=> special label
sigmaSettings :: {|SigmaSettings}
sigmaSettings =
{ animationsTime:
55
00.0
{ animationsTime:
300
00.0
, autoRescale: true
, autoResize: true
, batchEdgesDrawing: true
...
...
@@ -217,7 +217,7 @@ sigmaSettings =
, defaultLabelSize: 8.0 -- (old tina: showLabelsIfZoom)
, defaultNodeBorderColor : "#000" -- <- if nodeBorderColor = 'default'
, defaultNodeColor: "#FFF"
, doubleClickEnabled: false
, doubleClickEnabled: false
-- indicates whether or not the graph can be zoomed on double-click
, drawEdgeLabels: true
, drawEdges: true
, drawLabels: true
...
...
@@ -228,12 +228,12 @@ sigmaSettings =
, edgeHoverPrecision: 2.0
, edgeHoverSizeRatio: 2.0
, enableHovering: true
, font: "
Droid Sans
" -- font params
, font: "
arial
" -- font params
, fontStyle: "bold"
, hideEdgesOnMove: true
, labelSize : "
fixed"
, labelSize : "
proportional" -- alt : proportional
, labelSizeRatio: 2.0 -- label size in ratio of node size
, labelThreshold:
5
.0 -- min node cam size to start showing label
, labelThreshold:
7
.0 -- min node cam size to start showing label
, maxEdgeSize: 1.0
, maxNodeSize: 8.0
, minEdgeSize: 0.5 -- in fact used in tina as edge size
...
...
@@ -256,7 +256,7 @@ sigmaSettings =
, verbose : true
, zoomMax: 1.7
, zoomMin: 0.0
, zoomingRatio:
3.2
, zoomingRatio:
1.7
}
type ForceAtlas2Settings =
...
...
@@ -280,17 +280,17 @@ type ForceAtlas2Settings =
forceAtlas2Settings :: {|ForceAtlas2Settings}
forceAtlas2Settings =
{ adjustSizes :
fals
e
{ adjustSizes :
tru
e
, barnesHutOptimize : true
, edgeWeightInfluence :
0
.0
, edgeWeightInfluence :
1
.0
-- fixedY : false
, gravity : 1.0
, iterationsPerRender :
4
.0
, linLogMode :
tru
e -- false
, iterationsPerRender :
10
.0
, linLogMode :
fals
e -- false
, outboundAttractionDistribution: false
, scalingRatio :
4
.0
, scalingRatio :
10
.0
, skipHidden: false
, slowDown :
0.7
, startingIterations :
2
.0
, slowDown :
1.0
, startingIterations :
10
.0
, strongGravityMode : false
}
src/Gargantext/Components/GraphExplorer/Search.purs
View file @
23cc8537
...
...
@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.Search
import Prelude
import Data.Sequence as Seq
import Data.Set as Set
import Data.String as S
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
...
...
@@ -14,6 +13,7 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete)
import Gargantext.Utils (queryMatchesLabel)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
type Props = (
...
...
@@ -24,9 +24,7 @@ type Props = (
-- | Whether a node matches a search string
nodeMatchesSearch :: String -> Record SigmaxT.Node -> Boolean
nodeMatchesSearch s n = S.contains (S.Pattern $ normalize s) (normalize n.label)
where
normalize = S.toLower
nodeMatchesSearch s n = queryMatchesLabel s n.label
searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record SigmaxT.Node)
searchNodes "" _ = Seq.empty
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
23cc8537
...
...
@@ -6,7 +6,7 @@ module Gargantext.Components.NgramsTable
import Prelude
( class Show, Unit, bind, const, discard, identity, map, mempty, not
, pure, show, unit, (#), ($), (&&), (+), (/=), (<$>), (<<<), (<>), (=<<)
, (==), (||), otherwise )
, (==), (||), otherwise
, when
)
import Data.Array as A
import Data.FunctorWithIndex (mapWithIndex)
import Data.Lens (Lens', to, view, (%~), (.~), (^.), (^..), (^?))
...
...
@@ -18,7 +18,7 @@ import Data.Lens.Record (prop)
import Data.List as List
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe, is
Nothing
)
import Data.Maybe (Maybe(..), maybe, is
Just
)
import Data.Monoid.Additive (Additive(..))
import Data.Ord.Down (Down(..))
import Data.Set (Set)
...
...
@@ -31,7 +31,8 @@ import Reactix as R
import Reactix.DOM.HTML as H
import React (ReactClass, ReactElement, Children)
import React.DOM (a, i, input, li, span, text, ul)
import React.DOM.Props (_type, checked, className, onChange, onClick, style)
import React.DOM.Props ( _type, checked, className, onChange, onClick, style
, readOnly)
import React.DOM.Props as DOM
import Thermite as Thermite
import Thermite (modifyState_)
...
...
@@ -50,6 +51,7 @@ import Gargantext.Components.NgramsTable.Core
import Gargantext.Components.Loader (loader)
import Gargantext.Components.Table as T
import Gargantext.Sessions (Session)
import Gargantext.Utils (queryMatchesLabel)
import Gargantext.Utils.Reactix as R2
import Unsafe.Coerce (unsafeCoerce)
...
...
@@ -327,7 +329,7 @@ loadedNgramsTableSpec = Thermite.simpleSpec performAction render
pt = singletonNgramsTablePatch parent pe
render :: Thermite.Render State (Record LoadedNgramsTableProps) Action
render dispatch { path: path@({s
coreType, params
} /\ setPath)
render dispatch { path: path@({s
earchQuery, scoreType, params, termListFilter
} /\ setPath)
, versioned: Versioned { data: initTable }
, tabNgramType }
state@{ ngramsParent, ngramsChildren, ngramsLocalPatch
...
...
@@ -375,7 +377,7 @@ loadedNgramsTableSpec = Thermite.simpleSpec performAction render
<<< _Just
) =<< ngramsParent
displayRow (NgramsElement {ngrams, root}) =
displayRow (NgramsElement {ngrams, root
, list
}) =
root == Nothing
-- ^ Display only nodes without parents
&& ngramsChildren ^. at ngrams /= Just true
...
...
@@ -384,8 +386,14 @@ loadedNgramsTableSpec = Thermite.simpleSpec performAction render
-- ^ and which are not our new parent
&& Just ngrams /= ngramsParentRoot
-- ^ and which are not the root of our new parent
|| -- Unless they are scheduled to be removed.
ngramsChildren ^. at ngrams == Just false
&& queryMatchesLabel searchQuery (ngramsTermText ngrams)
-- ^ and which matches the search query.
&& maybe true (_ == list) termListFilter
-- ^ and which matches the ListType filter.
|| ngramsChildren ^. at ngrams == Just false
-- ^ unless they are scheduled to be removed.
|| tablePatchHasNgrams ngramsLocalPatch ngrams
-- ^ unless they are being processed at the moment.
convertRow (Tuple ngrams ngramsElement) =
{ row: R2.buff <$> renderNgramsItem { ngramsTable, ngrams,
ngramsLocalPatch,
...
...
@@ -501,7 +509,15 @@ renderNgramsItem { ngramsTable, ngrams, ngramsElement, ngramsParent
termList = ngramsElement ^. _NgramsElement <<< _list
ngramsStyle = [termStyle termList ngramsOpacity]
ngramsEdit = Just <<< dispatch <<< SetParentResetChildren <<< Just <<< view _ngrams
ngramsClick = Just <<< dispatch <<< cycleTermListItem <<< view _ngrams
ngramsClick
= Just <<< dispatch <<< cycleTermListItem <<< view _ngrams
-- ^ This is the old behavior it is nicer to use since one can
-- rapidly change the ngram list without waiting for confirmation.
-- However this might expose bugs. One of them can be reproduced
-- by clicking a multiple times on the same ngram, sometimes it stays
-- transient.
-- | ngramsTransient = const Nothing
-- | otherwise = Just <<< dispatch <<< cycleTermListItem <<< view _ngrams
selected =
input
[ _type "checkbox"
...
...
@@ -517,16 +533,22 @@ renderNgramsItem { ngramsTable, ngrams, ngramsElement, ngramsParent
[ _type "checkbox"
, className "checkbox"
, checked chkd
, onChange $ const $ dispatch $
, readOnly ngramsTransient
, onChange $ const $ when (not ngramsTransient) $ dispatch $
setTermListA ngrams (replace termList termList'')
]
ngramsOpacity
| isNothing (ngramsLocalPatch.ngramsPatches ^. _PatchMap <<< at ngrams) = 1.0
ngramsTransient = tablePatchHasNgrams ngramsLocalPatch ngrams
-- ^ TODO here we do not look at ngramsNewElems, shall we?
| otherwise = 0.5
ngramsOpacity
| ngramsTransient = 0.5
| otherwise = 1.0
cycleTermListItem n = setTermListA n (replace termList (nextTermList termList))
tablePatchHasNgrams :: NgramsTablePatch -> NgramsTerm -> Boolean
tablePatchHasNgrams ngramsTablePatch ngrams =
isJust $ ngramsTablePatch.ngramsPatches ^. _PatchMap <<< at ngrams
termStyle :: TermList -> Number -> DOM.Props
termStyle GraphTerm opacity = style {color: "green", opacity}
termStyle StopTerm opacity = style {color: "red", opacity, textDecoration: "line-through"}
...
...
src/Gargantext/Ends.purs
View file @
23cc8537
...
...
@@ -169,14 +169,14 @@ sessionPath (R.CorpusMetrics {tabType, listId, limit} i) =
$ "metrics"
<> "?ngrams=" <> show listId
<> "&ngramsType=" <> showTabType' tabType
<> maybe ""
(\x -> "&limit=" <> show x)
limit
<> maybe ""
limitUrl
limit
-- TODO fix this url path
sessionPath (R.Chart {chartType, tabType} i) =
sessionPath $ R.NodeAPI Corpus i
$ show chartType
<> "?ngramsType=" <> showTabType' tabType
<> "&listType=GraphTerm" -- <> show listId
-- <> maybe ""
(\x -> "&limit=" <> show x)
limit
-- <> maybe ""
limitUrl
limit
-- sessionPath (R.NodeAPI (NodeContact s a i) i) = sessionPath $ "annuaire/" <> show a <> "/contact/" <> show i
------- misc routing stuff
...
...
src/Gargantext/Utils.purs
View file @
23cc8537
...
...
@@ -5,7 +5,7 @@ import Data.Lens (Lens', lens)
import Data.Newtype (class Newtype, unwrap, wrap)
import Data.Set as Set
import Data.Set (Set)
import Data.String
(length)
import Data.String
as S
-- | Astonishingly, not in the prelude
id :: forall a. a -> a
...
...
@@ -62,7 +62,12 @@ glyphiconActive icon b = glyphicon icon <> if b then " active" else ""
zeroPad :: Int -> Int -> String
zeroPad pad num = zeros <> (show num)
where
numDigits = length $ show num
numDigits =
S.
length $ show num
zeros = if numDigits < pad then zeros' (pad - numDigits) else ""
zeros' 0 = ""
zeros' n = "0" <> (zeros' (n - 1))
queryMatchesLabel :: String -> String -> Boolean
queryMatchesLabel q l = S.contains (S.Pattern $ normalize q) (normalize l)
where
normalize = S.toLower
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