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
1fa7ae1f
Commit
1fa7ae1f
authored
Jan 10, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 339-dev-docs-download
parents
5816cd5c
512bb868
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
66 additions
and
30 deletions
+66
-30
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
package.json
package.json
+1
-1
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+1
-0
Search.purs
src/Gargantext/Components/GraphExplorer/Search.purs
+15
-9
InputWithAutocomplete.purs
src/Gargantext/Components/InputWithAutocomplete.purs
+7
-5
Utils.purs
src/Gargantext/Config/Utils.purs
+2
-1
Types.purs
src/Gargantext/Hooks/Sigmax/Types.purs
+1
-0
Types.purs
src/Gargantext/Types.purs
+3
-2
Reactix.js
src/Gargantext/Utils/Reactix.js
+25
-10
Reactix.purs
src/Gargantext/Utils/Reactix.purs
+10
-1
No files found.
.gitlab-ci.yml
View file @
1fa7ae1f
...
@@ -25,7 +25,7 @@ test:
...
@@ -25,7 +25,7 @@ test:
script
:
script
:
# find 0.14.2 purescript version here:
# find 0.14.2 purescript version here:
# https://lazamar.co.uk/nix-versions/
# https://lazamar.co.uk/nix-versions/
-
nix-env -i purescript-0.14.
2
-f https://github.com/NixOS/nixpkgs/archive/bed08131cd29a85f19716d9351940bdc34834492.tar.gz
-
nix-env -i purescript-0.14.
4
-f https://github.com/NixOS/nixpkgs/archive/bed08131cd29a85f19716d9351940bdc34834492.tar.gz
-
nix-env -i git
-
nix-env -i git
-
nix-env -i nodejs
-
nix-env -i nodejs
-
nix-env -i yarn
-
nix-env -i yarn
...
...
package.json
View file @
1fa7ae1f
{
{
"name"
:
"Gargantext"
,
"name"
:
"Gargantext"
,
"version"
:
"0.0.4.9.
7
"
,
"version"
:
"0.0.4.9.
9.2
"
,
"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/GraphExplorer.purs
View file @
1fa7ae1f
...
@@ -260,6 +260,7 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxT.Graph {nodes, edges}
...
@@ -260,6 +260,7 @@ convert (GET.GraphData r) = Tuple r.metaData $ SigmaxT.Graph {nodes, edges}
nodeFn _i nn@(GET.Node n) =
nodeFn _i nn@(GET.Node n) =
Seq.singleton {
Seq.singleton {
borderColor: color
borderColor: color
, children: n.children
, color : color
, color : color
, equilateral: { numPoints: 3 }
, equilateral: { numPoints: 3 }
, gargType
, gargType
...
...
src/Gargantext/Components/GraphExplorer/Search.purs
View file @
1fa7ae1f
...
@@ -2,9 +2,9 @@ module Gargantext.Components.GraphExplorer.Search
...
@@ -2,9 +2,9 @@ module Gargantext.Components.GraphExplorer.Search
( Props, nodeSearchControl ) where
( Props, nodeSearchControl ) where
import Prelude
import Prelude
import Data.Foldable (foldl)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set as Set
import Data.Set as Set
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
...
@@ -26,32 +26,37 @@ type Props = (
...
@@ -26,32 +26,37 @@ type Props = (
)
)
-- | Whether a node matches a search string
-- | Whether a node matches a search string
-- Searches given node and matches it's label or any of the children's labels.
nodeMatchesSearch :: String -> Record SigmaxT.Node -> Boolean
nodeMatchesSearch :: String -> Record SigmaxT.Node -> Boolean
nodeMatchesSearch s n = queryMatchesLabel s n.label
nodeMatchesSearch s n@{ children } =
foldl (\acc childLabel -> queryMatchesLabel s childLabel) initial children
where
initial = queryMatchesLabel s n.label
searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record SigmaxT.Node)
searchNodes :: String -> Seq.Seq (Record SigmaxT.Node) -> Seq.Seq (Record SigmaxT.Node)
searchNodes "" _ = Seq.empty
searchNodes "" _ = Seq.empty
searchNodes s nodes = Seq.filter (nodeMatchesSearch s) nodes
searchNodes s nodes = Seq.filter (nodeMatchesSearch s) nodes
nodeSearchControl :: R2.Component Props
nodeSearchControl :: R2.Component Props
nodeSearchControl = R.createElement sizeButtonCpt
nodeSearchControl = R.createElement nodeSearchControlCpt
nodeSearchControlCpt :: R.Component Props
sizeButtonCpt :: R.Component Props
nodeSearchControlCpt = here.component "nodeSearchControl" cpt
sizeButtonCpt = here.component "nodeSearchControl" cpt
where
where
cpt { graph, multiSelectEnabled, selectedNodeIds } _ = do
cpt { graph, multiSelectEnabled, selectedNodeIds } _ = do
search <- T.useBox ""
search <- T.useBox ""
search' <- T.useLive T.unequal search
search' <- T.useLive T.unequal search
multiSelectEnabled' <- T.useLive T.unequal multiSelectEnabled
multiSelectEnabled' <- T.useLive T.unequal multiSelectEnabled
let doSearch s = triggerSearch graph s multiSelectEnabled' selectedNodeIds
pure $ R.fragment
pure $ R.fragment
[ inputWithAutocomplete { autocompleteSearch: autocompleteSearch graph
[ inputWithAutocomplete { autocompleteSearch: autocompleteSearch graph
, classes: "mx-2"
, classes: "mx-2"
, onAutocompleteClick:
\s -> triggerSearch graph s multiSelectEnabled' selectedNodeIds
, onAutocompleteClick:
doSearch
, onEnterPress:
\s -> triggerSearch graph s multiSelectEnabled' selectedNodeIds
, onEnterPress:
doSearch
, state: search } []
, state: search } []
, H.div { className: "btn input-group-addon"
, H.div { className: "btn input-group-addon"
, on: { click: \_ ->
triggerSearch graph search' multiSelectEnabled' selectedNodeIds
}
, on: { click: \_ ->
doSearch search'
}
}
}
[ H.span { className: "fa fa-search" } [] ]
[ H.span { className: "fa fa-search" } [] ]
]
]
...
@@ -74,3 +79,4 @@ triggerSearch graph search multiSelectEnabled selectedNodeIds = do
...
@@ -74,3 +79,4 @@ triggerSearch graph search multiSelectEnabled selectedNodeIds = do
T.modify_ (\nodes ->
T.modify_ (\nodes ->
Set.union matching $ if multiSelectEnabled then nodes else SigmaxT.emptyNodeIds) selectedNodeIds
Set.union matching $ if multiSelectEnabled then nodes else SigmaxT.emptyNodeIds) selectedNodeIds
src/Gargantext/Components/InputWithAutocomplete.purs
View file @
1fa7ae1f
module Gargantext.Components.InputWithAutocomplete where
module Gargantext.Components.InputWithAutocomplete where
import Prelude
import Prelude
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe)
import DOM.Simple as DOM
import DOM.Simple as DOM
import DOM.Simple.Event as DE
import DOM.Simple.Event as DE
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable, null, toMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Timer (setTimeout)
import Effect.Timer (setTimeout)
import Gargantext.Utils.Reactix as R2
import React.SyntheticEvent as E
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import React.SyntheticEvent as E
import Toestand as T
import Toestand as T
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.InputWithAutocomplete"
here = R2.here "Gargantext.Components.InputWithAutocomplete"
...
@@ -79,6 +79,8 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
...
@@ -79,6 +79,8 @@ inputWithAutocompleteCpt = here.component "inputWithAutocomplete" cpt
onInputKeyUp :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect Boolean
onInputKeyUp :: R.Ref (Nullable DOM.Element) -> DE.KeyboardEvent -> Effect Boolean
onInputKeyUp inputRef e = do
onInputKeyUp inputRef e = do
if DE.key e == "Enter" then do
if DE.key e == "Enter" then do
R2.preventDefault e
R2.stopPropagation e
let val = R.unsafeEventValue e
let val = R.unsafeEventValue e
let mInput = toMaybe $ R.readRef inputRef
let mInput = toMaybe $ R.readRef inputRef
T.write_ val state
T.write_ val state
...
...
src/Gargantext/Config/Utils.purs
View file @
1fa7ae1f
...
@@ -5,6 +5,7 @@ import Gargantext.Prelude
...
@@ -5,6 +5,7 @@ import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Foldable (foldl)
import Data.Foldable (foldl)
import Data.Maybe (fromMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
...
@@ -41,7 +42,7 @@ handleErrorInAsyncProgress errors ap@(AsyncProgress { log, status: IsFinished })
...
@@ -41,7 +42,7 @@ handleErrorInAsyncProgress errors ap@(AsyncProgress { log, status: IsFinished })
handleErrorInAsyncProgress _ _ = pure unit
handleErrorInAsyncProgress _ _ = pure unit
concatErrors :: AsyncProgress -> String
concatErrors :: AsyncProgress -> String
concatErrors (AsyncProgress {
log }) = foldl eventsErrorMessage ""
log
concatErrors (AsyncProgress {
error, log }) = foldl eventsErrorMessage (fromMaybe "" error)
log
where
where
eventsErrorMessage acc (AsyncTaskLog { events }) = (foldl eventErrorMessage "" events) <> "\n" <> acc
eventsErrorMessage acc (AsyncTaskLog { events }) = (foldl eventErrorMessage "" events) <> "\n" <> acc
eventErrorMessage acc (AsyncEvent { level: "ERROR", message }) = message <> "\n" <> acc
eventErrorMessage acc (AsyncEvent { level: "ERROR", message }) = message <> "\n" <> acc
...
...
src/Gargantext/Hooks/Sigmax/Types.purs
View file @
1fa7ae1f
...
@@ -35,6 +35,7 @@ type EdgeId = String
...
@@ -35,6 +35,7 @@ type EdgeId = String
type Node = (
type Node = (
borderColor :: String
borderColor :: String
, children :: Array String
, color :: String
, color :: String
, equilateral :: { numPoints :: Int }
, equilateral :: { numPoints :: Int }
, gargType :: GT.Mode
, gargType :: GT.Mode
...
...
src/Gargantext/Types.purs
View file @
1fa7ae1f
...
@@ -737,6 +737,7 @@ instance Eq AsyncTaskWithType where eq = genericEq
...
@@ -737,6 +737,7 @@ instance Eq AsyncTaskWithType where eq = genericEq
newtype AsyncProgress = AsyncProgress
newtype AsyncProgress = AsyncProgress
{ id :: AsyncTaskID
{ id :: AsyncTaskID
, error :: Maybe String
, log :: Array AsyncTaskLog
, log :: Array AsyncTaskLog
, status :: AsyncTaskStatus
, status :: AsyncTaskStatus
}
}
...
...
src/Gargantext/Utils/Reactix.js
View file @
1fa7ae1f
...
@@ -27,12 +27,27 @@ function domRectFromRect(obj) {
...
@@ -27,12 +27,27 @@ function domRectFromRect(obj) {
return
DOMRectReadOnly
.
fromRect
(
obj
)
return
DOMRectReadOnly
.
fromRect
(
obj
)
}
}
function
preventDefault
(
e
)
{
return
e
.
preventDefault
();
}
function
stopPropagation
(
e
)
{
return
e
.
stopPropagation
();
}
function
blur
(
el
)
{
return
el
.
blur
();
}
exports
.
_addRootElement
=
addRootElement
;
exports
.
_addRootElement
=
addRootElement
;
exports
.
_getSelection
=
getSelection
;
exports
.
_getSelection
=
getSelection
;
exports
.
_stringify
=
stringify
;
exports
.
_stringify
=
stringify
;
exports
.
_postMessage
=
postMessage
;
exports
.
_postMessage
=
postMessage
;
exports
.
_setCookie
=
setCookie
;
exports
.
_setCookie
=
setCookie
;
exports
.
_domRectFromRect
=
domRectFromRect
;
exports
.
_domRectFromRect
=
domRectFromRect
;
exports
.
_preventDefault
=
preventDefault
;
exports
.
_stopPropagation
=
stopPropagation
;
exports
.
_blur
=
blur
;
exports
.
_keyCode
=
function
(
e
)
{
exports
.
_keyCode
=
function
(
e
)
{
// https://www.w3schools.com/jsref/event_key_keycode.asp
// https://www.w3schools.com/jsref/event_key_keycode.asp
...
...
src/Gargantext/Utils/Reactix.purs
View file @
1fa7ae1f
...
@@ -335,14 +335,23 @@ inputFileNameWithBlob n e = case ff of
...
@@ -335,14 +335,23 @@ inputFileNameWithBlob n e = case ff of
where
where
ff = inputFile n e
ff = inputFile n e
foreign import _preventDefault :: forall e. EffectFn1 e Unit
preventDefault :: forall e. DE.IsEvent e => e -> Effect Unit
preventDefault = runEffectFn1 _preventDefault
foreign import _stopPropagation :: forall e. EffectFn1 e Unit
stopPropagation :: forall e. DE.IsEvent e => e -> Effect Unit
stopPropagation = runEffectFn1 _stopPropagation
-- | Get blob from a drop event
-- | Get blob from a drop event
--dataTransferFileBlob :: forall e. DE.IsEvent e => RE.SyntheticEvent e -> Effect Blob
--dataTransferFileBlob :: forall e. DE.IsEvent e => RE.SyntheticEvent e -> Effect Blob
dataTransferFileBlob e = unsafePartial $ do
dataTransferFileBlob e = unsafePartial $ do
let ff = fromJust $ item 0 $ ((e .. "dataTransfer" .. "files") :: FileList)
let ff = fromJust $ item 0 $ ((e .. "dataTransfer" .. "files") :: FileList)
pure $ WF.toBlob ff
pure $ WF.toBlob ff
foreign import _blur :: EffectFn1 DOM.Element Unit
blur :: DOM.Element -> Effect Unit
blur :: DOM.Element -> Effect Unit
blur
el = el ... "blur" $ []
blur
= runEffectFn1 _blur
row :: Array R.Element -> R.Element
row :: Array R.Element -> R.Element
row children = H.div { className: "row" } children
row children = H.div { className: "row" } children
...
...
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