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
5fe07605
Commit
5fe07605
authored
Mar 10, 2021
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new toestand, kill warnings
parent
b87af132
Changes
78
Hide whitespace changes
Inline
Side-by-side
Showing
78 changed files
with
638 additions
and
958 deletions
+638
-958
packages.json
.psc-package/local/.set/packages.json
+2
-2
packages.dhall
packages.dhall
+1
-1
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+7
-7
AnnotatedField.purs
src/Gargantext/Components/Annotation/AnnotatedField.purs
+8
-8
App.purs
src/Gargantext/Components/App.purs
+5
-8
Data.purs
src/Gargantext/Components/App/Data.purs
+11
-11
Category.purs
src/Gargantext/Components/Category.purs
+24
-63
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+8
-9
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+10
-9
Footer.purs
src/Gargantext/Components/Footer.purs
+2
-5
Forest.purs
src/Gargantext/Components/Forest.purs
+14
-14
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+14
-15
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+15
-23
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+2
-3
Contact.purs
...argantext/Components/Forest/Tree/Node/Action/Contact.purs
+7
-11
Types.purs
...ext/Components/Forest/Tree/Node/Action/Contact/Types.purs
+6
-30
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+3
-12
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+1
-0
Search.purs
...Gargantext/Components/Forest/Tree/Node/Action/Search.purs
+0
-1
Frame.purs
...text/Components/Forest/Tree/Node/Action/Search/Frame.purs
+4
-3
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+5
-6
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+2
-2
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+9
-10
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+6
-7
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+28
-63
Sync.purs
src/Gargantext/Components/Forest/Tree/Node/Tools/Sync.purs
+3
-2
Graph.purs
src/Gargantext/Components/Graph.purs
+11
-22
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+37
-45
API.purs
src/Gargantext/Components/GraphExplorer/API.purs
+1
-1
Button.purs
src/Gargantext/Components/GraphExplorer/Button.purs
+6
-15
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+36
-46
RangeControl.purs
src/Gargantext/Components/GraphExplorer/RangeControl.purs
+6
-8
Search.purs
src/Gargantext/Components/GraphExplorer/Search.purs
+5
-8
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+13
-19
SlideButton.purs
src/Gargantext/Components/GraphExplorer/SlideButton.purs
+18
-24
ToggleButton.purs
src/Gargantext/Components/GraphExplorer/ToggleButton.purs
+15
-18
Login.purs
src/Gargantext/Components/Login.purs
+5
-6
Form.purs
src/Gargantext/Components/Login/Form.purs
+12
-11
Modal.purs
src/Gargantext/Components/Login/Modal.purs
+1
-1
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+4
-5
Components.purs
src/Gargantext/Components/NgramsTable/Components.purs
+7
-0
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+4
-5
Loader.purs
src/Gargantext/Components/NgramsTable/Loader.purs
+3
-4
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+1
-1
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+6
-6
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+7
-11
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+13
-8
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+6
-6
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+7
-5
Chart.purs
src/Gargantext/Components/Nodes/Corpus/Chart.purs
+1
-1
API.purs
src/Gargantext/Components/Nodes/Corpus/Chart/API.purs
+0
-1
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+3
-3
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+9
-8
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+4
-4
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+7
-9
Types.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
+0
-1
Utils.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
+21
-32
Tabs.purs
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
+1
-0
Types.purs
src/Gargantext/Components/Nodes/Dashboard/Types.purs
+1
-1
File.purs
src/Gargantext/Components/Nodes/File.purs
+1
-2
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+1
-5
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+1
-3
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+68
-110
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+7
-7
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+10
-7
RangeSlider.purs
src/Gargantext/Components/RangeSlider.purs
+0
-2
Router.purs
src/Gargantext/Components/Router.purs
+36
-47
Search.purs
src/Gargantext/Components/Search.purs
+3
-11
SessionLoader.purs
src/Gargantext/Components/SessionLoader.purs
+1
-1
SimpleLayout.purs
src/Gargantext/Components/SimpleLayout.purs
+1
-1
Types.purs
src/Gargantext/Components/Table/Types.purs
+3
-19
TopBar.purs
src/Gargantext/Components/TopBar.purs
+3
-8
Hooks.purs
src/Gargantext/Hooks.purs
+2
-4
Sigmax.purs
src/Gargantext/Hooks/Sigmax.purs
+7
-7
Sessions.purs
src/Gargantext/Sessions.purs
+1
-2
CacheAPI.purs
src/Gargantext/Utils/CacheAPI.purs
+2
-6
Reload.purs
src/Gargantext/Utils/Reload.purs
+2
-8
Toestand.purs
src/Gargantext/Utils/Toestand.purs
+21
-48
No files found.
.psc-package/local/.set/packages.json
View file @
5fe07605
...
@@ -4478,7 +4478,7 @@
...
@@ -4478,7 +4478,7 @@
"typelevel-prelude"
"typelevel-prelude"
],
],
"repo"
:
"https://github.com/poorscript/purescript-toestand"
,
"repo"
:
"https://github.com/poorscript/purescript-toestand"
,
"version"
:
"v0.
5
.1"
"version"
:
"v0.
6
.1"
},
},
"tolerant-argonaut"
:
{
"tolerant-argonaut"
:
{
"dependencies"
:
[
"dependencies"
:
[
...
@@ -5027,4 +5027,4 @@
...
@@ -5027,4 +5027,4 @@
"repo"
:
"https://github.com/athanclark/purescript-zeta-extra.git"
,
"repo"
:
"https://github.com/athanclark/purescript-zeta-extra.git"
,
"version"
:
"v0.0.1"
"version"
:
"v0.0.1"
}
}
}
}
\ No newline at end of file
packages.dhall
View file @
5fe07605
...
@@ -126,7 +126,7 @@ let additions =
...
@@ -126,7 +126,7 @@ let additions =
[ "prelude", "effect", "foldable-traversable", "reactix"
[ "prelude", "effect", "foldable-traversable", "reactix"
, "record", "tuples", "typelevel-prelude" ]
, "record", "tuples", "typelevel-prelude" ]
, repo = "https://github.com/poorscript/purescript-toestand"
, repo = "https://github.com/poorscript/purescript-toestand"
, version = "v0.
5
.1"
, version = "v0.
6
.1"
}
}
, typisch =
, typisch =
{ dependencies = [ "prelude" ]
{ dependencies = [ "prelude" ]
...
...
src/Gargantext/AsyncTasks.purs
View file @
5fe07605
...
@@ -9,7 +9,7 @@ import Data.Array as A
...
@@ -9,7 +9,7 @@ import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Map as Map
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Tuple (fst
, snd
)
import Data.Tuple (fst)
import Effect (Effect)
import Effect (Effect)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils as GU
import Gargantext.Utils as GU
...
@@ -55,15 +55,15 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } })
...
@@ -55,15 +55,15 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } })
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
type ReductorProps = (
type ReductorProps = (
reloadForest :: T.
Cursor
T2.Reload
reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, storage :: Storage
, storage :: Storage
)
)
type Reductor = R2.Reductor (Record ReductorProps) Action
type Reductor = R2.Reductor (Record ReductorProps) Action
type ReductorAction = Action -> Effect Unit
type ReductorAction = Action -> Effect Unit
useTasks :: T.
Cursor T2.Reload -> T.Cursor
T2.Reload -> R.Hooks Reductor
useTasks :: T.
Box T2.Reload -> T.Box
T2.Reload -> R.Hooks Reductor
useTasks reloadRoot reloadForest = R2.useReductor act initializer unit
useTasks reloadRoot reloadForest = R2.useReductor act initializer unit
where
where
act :: R2.Actor (Record ReductorProps) Action
act :: R2.Actor (Record ReductorProps) Action
...
@@ -79,18 +79,18 @@ data Action =
...
@@ -79,18 +79,18 @@ data Action =
action :: Record ReductorProps -> Action -> Effect (Record ReductorProps)
action :: Record ReductorProps -> Action -> Effect (Record ReductorProps)
action p@{ reloadForest, storage } (Insert nodeId t) = do
action p@{ reloadForest, storage } (Insert nodeId t) = do
_ <- GUR.bump
Cursor
reloadForest
_ <- GUR.bump
Box
reloadForest
let newStorage = Map.alter (maybe (Just [t]) (\ts -> Just $ A.cons t ts)) nodeId storage
let newStorage = Map.alter (maybe (Just [t]) (\ts -> Just $ A.cons t ts)) nodeId storage
pure $ p { storage = newStorage }
pure $ p { storage = newStorage }
action p (Finish nodeId t) = do
action p (Finish nodeId t) = do
action p (Remove nodeId t)
action p (Remove nodeId t)
action p@{ reloadRoot, reloadForest, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
action p@{ reloadRoot, reloadForest, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
_ <- if GT.asyncTaskTriggersAppReload typ then
_ <- if GT.asyncTaskTriggersAppReload typ then
GUR.bump
Cursor
reloadRoot
GUR.bump
Box
reloadRoot
else
else
pure unit
pure unit
_ <- if GT.asyncTaskTriggersTreeReload typ then
_ <- if GT.asyncTaskTriggersTreeReload typ then
GUR.bump
Cursor
reloadForest
GUR.bump
Box
reloadForest
else
else
pure unit
pure unit
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
...
...
src/Gargantext/Components/Annotation/AnnotatedField.purs
View file @
5fe07605
...
@@ -11,22 +11,22 @@
...
@@ -11,22 +11,22 @@
-- | 2. We will need a more ambitious search algorithm for skipgrams.
-- | 2. We will need a more ambitious search algorithm for skipgrams.
module Gargantext.Components.Annotation.AnnotatedField where
module Gargantext.Components.Annotation.AnnotatedField where
import Data.Maybe ( Maybe(..), maybe )
import Gargantext.Prelude (Unit, bind, const, discard, not, pure, ($), (<$>), (<>))
import Data.Tuple ( Tuple )
import Data.Maybe (Maybe(..), maybe)
import Data.Tuple.Nested ( (/\) )
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
--import DOM.Simple.Console (log2)
--import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import DOM.Simple.Event as DE
import Effect (
Effect
)
import Effect (
Effect
)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as HTML
import Reactix.DOM.HTML as HTML
import Reactix.SyntheticEvent as E
import Reactix.SyntheticEvent as E
import Gargantext.Prelude
import Gargantext.Types (CTabNgramType(..), TermList)
import Gargantext.Types (CTabNgramType(..), TermList)
import Gargantext.Components.Annotation.Utils (
termBootstrapClass, termClass
)
import Gargantext.Components.Annotation.Utils (
termClass
)
import Gargantext.Components.NgramsTable.Core
import Gargantext.Components.NgramsTable.Core
import Gargantext.Components.Annotation.Menu ( annotationMenu, MenuType(..) )
( NgramsTable, NgramsTerm, findNgramTermList, highlightNgrams, normNgram )
import Gargantext.Components.Annotation.Menu (annotationMenu, MenuType(..))
import Gargantext.Utils.Selection as Sel
import Gargantext.Utils.Selection as Sel
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
...
src/Gargantext/Components/App.purs
View file @
5fe07605
...
@@ -9,9 +9,7 @@ import Gargantext.Components.App.Data (emptyApp)
...
@@ -9,9 +9,7 @@ import Gargantext.Components.App.Data (emptyApp)
import Gargantext.Components.Router (router)
import Gargantext.Components.Router (router)
import Gargantext.Hooks (useHashRouter)
import Gargantext.Hooks (useHashRouter)
import Gargantext.Router as Router
import Gargantext.Router as Router
import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.App"
here = R2.here "Gargantext.Components.App"
...
@@ -22,9 +20,8 @@ app = R.createElement appCpt
...
@@ -22,9 +20,8 @@ app = R.createElement appCpt
appCpt :: R.Component ()
appCpt :: R.Component ()
appCpt = here.component "app" cpt where
appCpt = here.component "app" cpt where
cpt _ _ = do
cpt _ _ = do
cell <- T.useCell emptyApp -- global data
box <- T.useBox emptyApp -- global data
cursors <- T.useFieldCursors cell {} -- read-write access for children
boxes <- T.useFocusedFields box {} -- read-write access for children
-- tasks <- R.useRef Nothing -- storage for asynchronous tasks
tasks <- T.useBox Nothing -- storage for asynchronous tasks
tasks <- T2.useCursed Nothing -- storage for asynchronous tasks
useHashRouter Router.router boxes.route -- Install router to window
useHashRouter Router.router cursors.route -- Install router to window
pure $ router { boxes, tasks } -- Render router component
pure $ router { cursors, tasks } -- Render router component
src/Gargantext/Components/App/Data.purs
View file @
5fe07605
module Gargantext.Components.App.Data (App,
Cursor
s, emptyApp) where
module Gargantext.Components.App.Data (App,
Boxe
s, emptyApp) where
import Data.Set as Set
import Data.Set as Set
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
...
@@ -36,15 +36,15 @@ emptyApp =
...
@@ -36,15 +36,15 @@ emptyApp =
, showLogin: false
, showLogin: false
}
}
type
Cursor
s =
type
Boxe
s =
{ backend :: T.
Cursor
(Maybe Backend)
{ backend :: T.
Box
(Maybe Backend)
, handed :: T.
Cursor
Handed
, handed :: T.
Box
Handed
, forestOpen :: T.
Cursor
OpenNodes
, forestOpen :: T.
Box
OpenNodes
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, route :: T.
Cursor
AppRoute
, route :: T.
Box
AppRoute
, sessions :: T.
Cursor
Sessions
, sessions :: T.
Box
Sessions
, showCorpus :: T.
Cursor
Boolean
, showCorpus :: T.
Box
Boolean
, showLogin :: T.
Cursor
Boolean
, showLogin :: T.
Box
Boolean
}
}
src/Gargantext/Components/Category.purs
View file @
5fe07605
-- TODO: this module should be replaced by FacetsTable
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.Category where
module Gargantext.Components.Category where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>), encodeJson)
import Gargantext.Prelude (discard, map, pure, void, ($), (-), (<), (<>), (==))
import Data.Argonaut (class EncodeJson, encodeJson, jsonEmptyObject, (:=), (~>))
import Data.Array as A
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Lens ((^.))
import Data.Lens.At (at)
import Data.Lens.Record (prop)
import Data.Map (Map)
import Data.Map as Map
import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe, isJust)
import Data.Maybe (Maybe(..))
import Data.Ord.Down (Down(..))
import Data.Set (Set)
import Data.Set as Set
import Data.String as Str
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..), fst)
import Data.Tuple.Nested ((/\))
import DOM.Simple.Event as DE
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Category.Types
import Gargantext.Components.Category.Types
import Gargantext.Components.DocsTable.Types (DocumentsView(..), LocalCategories, LocalUserScore
)
( Category(..), Star(..), cat2score, categories, star2score, stars
)
import Gargantext.
Ends (Frontends, url)
import Gargantext.
Components.DocsTable.Types
import Gargantext.Hooks.Loader (useLoaderWithCacheAPI, HashedResponse(..)
)
( DocumentsView(..), LocalCategories, LocalUserScore
)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Routes as Routes
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, sessionId, get, delete, put)
import Gargantext.Sessions (Session, put)
import Gargantext.Types (NodeID, NodeType(..), OrderBy(..), TableResult, TabType, showTabType')
import Gargantext.Types (NodeID, NodeType(..))
import Gargantext.Utils.CacheAPI as GUC
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Category"
here = R2.here "Gargantext.Components.Category"
------------------------------------------------------------------------
type RatingProps =
type RatingProps =
( score :: Star
( score :: Star
, nodeId :: NodeID
, nodeId :: NodeID
...
@@ -55,31 +33,20 @@ rating :: R2.Component RatingProps
...
@@ -55,31 +33,20 @@ rating :: R2.Component RatingProps
rating = R.createElement ratingCpt
rating = R.createElement ratingCpt
ratingCpt :: R.Component RatingProps
ratingCpt :: R.Component RatingProps
ratingCpt = here.component "rating" cpt
ratingCpt = here.component "rating" cpt where
where
cpt { score, nodeId, row: DocumentsView r, session, setLocalCategories } _ =
cpt { score, nodeId, row: DocumentsView r, session, setLocalCategories } _ = do
pure $ H.div {className:"flex"} divs where
pure $ H.div {className:"flex"} divs
divs = map (\s -> H.div { className : icon' score s, on: { click: onClick s } } []) stars
where
icon' Star_0 Star_0 = "fa fa-times-circle"
divs = map (\s -> H.div { className : icon score s
icon' _ Star_0 = "fa fa-times"
, on: {click: onClick score s}
icon' c s = if star2score c < star2score s then "fa fa-star-o" else "fa fa-star"
} []) stars
onClick c = \_-> do
setLocalCategories $ Map.insert r._id c
icon Star_0 Star_0 = "fa fa-times-circle"
void $ launchAff
icon _ Star_0 = "fa fa-times"
$ putRating session nodeId
icon c s = if star2score c < star2score s
$ RatingQuery {nodeIds: [r._id], rating: c}
then "fa fa-star-o"
else "fa fa-star"
newtype RatingQuery = RatingQuery { nodeIds :: Array Int, rating :: Star }
onClick score c = \_-> do
setLocalCategories $ Map.insert r._id c
void $ launchAff
$ putRating session nodeId
$ RatingQuery {nodeIds: [r._id], rating: c}
newtype RatingQuery =
RatingQuery { nodeIds :: Array Int
, rating :: Star
}
instance encodeJsonRatingQuery :: EncodeJson RatingQuery where
instance encodeJsonRatingQuery :: EncodeJson RatingQuery where
encodeJson (RatingQuery post) =
encodeJson (RatingQuery post) =
...
@@ -88,14 +55,9 @@ instance encodeJsonRatingQuery :: EncodeJson RatingQuery where
...
@@ -88,14 +55,9 @@ instance encodeJsonRatingQuery :: EncodeJson RatingQuery where
~> jsonEmptyObject
~> jsonEmptyObject
putRating :: Session -> Int -> RatingQuery -> Aff (Array Int)
putRating :: Session -> Int -> RatingQuery -> Aff (Array Int)
putRating session nodeId = put session $ ratingRoute nodeId
putRating session nodeId = put session $ ratingRoute where
where
ratingRoute = NodeAPI Node (Just nodeId) "category"
ratingRoute :: Int -> SessionRoute
ratingRoute nodeId = NodeAPI Node (Just nodeId) "category"
------------------------------------------------------------------------
type CarousselProps =
type CarousselProps =
( category :: Category
( category :: Category
, nodeId :: NodeID
, nodeId :: NodeID
...
@@ -104,7 +66,6 @@ type CarousselProps =
...
@@ -104,7 +66,6 @@ type CarousselProps =
, setLocalCategories :: R.Setter LocalCategories
, setLocalCategories :: R.Setter LocalCategories
)
)
caroussel :: R2.Component CarousselProps
caroussel :: R2.Component CarousselProps
caroussel = R.createElement carousselCpt
caroussel = R.createElement carousselCpt
...
...
src/Gargantext/Components/DocsTable.purs
View file @
5fe07605
-- TODO: this module should be replaced by FacetsTable
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.DocsTable where
module Gargantext.Components.DocsTable where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>))
import Gargantext.Prelude
( class Ord, Unit, bind, const, discard, identity, mempty
, otherwise, pure, show, unit, ($), (/=), (<$>), (<<<), (<>), (==) )
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Array as A
import Data.Array as A
import Data.Lens ((^.))
import Data.Lens ((^.))
import Data.Lens.At (at)
import Data.Lens.At (at)
import Data.Lens.Record (prop)
import Data.Lens.Record (prop)
import Data.Map (Map)
import Data.Maybe (Maybe(..), fromMaybe, isJust, maybe)
import Data.Maybe (Maybe(..), fromMaybe, isJust, maybe)
import Data.Ord.Down (Down(..))
import Data.Ord.Down (Down(..))
import Data.Set (Set)
import Data.Set (Set)
...
@@ -15,19 +17,18 @@ import Data.String as Str
...
@@ -15,19 +17,18 @@ import Data.String as Str
import Data.Symbol (SProxy(..))
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..), fst)
import Data.Tuple (Tuple(..), fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log
, log
2)
import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import DOM.Simple.Event as DE
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.Category (rating)
import Gargantext.Components.Category (caroussel, rating)
import Gargantext.Components.Category.Types (Star(..))
import Gargantext.Components.Category.Types (Category(..), decodeCategory, Star(..), decodeStar)
import Gargantext.Components.DocsTable.Types
import Gargantext.Components.DocsTable.Types
( DocumentsView(..), Hyperdata(..), LocalUserScore, Query, Response(..), sampleData )
import Gargantext.Components.Table.Types as T
import Gargantext.Components.Table.Types as T
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.Types (SidePanelTriggers)
import Gargantext.Components.Nodes.Texts.Types (SidePanelTriggers)
...
@@ -43,11 +44,9 @@ import Gargantext.Utils.CacheAPI as GUC
...
@@ -43,11 +44,9 @@ import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.DocsTable"
here = R2.here "Gargantext.Components.DocsTable"
------------------------------------------------------------------------
type TotalRecords = Int
type TotalRecords = Int
...
...
src/Gargantext/Components/FacetsTable.purs
View file @
5fe07605
...
@@ -3,9 +3,10 @@
...
@@ -3,9 +3,10 @@
-- has not been ported to this module yet.
-- has not been ported to this module yet.
module Gargantext.Components.FacetsTable where
module Gargantext.Components.FacetsTable where
------------------------------------------------------------------------
import Prelude
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>))
( class Show, Unit, bind, const, discard, identity, mempty, not
import Data.Array (concat, filter)
, otherwise, pure, unit, void, ($), (*>), (<$>), (<<<), (<>), (==), (>) )
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
...
@@ -13,19 +14,20 @@ import Data.Sequence (Seq)
...
@@ -13,19 +14,20 @@ import Data.Sequence (Seq)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set (Set)
import Data.Set (Set)
import Data.Set as Set
import Data.Set as Set
import Data.String (Pattern(..), split)
import Data.String as String
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Prelude
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Components.Category (CategoryQuery(..), putCategories)
import Gargantext.Components.Category (CategoryQuery(..), putCategories)
import Gargantext.Components.Category.Types (Category(..), decodeCategory, favCategory)
import Gargantext.Components.Category.Types (Category(..), decodeCategory, favCategory)
import Gargantext.Components.Search
import Gargantext.Components.Search
( Contact(..), Document(..), HyperdataRowContact(..), HyperdataRowDocument(..)
, SearchQuery, SearchResult(..), SearchResultTypes(..) )
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Components.Table.Types as T
import Gargantext.Components.Table.Types as T
import Gargantext.Ends (url, Frontends)
import Gargantext.Ends (url, Frontends)
...
@@ -35,11 +37,10 @@ import Gargantext.Routes as Routes
...
@@ -35,11 +37,10 @@ import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, post, deleteWithBody)
import Gargantext.Sessions (Session, sessionId, post, deleteWithBody)
import Gargantext.Types (NodeType(..), OrderBy(..), NodePath(..), NodeID)
import Gargantext.Types (NodeType(..), OrderBy(..), NodePath(..), NodeID)
import Gargantext.Utils (toggleSet, zeroPad)
import Gargantext.Utils (toggleSet, zeroPad)
import Gargantext.Utils.DecodeMaybe ((.|))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.FacetsTable"
here = R2.here "Gargantext.Components.FacetsTable"
------------------------------------------------------------------------
type Props =
type Props =
( chart :: R.Element
( chart :: R.Element
...
@@ -360,7 +361,7 @@ pageCpt = here.component "page" cpt
...
@@ -360,7 +361,7 @@ pageCpt = here.component "page" cpt
}
}
where
where
markClick _ = markCategory session nodeId Favorite [id]
markClick _ = markCategory session nodeId Favorite [id]
contactUrl aId id
= url frontends $ Routes.ContactPage (sessionId session) annuaireId id
contactUrl aId id
' = url frontends $ Routes.ContactPage (sessionId session) annuaireId id'
docRow dv@(DocumentsView {id, score, title, source, authors, pairs, delete, category}) =
docRow dv@(DocumentsView {id, score, title, source, authors, pairs, delete, category}) =
{ row:
{ row:
...
...
src/Gargantext/Components/Footer.purs
View file @
5fe07605
module Gargantext.Components.Footer where
module Gargantext.Components.Footer where
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Footer"
here = R2.here "Gargantext.Components.Footer"
...
...
src/Gargantext/Components/Forest.purs
View file @
5fe07605
...
@@ -35,26 +35,26 @@ here = R2.here "Gargantext.Components.Forest"
...
@@ -35,26 +35,26 @@ here = R2.here "Gargantext.Components.Forest"
-- Shared by components here with Tree
-- Shared by components here with Tree
type Common =
type Common =
( frontends :: Frontends
( frontends :: Frontends
, handed :: T.
Cursor
Handed
, handed :: T.
Box
Handed
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, route :: T.
Cursor
AppRoute
, route :: T.
Box
AppRoute
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
type LayoutProps =
type LayoutProps =
( backend :: T.
Cursor
(Maybe Backend)
( backend :: T.
Box
(Maybe Backend)
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, sessions :: T.
Cursor
Sessions
, sessions :: T.
Box
Sessions
, showLogin :: T.
Cursor
Boolean
, showLogin :: T.
Box
Boolean
| Common
| Common
)
)
type Props = (
type Props = (
forestOpen :: T.
Cursor
OpenNodes
forestOpen :: T.
Box
OpenNodes
| LayoutProps )
| LayoutProps )
type TreeExtra = (
type TreeExtra = (
forestOpen :: T.
Cursor
OpenNodes
forestOpen :: T.
Box
OpenNodes
, session :: Session
, session :: Session
)
)
...
@@ -74,7 +74,7 @@ forestCpt = here.component "forest" cpt where
...
@@ -74,7 +74,7 @@ forestCpt = here.component "forest" cpt where
, showLogin
, showLogin
, tasks } _ = do
, tasks } _ = do
tasks' <- GAT.useTasks reloadRoot reloadForest
tasks' <- GAT.useTasks reloadRoot reloadForest
R.useEffect' $ T
2
.write_ (Just tasks') tasks
R.useEffect' $ T.write_ (Just tasks') tasks
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
reloadForest' <- T.useLive T.unequal reloadForest
reloadForest' <- T.useLive T.unequal reloadForest
reloadRoot' <- T.useLive T.unequal reloadRoot
reloadRoot' <- T.useLive T.unequal reloadRoot
...
@@ -107,7 +107,7 @@ forestCpt = here.component "forest" cpt where
...
@@ -107,7 +107,7 @@ forestCpt = here.component "forest" cpt where
, session: s
, session: s
, tasks } []
, tasks } []
plus :: Handed -> T.
Cursor Boolean -> T.Cursor
(Maybe Backend) -> R.Element
plus :: Handed -> T.
Box Boolean -> T.Box
(Maybe Backend) -> R.Element
plus handed showLogin backend = H.div { className: "row" }
plus handed showLogin backend = H.div { className: "row" }
[ H.button { className: buttonClass
[ H.button { className: buttonClass
, on: { click }
, on: { click }
...
@@ -122,7 +122,7 @@ plus handed showLogin backend = H.div { className: "row" }
...
@@ -122,7 +122,7 @@ plus handed showLogin backend = H.div { className: "row" }
where
where
click _ = do
click _ = do
-- _ <- T.write Nothing backend
-- _ <- T.write Nothing backend
T
2
.write_ true showLogin
T.write_ true showLogin
title = "Add or remove connections to the server(s)."
title = "Add or remove connections to the server(s)."
divClass = "fa fa-universal-access"
divClass = "fa fa-universal-access"
buttonClass =
buttonClass =
...
@@ -174,7 +174,7 @@ forestLayoutRawCpt = here.component "forestLayoutRaw" cpt where
...
@@ -174,7 +174,7 @@ forestLayoutRawCpt = here.component "forestLayoutRaw" cpt where
, showLogin
, showLogin
, tasks } children = do
, tasks } children = do
handed' <- T.useLive T.unequal p.handed
handed' <- T.useLive T.unequal p.handed
forestOpen <- T
2.useCursed
$ Set.empty
forestOpen <- T
.useBox
$ Set.empty
pure $ R2.row $ reverseHanded
pure $ R2.row $ reverseHanded
[ H.div { className: "col-md-2"
[ H.div { className: "col-md-2"
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
5fe07605
...
@@ -16,7 +16,6 @@ import Reactix.DOM.HTML as H
...
@@ -16,7 +16,6 @@ import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
import Record.Extra as RecordE
import Record.Extra as RecordE
import Toestand as T
import Toestand as T
import Web.HTML.Event.EventTypes (offline)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node (nodeSpan)
import Gargantext.Components.Forest.Tree.Node (nodeSpan)
...
@@ -48,20 +47,20 @@ here = R2.here "Gargantext.Components.Forest.Tree"
...
@@ -48,20 +47,20 @@ here = R2.here "Gargantext.Components.Forest.Tree"
-- Shared by every component here + performAction + nodeSpan
-- Shared by every component here + performAction + nodeSpan
type Universal =
type Universal =
( reloadRoot :: T.
Cursor
T2.Reload
( reloadRoot :: T.
Box
T2.Reload
, tasks :: T.
Cursor
(Maybe GAT.Reductor) )
, tasks :: T.
Box
(Maybe GAT.Reductor) )
-- Shared by every component here + nodeSpan
-- Shared by every component here + nodeSpan
type Global =
type Global =
( frontends :: Frontends
( frontends :: Frontends
, handed :: Handed
, handed :: Handed
, route :: T.
Cursor
AppRoute
, route :: T.
Box
AppRoute
| Universal )
| Universal )
-- Shared by every component here
-- Shared by every component here
type Common = (
type Common = (
forestOpen :: T.
Cursor
OpenNodes
forestOpen :: T.
Box
OpenNodes
, reload :: T.
Cursor
T2.Reload
, reload :: T.
Box
T2.Reload
| Global
| Global
)
)
...
@@ -89,7 +88,7 @@ getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
...
@@ -89,7 +88,7 @@ getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
getNodeTreeFirstLevel :: Session -> ID -> Aff FTree
getNodeTreeFirstLevel :: Session -> ID -> Aff FTree
getNodeTreeFirstLevel session nodeId = get session $ GR.TreeFirstLevel (Just nodeId) ""
getNodeTreeFirstLevel session nodeId = get session $ GR.TreeFirstLevel (Just nodeId) ""
type NodeProps = ( reloadTree :: T.
Cursor
T2.Reload, session :: Session | Common )
type NodeProps = ( reloadTree :: T.
Box
T2.Reload, session :: Session | Common )
type TreeProps = ( tree :: FTree | NodeProps )
type TreeProps = ( tree :: FTree | NodeProps )
...
@@ -100,7 +99,7 @@ treeCpt :: R.Component TreeProps
...
@@ -100,7 +99,7 @@ treeCpt :: R.Component TreeProps
treeCpt = here.component "tree" cpt where
treeCpt = here.component "tree" cpt where
cpt p@{ session, tree: NTree (LNode { id, name, nodeType }) children } _ = do
cpt p@{ session, tree: NTree (LNode { id, name, nodeType }) children } _ = do
setPopoverRef <- R.useRef Nothing
setPopoverRef <- R.useRef Nothing
folderOpen <- T2.useMember
Cursor
nodeId p.forestOpen
folderOpen <- T2.useMember
Box
nodeId p.forestOpen
open <- T.useLive T.unequal folderOpen
open <- T.useLive T.unequal folderOpen
pure $ H.ul { className: ulClass }
pure $ H.ul { className: ulClass }
[ H.div { className: divClass } -- TODO: naughty div should not be in a ul
[ H.div { className: divClass } -- TODO: naughty div should not be in a ul
...
@@ -131,8 +130,8 @@ treeCpt = here.component "tree" cpt where
...
@@ -131,8 +130,8 @@ treeCpt = here.component "tree" cpt where
--- The properties tree shares in common with performAction
--- The properties tree shares in common with performAction
type PACommon =
type PACommon =
( forestOpen :: T.
Cursor
OpenNodes
( forestOpen :: T.
Box
OpenNodes
, reloadTree :: T.
Cursor
T2.Reload
, reloadTree :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, tree :: FTree
, tree :: FTree
| Universal )
| Universal )
...
@@ -151,7 +150,7 @@ childLoader = R.createElement childLoaderCpt
...
@@ -151,7 +150,7 @@ childLoader = R.createElement childLoaderCpt
childLoaderCpt :: R.Component ChildLoaderProps
childLoaderCpt :: R.Component ChildLoaderProps
childLoaderCpt = here.component "childLoader" cpt where
childLoaderCpt = here.component "childLoader" cpt where
cpt p@{ render } _ = do
cpt p@{ render } _ = do
reload <- T
2.useCursed
T2.newReload
reload <- T
.useBox
T2.newReload
let reloads = [ reload, p.reloadTree, p.reloadRoot ]
let reloads = [ reload, p.reloadTree, p.reloadRoot ]
cache <- (A.cons p.id) <$> traverse (T.useLive T.unequal) reloads
cache <- (A.cons p.id) <$> traverse (T.useLive T.unequal) reloads
useLoader cache fetch (paint reload)
useLoader cache fetch (paint reload)
...
@@ -175,7 +174,7 @@ performAction (DeleteNode nt) p@{ forestOpen
...
@@ -175,7 +174,7 @@ performAction (DeleteNode nt) p@{ forestOpen
GT.NodePublic GT.FolderPublic -> void $ deleteNode session nt id
GT.NodePublic GT.FolderPublic -> void $ deleteNode session nt id
GT.NodePublic _ -> void $ unpublishNode session parent_id id
GT.NodePublic _ -> void $ unpublishNode session parent_id id
_ -> void $ deleteNode session nt id
_ -> void $ deleteNode session nt id
liftEffect $ T
2
.modify_ (Set.delete (mkNodeId session id)) forestOpen
liftEffect $ T.modify_ (Set.delete (mkNodeId session id)) forestOpen
performAction RefreshTree p
performAction RefreshTree p
performAction (DoSearch task) p@{ tasks
performAction (DoSearch task) p@{ tasks
, tree: (NTree (LNode {id}) _) } = liftEffect $ do
, tree: (NTree (LNode {id}) _) } = liftEffect $ do
...
@@ -201,14 +200,14 @@ performAction (ShareTeam username) p@{ tree: (NTree (LNode {id}) _)} =
...
@@ -201,14 +200,14 @@ performAction (ShareTeam username) p@{ tree: (NTree (LNode {id}) _)} =
performAction (SharePublic { params }) p@{ forestOpen } = traverse_ f params where
performAction (SharePublic { params }) p@{ forestOpen } = traverse_ f params where
f (SubTreeOut { in: inId, out }) = do
f (SubTreeOut { in: inId, out }) = do
void $ Share.shareReq p.session inId $ Share.SharePublicParams { node_id: out }
void $ Share.shareReq p.session inId $ Share.SharePublicParams { node_id: out }
liftEffect $ T
2
.modify_ (Set.insert (mkNodeId p.session out)) forestOpen
liftEffect $ T.modify_ (Set.insert (mkNodeId p.session out)) forestOpen
performAction RefreshTree p
performAction RefreshTree p
performAction (AddContact params) p@{ tree: (NTree (LNode {id}) _) } =
performAction (AddContact params) p@{ tree: (NTree (LNode {id}) _) } =
void $ Contact.contactReq p.session id params
void $ Contact.contactReq p.session id params
performAction (AddNode name nodeType) p@{ forestOpen
performAction (AddNode name nodeType) p@{ forestOpen
, tree: (NTree (LNode { id }) _) } = do
, tree: (NTree (LNode { id }) _) } = do
task <- addNode p.session id $ AddNodeValue {name, nodeType}
task <- addNode p.session id $ AddNodeValue {name, nodeType}
liftEffect $ T
2
.modify_ (Set.insert (mkNodeId p.session id)) forestOpen
liftEffect $ T.modify_ (Set.insert (mkNodeId p.session id)) forestOpen
performAction RefreshTree p
performAction RefreshTree p
performAction (UploadFile nodeType fileType mName blob) p@{ tasks
performAction (UploadFile nodeType fileType mName blob) p@{ tasks
, tree: (NTree (LNode { id }) _) } = do
, tree: (NTree (LNode { id }) _) } = do
...
@@ -233,7 +232,7 @@ performAction (MoveNode {params}) p@{ forestOpen
...
@@ -233,7 +232,7 @@ performAction (MoveNode {params}) p@{ forestOpen
, session } = traverse_ f params where
, session } = traverse_ f params where
f (SubTreeOut { in: in', out }) = do
f (SubTreeOut { in: in', out }) = do
void $ moveNodeReq p.session in' out
void $ moveNodeReq p.session in' out
liftEffect $ T
2
.modify_ (Set.insert (mkNodeId session out)) forestOpen
liftEffect $ T.modify_ (Set.insert (mkNodeId session out)) forestOpen
performAction RefreshTree p
performAction RefreshTree p
performAction (MergeNode { params }) p = traverse_ f params where
performAction (MergeNode { params }) p = traverse_ f params where
f (SubTreeOut { in: in', out }) = do
f (SubTreeOut { in: in', out }) = do
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
5fe07605
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array (reverse)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (null)
import Data.Nullable (null)
import Data.Symbol (SProxy(..))
import Data.Symbol (SProxy(..))
...
@@ -16,7 +15,6 @@ import Reactix as R
...
@@ -16,7 +15,6 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
import Toestand as T
import Toestand as T
import Web.HTML.Event.EventTypes (offline)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
...
@@ -47,16 +45,16 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node"
...
@@ -47,16 +45,16 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node"
-- Main Node
-- Main Node
type NodeMainSpanProps =
type NodeMainSpanProps =
( folderOpen :: T.
Cursor
Boolean
( folderOpen :: T.
Box
Boolean
, frontends :: Frontends
, frontends :: Frontends
, id :: ID
, id :: ID
, isLeaf :: IsLeaf
, isLeaf :: IsLeaf
, name :: Name
, name :: Name
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, route :: T.
Cursor
Routes.AppRoute
, route :: T.
Box
Routes.AppRoute
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
| CommonProps
| CommonProps
)
)
...
@@ -103,7 +101,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
...
@@ -103,7 +101,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
tasks' <- T.read tasks
tasks' <- T.read tasks
pure $ H.span (dropProps droppedFile isDragOver)
pure $ H.span (dropProps droppedFile isDragOver)
$
GT.
reverseHanded
$ reverseHanded
[ folderIcon { folderOpen, nodeType } []
[ folderIcon { folderOpen, nodeType } []
, chevronIcon { folderOpen, handed, isLeaf, nodeType } []
, chevronIcon { folderOpen, handed, isLeaf, nodeType } []
, nodeLink { frontends, handed, folderOpen, id, isSelected
, nodeLink { frontends, handed, folderOpen, id, isSelected
...
@@ -140,27 +138,21 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
...
@@ -140,27 +138,21 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
} []
} []
] handed
] handed
where
where
onTaskFinish id t _ = do
onTaskFinish id
'
t _ = do
mT <- T.read tasks
mT <- T.read tasks
case mT of
case mT of
Just t' -> snd t' $ GAT.Finish id t
Just t' -> snd t' $ GAT.Finish id
'
t
Nothing -> pure unit
Nothing -> pure unit
T2.reload reloadRoot
T2.reload reloadRoot
SettingsBox {show: showBox} = settingsBox nodeType
SettingsBox {show: showBox} = settingsBox nodeType
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
name' {name
, nodeType} = if nodeType == GT.NodeUser then show session else name
name' {name
: n, nodeType: nt} = if nt == GT.NodeUser then show session else n
mNodePopupView props@{id, nodeType} onPopoverClose =
mNodePopupView props'@{ id: i, nodeType: nt, handed: h } opc =
nodePopupView { dispatch
nodePopupView { dispatch, handed: h, id: i, name: name' props'
, handed : props.handed
, nodeType: nt, onPopoverClose: opc, session }
, id
, name: name' props
, nodeType
, onPopoverClose
, session
}
popOverIcon =
popOverIcon =
H.a { className: "settings fa fa-cog"
H.a { className: "settings fa fa-cog"
...
@@ -199,7 +191,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
...
@@ -199,7 +191,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
onDragLeave (_ /\ setIsDragOver) _ = setIsDragOver $ const false
onDragLeave (_ /\ setIsDragOver) _ = setIsDragOver $ const false
type FolderIconProps = (
type FolderIconProps = (
folderOpen :: T.
Cursor
Boolean
folderOpen :: T.
Box
Boolean
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
)
)
...
@@ -211,11 +203,11 @@ folderIconCpt = here.component "folderIcon" cpt
...
@@ -211,11 +203,11 @@ folderIconCpt = here.component "folderIcon" cpt
where
where
cpt { folderOpen, nodeType } _ = do
cpt { folderOpen, nodeType } _ = do
open <- T.read folderOpen
open <- T.read folderOpen
pure $ H.a { className: "folder-icon", on: { click: \_ -> T
2
.modify_ not folderOpen } }
pure $ H.a { className: "folder-icon", on: { click: \_ -> T.modify_ not folderOpen } }
[ H.i { className: GT.fldr nodeType open } [] ]
[ H.i { className: GT.fldr nodeType open } [] ]
type ChevronIconProps = (
type ChevronIconProps = (
folderOpen :: T.
Cursor
Boolean
folderOpen :: T.
Box
Boolean
, handed :: GT.Handed
, handed :: GT.Handed
, isLeaf :: Boolean
, isLeaf :: Boolean
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
...
@@ -232,7 +224,7 @@ chevronIconCpt = here.component "chevronIcon" cpt
...
@@ -232,7 +224,7 @@ chevronIconCpt = here.component "chevronIcon" cpt
cpt { folderOpen, handed, isLeaf: false, nodeType } _ = do
cpt { folderOpen, handed, isLeaf: false, nodeType } _ = do
open <- T.read folderOpen
open <- T.read folderOpen
pure $ H.a { className: "chevron-icon"
pure $ H.a { className: "chevron-icon"
, on: { click: \_ -> T
2
.modify_ not folderOpen }
, on: { click: \_ -> T.modify_ not folderOpen }
}
}
[ H.i { className: if open
[ H.i { className: if open
then "fa fa-chevron-down"
then "fa fa-chevron-down"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
5fe07605
...
@@ -20,9 +20,9 @@ import Gargantext.Types as GT
...
@@ -20,9 +20,9 @@ import Gargantext.Types as GT
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Add"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Add"
----------------------------------------------------------------------
addNode :: Session -> GT.ID -> AddNodeValue -> Aff (Array GT.ID)
addNode :: Session -> GT.ID -> AddNodeValue -> Aff (Array GT.ID)
addNode session parentId = post session $ GR.NodeAPI GT.Node (Just parentId) ""
addNode session parentId = post session $ GR.NodeAPI GT.Node (Just parentId) ""
...
@@ -33,8 +33,7 @@ addNodeAsync :: Session
...
@@ -33,8 +33,7 @@ addNodeAsync :: Session
addNodeAsync session parentId q = do
addNodeAsync session parentId q = do
task <- post session p q
task <- post session p q
pure $ GT.AsyncTaskWithType {task, typ: GT.AddNode}
pure $ GT.AsyncTaskWithType {task, typ: GT.AddNode}
where
where p = GR.NodeAPI GT.Node (Just parentId) (GT.asyncTaskTypePath GT.AddNode)
p = GR.NodeAPI GT.Node (Just parentId) (GT.asyncTaskTypePath GT.AddNode)
----------------------------------------------------------------------
----------------------------------------------------------------------
-- TODO AddNodeParams
-- TODO AddNodeParams
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Contact.purs
View file @
5fe07605
...
@@ -2,9 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Contact where
...
@@ -2,9 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Contact where
import Prelude
import Prelude
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Effect.Uncurried (mkEffectFn1)
import Formula as F
import Formula as F
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -13,13 +11,11 @@ import Toestand as T
...
@@ -13,13 +11,11 @@ import Toestand as T
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactParams(..))
import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactParams(..))
-- import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
-- import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Prelude (Unit, bind, const, discard, pure, (<<<), (<>))
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Contact"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Contact"
...
@@ -32,7 +28,7 @@ type TextInputBoxProps =
...
@@ -32,7 +28,7 @@ type TextInputBoxProps =
( id :: ID
( id :: ID
, dispatch :: Action -> Aff Unit
, dispatch :: Action -> Aff Unit
, params :: Record AddContactProps
, params :: Record AddContactProps
, isOpen :: T.
Cursor
Boolean
, isOpen :: T.
Box
Boolean
, boxName :: String
, boxName :: String
, boxAction :: AddContactParams -> Action
, boxAction :: AddContactParams -> Action
)
)
...
@@ -47,7 +43,7 @@ textInputBoxCpt = here.component "textInputBox" cpt where
...
@@ -47,7 +43,7 @@ textInputBoxCpt = here.component "textInputBox" cpt where
cpt p@{ boxName, boxAction, dispatch, isOpen
cpt p@{ boxName, boxAction, dispatch, isOpen
, params: { firstname, lastname } } _ =
, params: { firstname, lastname } } _ =
content <$> T.useLive T.unequal isOpen
content <$> T.useLive T.unequal isOpen
<*> T.use
Cell firstname <*> T.useCell
lastname
<*> T.use
Box firstname <*> T.useBox
lastname
where
where
content false _ _ = H.div {} []
content false _ _ = H.div {} []
content true firstName lastName =
content true firstName lastName =
...
@@ -68,14 +64,14 @@ textInputBoxCpt = here.component "textInputBox" cpt where
...
@@ -68,14 +64,14 @@ textInputBoxCpt = here.component "textInputBox" cpt where
, type: "button", on: { click }, title:"Submit"
, type: "button", on: { click }, title:"Submit"
} [] where
} [] where
click _ = do
click _ = do
f
irstname
<- T.read first
f <- T.read first
l
astname
<- T.read last
l <- T.read last
T
2
.write_ false isOpen
T.write_ false isOpen
launchAff $
launchAff $
dispatch (boxAction $ AddContactParams { firstname
, lastname
})
dispatch (boxAction $ AddContactParams { firstname
: f, lastname: l
})
cancelBtn =
cancelBtn =
H.a
H.a
{ className: "btn text-danger glyphitem fa fa-remove col-md-2 pull-left"
{ className: "btn text-danger glyphitem fa fa-remove col-md-2 pull-left"
, on: { click }, title: "Cancel", type: "button"
, on: { click }, title: "Cancel", type: "button"
} [] where
} [] where
click _ = T
2
.write_ false isOpen
click _ = T.write_ false isOpen
src/Gargantext/Components/Forest/Tree/Node/Action/Contact/Types.purs
View file @
5fe07605
module Gargantext.Components.Forest.Tree.Node.Action.Contact.Types where
module Gargantext.Components.Forest.Tree.Node.Action.Contact.Types where
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Gargantext.Prelude (class Eq, class Show)
import Data.Maybe (Maybe(..))
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Effect.Aff (Aff)
import Data.Argonaut (class DecodeJson, class EncodeJson)
import Prelude (($))
import Reactix as R
import Gargantext.Types as GT
import Gargantext.Types (ID)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Prelude
import Gargantext.Sessions (Session, put_)
import Gargantext.Types as GT
import Reactix as R
import Reactix.DOM.HTML as H
import Data.Argonaut as Argonaut
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Data.Maybe (Maybe(..))
import Gargantext.Prelude (class Eq, class Read, class Show)
------------------------------------------------------------------------
data AddContactParams =
data AddContactParams =
AddContactParams { firstname :: String
AddContactParams { firstname :: String, lastname :: String }
, lastname :: String
}
derive instance eqAddContactParams :: Eq AddContactParams
derive instance eqAddContactParams :: Eq AddContactParams
...
@@ -38,10 +16,8 @@ derive instance genericAddContactParams :: Generic AddContactParams _
...
@@ -38,10 +16,8 @@ derive instance genericAddContactParams :: Generic AddContactParams _
instance showAddContactParams :: Show AddContactParams where
instance showAddContactParams :: Show AddContactParams where
show = genericShow
show = genericShow
instance decodeJsonAddContactParams ::
Argonaut.
DecodeJson AddContactParams where
instance decodeJsonAddContactParams :: DecodeJson AddContactParams where
decodeJson = genericSumDecodeJson
decodeJson = genericSumDecodeJson
instance encodeJsonAddContactParams ::
Argonaut.
EncodeJson AddContactParams where
instance encodeJsonAddContactParams :: EncodeJson AddContactParams where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
------------------------------------------------------------------------
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
5fe07605
...
@@ -15,18 +15,14 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTre
...
@@ -15,18 +15,14 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTre
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Routes as GR
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Link"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Link"
data LinkNodeReq = LinkNodeReq { nodeType :: GT.NodeType, id :: GT.ID }
data LinkNodeReq = LinkNodeReq { nodeType :: GT.NodeType
, id :: GT.ID
}
derive instance eqLinkNodeReq :: Eq LinkNodeReq
derive instance eqLinkNodeReq :: Eq LinkNodeReq
derive instance genericLinkNodeReq :: Generic LinkNodeReq _
derive instance genericLinkNodeReq :: Generic LinkNodeReq _
...
@@ -41,13 +37,8 @@ instance encodeJsonLinkNodeReq :: Argonaut.EncodeJson LinkNodeReq where
...
@@ -41,13 +37,8 @@ instance encodeJsonLinkNodeReq :: Argonaut.EncodeJson LinkNodeReq where
linkNodeReq :: Session -> Maybe GT.NodeType -> GT.ID -> GT.ID -> Aff GT.AsyncTaskWithType
linkNodeReq :: Session -> Maybe GT.NodeType -> GT.ID -> GT.ID -> Aff GT.AsyncTaskWithType
linkNodeReq session nt fromId toId = do
linkNodeReq session nt fromId toId = do
task <- post session (NodeAPI GT.Node (Just fromId) "update")
task <- post session (NodeAPI GT.Node (Just fromId) "update")
(LinkNodeReq { nodeType: linkNodeType nt
(LinkNodeReq { nodeType: linkNodeType nt, id: toId })
, id: toId
}
)
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
p = GR.NodeAPI GT.Node (Just fromId) "update"
linkNodeType :: Maybe GT.NodeType -> GT.NodeType
linkNodeType :: Maybe GT.NodeType -> GT.NodeType
linkNodeType (Just GT.Corpus) = GT.Annuaire
linkNodeType (Just GT.Corpus) = GT.Annuaire
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
5fe07605
...
@@ -16,6 +16,7 @@ import Gargantext.Sessions (Session, put_)
...
@@ -16,6 +16,7 @@ import Gargantext.Sessions (Session, put_)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Merge"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Merge"
mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff (Array GT.ID)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search.purs
View file @
5fe07605
...
@@ -3,7 +3,6 @@ module Gargantext.Components.Forest.Tree.Node.Action.Search where
...
@@ -3,7 +3,6 @@ module Gargantext.Components.Forest.Tree.Node.Action.Search where
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Frame.purs
View file @
5fe07605
module Gargantext.Components.Forest.Tree.Node.Action.Search.Frame where
module Gargantext.Components.Forest.Tree.Node.Action.Search.Frame where
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==), class Show)
import DOM.Simple as DOM
import DOM.Simple as DOM
import DOM.Simple.Event (MessageEvent)
import DOM.Simple.Event (MessageEvent)
import DOM.Simple.EventListener (Callback, addEventListener, callback)
import DOM.Simple.EventListener (Callback, addEventListener, callback)
...
@@ -8,7 +9,6 @@ import Data.Generic.Rep (class Generic)
...
@@ -8,7 +9,6 @@ import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)
import Data.Nullable (Nullable)
import Data.String (toLower)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Reactix as R
import Reactix as R
...
@@ -16,10 +16,11 @@ import Reactix.DOM.HTML as H
...
@@ -16,10 +16,11 @@ import Reactix.DOM.HTML as H
import URI.Extra.QueryPairs as NQP
import URI.Extra.QueryPairs as NQP
import URI.Query as Query
import URI.Query as Query
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types
(DataField(..), Search, isIsTex_Advanced)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==), class Show, show
)
( DataField(..), Search, isIsTex_Advanced
)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search.Frame"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search.Frame"
--------------------
--------------------
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
5fe07605
...
@@ -14,7 +14,6 @@ import Reactix.DOM.HTML as H
...
@@ -14,7 +14,6 @@ import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Tools (panel)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Database(..), IMT_org(..), Org(..), SearchQuery(..), allIMTorgs, allOrgs, dataFields, defaultSearchQuery, doc, performSearch, datafield2database, Search)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Database(..), IMT_org(..), Org(..), SearchQuery(..), allIMTorgs, allOrgs, dataFields, defaultSearchQuery, doc, performSearch, datafield2database, Search)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Lang (Lang)
import Gargantext.Components.Lang (Lang)
...
@@ -405,11 +404,11 @@ triggerSearch :: (GT.AsyncTaskWithType -> Effect Unit)
...
@@ -405,11 +404,11 @@ triggerSearch :: (GT.AsyncTaskWithType -> Effect Unit)
triggerSearch os s q =
triggerSearch os s q =
launchAff_ $ do
launchAff_ $ do
liftEffect $ do
liftEffect $ do
let here = "[triggerSearch] Searching "
let here
'
= "[triggerSearch] Searching "
log2 (here <> "databases: ") (show q.databases)
log2 (here
'
<> "databases: ") (show q.databases)
log2 (here <> "datafield: ") (show q.datafield)
log2 (here
'
<> "datafield: ") (show q.datafield)
log2 (here <> "term: ") q.term
log2 (here
'
<> "term: ") q.term
log2 (here <> "lang: ") (show q.lang)
log2 (here
'
<> "lang: ") (show q.lang)
case q.node_id of
case q.node_id of
Nothing -> liftEffect $ log "[triggerSearch] node_id is Nothing, don't know what to do"
Nothing -> liftEffect $ log "[triggerSearch] node_id is Nothing, don't know what to do"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
5fe07605
...
@@ -9,9 +9,8 @@ import Data.Tuple (Tuple(..))
...
@@ -9,9 +9,8 @@ import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff
, throwError
)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
import React.SyntheticEvent as E
import React.SyntheticEvent as E
import Reactix as R
import Reactix as R
...
@@ -32,6 +31,7 @@ import Gargantext.Types (NodeType(..), ID)
...
@@ -32,6 +31,7 @@ import Gargantext.Types (NodeType(..), ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Upload"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Upload"
-- UploadFile Action
-- UploadFile Action
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
5fe07605
...
@@ -33,7 +33,6 @@ import Gargantext.Types (Name, ID)
...
@@ -33,7 +33,6 @@ import Gargantext.Types (Name, ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils (glyphicon, glyphiconActive)
import Gargantext.Utils (glyphicon, glyphiconActive)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
...
@@ -46,10 +45,10 @@ nodePopupView p = R.createElement nodePopupCpt p []
...
@@ -46,10 +45,10 @@ nodePopupView p = R.createElement nodePopupCpt p []
nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt = here.component "nodePopupView" cpt where
nodePopupCpt = here.component "nodePopupView" cpt where
cpt p@{ id, name, nodeType } _ = do
cpt p@{ id, name, nodeType } _ = do
renameIsOpen <- T.use
Cell false >>= T2.useIdentityCursor
renameIsOpen <- T.use
Box false
open <- T.useLive T.unequal renameIsOpen
open <- T.useLive T.unequal renameIsOpen
nodePopup <- T.use
Cell
{ action: Nothing, id, name, nodeType }
nodePopup <- T.use
Box
{ action: Nothing, id, name, nodeType }
action <- T.use
Cursor
(_.action) (\a b -> b { action = a }) nodePopup
action <- T.use
Focused
(_.action) (\a b -> b { action = a }) nodePopup
nodePopup' <- T.useLive T.unequal nodePopup
nodePopup' <- T.useLive T.unequal nodePopup
search <- R.useState' $ defaultSearch { node_id = Just p.id }
search <- R.useState' $ defaultSearch { node_id = Just p.id }
pure $ H.div tooltipProps
pure $ H.div tooltipProps
...
@@ -81,8 +80,8 @@ nodePopupCpt = here.component "nodePopupView" cpt where
...
@@ -81,8 +80,8 @@ nodePopupCpt = here.component "nodePopupView" cpt where
editIcon _ true = H.div {} []
editIcon _ true = H.div {} []
editIcon isOpen false =
editIcon isOpen false =
H.a { className: glyphicon "pencil", id: "rename1"
H.a { className: glyphicon "pencil", id: "rename1"
, title : "Rename", on: { click: \_ -> T
2
.write_ true isOpen } } []
, title : "Rename", on: { click: \_ -> T.write_ true isOpen } } []
panelBody :: T.
Cursor
(Maybe NodeAction) -> Record NodePopupProps -> R.Element
panelBody :: T.
Box
(Maybe NodeAction) -> Record NodePopupProps -> R.Element
panelBody nodePopupState {dispatch: d, nodeType} =
panelBody nodePopupState {dispatch: d, nodeType} =
let (SettingsBox { edit, doc, buttons }) = settingsBox nodeType in
let (SettingsBox { edit, doc, buttons }) = settingsBox nodeType in
H.div {className: "card-body flex-space-between"}
H.div {className: "card-body flex-space-between"}
...
@@ -121,7 +120,7 @@ type ActionState =
...
@@ -121,7 +120,7 @@ type ActionState =
type ButtonClickProps =
type ButtonClickProps =
( action :: NodeAction
( action :: NodeAction
, state :: T.
Cursor
(Maybe NodeAction)
, state :: T.
Box
(Maybe NodeAction)
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
)
)
...
@@ -134,7 +133,7 @@ buttonClickCpt = here.component "buttonClick" cpt where
...
@@ -134,7 +133,7 @@ buttonClickCpt = here.component "buttonClick" cpt where
action <- T.useLive T.unequal state
action <- T.useLive T.unequal state
let className = glyphiconActive (glyphiconNodeAction todo) (action == (Just todo))
let className = glyphiconActive (glyphiconNodeAction todo) (action == (Just todo))
let style = iconAStyle nodeType todo
let style = iconAStyle nodeType todo
let click _ = T
2
.write_ (if action == Just todo then Nothing else Just todo) state
let click _ = T.write_ (if action == Just todo then Nothing else Just todo) state
pure $ H.div { className: "col-1" }
pure $ H.div { className: "col-1" }
[ H.a { style, className, id: show todo, title: show todo, on: { click } } [] ]
[ H.a { style, className, id: show todo, title: show todo, on: { click } } [] ]
-- | Open the help indications if selected already
-- | Open the help indications if selected already
...
@@ -188,14 +187,14 @@ panelActionCpt = here.component "panelAction" cpt
...
@@ -188,14 +187,14 @@ panelActionCpt = here.component "panelAction" cpt
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session, handed} _ =
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session, handed} _ =
pure $ linkNode {dispatch, id, nodeType, session, subTreeParams, handed} []
pure $ linkNode {dispatch, id, nodeType, session, subTreeParams, handed} []
cpt {action : Share, dispatch, id, name } _ = do
cpt {action : Share, dispatch, id, name } _ = do
isOpen <- T.use
Cell true >>= T.useCursor
identity (\a _ -> a)
isOpen <- T.use
Box true >>= T.useFocused
identity (\a _ -> a)
pure $ panel
pure $ panel
[ textInputBox
[ textInputBox
{ boxAction: Share.shareAction, boxName: "Share"
{ boxAction: Share.shareAction, boxName: "Share"
, dispatch, id, text: "username", isOpen } []
, dispatch, id, text: "username", isOpen } []
] (H.div {} [])
] (H.div {} [])
cpt {action : AddingContact, dispatch, id, name } _ = do
cpt {action : AddingContact, dispatch, id, name } _ = do
isOpen <- T.use
Cell true >>= T.useCursor
identity (\a _ -> a)
isOpen <- T.use
Box true >>= T.useFocused
identity (\a _ -> a)
pure $ Contact.textInputBox
pure $ Contact.textInputBox
{ id, dispatch, isOpen, boxName:"addContact"
{ id, dispatch, isOpen, boxName:"addContact"
, params : {firstname:"First Name", lastname: "Last Name"}
, params : {firstname:"First Name", lastname: "Last Name"}
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
5fe07605
...
@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Tools where
...
@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Tools where
import Gargantext.Prelude
import Gargantext.Prelude
( class Ord, class Read, class Show, Unit
( class Ord, class Read, class Show, Unit
, bind, const, discard, map, not, pure, read, show, when
, void
, bind, const, discard, map, not, pure, read, show, when
, ($), (<), (<<<), (<>), (<$>), (<*>) )
, ($), (<), (<<<), (<>), (<$>), (<*>) )
import Data.Maybe (fromMaybe, Maybe(..))
import Data.Maybe (fromMaybe, Maybe(..))
import Data.Nullable (null)
import Data.Nullable (null)
...
@@ -26,7 +26,6 @@ import Gargantext.Types as GT
...
@@ -26,7 +26,6 @@ import Gargantext.Types as GT
import Gargantext.Utils (glyphicon, toggleSet)
import Gargantext.Utils (glyphicon, toggleSet)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.ReactTooltip as ReactTooltip
import Gargantext.Utils.ReactTooltip as ReactTooltip
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools"
...
@@ -53,7 +52,7 @@ type TextInputBoxProps =
...
@@ -53,7 +52,7 @@ type TextInputBoxProps =
( id :: ID
( id :: ID
, dispatch :: Action -> Aff Unit
, dispatch :: Action -> Aff Unit
, text :: String
, text :: String
, isOpen :: T.
Cursor
Boolean
, isOpen :: T.
Box
Boolean
, boxName :: String
, boxName :: String
, boxAction :: String -> Action
, boxAction :: String -> Action
)
)
...
@@ -82,8 +81,8 @@ textInputBoxCpt = here.component "textInputBox" cpt where
...
@@ -82,8 +81,8 @@ textInputBoxCpt = here.component "textInputBox" cpt where
, className: "text-danger col-2 " <> glyphicon "times" } [] ]
, className: "text-danger col-2 " <> glyphicon "times" } [] ]
submit ref _ = do
submit ref _ = do
launchAff_ $ dispatch (boxAction $ R.readRef ref)
launchAff_ $ dispatch (boxAction $ R.readRef ref)
T
2
.write_ false isOpen
T.write_ false isOpen
click _ = T
2
.write_ false isOpen
click _ = T.write_ false isOpen
type DefaultText = String
type DefaultText = String
...
@@ -195,7 +194,7 @@ prettyNodeType
...
@@ -195,7 +194,7 @@ prettyNodeType
type NodeLinkProps = (
type NodeLinkProps = (
frontends :: Frontends
frontends :: Frontends
, id :: Int
, id :: Int
, folderOpen :: T.
Cursor
Boolean
, folderOpen :: T.
Box
Boolean
, isSelected :: Boolean
, isSelected :: Boolean
, name :: Name
, name :: Name
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
...
@@ -224,7 +223,7 @@ nodeLinkCpt = here.component "nodeLink" cpt where
...
@@ -224,7 +223,7 @@ nodeLinkCpt = here.component "nodeLink" cpt where
-- NOTE Don't toggle tree if it is not selected
-- NOTE Don't toggle tree if it is not selected
-- click on closed -> open
-- click on closed -> open
-- click on open -> ?
-- click on open -> ?
click _ = when (not isSelected) (T
2
.write_ true folderOpen)
click _ = when (not isSelected) (T.write_ true folderOpen)
tooltipId = "node-link-" <> show id
tooltipId = "node-link-" <> show id
href = url frontends $ GT.NodePath (sessionId session) nodeType (Just id)
href = url frontends $ GT.NodePath (sessionId session) nodeType (Just id)
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
5fe07605
...
@@ -102,66 +102,31 @@ subTreeTreeView :: Record CorpusTreeProps -> R.Element
...
@@ -102,66 +102,31 @@ subTreeTreeView :: Record CorpusTreeProps -> R.Element
subTreeTreeView props = R.createElement subTreeTreeViewCpt props []
subTreeTreeView props = R.createElement subTreeTreeViewCpt props []
subTreeTreeViewCpt :: R.Component CorpusTreeProps
subTreeTreeViewCpt :: R.Component CorpusTreeProps
subTreeTreeViewCpt = here.component "subTreeTreeViewCpt" cpt
subTreeTreeViewCpt = here.component "subTreeTreeViewCpt" cpt where
where
cpt p@{ tree: NTree (LNode { id: targetId, name, nodeType }) ary
cpt p@{ id
, id, subTreeParams, dispatch, action, handed } _ =
, tree: NTree (LNode { id: targetId
pure $ H.div {} $ GT.reverseHanded
, name
[ H.div { className: nodeClass validNodeType }
, nodeType
[ H.span { className: "text", on: { click } }
}
[ nodeText { isSelected: isSelected targetId valAction
) ary
, name: " " <> name, handed }
, subTreeParams
, H.span { className: "children" } children ]]]
, dispatch
handed
, action
where
, handed
nodeClass vnt = "node " <> GT.fldr nodeType true <> " " <> validNodeTypeClass where
} _ = do
validNodeTypeClass = if vnt then "node-type-valid" else ""
let ordering =
SubTreeParams { valitypes } = subTreeParams
case handed of
sortedAry = A.sortWith (\(NTree (LNode {id:id'}) _) -> id')
GT.LeftHanded -> A.reverse
$ A.filter (\(NTree (LNode {id:id'}) _) -> id'/= id) ary
GT.RightHanded -> identity
children = map (\ctree -> subTreeTreeView (p { tree = ctree })) sortedAry
validNodeType = (A.elem nodeType valitypes) && (id /= targetId)
pure $ H.div {} $ ordering [
clickable = if validNodeType then "clickable" else ""
H.div { className: nodeClass validNodeType } [
(valAction /\ setAction) = action
H.span { className: "text"
isSelected n action' = case (subTreeOut action') of
, on: { click: onClick }
Nothing -> false
} [
(Just (SubTreeOut {out})) -> n == out
nodeText { isSelected: isSelected targetId valAction
click e = do
, name: " " <> name
let action' = if not validNodeType then Nothing else Just $ SubTreeOut { in: id, out: targetId }
, handed
E.preventDefault e
}
E.stopPropagation e
, H.span { className: "children" } children
setAction $ const $ setTreeOut valAction action'
]
]
]
where
nodeClass vnt = "node " <> GT.fldr nodeType true <> " " <> validNodeTypeClass
where
validNodeTypeClass = if vnt then "node-type-valid" else ""
SubTreeParams { valitypes } = subTreeParams
sortedAry = A.sortWith (\(NTree (LNode {id:id'}) _) -> id')
$ A.filter (\(NTree (LNode {id:id'}) _) -> id'/= id) ary
children = map (\ctree -> subTreeTreeView (p { tree = ctree })) sortedAry
validNodeType = (A.elem nodeType valitypes) && (id /= targetId)
clickable = if validNodeType then "clickable" else ""
(valAction /\ setAction) = action
isSelected n action' = case (subTreeOut action') of
Nothing -> false
(Just (SubTreeOut {out})) -> n == out
onClick e = do
let action = if not validNodeType then Nothing else Just $ SubTreeOut { in: id, out: targetId }
E.preventDefault e
E.stopPropagation e
setAction $ const $ setTreeOut valAction action
--------------------------------------------------------------------------------------------
src/Gargantext/Components/Forest/Tree/Node/Tools/Sync.purs
View file @
5fe07605
module Gargantext.Components.Forest.Tree.Node.Tools.Sync where
module Gargantext.Components.Forest.Tree.Node.Tools.Sync where
import Gargantext.Prelude
( Unit, bind, const, discard, pure, unit, ($), (<>), (==) )
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
...
@@ -9,12 +11,11 @@ import Reactix.DOM.HTML as H
...
@@ -9,12 +11,11 @@ import Reactix.DOM.HTML as H
import Reactix as R
import Reactix as R
import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Components.NgramsTable.API as NTAPI
import Gargantext.Prelude (Unit, bind, const, discard, pure, unit, ($), (<>), (==))
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.Sync"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.Sync"
...
...
src/Gargantext/Components/Graph.purs
View file @
5fe07605
...
@@ -11,7 +11,6 @@ import Data.Maybe (Maybe(..))
...
@@ -11,7 +11,6 @@ import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)
import Data.Nullable (Nullable)
import DOM.Simple.Console (log, log2)
import DOM.Simple.Console (log, log2)
import DOM.Simple.Types (Element)
import DOM.Simple.Types (Element)
import FFI.Simple (delay)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as RH
import Reactix.DOM.HTML as RH
import Record as Record
import Record as Record
...
@@ -35,17 +34,17 @@ derive instance genericStage :: Generic Stage _
...
@@ -35,17 +34,17 @@ derive instance genericStage :: Generic Stage _
derive instance eqStage :: Eq Stage
derive instance eqStage :: Eq Stage
type Props sigma forceatlas2 =
(
type Props sigma forceatlas2 =
elRef :: R.Ref (Nullable Element)
(
elRef :: R.Ref (Nullable Element)
, forceAtlas2Settings :: forceatlas2
, forceAtlas2Settings :: forceatlas2
, graph :: SigmaxTypes.SGraph
, graph :: SigmaxTypes.SGraph
, mCamera :: Maybe GET.Camera
, mCamera :: Maybe GET.Camera
, multiSelectEnabledRef :: R.Ref Boolean
, multiSelectEnabledRef :: R.Ref Boolean
, selectedNodeIds :: T.
Cursor
SigmaxTypes.NodeIds
, selectedNodeIds :: T.
Box
SigmaxTypes.NodeIds
, showEdges :: T.
Cursor
SigmaxTypes.ShowEdgesState
, showEdges :: T.
Box
SigmaxTypes.ShowEdgesState
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaSettings :: sigma
, sigmaSettings :: sigma
, stage :: T.
Cursor
Stage
, stage :: T.
Box
Stage
, startForceAtlas :: Boolean
, startForceAtlas :: Boolean
, transformedGraph :: SigmaxTypes.SGraph
, transformedGraph :: SigmaxTypes.SGraph
)
)
...
@@ -54,17 +53,13 @@ graph :: forall s fa2. R2.Component (Props s fa2)
...
@@ -54,17 +53,13 @@ graph :: forall s fa2. R2.Component (Props s fa2)
graph = R.createElement graphCpt
graph = R.createElement graphCpt
graphCpt :: forall s fa2. R.Component (Props s fa2)
graphCpt :: forall s fa2. R.Component (Props s fa2)
graphCpt = here.component "graph" cpt
graphCpt = here.component "graph" cpt where
where
cpt props@{ elRef
cpt props@{ elRef
, forceAtlas2Settings
, graph
, mCamera
, mCamera
, multiSelectEnabledRef
, multiSelectEnabledRef
, selectedNodeIds
, selectedNodeIds
, showEdges
, showEdges
, sigmaRef
, sigmaRef
, sigmaSettings
, stage
, stage
, startForceAtlas
, startForceAtlas
, transformedGraph } _ = do
, transformedGraph } _ = do
...
@@ -89,15 +84,8 @@ graphCpt = here.component "graph" cpt
...
@@ -89,15 +84,8 @@ graphCpt = here.component "graph" cpt
Nothing -> RH.div {} []
Nothing -> RH.div {} []
Just el -> R.createPortal [] el
Just el -> R.createPortal [] el
stageHooks { elRef
stageHooks props@{ elRef, mCamera, multiSelectEnabledRef, selectedNodeIds, forceAtlas2Settings: fa2, graph: graph'
, graph
, sigmaRef, stage, stage': Init, startForceAtlas } = do
, mCamera
, multiSelectEnabledRef
, selectedNodeIds
, sigmaRef
, stage
, stage': Init
, startForceAtlas } = do
R.useEffectOnce' $ do
R.useEffectOnce' $ do
let rSigma = R.readRef sigmaRef
let rSigma = R.readRef sigmaRef
...
@@ -117,7 +105,7 @@ graphCpt = here.component "graph" cpt
...
@@ -117,7 +105,7 @@ graphCpt = here.component "graph" cpt
}
}
pure unit
pure unit
Sigmax.refreshData sig $ Sigmax.sigmafy graph
Sigmax.refreshData sig $ Sigmax.sigmafy graph
'
Sigmax.dependOnSigma (R.readRef sigmaRef) "[graphCpt (Ready)] no sigma" $ \sigma -> do
Sigmax.dependOnSigma (R.readRef sigmaRef) "[graphCpt (Ready)] no sigma" $ \sigma -> do
-- bind the click event only initially, when ref was empty
-- bind the click event only initially, when ref was empty
...
@@ -129,7 +117,7 @@ graphCpt = here.component "graph" cpt
...
@@ -129,7 +117,7 @@ graphCpt = here.component "graph" cpt
-- log2 "[graph] startForceAtlas" startForceAtlas
-- log2 "[graph] startForceAtlas" startForceAtlas
if startForceAtlas then
if startForceAtlas then
Sigma.startForceAtlas2 sig f
orceAtlas2Settings
Sigma.startForceAtlas2 sig f
a2
else
else
Sigma.stopForceAtlas2 sig
Sigma.stopForceAtlas2 sig
...
@@ -144,6 +132,7 @@ graphCpt = here.component "graph" cpt
...
@@ -144,6 +132,7 @@ graphCpt = here.component "graph" cpt
T.write Ready stage
T.write Ready stage
stageHooks { showEdges'
stageHooks { showEdges'
, sigmaRef
, sigmaRef
, stage': Ready
, stage': Ready
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
5fe07605
...
@@ -45,28 +45,23 @@ import Gargantext.Utils.Toestand as T2
...
@@ -45,28 +45,23 @@ import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer"
here = R2.here "Gargantext.Components.GraphExplorer"
type BaseProps =
(
type BaseProps =
backend :: T.Cursor
(Maybe Backend)
( backend :: T.Box
(Maybe Backend)
, frontends :: Frontends
, frontends :: Frontends
, graphId :: GET.GraphId
, graphId :: GET.GraphId
, handed :: T.Cursor Types.Handed
, handed :: T.Box Types.Handed
, route :: T.Cursor AppRoute
, route :: T.Box AppRoute
, sessions :: T.Cursor Sessions
, sessions :: T.Box Sessions
, showLogin :: T.Cursor Boolean
, showLogin :: T.Box Boolean
, tasks :: T.Cursor (Maybe GAT.Reductor)
, tasks :: T.Box (Maybe GAT.Reductor)
)
)
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutProps = (
type LayoutProps = ( graphVersion :: GUR.ReloadS, session :: Session | BaseProps )
graphVersion :: GUR.ReloadS
, session :: Session
| BaseProps
)
type Props =
(
type Props =
graph :: SigmaxT.SGraph
(
graph :: SigmaxT.SGraph
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, mMetaData :: Maybe GET.MetaData
, mMetaData :: Maybe GET.MetaData
| LayoutProps
| LayoutProps
...
@@ -90,10 +85,7 @@ explorerLayout = R.createElement explorerLayoutCpt
...
@@ -90,10 +85,7 @@ explorerLayout = R.createElement explorerLayoutCpt
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = here.component "explorerLayout" cpt where
explorerLayoutCpt = here.component "explorerLayout" cpt where
cpt props@{ backend
cpt props@{ backend, graphId, graphVersion, session } _ = do
, graphId
, graphVersion
, session } _ = do
useLoader graphId (getNodes session graphVersion) handler
useLoader graphId (getNodes session graphVersion) handler
where
where
handler loaded = explorer (Record.merge props { graph, hyperdataGraph: loaded, mMetaData }) []
handler loaded = explorer (Record.merge props { graph, hyperdataGraph: loaded, mMetaData }) []
...
@@ -125,7 +117,7 @@ explorerCpt = here.component "explorer" cpt
...
@@ -125,7 +117,7 @@ explorerCpt = here.component "explorer" cpt
} _ = do
} _ = do
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
let startForceAtlas = maybe true (\(GET.MetaData { startForceAtlas
}) -> startForceAtlas
) mMetaData
let startForceAtlas = maybe true (\(GET.MetaData { startForceAtlas
: sfa }) -> sfa
) mMetaData
let forceAtlasS = if startForceAtlas
let forceAtlasS = if startForceAtlas
then SigmaxT.InitialRunning
then SigmaxT.InitialRunning
...
@@ -134,21 +126,21 @@ explorerCpt = here.component "explorer" cpt
...
@@ -134,21 +126,21 @@ explorerCpt = here.component "explorer" cpt
dataRef <- R.useRef graph
dataRef <- R.useRef graph
graphRef <- R.useRef null
graphRef <- R.useRef null
graphVersionRef <- R.useRef (GUR.value graphVersion)
graphVersionRef <- R.useRef (GUR.value graphVersion)
-- reloadForest <- T
2.useCursed
$ T2.Ready 0
-- reloadForest <- T
.useBox
$ T2.Ready 0
reloadForest <- T
2.useCursed
0
reloadForest <- T
.useBox
0
-- reloadForest <- GUR.newIInitialized reloadForest
-- reloadForest <- GUR.newIInitialized reloadForest
controls <- Controls.useGraphControls { forceAtlasS
controls <- Controls.useGraphControls { forceAtlasS
, graph
, graph
, graphId
, graphId
, hyperdataGraph
, hyperdataGraph
, reloadForest: \_ -> GUR.bump
Cursor
reloadForest
, reloadForest: \_ -> GUR.bump
Box
reloadForest
, session
, session
}
}
multiSelectEnabled' <- T.useLive T.unequal controls.multiSelectEnabled
multiSelectEnabled' <- T.useLive T.unequal controls.multiSelectEnabled
showTree' <- T.useLive T.unequal controls.showTree
showTree' <- T.useLive T.unequal controls.showTree
multiSelectEnabledRef <- R.useRef multiSelectEnabled'
multiSelectEnabledRef <- R.useRef multiSelectEnabled'
forestOpen <- T
2.useCursed
$ Set.empty
forestOpen <- T
.useBox
$ Set.empty
R.useEffect' $ do
R.useEffect' $ do
let readData = R.readRef dataRef
let readData = R.readRef dataRef
...
@@ -162,12 +154,12 @@ explorerCpt = here.component "explorer" cpt
...
@@ -162,12 +154,12 @@ explorerCpt = here.component "explorer" cpt
R.setRef dataRef graph
R.setRef dataRef graph
R.setRef graphVersionRef (GUR.value graphVersion)
R.setRef graphVersionRef (GUR.value graphVersion)
-- Reinitialize bunch of state as well.
-- Reinitialize bunch of state as well.
T
2
.write_ SigmaxT.emptyNodeIds controls.removedNodeIds
T.write_ SigmaxT.emptyNodeIds controls.removedNodeIds
T
2
.write_ SigmaxT.emptyNodeIds controls.selectedNodeIds
T.write_ SigmaxT.emptyNodeIds controls.selectedNodeIds
T
2
.write_ SigmaxT.EShow controls.showEdges
T.write_ SigmaxT.EShow controls.showEdges
T
2
.write_ forceAtlasS controls.forceAtlasState
T.write_ forceAtlasS controls.forceAtlasState
T
2
.write_ Graph.Init controls.graphStage
T.write_ Graph.Init controls.graphStage
T
2
.write_ GET.InitialClosed controls.showSidePanel
T.write_ GET.InitialClosed controls.showSidePanel
pure $
pure $
RH.div { className: "graph-meta-container" } [
RH.div { className: "graph-meta-container" } [
...
@@ -265,17 +257,17 @@ explorerCpt = here.component "explorer" cpt
...
@@ -265,17 +257,17 @@ explorerCpt = here.component "explorer" cpt
Sidebar.sidebar (Record.merge props { metaData })
Sidebar.sidebar (Record.merge props { metaData })
type TreeProps = (
type TreeProps = (
backend :: T.
Cursor
(Maybe Backend)
backend :: T.
Box
(Maybe Backend)
, forestOpen :: T.
Cursor
OpenNodes
, forestOpen :: T.
Box
OpenNodes
, frontends :: Frontends
, frontends :: Frontends
, handed :: T.
Cursor
Types.Handed
, handed :: T.
Box
Types.Handed
, reload :: T.
Cursor
T2.Reload
, reload :: T.
Box
T2.Reload
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, route :: T.
Cursor
AppRoute
, route :: T.
Box
AppRoute
, sessions :: T.
Cursor
Sessions
, sessions :: T.
Box
Sessions
, show :: Boolean
, show :: Boolean
, showLogin :: T.
Cursor
Boolean
, showLogin :: T.
Box
Boolean
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
type MSidebarProps =
type MSidebarProps =
...
@@ -283,11 +275,11 @@ type MSidebarProps =
...
@@ -283,11 +275,11 @@ type MSidebarProps =
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphId :: GET.GraphId
, graphId :: GET.GraphId
, graphVersion :: GUR.ReloadS
, graphVersion :: GUR.ReloadS
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, removedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, removedNodeIds :: T.
Box
SigmaxT.NodeIds
, selectedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, selectedNodeIds :: T.
Box
SigmaxT.NodeIds
, session :: Session
, session :: Session
, showSidePanel :: T.
Cursor
GET.SidePanelState
, showSidePanel :: T.
Box
GET.SidePanelState
)
)
type GraphProps = (
type GraphProps = (
...
@@ -337,7 +329,7 @@ graphViewCpt = here.component "graphView" cpt
...
@@ -337,7 +329,7 @@ graphViewCpt = here.component "graphView" cpt
, removedNodeIds'
, removedNodeIds'
, selectedNodeIds'
, selectedNodeIds'
, showEdges' }
, showEdges' }
let startForceAtlas = maybe true (\(GET.MetaData { startForceAtlas
}) -> startForceAtlas
) mMetaData
let startForceAtlas = maybe true (\(GET.MetaData { startForceAtlas
: sfa }) -> sfa
) mMetaData
R.useEffect1' multiSelectEnabled' $ do
R.useEffect1' multiSelectEnabled' $ do
R.setRef multiSelectEnabledRef multiSelectEnabled'
R.setRef multiSelectEnabledRef multiSelectEnabled'
...
...
src/Gargantext/Components/GraphExplorer/API.purs
View file @
5fe07605
module Gargantext.Components.GraphExplorer.API where
module Gargantext.Components.GraphExplorer.API where
import Data.Maybe (Maybe
(..)
)
import Data.Maybe (Maybe)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
...
...
src/Gargantext/Components/GraphExplorer/Button.purs
View file @
5fe07605
module Gargantext.Components.GraphExplorer.Button
module Gargantext.Components.GraphExplorer.Button
( centerButton
( Props, centerButton, simpleButton, cameraButton ) where
, Props
, simpleButton
, cameraButton
) where
import Prelude
import Prelude
...
@@ -12,7 +8,6 @@ import Data.Maybe (Maybe(..))
...
@@ -12,7 +8,6 @@ import Data.Maybe (Maybe(..))
import Data.DateTime as DDT
import Data.DateTime as DDT
import Data.DateTime.Instant as DDI
import Data.DateTime.Instant as DDI
import Data.String as DS
import Data.String as DS
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
...
@@ -29,6 +24,7 @@ import Gargantext.Hooks.Sigmax.Sigma as Sigma
...
@@ -29,6 +24,7 @@ import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Button"
here = R2.here "Gargantext.Components.GraphExplorer.Button"
type Props = (
type Props = (
...
@@ -92,16 +88,11 @@ cameraButton { id
...
@@ -92,16 +88,11 @@ cameraButton { id
, nodes = map GEU.stNodeToGET nodes }
, nodes = map GEU.stNodeToGET nodes }
let cameras = map Sigma.toCamera $ Sigma.cameras s
let cameras = map Sigma.toCamera $ Sigma.cameras s
let camera = case cameras of
let camera = case cameras of
[c] -> GET.Camera { ratio: c.ratio
[c] -> GET.Camera { ratio: c.ratio, x: c.x, y: c.y }
, x: c.x
_ -> GET.Camera { ratio: 1.0, x: 0.0, y: 0.0 }
, y: c.y }
let hyperdataGraph' = GET.HyperdataGraph { graph: graphData, mCamera: Just camera }
_ -> GET.Camera { ratio: 1.0
, x: 0.0
, y: 0.0 }
let hyperdataGraph = GET.HyperdataGraph { graph: graphData
, mCamera: Just camera }
launchAff_ $ do
launchAff_ $ do
clonedGraphId <- cloneGraph { id, hyperdataGraph, session }
clonedGraphId <- cloneGraph { id, hyperdataGraph
: hyperdataGraph'
, session }
ret <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
ret <- uploadArbitraryDataURL session clonedGraphId (Just $ nowStr <> "-" <> "screenshot.png") screen
liftEffect $ reloadForest unit
liftEffect $ reloadForest unit
pure ret
pure ret
...
...
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
5fe07605
...
@@ -12,8 +12,6 @@ import Data.Int as I
...
@@ -12,8 +12,6 @@ import Data.Int as I
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set as Set
import Data.Set as Set
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Timer (setTimeout)
import Effect.Timer (setTimeout)
import Prelude
import Prelude
...
@@ -33,47 +31,39 @@ import Gargantext.Hooks.Sigmax.Types as SigmaxT
...
@@ -33,47 +31,39 @@ import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Controls"
here = R2.here "Gargantext.Components.GraphExplorer.Controls"
type Controls =
(
type Controls =
edgeConfluence :: T.Cursor
Range.NumberRange
( edgeConfluence :: T.Box
Range.NumberRange
, edgeWeight :: T.
Cursor
Range.NumberRange
, edgeWeight :: T.
Box
Range.NumberRange
, forceAtlasState :: T.
Cursor
SigmaxT.ForceAtlasState
, forceAtlasState :: T.
Box
SigmaxT.ForceAtlasState
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphId :: GET.GraphId
, graphId :: GET.GraphId
, graphStage :: T.
Cursor
Graph.Stage
, graphStage :: T.
Box
Graph.Stage
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, multiSelectEnabled :: T.
Cursor
Boolean
, multiSelectEnabled :: T.
Box
Boolean
, nodeSize :: T.
Cursor
Range.NumberRange
, nodeSize :: T.
Box
Range.NumberRange
, reloadForest :: Unit -> Effect Unit
, reloadForest :: Unit -> Effect Unit
, removedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, removedNodeIds :: T.
Box
SigmaxT.NodeIds
, selectedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, selectedNodeIds :: T.
Box
SigmaxT.NodeIds
, session :: Session
, session :: Session
, showControls :: T.
Cursor
Boolean
, showControls :: T.
Box
Boolean
, showEdges :: T.
Cursor
SigmaxT.ShowEdgesState
, showEdges :: T.
Box
SigmaxT.ShowEdgesState
, showLouvain :: T.
Cursor
Boolean
, showLouvain :: T.
Box
Boolean
, showSidePanel :: T.
Cursor
GET.SidePanelState
, showSidePanel :: T.
Box
GET.SidePanelState
, showTree :: T.
Cursor
Boolean
, showTree :: T.
Box
Boolean
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
)
)
type LocalControls = (
type LocalControls = ( labelSize :: T.Box Number, mouseSelectorSize :: T.Box Number )
labelSize :: T.Cursor Number
, mouseSelectorSize :: T.Cursor Number
)
initialLocalControls :: R.Hooks (Record LocalControls)
initialLocalControls :: R.Hooks (Record LocalControls)
initialLocalControls = do
initialLocalControls = do
labelSize <- T2.useCursed 14.0
labelSize <- T.useBox 14.0
mouseSelectorSize <- T2.useCursed 15.0
mouseSelectorSize <- T.useBox 15.0
pure $ { labelSize, mouseSelectorSize }
pure $ {
labelSize
, mouseSelectorSize
}
controls :: Record Controls -> R.Element
controls :: Record Controls -> R.Element
controls props = R.createElement controlsCpt props []
controls props = R.createElement controlsCpt props []
...
@@ -122,12 +112,12 @@ controlsCpt = here.component "controls" cpt
...
@@ -122,12 +112,12 @@ controlsCpt = here.component "controls" cpt
-- Handle automatic edge hiding when FA is running (to prevent flickering).
-- Handle automatic edge hiding when FA is running (to prevent flickering).
R.useEffect2' sigmaRef forceAtlasState' $ do
R.useEffect2' sigmaRef forceAtlasState' $ do
T
2
.modify_ (SigmaxT.forceAtlasEdgeState forceAtlasState') showEdges
T.modify_ (SigmaxT.forceAtlasEdgeState forceAtlasState') showEdges
-- Automatic opening of sidebar when a node is selected (but only first time).
-- Automatic opening of sidebar when a node is selected (but only first time).
R.useEffect' $ do
R.useEffect' $ do
if showSidePanel' == GET.InitialClosed && (not Set.isEmpty selectedNodeIds') then
if showSidePanel' == GET.InitialClosed && (not Set.isEmpty selectedNodeIds') then
T
2
.write_ (GET.Opened GET.SideTabData) showSidePanel
T.write_ (GET.Opened GET.SideTabData) showSidePanel
else
else
pure unit
pure unit
...
@@ -138,7 +128,7 @@ controlsCpt = here.component "controls" cpt
...
@@ -138,7 +128,7 @@ controlsCpt = here.component "controls" cpt
timeoutId <- setTimeout 9000 $ do
timeoutId <- setTimeout 9000 $ do
case forceAtlasState' of
case forceAtlasState' of
SigmaxT.InitialRunning ->
SigmaxT.InitialRunning ->
T
2
.write_ SigmaxT.Paused forceAtlasState
T.write_ SigmaxT.Paused forceAtlasState
_ -> pure unit
_ -> pure unit
R.setRef mFAPauseRef Nothing
R.setRef mFAPauseRef Nothing
R.setRef mFAPauseRef $ Just timeoutId
R.setRef mFAPauseRef $ Just timeoutId
...
@@ -243,22 +233,22 @@ useGraphControls { forceAtlasS
...
@@ -243,22 +233,22 @@ useGraphControls { forceAtlasS
, hyperdataGraph
, hyperdataGraph
, session
, session
, reloadForest } = do
, reloadForest } = do
edgeConfluence <- T
2.useCursed
$ Range.Closed { min: 0.0, max: 1.0 }
edgeConfluence <- T
.useBox
$ Range.Closed { min: 0.0, max: 1.0 }
edgeWeight <- T
2.useCursed
$ Range.Closed {
edgeWeight <- T
.useBox
$ Range.Closed {
min: 0.0
min: 0.0
, max: I.toNumber $ Seq.length $ SigmaxT.graphEdges graph
, max: I.toNumber $ Seq.length $ SigmaxT.graphEdges graph
}
}
forceAtlasState <- T
2.useCursed
forceAtlasS
forceAtlasState <- T
.useBox
forceAtlasS
graphStage <- T
2.useCursed
Graph.Init
graphStage <- T
.useBox
Graph.Init
multiSelectEnabled <- T
2.useCursed
false
multiSelectEnabled <- T
.useBox
false
nodeSize <- T
2.useCursed
$ Range.Closed { min: 0.0, max: 100.0 }
nodeSize <- T
.useBox
$ Range.Closed { min: 0.0, max: 100.0 }
removedNodeIds <- T
2.useCursed
SigmaxT.emptyNodeIds
removedNodeIds <- T
.useBox
SigmaxT.emptyNodeIds
selectedNodeIds <- T
2.useCursed
SigmaxT.emptyNodeIds
selectedNodeIds <- T
.useBox
SigmaxT.emptyNodeIds
showControls <- T
2.useCursed
false
showControls <- T
.useBox
false
showEdges <- T
2.useCursed
SigmaxT.EShow
showEdges <- T
.useBox
SigmaxT.EShow
showLouvain <- T
2.useCursed
false
showLouvain <- T
.useBox
false
showSidePanel <- T
2.useCursed
GET.InitialClosed
showSidePanel <- T
.useBox
GET.InitialClosed
showTree <- T
2.useCursed
false
showTree <- T
.useBox
false
sigma <- Sigmax.initSigma
sigma <- Sigmax.initSigma
sigmaRef <- R.useRef sigma
sigmaRef <- R.useRef sigma
...
@@ -284,7 +274,7 @@ useGraphControls { forceAtlasS
...
@@ -284,7 +274,7 @@ useGraphControls { forceAtlasS
}
}
setShowControls :: Record Controls -> Boolean -> Effect Unit
setShowControls :: Record Controls -> Boolean -> Effect Unit
setShowControls { showControls } v = T
2
.write_ v showControls
setShowControls { showControls } v = T.write_ v showControls
setShowTree :: Record Controls -> Boolean -> Effect Unit
setShowTree :: Record Controls -> Boolean -> Effect Unit
setShowTree { showTree } v = T
2
.write_ (not v) showTree
setShowTree { showTree } v = T.write_ (not v) showTree
src/Gargantext/Components/GraphExplorer/RangeControl.purs
View file @
5fe07605
...
@@ -7,7 +7,6 @@ module Gargantext.Components.GraphExplorer.RangeControl
...
@@ -7,7 +7,6 @@ module Gargantext.Components.GraphExplorer.RangeControl
) where
) where
import Prelude
import Prelude
import Data.Tuple.Nested ((/\))
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Toestand as T
...
@@ -15,7 +14,6 @@ import Toestand as T
...
@@ -15,7 +14,6 @@ import Toestand as T
import Gargantext.Components.RangeSlider as RS
import Gargantext.Components.RangeSlider as RS
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.RangeControl"
here = R2.here "Gargantext.Components.GraphExplorer.RangeControl"
...
@@ -40,7 +38,7 @@ rangeControlCpt = here.component "rangeButton" cpt
...
@@ -40,7 +38,7 @@ rangeControlCpt = here.component "rangeButton" cpt
type EdgeConfluenceControlProps = (
type EdgeConfluenceControlProps = (
range :: Range.NumberRange
range :: Range.NumberRange
, state :: T.
Cursor
Range.NumberRange
, state :: T.
Box
Range.NumberRange
)
)
edgeConfluenceControl :: R2.Component EdgeConfluenceControlProps
edgeConfluenceControl :: R2.Component EdgeConfluenceControlProps
...
@@ -62,13 +60,13 @@ edgeConfluenceControlCpt = here.component "edgeConfluenceControl" cpt
...
@@ -62,13 +60,13 @@ edgeConfluenceControlCpt = here.component "edgeConfluenceControl" cpt
, step: 1.0
, step: 1.0
, width: 10.0
, width: 10.0
, height: 5.0
, height: 5.0
, onChange: \rng -> T
2
.write_ rng state
, onChange: \rng -> T.write_ rng state
}
}
} []
} []
type EdgeWeightControlProps = (
type EdgeWeightControlProps = (
range :: Range.NumberRange
range :: Range.NumberRange
, state :: T.
Cursor
Range.NumberRange
, state :: T.
Box
Range.NumberRange
)
)
edgeWeightControl :: R2.Component EdgeWeightControlProps
edgeWeightControl :: R2.Component EdgeWeightControlProps
...
@@ -90,13 +88,13 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt
...
@@ -90,13 +88,13 @@ edgeWeightControlCpt = here.component "edgeWeightControl" cpt
, step: 1.0
, step: 1.0
, width: 10.0
, width: 10.0
, height: 5.0
, height: 5.0
, onChange: \rng -> T
2
.write_ rng state
, onChange: \rng -> T.write_ rng state
}
}
} []
} []
type NodeSideControlProps = (
type NodeSideControlProps = (
range :: Range.NumberRange
range :: Range.NumberRange
, state :: T.
Cursor
Range.NumberRange
, state :: T.
Box
Range.NumberRange
)
)
nodeSizeControl :: R2.Component NodeSideControlProps
nodeSizeControl :: R2.Component NodeSideControlProps
...
@@ -118,6 +116,6 @@ nodeSizeControlCpt = here.component "nodeSizeControl" cpt
...
@@ -118,6 +116,6 @@ nodeSizeControlCpt = here.component "nodeSizeControl" cpt
, step: 1.0
, step: 1.0
, width: 10.0
, width: 10.0
, height: 5.0
, height: 5.0
, onChange: \rng -> T
2
.write_ rng state
, onChange: \rng -> T.write_ rng state
}
}
} []
} []
src/Gargantext/Components/GraphExplorer/Search.purs
View file @
5fe07605
module Gargantext.Components.GraphExplorer.Search
module Gargantext.Components.GraphExplorer.Search
( Props
( Props, nodeSearchControl ) where
, nodeSearchControl
) where
import Prelude
import Prelude
import Data.Sequence as Seq
import Data.Sequence as Seq
...
@@ -17,15 +15,14 @@ import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete)
...
@@ -17,15 +15,14 @@ import Gargantext.Components.InputWithAutocomplete (inputWithAutocomplete)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Utils (queryMatchesLabel)
import Gargantext.Utils (queryMatchesLabel)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Search"
here = R2.here "Gargantext.Components.GraphExplorer.Search"
type Props = (
type Props = (
graph :: SigmaxT.SGraph
graph :: SigmaxT.SGraph
, multiSelectEnabled :: T.
Cursor
Boolean
, multiSelectEnabled :: T.
Box
Boolean
, selectedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, selectedNodeIds :: T.
Box
SigmaxT.NodeIds
)
)
-- | Whether a node matches a search string
-- | Whether a node matches a search string
...
@@ -68,7 +65,7 @@ autocompleteSearch graph s = Seq.toUnfoldable $ (_.label) <$> searchNodes s node
...
@@ -68,7 +65,7 @@ autocompleteSearch graph s = Seq.toUnfoldable $ (_.label) <$> searchNodes s node
triggerSearch :: SigmaxT.SGraph
triggerSearch :: SigmaxT.SGraph
-> String
-> String
-> Boolean
-> Boolean
-> T.
Cursor
SigmaxT.NodeIds
-> T.
Box
SigmaxT.NodeIds
-> Effect Unit
-> Effect Unit
triggerSearch graph search multiSelectEnabled selectedNodeIds = do
triggerSearch graph search multiSelectEnabled selectedNodeIds = do
let graphNodes = SigmaxT.graphNodes graph
let graphNodes = SigmaxT.graphNodes graph
...
@@ -76,5 +73,5 @@ triggerSearch graph search multiSelectEnabled selectedNodeIds = do
...
@@ -76,5 +73,5 @@ triggerSearch graph search multiSelectEnabled selectedNodeIds = do
log2 "[triggerSearch] search" search
log2 "[triggerSearch] search" search
T
2
.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/GraphExplorer/Sidebar.purs
View file @
5fe07605
...
@@ -9,8 +9,6 @@ import Data.Map as Map
...
@@ -9,8 +9,6 @@ import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (Maybe(..), fromJust)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set as Set
import Data.Set as Set
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
...
@@ -47,9 +45,9 @@ here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
...
@@ -47,9 +45,9 @@ here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
type Common = (
type Common = (
graphId :: NodeID
graphId :: NodeID
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, removedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, removedNodeIds :: T.
Box
SigmaxT.NodeIds
, selectedNodeIds :: T.
Cursor
SigmaxT.NodeIds
, selectedNodeIds :: T.
Box
SigmaxT.NodeIds
, session :: Session
, session :: Session
)
)
...
@@ -57,7 +55,7 @@ type Props = (
...
@@ -57,7 +55,7 @@ type Props = (
frontends :: Frontends
frontends :: Frontends
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphVersion :: GUR.ReloadS
, graphVersion :: GUR.ReloadS
, showSidePanel :: T.
Cursor
GET.SidePanelState
, showSidePanel :: T.
Box
GET.SidePanelState
| Common
| Common
)
)
...
@@ -78,8 +76,6 @@ sidebarCpt = here.component "sidebar" cpt
...
@@ -78,8 +76,6 @@ sidebarCpt = here.component "sidebar" cpt
SideTabLegend -> sideTabLegend sideTabProps []
SideTabLegend -> sideTabLegend sideTabProps []
SideTabData -> sideTabData sideTabProps []
SideTabData -> sideTabData sideTabProps []
SideTabCommunity -> sideTabCommunity sideTabProps []
SideTabCommunity -> sideTabCommunity sideTabProps []
_ -> H.div {} []
pure $ RH.div { id: "sp-container" }
pure $ RH.div { id: "sp-container" }
[ sideTabNav { sidePanel: showSidePanel
[ sideTabNav { sidePanel: showSidePanel
, sideTabs: [SideTabLegend, SideTabData, SideTabCommunity] } []
, sideTabs: [SideTabLegend, SideTabData, SideTabCommunity] } []
...
@@ -89,7 +85,7 @@ sidebarCpt = here.component "sidebar" cpt
...
@@ -89,7 +85,7 @@ sidebarCpt = here.component "sidebar" cpt
sideTabProps = RX.pick props :: Record SideTabProps
sideTabProps = RX.pick props :: Record SideTabProps
type SideTabNavProps = (
type SideTabNavProps = (
sidePanel :: T.
Cursor
GET.SidePanelState
sidePanel :: T.
Box
GET.SidePanelState
, sideTabs :: Array SideTab
, sideTabs :: Array SideTab
)
)
...
@@ -299,34 +295,32 @@ removeButtonCpt = here.component "removeButton" cpt
...
@@ -299,34 +295,32 @@ removeButtonCpt = here.component "removeButton" cpt
, session: session
, session: session
, termList: rType
, termList: rType
, reloadForest }
, reloadForest }
T
2
.write_ selectedNodeIds' removedNodeIds
T.write_ selectedNodeIds' removedNodeIds
T
2
.write_ SigmaxT.emptyNodeIds selectedNodeIds
T.write_ SigmaxT.emptyNodeIds selectedNodeIds
badge :: T.
Cursor
SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
badge :: T.
Box
SigmaxT.NodeIds -> Record SigmaxT.Node -> R.Element
badge selectedNodeIds {id, label} =
badge selectedNodeIds {id, label} =
RH.a { className: "badge badge-pill badge-light"
RH.a { className: "badge badge-pill badge-light"
, on: { click: onClick }
, on: { click: onClick }
} [ RH.h6 {} [ RH.text label ] ]
} [ RH.h6 {} [ RH.text label ] ]
where
where
onClick e = do
onClick e = do
T
2
.write_ (Set.singleton id) selectedNodeIds
T.write_ (Set.singleton id) selectedNodeIds
badges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
badges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
badges graph selectedNodeIds = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
badges graph selectedNodeIds = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
neighbourBadges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
neighbourBadges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
neighbourBadges graph selectedNodeIds = SigmaxT.neighbours graph selectedNodes
neighbourBadges graph selectedNodeIds = SigmaxT.neighbours graph selectedNodes' where
where
selectedNodes' = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
selectedNodes = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
type DeleteNodes =
type DeleteNodes =
( graphId :: NodeID
( graphId :: NodeID
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, nodes :: Array (Record SigmaxT.Node)
, nodes :: Array (Record SigmaxT.Node)
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, termList :: TermList
, termList :: TermList
)
)
...
@@ -339,7 +333,7 @@ deleteNodes { graphId, metaData, nodes, session, termList, reloadForest } = do
...
@@ -339,7 +333,7 @@ deleteNodes { graphId, metaData, nodes, session, termList, reloadForest } = do
case mPatch of
case mPatch of
Nothing -> pure unit
Nothing -> pure unit
Just (NTC.Versioned patch) -> do
Just (NTC.Versioned patch) -> do
liftEffect $ GUR.bump
Cursor
reloadForest
liftEffect $ GUR.bump
Box
reloadForest
-- Why is this called delete node?
-- Why is this called delete node?
deleteNode :: TermList
deleteNode :: TermList
...
...
src/Gargantext/Components/GraphExplorer/SlideButton.purs
View file @
5fe07605
...
@@ -7,7 +7,6 @@ module Gargantext.Components.GraphExplorer.SlideButton
...
@@ -7,7 +7,6 @@ module Gargantext.Components.GraphExplorer.SlideButton
import Global (readFloat)
import Global (readFloat)
import Prelude
import Prelude
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -16,40 +15,35 @@ import Toestand as T
...
@@ -16,40 +15,35 @@ import Toestand as T
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.SlideButton"
here = R2.here "Gargantext.Components.GraphExplorer.SlideButton"
type Props =
(
type Props =
caption :: String
(
caption :: String
, min :: Number
, min :: Number
, max :: Number
, max :: Number
, onChange :: forall e. e -> Effect Unit
, onChange :: forall e. e -> Effect Unit
, state :: T.
Cursor
Number
, state :: T.
Box
Number
)
)
sizeButton :: Record Props -> R.Element
sizeButton :: Record Props -> R.Element
sizeButton props = R.createElement sizeButtonCpt props []
sizeButton props = R.createElement sizeButtonCpt props []
sizeButtonCpt :: R.Component Props
sizeButtonCpt :: R.Component Props
sizeButtonCpt = here.component "sizeButton" cpt
sizeButtonCpt = here.component "sizeButton" cpt where
where
cpt { state, caption, min, max, onChange } _ = do
cpt {state, caption, min, max, onChange} _ = do
defaultValue <- T.useLive T.unequal state
state' <- T.useLive T.unequal state
pure $ H.span { class: "range-simple" }
pure $
[ H.label {} [ R2.small {} [ H.text caption ] ]
H.span { class: "range-simple" }
, H.input { type: "range"
[ H.label {} [ R2.small {} [ H.text caption ] ]
, className: "form-control"
, H.input { type: "range"
, min: show min
, className: "form-control"
, max: show max
, min: show min
, defaultValue
, max: show max
, on: { input: onChange } }]
, defaultValue: state'
, on: {input: onChange}
}
]
labelSizeButton :: R.Ref Sigmax.Sigma -> T.
Cursor
Number -> R.Element
labelSizeButton :: R.Ref Sigmax.Sigma -> T.
Box
Number -> R.Element
labelSizeButton sigmaRef state =
labelSizeButton sigmaRef state =
sizeButton {
sizeButton {
state
state
...
@@ -66,10 +60,10 @@ labelSizeButton sigmaRef state =
...
@@ -66,10 +60,10 @@ labelSizeButton sigmaRef state =
, maxNodeSize: newValue / 2.5
, maxNodeSize: newValue / 2.5
--, labelSizeRatio: newValue / 2.5
--, labelSizeRatio: newValue / 2.5
}
}
T
2
.write_ newValue state
T.write_ newValue state
}
}
mouseSelectorSizeButton :: R.Ref Sigmax.Sigma -> T.
Cursor
Number -> R.Element
mouseSelectorSizeButton :: R.Ref Sigmax.Sigma -> T.
Box
Number -> R.Element
mouseSelectorSizeButton sigmaRef state =
mouseSelectorSizeButton sigmaRef state =
sizeButton {
sizeButton {
state
state
...
@@ -83,5 +77,5 @@ mouseSelectorSizeButton sigmaRef state =
...
@@ -83,5 +77,5 @@ mouseSelectorSizeButton sigmaRef state =
Sigma.setSettings s {
Sigma.setSettings s {
mouseSelectorSize: newValue
mouseSelectorSize: newValue
}
}
T
2
.write_ newValue state
T.write_ newValue state
}
}
src/Gargantext/Components/GraphExplorer/ToggleButton.purs
View file @
5fe07605
...
@@ -13,8 +13,6 @@ module Gargantext.Components.GraphExplorer.ToggleButton
...
@@ -13,8 +13,6 @@ module Gargantext.Components.GraphExplorer.ToggleButton
import Prelude
import Prelude
import Data.Tuple (snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -23,13 +21,12 @@ import Toestand as T
...
@@ -23,13 +21,12 @@ import Toestand as T
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.ToggleButton"
here = R2.here "Gargantext.Components.GraphExplorer.ToggleButton"
type Props = (
type Props = (
state :: T.
Cursor
Boolean
state :: T.
Box
Boolean
, onMessage :: String
, onMessage :: String
, offMessage :: String
, offMessage :: String
, style :: String
, style :: String
...
@@ -59,7 +56,7 @@ toggleButtonCpt = here.component "toggleButton" cpt
...
@@ -59,7 +56,7 @@ toggleButtonCpt = here.component "toggleButton" cpt
text _on off false = off
text _on off false = off
type ControlsToggleButtonProps = (
type ControlsToggleButtonProps = (
state :: T.
Cursor
Boolean
state :: T.
Box
Boolean
)
)
controlsToggleButton :: R2.Component ControlsToggleButtonProps
controlsToggleButton :: R2.Component ControlsToggleButtonProps
...
@@ -73,12 +70,12 @@ controlsToggleButtonCpt = here.component "controlsToggleButton" cpt
...
@@ -73,12 +70,12 @@ controlsToggleButtonCpt = here.component "controlsToggleButton" cpt
state: state
state: state
, onMessage: "Hide Controls"
, onMessage: "Hide Controls"
, offMessage: "Show Controls"
, offMessage: "Show Controls"
, onClick: \_ -> T
2
.modify_ not state
, onClick: \_ -> T.modify_ not state
, style: "light"
, style: "light"
} []
} []
type EdgesButtonProps = (
type EdgesButtonProps = (
state :: T.
Cursor
SigmaxTypes.ShowEdgesState
state :: T.
Box
SigmaxTypes.ShowEdgesState
)
)
edgesToggleButton :: R2.Component EdgesButtonProps
edgesToggleButton :: R2.Component EdgesButtonProps
...
@@ -100,10 +97,10 @@ edgesToggleButtonCpt = here.component "edgesToggleButton" cpt
...
@@ -100,10 +97,10 @@ edgesToggleButtonCpt = here.component "edgesToggleButton" cpt
cls _ = "active"
cls _ = "active"
-- TODO: Move this to Graph.purs to the R.useEffect handler which renders nodes/edges
-- TODO: Move this to Graph.purs to the R.useEffect handler which renders nodes/edges
onClick state _ = T
2
.modify_ SigmaxTypes.toggleShowEdgesState state
onClick state _ = T.modify_ SigmaxTypes.toggleShowEdgesState state
type LouvainToggleButtonProps = (
type LouvainToggleButtonProps = (
state :: T.
Cursor
Boolean
state :: T.
Box
Boolean
)
)
louvainToggleButton :: R2.Component LouvainToggleButtonProps
louvainToggleButton :: R2.Component LouvainToggleButtonProps
...
@@ -117,12 +114,12 @@ louvainToggleButtonCpt = here.component "louvainToggleButton" cpt
...
@@ -117,12 +114,12 @@ louvainToggleButtonCpt = here.component "louvainToggleButton" cpt
state: state
state: state
, onMessage: "Louvain off"
, onMessage: "Louvain off"
, offMessage: "Louvain on"
, offMessage: "Louvain on"
, onClick: \_ -> T
2
.modify_ not state
, onClick: \_ -> T.modify_ not state
, style: "primary"
, style: "primary"
} []
} []
type MultiSelectEnabledButtonProps = (
type MultiSelectEnabledButtonProps = (
state :: T.
Cursor
Boolean
state :: T.
Box
Boolean
)
)
multiSelectEnabledButton :: R2.Component MultiSelectEnabledButtonProps
multiSelectEnabledButton :: R2.Component MultiSelectEnabledButtonProps
...
@@ -136,12 +133,12 @@ multiSelectEnabledButtonCpt = here.component "lmultiSelectEnabledButton" cpt
...
@@ -136,12 +133,12 @@ multiSelectEnabledButtonCpt = here.component "lmultiSelectEnabledButton" cpt
state: state
state: state
, onMessage: "Single-node"
, onMessage: "Single-node"
, offMessage: "Multi-node"
, offMessage: "Multi-node"
, onClick: \_ -> T
2
.modify_ not state
, onClick: \_ -> T.modify_ not state
, style : "primary"
, style : "primary"
} []
} []
type ForceAtlasProps = (
type ForceAtlasProps = (
state :: T.
Cursor
SigmaxTypes.ForceAtlasState
state :: T.
Box
SigmaxTypes.ForceAtlasState
)
)
pauseForceAtlasButton :: R2.Component ForceAtlasProps
pauseForceAtlasButton :: R2.Component ForceAtlasProps
...
@@ -166,10 +163,10 @@ pauseForceAtlasButtonCpt = here.component "forceAtlasToggleButton" cpt
...
@@ -166,10 +163,10 @@ pauseForceAtlasButtonCpt = here.component "forceAtlasToggleButton" cpt
text SigmaxTypes.Running = "Pause Force Atlas"
text SigmaxTypes.Running = "Pause Force Atlas"
text SigmaxTypes.Paused = "Start Force Atlas"
text SigmaxTypes.Paused = "Start Force Atlas"
onClick state _ = T
2
.modify_ SigmaxTypes.toggleForceAtlasState state
onClick state _ = T.modify_ SigmaxTypes.toggleForceAtlasState state
type TreeToggleButtonProps = (
type TreeToggleButtonProps = (
state :: T.
Cursor
Boolean
state :: T.
Box
Boolean
)
)
treeToggleButton :: R2.Component TreeToggleButtonProps
treeToggleButton :: R2.Component TreeToggleButtonProps
...
@@ -183,12 +180,12 @@ treeToggleButtonCpt = here.component "treeToggleButton" cpt
...
@@ -183,12 +180,12 @@ treeToggleButtonCpt = here.component "treeToggleButton" cpt
state: state
state: state
, onMessage: "Hide Tree"
, onMessage: "Hide Tree"
, offMessage: "Show Tree"
, offMessage: "Show Tree"
, onClick: \_ -> T
2
.modify_ not state
, onClick: \_ -> T.modify_ not state
, style: "light"
, style: "light"
} []
} []
type SidebarToggleButtonProps = (
type SidebarToggleButtonProps = (
state :: T.
Cursor
GET.SidePanelState
state :: T.
Box
GET.SidePanelState
)
)
sidebarToggleButton :: R2.Component SidebarToggleButtonProps
sidebarToggleButton :: R2.Component SidebarToggleButtonProps
...
@@ -214,7 +211,7 @@ sidebarToggleButtonCpt = here.component "sidebarToggleButton" cpt
...
@@ -214,7 +211,7 @@ sidebarToggleButtonCpt = here.component "sidebarToggleButton" cpt
text _on off GET.Closed = off
text _on off GET.Closed = off
onClick state = \_ ->
onClick state = \_ ->
T
2
.modify_ (\s -> case s of
T.modify_ (\s -> case s of
GET.InitialClosed -> GET.Opened GET.SideTabLegend
GET.InitialClosed -> GET.Opened GET.SideTabLegend
GET.Closed -> GET.Opened GET.SideTabLegend
GET.Closed -> GET.Opened GET.SideTabLegend
(GET.Opened _) -> GET.Closed) state
(GET.Opened _) -> GET.Closed) state
src/Gargantext/Components/Login.purs
View file @
5fe07605
...
@@ -21,7 +21,6 @@ import Gargantext.Hooks.Loader as GHL
...
@@ -21,7 +21,6 @@ import Gargantext.Hooks.Loader as GHL
import Gargantext.Sessions (Session, Sessions, Action(Logout), unSessions)
import Gargantext.Sessions (Session, Sessions, Action(Logout), unSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Login"
here = R2.here "Gargantext.Components.Login"
...
@@ -31,11 +30,11 @@ here = R2.here "Gargantext.Components.Login"
...
@@ -31,11 +30,11 @@ here = R2.here "Gargantext.Components.Login"
-- and ask for login (modal) or account creation after 15 mn when user
-- and ask for login (modal) or account creation after 15 mn when user
-- if not logged user can not save his work
-- if not logged user can not save his work
type Props =
(
type Props =
backend :: T.Cursor
(Maybe Backend)
( backend :: T.Box
(Maybe Backend)
, backends :: Array Backend
, backends :: Array Backend
, sessions :: T.
Cursor
Sessions
, sessions :: T.
Box
Sessions
, visible :: T.
Cursor
Boolean
, visible :: T.
Box
Boolean
)
)
login :: R2.Leaf Props
login :: R2.Leaf Props
...
@@ -110,7 +109,7 @@ renderBackend cursor backend@(Backend {name}) =
...
@@ -110,7 +109,7 @@ renderBackend cursor backend@(Backend {name}) =
, H.td {} [ H.a { on: { click }} [ H.text (backendLabel name) ]]
, H.td {} [ H.a { on: { click }} [ H.text (backendLabel name) ]]
, H.td {} [ H.text $ "garg://" <> name ]] where
, H.td {} [ H.text $ "garg://" <> name ]] where
className = "fa fa-hand-o-right" -- "glyphitem fa fa-log-in"
className = "fa fa-hand-o-right" -- "glyphitem fa fa-log-in"
click _ = T
2
.write_ (Just backend) cursor
click _ = T.write_ (Just backend) cursor
backendLabel :: String -> String
backendLabel :: String -> String
backendLabel =
backendLabel =
...
...
src/Gargantext/Components/Login/Form.purs
View file @
5fe07605
...
@@ -11,6 +11,7 @@ import Reactix as R
...
@@ -11,6 +11,7 @@ import Reactix as R
import Reactix.SyntheticEvent as E
import Reactix.SyntheticEvent as E
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Toestand as T
import Toestand.Records (useFocusedFields)
import Gargantext.Components.Login.Types (AuthRequest(..))
import Gargantext.Components.Login.Types (AuthRequest(..))
import Gargantext.Components.Forms (clearfix, formGroup)
import Gargantext.Components.Forms (clearfix, formGroup)
...
@@ -33,14 +34,14 @@ type Form =
...
@@ -33,14 +34,14 @@ type Form =
emptyForm :: Form
emptyForm :: Form
emptyForm = { error: "", username: "", password: "", agreed: false }
emptyForm = { error: "", username: "", password: "", agreed: false }
type
Cursor
s =
type
Boxe
s =
{ error :: T.
Cursor
String
{ error :: T.
Box
String
, username :: T.
Cursor
String
, username :: T.
Box
String
, password :: T.
Cursor
String
, password :: T.
Box
String
, agreed :: T.
Cursor
Boolean }
, agreed :: T.
Box
Boolean }
form
Cursors :: T.Cell Form -> R.Hooks Cursor
s
form
Boxes :: T.Box Form -> R.Hooks Boxe
s
form
Cursors cell = T.useFieldCursors cell
{}
form
Boxes box = useFocusedFields box
{}
type Props s v =
type Props s v =
( backend :: Backend
( backend :: Backend
...
@@ -56,8 +57,8 @@ formCpt :: forall s v. T.ReadWrite s Sessions => T.ReadWrite v Boolean
...
@@ -56,8 +57,8 @@ formCpt :: forall s v. T.ReadWrite s Sessions => T.ReadWrite v Boolean
=> R.Component (Props s v)
=> R.Component (Props s v)
formCpt = here.component "form" cpt where
formCpt = here.component "form" cpt where
cpt props@{ backend, sessions, visible } _ = do
cpt props@{ backend, sessions, visible } _ = do
cell <- T.use
Cell
emptyForm
cell <- T.use
Box
emptyForm
cursors <-
T.useFieldCursor
s cell {}
cursors <-
useFocusedField
s cell {}
pure $ R2.row
pure $ R2.row
[ H.form { className: "col-md-12" }
[ H.form { className: "col-md-12" }
[ formLoginLink backend
[ formLoginLink backend
...
@@ -81,7 +82,7 @@ formLoginLink backend =
...
@@ -81,7 +82,7 @@ formLoginLink backend =
H.h4 { className: "text-center" } {-className: "text-muted"-}
H.h4 { className: "text-center" } {-className: "text-muted"-}
[ H.text $ "Login to garg://" <> show backend ]
[ H.text $ "Login to garg://" <> show backend ]
type SubmitButtonProps s v = ( cell :: T.
Cell
Form | Props s v )
type SubmitButtonProps s v = ( cell :: T.
Box
Form | Props s v )
submitButton
submitButton
:: forall s v. T.ReadWrite s Sessions => T.Write v Boolean
:: forall s v. T.ReadWrite s Sessions => T.Write v Boolean
...
@@ -102,7 +103,7 @@ submitButtonCpt = here.component "submitButton" cpt where
...
@@ -102,7 +103,7 @@ submitButtonCpt = here.component "submitButton" cpt where
-- Attempts to submit the form
-- Attempts to submit the form
submitForm :: forall s v. T.ReadWrite s Sessions => T.Write v Boolean
submitForm :: forall s v. T.ReadWrite s Sessions => T.Write v Boolean
=> Record (Props s v) -> T.
Cell
Form -> ChangeEvent -> Effect Unit
=> Record (Props s v) -> T.
Box
Form -> ChangeEvent -> Effect Unit
submitForm { backend, sessions, visible } cell e = do
submitForm { backend, sessions, visible } cell e = do
E.preventDefault e
E.preventDefault e
state <- T.read cell
state <- T.read cell
...
...
src/Gargantext/Components/Login/Modal.purs
View file @
5fe07605
module Gargantext.Components.Login.Modal (Props, modal) where
module Gargantext.Components.Login.Modal (Props, modal) where
import Prelude (bind, (<*), (
>>=), (
<$>))
import Prelude (bind, (<*), (<$>))
import Data.Semigroup ((<>))
import Data.Semigroup ((<>))
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
5fe07605
...
@@ -25,7 +25,7 @@ import Data.Tuple (Tuple(..), fst)
...
@@ -25,7 +25,7 @@ import Data.Tuple (Tuple(..), fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix (Component, Element,
Ref, State, createElement, fragment, hooksComponentWithModule
, unsafeEventValue, useState') as R
import Reactix (Component, Element,
State, createElement, fragment
, unsafeEventValue, useState') as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Toestand as T
...
@@ -48,7 +48,6 @@ import Gargantext.Types (CTabNgramType, OrderBy(..), SearchQuery, TabType, TermL
...
@@ -48,7 +48,6 @@ import Gargantext.Types (CTabNgramType, OrderBy(..), SearchQuery, TabType, TermL
import Gargantext.Utils (queryMatchesLabel, toggleSet, sortWith)
import Gargantext.Utils (queryMatchesLabel, toggleSet, sortWith)
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Seq as Seq
import Gargantext.Utils.Seq as Seq
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
...
@@ -258,11 +257,11 @@ tableContainerCpt { dispatch
...
@@ -258,11 +257,11 @@ tableContainerCpt { dispatch
type CommonProps = (
type CommonProps = (
afterSync :: Unit -> Aff Unit
afterSync :: Unit -> Aff Unit
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, sidePanelTriggers :: Record NT.SidePanelTriggers
, sidePanelTriggers :: Record NT.SidePanelTriggers
, tabNgramType :: CTabNgramType
, tabNgramType :: CTabNgramType
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
, withAutoUpdate :: Boolean
, withAutoUpdate :: Boolean
)
)
...
...
src/Gargantext/Components/NgramsTable/Components.purs
View file @
5fe07605
...
@@ -17,12 +17,19 @@ import Reactix as R
...
@@ -17,12 +17,19 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Prelude
( Unit, bind, const, discard, map, not, otherwise
, pure, show, unit, ($), (+), (/=), (<<<), (<>), (==), (>), (||) )
import Gargantext.Components.NgramsTable.Core
import Gargantext.Components.NgramsTable.Core
( Action(..), Dispatch, NgramsElement, NgramsTable, NgramsTablePatch, NgramsTerm
, _NgramsElement, _NgramsRepoElement, _PatchMap, _children, _list
, _ngrams, _occurrences, ngramsTermText, replace, setTermListA )
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as Tbl
import Gargantext.Components.Table as Tbl
import Gargantext.Types as T
import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.NgramsTable.Components"
here = R2.here "Gargantext.Components.NgramsTable.Components"
type SearchInputProps =
type SearchInputProps =
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
5fe07605
...
@@ -8,7 +8,7 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -8,7 +8,7 @@ module Gargantext.Components.NgramsTable.Core
, ngramsRepoElementToNgramsElement
, ngramsRepoElementToNgramsElement
, NgramsTable(..)
, NgramsTable(..)
, NewElems
, NewElems
, NgramsPatch
, NgramsPatch
(..)
, NgramsPatches
, NgramsPatches
, _NgramsTable
, _NgramsTable
, NgramsTerm
, NgramsTerm
...
@@ -26,7 +26,6 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -26,7 +26,6 @@ module Gargantext.Components.NgramsTable.Core
, VersionedNgramsTable
, VersionedNgramsTable
, VersionedWithCountNgramsTable
, VersionedWithCountNgramsTable
, NgramsTablePatch
, NgramsTablePatch
, NgramsPatch(..)
, CoreState
, CoreState
, highlightNgrams
, highlightNgrams
, initialPageParams
, initialPageParams
...
@@ -1178,9 +1177,9 @@ chartsAfterSync :: forall props discard.
...
@@ -1178,9 +1177,9 @@ chartsAfterSync :: forall props discard.
, tabType :: TabType
, tabType :: TabType
| props
| props
}
}
-> T.
Cursor
(Maybe GAT.Reductor)
-> T.
Box
(Maybe GAT.Reductor)
-> Int
-> Int
-> T.
Cursor
T2.Reload
-> T.
Box
T2.Reload
-> discard
-> discard
-> Aff Unit
-> Aff Unit
chartsAfterSync path' tasks nodeId reloadForest _ = do
chartsAfterSync path' tasks nodeId reloadForest _ = do
...
@@ -1192,7 +1191,7 @@ chartsAfterSync path' tasks nodeId reloadForest _ = do
...
@@ -1192,7 +1191,7 @@ chartsAfterSync path' tasks nodeId reloadForest _ = do
Nothing -> log "[chartsAfterSync] tasks is Nothing"
Nothing -> log "[chartsAfterSync] tasks is Nothing"
Just tasks' -> do
Just tasks' -> do
snd tasks' (GAT.Insert nodeId task) -- *> T2.reload reloadForest
snd tasks' (GAT.Insert nodeId task) -- *> T2.reload reloadForest
GUR.bump
Cursor
reloadForest
GUR.bump
Box
reloadForest
postNgramsChartsAsync :: forall s. CoreParams s -> Aff AsyncTaskWithType
postNgramsChartsAsync :: forall s. CoreParams s -> Aff AsyncTaskWithType
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
...
...
src/Gargantext/Components/NgramsTable/Loader.purs
View file @
5fe07605
...
@@ -4,7 +4,6 @@ import Data.Argonaut (class DecodeJson)
...
@@ -4,7 +4,6 @@ import Data.Argonaut (class DecodeJson)
import Data.Maybe (Maybe(..), maybe, isJust)
import Data.Maybe (Maybe(..), maybe, isJust)
import Data.Tuple (fst)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log, log2)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
...
@@ -13,7 +12,7 @@ import Reactix as R
...
@@ -13,7 +12,7 @@ import Reactix as R
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Components.NgramsTable.Core (Version
(..)
, Versioned(..))
import Gargantext.Components.NgramsTable.Core (Version, Versioned(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
...
@@ -85,9 +84,9 @@ useCachedAPILoaderEffect { cacheEndpoint
...
@@ -85,9 +84,9 @@ useCachedAPILoaderEffect { cacheEndpoint
-- log2 "[useCachedAPILoaderEffect] cached version" version
-- log2 "[useCachedAPILoaderEffect] cached version" version
-- log2 "[useCachedAPILoaderEffect] real version" cacheReal
-- log2 "[useCachedAPILoaderEffect] real version" cacheReal
_ <- GUC.deleteReq cache req
_ <- GUC.deleteReq cache req
vr
@(Versioned { version, "data": d
}) <- GUC.cachedJson cache req
vr
'@(Versioned { version: _, data: _
}) <- GUC.cachedJson cache req
if version == cacheReal then
if version == cacheReal then
pure vr
pure vr
'
else
else
throwError $ error $ "Fetched clean cache but hashes don't match"
throwError $ error $ "Fetched clean cache but hashes don't match"
liftEffect $ do
liftEffect $ do
...
...
src/Gargantext/Components/Nodes/Annuaire.purs
View file @
5fe07605
...
@@ -212,7 +212,7 @@ contactCellsCpt = here.component "contactCells" cpt where
...
@@ -212,7 +212,7 @@ contactCellsCpt = here.component "contactCells" cpt where
--nodepath = NodePath (sessionId session) NodeContact (Just id)
--nodepath = NodePath (sessionId session) NodeContact (Just id)
nodepath = Routes.ContactPage (sessionId session) annuaireId id
nodepath = Routes.ContactPage (sessionId session) annuaireId id
href = url frontends nodepath
href = url frontends nodepath
contactUrl aId id
= url frontends $ Routes.ContactPage (sessionId session) aId id
contactUrl aId id
' = url frontends $ Routes.ContactPage (sessionId session) aId id'
contactWhereOrg (CT.ContactWhere { organization: [] }) = "No Organization"
contactWhereOrg (CT.ContactWhere { organization: [] }) = "No Organization"
contactWhereOrg (CT.ContactWhere { organization: orga }) =
contactWhereOrg (CT.ContactWhere { organization: orga }) =
fromMaybe "No orga (list)" (A.head orga)
fromMaybe "No orga (list)" (A.head orga)
...
...
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
5fe07605
...
@@ -55,11 +55,11 @@ type TabsProps =
...
@@ -55,11 +55,11 @@ type TabsProps =
, contactData :: ContactData
, contactData :: ContactData
, frontends :: Frontends
, frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
tabs :: R2.Leaf TabsProps
tabs :: R2.Leaf TabsProps
...
@@ -130,9 +130,9 @@ type NTCommon =
...
@@ -130,9 +130,9 @@ type NTCommon =
( cacheState :: R.State LTypes.CacheState
( cacheState :: R.State LTypes.CacheState
, defaultListId :: Int
, defaultListId :: Int
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
5fe07605
...
@@ -4,10 +4,9 @@ module Gargantext.Components.Nodes.Annuaire.User
...
@@ -4,10 +4,9 @@ module Gargantext.Components.Nodes.Annuaire.User
)
)
where
where
import
DOM.Simple.Console (log2
)
import
Gargantext.Prelude (Unit, bind, const, discard, pure, show, ($), (<$>), (<<<), (<>)
)
import Data.Lens as L
import Data.Lens as L
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
...
@@ -23,7 +22,6 @@ import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
...
@@ -23,7 +22,6 @@ import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==))
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
...
@@ -34,9 +32,7 @@ import Gargantext.Utils.Toestand as T2
...
@@ -34,9 +32,7 @@ import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Annuaire.User"
here = R2.here "Gargantext.Components.Nodes.Annuaire.User"
type DisplayProps = (
type DisplayProps = ( title :: String )
title :: String
)
display :: R2.Component DisplayProps
display :: R2.Component DisplayProps
display = R.createElement displayCpt
display = R.createElement displayCpt
...
@@ -115,7 +111,7 @@ contactInfoItemCpt = here.component "contactInfoItem" cpt
...
@@ -115,7 +111,7 @@ contactInfoItemCpt = here.component "contactInfoItem" cpt
item (false /\ setIsEditing) valueRef =
item (false /\ setIsEditing) valueRef =
H.div { className: "input-group col-sm-6" } [
H.div { className: "input-group col-sm-6" } [
H.input { className: "form-control"
H.input { className: "form-control"
, defaultValue: placeholder
, defaultValue: placeholder
'
, disabled: 1
, disabled: 1
, type: "text" }
, type: "text" }
, H.div { className: "btn input-group-append"
, H.div { className: "btn input-group-append"
...
@@ -124,7 +120,7 @@ contactInfoItemCpt = here.component "contactInfoItem" cpt
...
@@ -124,7 +120,7 @@ contactInfoItemCpt = here.component "contactInfoItem" cpt
]
]
]
]
where
where
placeholder = R.readRef valueRef
placeholder
'
= R.readRef valueRef
onClick _ = setIsEditing $ const true
onClick _ = setIsEditing $ const true
item (true /\ setIsEditing) valueRef =
item (true /\ setIsEditing) valueRef =
H.div { className: "input-group col-sm-6" } [
H.div { className: "input-group col-sm-6" } [
...
@@ -154,10 +150,10 @@ listElement = H.li { className: "list-group-item justify-content-between" }
...
@@ -154,10 +150,10 @@ listElement = H.li { className: "list-group-item justify-content-between" }
type LayoutProps =
type LayoutProps =
( frontends :: Frontends
( frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
type KeyLayoutProps = (
type KeyLayoutProps = (
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
5fe07605
...
@@ -4,7 +4,7 @@ module Gargantext.Components.Nodes.Annuaire.User.Contact
...
@@ -4,7 +4,7 @@ module Gargantext.Components.Nodes.Annuaire.User.Contact
) where
) where
import Gargantext.Prelude
import Gargantext.Prelude
( Unit, bind, const, discard, pure, show,
void,
($), (<$>), (*>), (<<<), (<>) )
( Unit, bind, const, discard, pure, show, ($), (<$>), (*>), (<<<), (<>) )
import Data.Lens as L
import Data.Lens as L
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
...
@@ -18,7 +18,13 @@ import Toestand as T
...
@@ -18,7 +18,13 @@ import Toestand as T
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact'(..), ContactData', ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types
( Contact'(..), ContactData', ContactTouch(..), ContactWhere(..)
, ContactWho(..), HyperdataContact(..), HyperdataUser(..)
, _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName
, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role
, _shared, _touch, _who, defaultContactTouch, defaultContactWhere
, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser )
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -26,7 +32,6 @@ import Gargantext.Routes as Routes
...
@@ -26,7 +32,6 @@ import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
...
@@ -131,12 +136,12 @@ listElement = H.li { className: "list-group-item justify-content-between" }
...
@@ -131,12 +136,12 @@ listElement = H.li { className: "list-group-item justify-content-between" }
type BasicProps =
type BasicProps =
( frontends :: Frontends
( frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
type ReloadProps =
type ReloadProps =
( reloadForest :: T.
Cursor
T2.Reload
( reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
| BasicProps
| BasicProps
)
)
...
@@ -176,7 +181,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
...
@@ -176,7 +181,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
, nodeId
, nodeId
, session
, session
, tasks } _ = do
, tasks } _ = do
reload <- T.use
Cell
T2.newReload
reload <- T.use
Box
T2.newReload
_ <- T.useLive T.unequal reload
_ <- T.useLive T.unequal reload
cacheState <- R.useState' LT.CacheOn
cacheState <- R.useState' LT.CacheOn
sidePanelTriggers <- LT.emptySidePanelTriggers
sidePanelTriggers <- LT.emptySidePanelTriggers
...
@@ -189,7 +194,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
...
@@ -189,7 +194,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
{ cacheState, contactData, frontends, nodeId, session
{ cacheState, contactData, frontends, nodeId, session
, sidePanelTriggers, reloadForest, reloadRoot, tasks } ]
, sidePanelTriggers, reloadForest, reloadRoot, tasks } ]
where
where
onUpdateHyperdata :: T.
Cell
T2.Reload -> HyperdataContact -> Effect Unit
onUpdateHyperdata :: T.
Box
T2.Reload -> HyperdataContact -> Effect Unit
onUpdateHyperdata reload hd =
onUpdateHyperdata reload hd =
launchAff_ $
launchAff_ $
saveContactHyperdata session nodeId hd *> liftEffect (T2.reload reload)
saveContactHyperdata session nodeId hd *> liftEffect (T2.reload reload)
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
5fe07605
...
@@ -53,11 +53,11 @@ type TabsProps = (
...
@@ -53,11 +53,11 @@ type TabsProps = (
, contactData :: ContactData'
, contactData :: ContactData'
, frontends :: Frontends
, frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
tabs :: Record TabsProps -> R.Element
tabs :: Record TabsProps -> R.Element
...
@@ -135,11 +135,11 @@ type NgramsViewTabsProps = (
...
@@ -135,11 +135,11 @@ type NgramsViewTabsProps = (
, defaultListId :: Int
, defaultListId :: Int
, mode :: Mode
, mode :: Mode
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
ngramsView :: R2.Component NgramsViewTabsProps
ngramsView :: R2.Component NgramsViewTabsProps
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Corpus where
module Gargantext.Components.Nodes.Corpus where
import Gargantext.Prelude
( Unit, bind, const, discard, pure, show, unit
, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>))
import Data.Argonaut (class DecodeJson, decodeJson, encodeJson)
import Data.Argonaut (class DecodeJson, decodeJson, encodeJson)
import Data.Argonaut.Parser (jsonParser)
import Data.Argonaut.Parser (jsonParser)
import Data.Array as A
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.List as List
import Data.List as List
import Data.Maybe (Maybe(..),
maybe,
fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple (Tuple(..), fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
...
@@ -15,13 +18,13 @@ import Effect.Class (liftEffect)
...
@@ -15,13 +18,13 @@ import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Nodes.Types
import Gargantext.Components.Nodes.Types
( FTField, FTFieldWithIndex, FTFieldsWithIndex, Field(..), FieldType(..), Hash, Index
, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython' )
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..))
import Gargantext.Data.Array as GDA
import Gargantext.Data.Array as GDA
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -31,7 +34,6 @@ import Gargantext.Types (NodeType(..), AffTableResult)
...
@@ -31,7 +34,6 @@ import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus"
here = R2.here "Gargantext.Components.Nodes.Corpus"
...
...
src/Gargantext/Components/Nodes/Corpus/Chart.purs
View file @
5fe07605
...
@@ -6,7 +6,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
...
@@ -6,7 +6,7 @@ import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Types (P
ath, P
rops)
import Gargantext.Components.Nodes.Corpus.Chart.Types (Props)
import Gargantext.Types (ChartType(..))
import Gargantext.Types (ChartType(..))
getChartFunction :: ChartType -> (Record Props -> R.Element)
getChartFunction :: ChartType -> (Record Props -> R.Element)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/API.purs
View file @
5fe07605
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.API where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.API where
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types as T
import Gargantext.Types as T
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Corpus.Chart.Common where
module Gargantext.Components.Nodes.Corpus.Chart.Common where
import Data.Argonaut (class DecodeJson
, class EncodeJson
)
import Data.Argonaut (class DecodeJson)
import Data.Tuple (fst
, Tuple(..)
)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Components.Nodes.Corpus.Chart.Types (
Path, Props,
MetricsProps, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, ReloadPath)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Utils.Crypto (Hash)
import Gargantext.Utils.Crypto (Hash)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Corpus.Chart.Metrics where
module Gargantext.Components.Nodes.Corpus.Chart.Metrics where
import Gargantext.Prelude (bind, negate, pure, ($), (<$>), (<>))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Map as Map
import Data.Map as Map
...
@@ -7,28 +9,27 @@ import Data.Map (Map)
...
@@ -7,28 +9,27 @@ import Data.Map (Map)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff
, launchAff_
)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, yAxis')
import Gargantext.Components.Charts.Options.Type (xAxis)
import Gargantext.Components.Charts.Options.Type (xAxis)
import Gargantext.Components.Charts.Options.Series (Series, seriesScatterD2)
import Gargantext.Components.Charts.Options.Series (Series, seriesScatterD2)
import Gargantext.Components.Charts.Options.Color (green, grey, red)
import Gargantext.Components.Charts.Options.Color (green, grey, red)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metrics
LoadView, metrics
WithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
(MetricsProps, Path, Props, ReloadPath)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (
ChartType(..), TabType,
TermList(..))
import Gargantext.Types (TermList(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Metrics"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Metrics"
newtype Metric = Metric
newtype Metric = Metric
...
@@ -134,9 +135,9 @@ metricsCpt = here.component "etrics" cpt
...
@@ -134,9 +135,9 @@ metricsCpt = here.component "etrics" cpt
loaded :: Record MetricsProps -> Loaded -> R.Element
loaded :: Record MetricsProps -> Loaded -> R.Element
loaded { path, reload, session } loaded =
loaded { path, reload, session } loaded
'
=
H.div {} [
H.div {} [
{- U.reloadButton reload
{- U.reloadButton reload
, U.chartUpdateButton { chartType: Scatter, path, reload, session }
, U.chartUpdateButton { chartType: Scatter, path, reload, session }
, -} chart $ scatterOptions loaded
, -} chart $ scatterOptions loaded
'
]
]
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Corpus.Chart.Pie where
module Gargantext.Components.Nodes.Corpus.Chart.Pie where
import Gargantext.Prelude (bind, map, pure, ($), (==), (>))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Array (zip, filter)
import Data.Array (zip, filter)
...
@@ -17,14 +18,13 @@ import Gargantext.Components.Charts.Options.Data (dataSerie)
...
@@ -17,14 +18,13 @@ import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Series (seriesBarD1, seriesPieD1)
import Gargantext.Components.Charts.Options.Series (seriesBarD1, seriesPieD1)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metrics
LoadView, metrics
WithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
(MetricsProps, Path, Props, ReloadPath)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (ChartType(..)
, TabType
)
import Gargantext.Types (ChartType(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Corpus.Chart.Tree where
module Gargantext.Components.Nodes.Corpus.Chart.Tree where
import Prelude (bind, pure, ($), (==))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.Series (TreeNode, Trees(..), mkTree)
import Gargantext.Components.Charts.Options.Series (TreeNode, Trees(..), mkTree)
import Gargantext.Components.Charts.Options.Font (mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (mkTooltip, templateFormatter)
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView, metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (ChartType(..)
, TabType
)
import Gargantext.Types (ChartType(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Tree"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Tree"
newtype Metrics = Metrics {
newtype Metrics = Metrics {
...
@@ -92,9 +90,9 @@ treeCpt = here.component "tree" cpt
...
@@ -92,9 +90,9 @@ treeCpt = here.component "tree" cpt
}
}
loaded :: Record MetricsProps -> Loaded -> R.Element
loaded :: Record MetricsProps -> Loaded -> R.Element
loaded { path, reload, session } loaded =
loaded { path, reload, session } loaded
'
=
H.div {} [
H.div {} [
{- U.reloadButton reload
{- U.reloadButton reload
, U.chartUpdateButton { chartType: ChartTree, path, reload, session }
, U.chartUpdateButton { chartType: ChartTree, path, reload, session }
, -} chart (scatterOptions loaded)
, -} chart (scatterOptions loaded
'
)
]
]
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
View file @
5fe07605
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.Types where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.Types where
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Data.Tuple (Tuple)
import Reactix as R
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (TabType)
import Gargantext.Types (TabType)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Corpus.Chart.Utils where
module Gargantext.Components.Nodes.Corpus.Chart.Utils where
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -17,6 +15,7 @@ import Gargantext.Types as T
...
@@ -17,6 +15,7 @@ import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Reload as GUR
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Utils"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Utils"
reloadButtonWrap :: GUR.ReloadS -> R.Element -> R.Element
reloadButtonWrap :: GUR.ReloadS -> R.Element -> R.Element
...
@@ -26,24 +25,19 @@ reloadButtonWrap setReload el = H.div {} [
...
@@ -26,24 +25,19 @@ reloadButtonWrap setReload el = H.div {} [
]
]
reloadButton :: GUR.ReloadS -> R.Element
reloadButton :: GUR.ReloadS -> R.Element
reloadButton reloadS = H.a { className
reloadButton reloadS = H.a { className, on: { click }, title: "Reload" } [] where
, on: { click: onClick }
className = "reload-btn fa fa-refresh"
, title: "Reload" } []
click _ = GUR.bump reloadS
where
className = "reload-btn fa fa-refresh"
onClick _ = GUR.bump reloadS
mNgramsTypeFromTabType :: T.TabType -> Maybe T.CTabNgramType
mNgramsTypeFromTabType :: T.TabType -> Maybe T.CTabNgramType
mNgramsTypeFromTabType (T.TabCorpus (T.TabNgramType ngramType)) = Just ngramType
mNgramsTypeFromTabType (T.TabCorpus (T.TabNgramType ngramType)) = Just ngramType
mNgramsTypeFromTabType (T.TabCorpus _) = Nothing
mNgramsTypeFromTabType (T.TabDocument (T.TabNgramType ngramType)) = Just ngramType
mNgramsTypeFromTabType (T.TabDocument (T.TabNgramType ngramType)) = Just ngramType
mNgramsTypeFromTabType (T.TabDocument _) = Nothing
mNgramsTypeFromTabType _ = Nothing
mNgramsTypeFromTabType (T.TabPairing _) = Nothing
type ChartUpdateButtonProps =
(
type ChartUpdateButtonProps =
chartType :: T.ChartType
(
chartType :: T.ChartType
, path :: Record Path
, path :: Record Path
, reload :: GUR.ReloadS
, reload :: GUR.ReloadS
, session :: Session
, session :: Session
...
@@ -53,22 +47,17 @@ chartUpdateButton :: Record ChartUpdateButtonProps -> R.Element
...
@@ -53,22 +47,17 @@ chartUpdateButton :: Record ChartUpdateButtonProps -> R.Element
chartUpdateButton p = R.createElement chartUpdateButtonCpt p []
chartUpdateButton p = R.createElement chartUpdateButtonCpt p []
chartUpdateButtonCpt :: R.Component ChartUpdateButtonProps
chartUpdateButtonCpt :: R.Component ChartUpdateButtonProps
chartUpdateButtonCpt = here.component "chartUpdateButton" cpt
chartUpdateButtonCpt = here.component "chartUpdateButton" cpt where
where
cpt { path: { corpusId, listId, tabType }
cpt { chartType
, reload, chartType, session } _ = do
, path: { corpusId, listId, tabType }
pure $ H.a { className, on: { click }, title: "Update chart data" } []
, reload
where
, session } _ = do
className = "chart-update-button fa fa-database"
click :: forall a. a -> Effect Unit
pure $ H.a { className: "chart-update-button fa fa-database"
click _ = do
, on: { click: onClick }
launchAff_ $ do
, title: "Update chart data" } []
case mNgramsTypeFromTabType tabType of
where
Just ngramsType -> do
onClick :: forall a. a -> Effect Unit
_ <- recomputeChart session chartType ngramsType corpusId listId
onClick _ = do
liftEffect $ GUR.bump reload
launchAff_ $ do
Nothing -> pure unit
case mNgramsTypeFromTabType tabType of
Just ngramsType -> do
_ <- recomputeChart session chartType ngramsType corpusId listId
liftEffect $ GUR.bump reload
Nothing -> pure unit
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
View file @
5fe07605
...
@@ -13,6 +13,7 @@ import Gargantext.Ends (Frontends)
...
@@ -13,6 +13,7 @@ import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Graph.Tabs"
here = R2.here "Gargantext.Components.Nodes.Corpus.Graph.Tabs"
type Props =
type Props =
...
...
src/Gargantext/Components/Nodes/Dashboard/Types.purs
View file @
5fe07605
...
@@ -6,7 +6,7 @@ import Data.Maybe (Maybe(..))
...
@@ -6,7 +6,7 @@ import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Types (FTField
, Field(..), FieldType(..), isJSON
)
import Gargantext.Components.Nodes.Types (FTField)
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, put)
import Gargantext.Sessions (Session, get, put)
...
...
src/Gargantext/Components/Nodes/File.purs
View file @
5fe07605
module Gargantext.Components.Nodes.File where
module Gargantext.Components.Nodes.File where
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..)
, maybe
)
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Ends (toUrl)
import Gargantext.Ends (toUrl)
...
...
src/Gargantext/Components/Nodes/Frame.purs
View file @
5fe07605
...
@@ -5,12 +5,9 @@ import Data.Argonaut (decodeJson, (.:))
...
@@ -5,12 +5,9 @@ import Data.Argonaut (decodeJson, (.:))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
--import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
--import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..))
import Data.Tuple (fst)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -21,7 +18,6 @@ import Gargantext.Types (NodeType(..))
...
@@ -21,7 +18,6 @@ import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Frame"
here = R2.here "Gargantext.Components.Nodes.Frame"
...
...
src/Gargantext/Components/Nodes/Home/Public.purs
View file @
5fe07605
...
@@ -9,13 +9,11 @@ import Data.Tuple (fst)
...
@@ -9,13 +9,11 @@ import Data.Tuple (fst)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Config (publicBackend)
import Gargantext.Config (publicBackend)
import Gargantext.Config.REST (get)
import Gargantext.Config.REST (get)
import Gargantext.Ends (
Backend,
backendUrl)
import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Sessions)
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Lists where
module Gargantext.Components.Nodes.Lists where
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (<>))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
...
@@ -9,29 +10,31 @@ import Reactix as R
...
@@ -9,29 +10,31 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
import Toestand as T
import Toestand as T
------------------------------------------------------------------------
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest as Forest
import Gargantext.Components.Forest as Forest
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Corpus.Types
( getCorpusInfo, CorpusInfo(..), Hyperdata(..) )
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Nodes.Lists.Types
( CacheState(..), ListsLayoutControls, SidePanelState(..)
, initialControls, toggleSidePanelState )
import Gargantext.Components.Table as Table
import Gargantext.Components.Table as Table
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Sessions (Session, sessionId, getCacheState, setCacheState)
import Gargantext.Sessions (Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists"
here = R2.here "Gargantext.Components.Nodes.Lists"
------------------------------------------------------------------------
type ListsWithForest =
(
type ListsWithForest =
forestProps :: Record Forest.LayoutProps
(
forestProps :: Record Forest.LayoutProps
, listsProps :: Record CommonProps
, listsProps :: Record CommonProps
)
)
...
@@ -39,89 +42,61 @@ listsWithForest :: R2.Component ListsWithForest
...
@@ -39,89 +42,61 @@ listsWithForest :: R2.Component ListsWithForest
listsWithForest = R.createElement listsWithForestCpt
listsWithForest = R.createElement listsWithForestCpt
listsWithForestCpt :: R.Component ListsWithForest
listsWithForestCpt :: R.Component ListsWithForest
listsWithForestCpt = here.component "listsWithForest" cpt
listsWithForestCpt = here.component "listsWithForest" cpt where
where
cpt { forestProps, listsProps: listsProps@{ session } } _ = do
cpt { forestProps
controls <- initialControls
, listsProps: listsProps@{ session } } _ = do
pure $ Forest.forestLayoutWithTopBar forestProps
controls <- initialControls
[ topBar { controls } []
pure $ Forest.forestLayoutWithTopBar forestProps [
topBar { controls } []
, listsLayout (Record.merge listsProps { controls }) []
, listsLayout (Record.merge listsProps { controls }) []
, H.div { className: "side-panel" } [
, H.div { className: "side-panel" } [ sidePanel { controls, session } [] ]
sidePanel { controls, session } []
]
]
]
--------------------------------------------------------
type TopBarProps = (
type TopBarProps = ( controls :: Record ListsLayoutControls )
controls :: Record ListsLayoutControls
)
topBar :: R2.Component TopBarProps
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt :: R.Component TopBarProps
topBarCpt = here.component "topBar" cpt
topBarCpt = here.component "topBar" cpt where
where
cpt { controls } _ = do
cpt { controls } _ = do
-- empty for now because the button is moved to the side panel
-- empty for now because the button is moved to the side panel
pure $ H.div {} []
pure $ H.div {} []
-- H.ul { className: "nav navbar-nav" } [
-- H.ul { className: "nav navbar-nav" } [
-- H.li {} [
-- H.li {} [
-- sidePanelToggleButton { state: controls.showSidePanel } []
-- sidePanelToggleButton { state: controls.showSidePanel } []
-- ]
-- ]
-- ] -- head (goes to top bar)
-- ] -- head (goes to top bar)
--------------------------------------------------------
type CommonProps =
( nodeId :: Int
type CommonProps = (
, reloadForest :: T.Box T2.Reload
nodeId :: Int
, reloadRoot :: T.Box T2.Reload
, reloadForest :: T.Cursor T2.Reload
, reloadRoot :: T.Cursor T2.Reload
, session :: Session
, session :: Session
, sessionUpdate :: Session -> Effect Unit
, sessionUpdate :: Session -> Effect Unit
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
type Props = (
type Props = ( controls :: Record ListsLayoutControls | CommonProps )
controls :: Record ListsLayoutControls
| CommonProps
)
type WithTreeProps = (
type WithTreeProps = ( handed :: GT.Handed | Props )
handed :: GT.Handed
| Props
)
listsLayout :: R2.Component Props
listsLayout :: R2.Component Props
listsLayout = R.createElement listsLayoutCpt
listsLayout = R.createElement listsLayoutCpt
listsLayoutCpt :: R.Component Props
listsLayoutCpt :: R.Component Props
listsLayoutCpt = here.component "listsLayout" cpt
listsLayoutCpt = here.component "listsLayout" cpt where
where
cpt path@{ nodeId, session } _ = do
cpt path@{ nodeId, session } _ = do
let sid = sessionId session
let sid = sessionId session
pure $ listsLayoutWithKey $ Record.merge path { key: show sid <> "-" <> show nodeId }
pure $ listsLayoutWithKey $ Record.merge path { key: show sid <> "-" <> show nodeId }
type KeyProps = (
type KeyProps = ( key :: String | Props )
key :: String
| Props
)
listsLayoutWithKey :: Record KeyProps -> R.Element
listsLayoutWithKey :: Record KeyProps -> R.Element
listsLayoutWithKey props = R.createElement listsLayoutWithKeyCpt props []
listsLayoutWithKey props = R.createElement listsLayoutWithKeyCpt props []
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
where
cpt { controls, nodeId, reloadForest, reloadRoot, session, sessionUpdate, tasks } _ = do
cpt { controls
, nodeId
, reloadForest
, reloadRoot
, session
, sessionUpdate
, tasks } _ = do
let path = { nodeId, session }
let path = { nodeId, session }
cacheState <- R.useState' $ getCacheState CacheOn session nodeId
cacheState <- R.useState' $ getCacheState CacheOn session nodeId
...
@@ -157,10 +132,9 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt
...
@@ -157,10 +132,9 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt
afterCacheStateChange cacheState = do
afterCacheStateChange cacheState = do
launchAff_ $ clearCache unit
launchAff_ $ clearCache unit
sessionUpdate $ setCacheState session nodeId cacheState
sessionUpdate $ setCacheState session nodeId cacheState
------------------------------------------------------------------------
type SidePanelProps =
(
type SidePanelProps =
controls :: Record ListsLayoutControls
(
controls :: Record ListsLayoutControls
, session :: Session
, session :: Session
)
)
...
@@ -168,52 +142,36 @@ sidePanel :: R2.Component SidePanelProps
...
@@ -168,52 +142,36 @@ sidePanel :: R2.Component SidePanelProps
sidePanel = R.createElement sidePanelCpt
sidePanel = R.createElement sidePanelCpt
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = here.component "sidePanel" cpt
sidePanelCpt = here.component "sidePanel" cpt where
where
cpt { controls: { triggers: { toggleSidePanel, triggerSidePanel } }
cpt { controls: { triggers: { toggleSidePanel
, session } _ = do
, triggerSidePanel
showSidePanel <- R.useState' InitialClosed
} }
R.useEffect' $ do
, session } _ = do
let toggleSidePanel' _ = snd showSidePanel toggleSidePanelState
triggerSidePanel' _ = snd showSidePanel $ const Opened
showSidePanel <- R.useState' InitialClosed
R2.setTrigger toggleSidePanel toggleSidePanel'
R2.setTrigger triggerSidePanel triggerSidePanel'
R.useEffect' $ do
(mCorpusId /\ setMCorpusId) <- R.useState' Nothing
let toggleSidePanel' _ = snd showSidePanel toggleSidePanelState
(mListId /\ setMListId) <- R.useState' Nothing
triggerSidePanel' _ = snd showSidePanel $ const Opened
(mNodeId /\ setMNodeId) <- R.useState' Nothing
R2.setTrigger toggleSidePanel toggleSidePanel'
let mainStyle = case fst showSidePanel of
R2.setTrigger triggerSidePanel triggerSidePanel'
Opened -> { display: "block" }
_ -> { display: "none" }
(mCorpusId /\ setMCorpusId) <- R.useState' Nothing
let closeSidePanel _ = snd showSidePanel $ const Closed
(mListId /\ setMListId) <- R.useState' Nothing
pure $ H.div { style: mainStyle }
(mNodeId /\ setMNodeId) <- R.useState' Nothing
[ H.div { className: "header" }
[ H.span { className: "btn btn-danger", on: { click: closeSidePanel } }
let mainStyle = case fst showSidePanel of
[ H.span { className: "fa fa-times" } [] ]]
Opened -> { display: "block" }
_ -> { display: "none" }
let closeSidePanel _ = do
snd showSidePanel $ const Closed
pure $ H.div { style: mainStyle } [
H.div { className: "header" } [
H.span { className: "btn btn-danger"
, on: { click: closeSidePanel } } [
H.span { className: "fa fa-times" } []
]
]
, sidePanelDocView { session } []
, sidePanelDocView { session } []
]
]
type SidePanelDocView = (
type SidePanelDocView = ( session :: Session )
session :: Session
)
sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt = here.component "sidePanelDocView" cpt
sidePanelDocViewCpt = here.component "sidePanelDocView" cpt where
where
cpt { session } _ = do
cpt { session } _ = do
-- pure $ H.h4 {} [ H.text txt ]
-- pure $ H.h4 {} [ H.text txt ]
pure $ H.div {} [ H.text "Hello ngrams" ]
pure $ H.div {} [ H.text "Hello ngrams" ]
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Lists.Tabs where
module Gargantext.Components.Nodes.Lists.Tabs where
import Gargantext.Prelude (bind, pure, unit, ($), (<>))
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (fst)
import Data.Tuple (fst)
...
@@ -11,7 +12,6 @@ import Record as Record
...
@@ -11,7 +12,6 @@ import Record as Record
import Record.Extra as RX
import Record.Extra as RX
import Toestand as T
import Toestand as T
import Gargantext.Prelude
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable as NT
...
@@ -20,12 +20,12 @@ import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
...
@@ -20,12 +20,12 @@ import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart (getChartFunction)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Nodes.Lists.Types
(CacheState, SidePanelTriggers)
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
import Gargantext.Types
( ChartType(..), CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), modeTabType )
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
...
@@ -37,11 +37,11 @@ type Props = (
...
@@ -37,11 +37,11 @@ type Props = (
cacheState :: R.State CacheState
cacheState :: R.State CacheState
, corpusData :: CorpusData
, corpusData :: CorpusData
, corpusId :: Int
, corpusId :: Int
, reloadForest :: T.
Cursor
T2.Reload
, reloadForest :: T.
Box
T2.Reload
, reloadRoot :: T.
Cursor
T2.Reload
, reloadRoot :: T.
Box
T2.Reload
, session :: Session
, session :: Session
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record SidePanelTriggers
, tasks :: T.
Cursor
(Maybe GAT.Reductor)
, tasks :: T.
Box
(Maybe GAT.Reductor)
)
)
type PropsWithKey = ( key :: String | Props )
type PropsWithKey = ( key :: String | Props )
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
5fe07605
module Gargantext.Components.Nodes.Texts where
module Gargantext.Components.Nodes.Texts where
import Prelude
import Prelude
( class Eq, class Show, Unit, bind, const, discard
, pure, show, unit, ($), (&&), (<>), (==) )
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log, log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
--------------------------------------------------------
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.Forest as Forest
import Gargantext.Components.Forest as Forest
import Gargantext.Components.Loader (loader)
import Gargantext.Components.Loader (loader)
...
@@ -22,15 +22,18 @@ import Gargantext.Components.Node (NodePoly(..))
...
@@ -22,15 +22,18 @@ import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Document as D
import Gargantext.Components.Nodes.Corpus.Document as D
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..), getCorpusInfo, CorpusInfo(..))
import Gargantext.Components.Nodes.Corpus.Types
( CorpusData, Hyperdata(..), getCorpusInfo, CorpusInfo(..) )
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.SidePanelToggleButton (sidePanelToggleButton)
import Gargantext.Components.Nodes.Texts.Types
import Gargantext.Components.Nodes.Texts.Types
( SidePanelState(..), SidePanelTriggers, TextsLayoutControls
, TriggerAnnotatedDocIdChangeParams, initialControls, toggleSidePanelState )
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table
import Gargantext.Components.Table as Table
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session,
Sessions, sessionId, getCacheState, s
etCacheState)
import Gargantext.Sessions (Session,
sessionId, g
etCacheState)
import Gargantext.Types (CTabNgramType(..),
Handed(..),
ListId, NodeID, TabSubType(..), TabType(..))
import Gargantext.Types (CTabNgramType(..), ListId, NodeID, TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here :: R2.Here
...
...
src/Gargantext/Components/RangeSlider.purs
View file @
5fe07605
...
@@ -19,11 +19,9 @@ import DOM.Simple.EventListener as EL
...
@@ -19,11 +19,9 @@ import DOM.Simple.EventListener as EL
import DOM.Simple (DOMRect)
import DOM.Simple (DOMRect)
import Global (toFixed)
import Global (toFixed)
import Effect (Effect)
import Effect (Effect)
import Effect.Uncurried (mkEffectFn1)
import Math as M
import Math as M
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Utils.Math (roundToMultiple)
import Gargantext.Utils.Math (roundToMultiple)
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
...
...
src/Gargantext/Components/Router.purs
View file @
5fe07605
...
@@ -11,7 +11,7 @@ import Unsafe.Coerce (unsafeCoerce)
...
@@ -11,7 +11,7 @@ import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (
Cursor
s)
import Gargantext.Components.App.Data (
Boxe
s)
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.Forest (forestLayout)
import Gargantext.Components.GraphExplorer (explorerLayoutLoader)
import Gargantext.Components.GraphExplorer (explorerLayoutLoader)
...
@@ -37,26 +37,15 @@ import Gargantext.Routes as GR
...
@@ -37,26 +37,15 @@ import Gargantext.Routes as GR
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId)
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Router"
here = R2.here "Gargantext.Components.Router"
type Props = (
type Props = ( boxes :: Boxes, tasks :: T.Box (Maybe GAT.Reductor) )
cursors :: Cursors
, tasks :: T.Cursor (Maybe GAT.Reductor)
)
type SessionProps = (
type SessionProps = ( session :: R.Context Session, sessionId :: SessionId | Props )
session :: R.Context Session
, sessionId :: SessionId
| Props
)
type SessionNodeProps = (
type SessionNodeProps = ( nodeId :: NodeID | SessionProps )
nodeId :: NodeID
| SessionProps
)
type Props' = ( route' :: AppRoute, backend :: Backend | Props )
type Props' = ( route' :: AppRoute, backend :: Backend | Props )
router :: R2.Leaf Props
router :: R2.Leaf Props
...
@@ -64,13 +53,13 @@ router props = R.createElement routerCpt props []
...
@@ -64,13 +53,13 @@ router props = R.createElement routerCpt props []
routerCpt :: R.Component Props
routerCpt :: R.Component Props
routerCpt = here.component "router" cpt where
routerCpt = here.component "router" cpt where
cpt props@{
cursor
s, tasks } _ = do
cpt props@{
boxe
s, tasks } _ = do
let session = R.createContext (unsafeCoerce {})
let session = R.createContext (unsafeCoerce {})
let sessionProps sId = Record.merge { session, sessionId: sId } props
let sessionProps sId = Record.merge { session, sessionId: sId } props
let sessionNodeProps sId nId = Record.merge { nodeId: nId } $ sessionProps sId
let sessionNodeProps sId nId = Record.merge { nodeId: nId } $ sessionProps sId
showLogin <- T.useLive T.unequal
cursor
s.showLogin
showLogin <- T.useLive T.unequal
boxe
s.showLogin
route' <- T.useLive T.unequal
cursor
s.route
route' <- T.useLive T.unequal
boxe
s.route
pure $ if showLogin then login'
cursor
s
pure $ if showLogin then login'
boxe
s
else case route' of
else case route' of
GR.Annuaire s n -> annuaire (sessionNodeProps s n) []
GR.Annuaire s n -> annuaire (sessionNodeProps s n) []
GR.ContactPage s a n -> contact (Record.merge { annuaireId: a } $ sessionNodeProps s n) []
GR.ContactPage s a n -> contact (Record.merge { annuaireId: a } $ sessionNodeProps s n) []
...
@@ -84,7 +73,7 @@ routerCpt = here.component "router" cpt where
...
@@ -84,7 +73,7 @@ routerCpt = here.component "router" cpt where
GR.FolderShared s n -> corpus (sessionNodeProps s n) []
GR.FolderShared s n -> corpus (sessionNodeProps s n) []
GR.Home -> home props []
GR.Home -> home props []
GR.Lists s n -> lists (sessionNodeProps s n) []
GR.Lists s n -> lists (sessionNodeProps s n) []
GR.Login -> login'
cursor
s
GR.Login -> login'
boxe
s
GR.PGraphExplorer s g -> graphExplorer (sessionNodeProps s g) []
GR.PGraphExplorer s g -> graphExplorer (sessionNodeProps s g) []
GR.RouteFile s n -> routeFile (sessionNodeProps s n) []
GR.RouteFile s n -> routeFile (sessionNodeProps s n) []
GR.RouteFrameCalc s n -> routeFrame (Record.merge { nodeType: NodeFrameCalc } $ sessionNodeProps s n) []
GR.RouteFrameCalc s n -> routeFrame (Record.merge { nodeType: NodeFrameCalc } $ sessionNodeProps s n) []
...
@@ -100,7 +89,7 @@ forested = R.createElement forestedCpt
...
@@ -100,7 +89,7 @@ forested = R.createElement forestedCpt
forestedCpt :: R.Component Props
forestedCpt :: R.Component Props
forestedCpt = here.component "forested" cpt
forestedCpt = here.component "forested" cpt
where
where
cpt {
cursor
s: { backend, handed, reloadForest, reloadRoot, route, sessions, showLogin }, tasks } children = do
cpt {
boxe
s: { backend, handed, reloadForest, reloadRoot, route, sessions, showLogin }, tasks } children = do
pure $ forestLayout { backend
pure $ forestLayout { backend
, frontends: defaultFrontends
, frontends: defaultFrontends
, handed
, handed
...
@@ -112,7 +101,7 @@ forestedCpt = here.component "forested" cpt
...
@@ -112,7 +101,7 @@ forestedCpt = here.component "forested" cpt
, tasks } children
, tasks } children
authed :: Record SessionProps -> R.Element -> R.Element
authed :: Record SessionProps -> R.Element -> R.Element
authed props@{
cursor
s: { sessions }, session, sessionId, tasks } content =
authed props@{
boxe
s: { sessions }, session, sessionId, tasks } content =
sessionWrapper { fallback: home homeProps [], context: session, sessionId, sessions }
sessionWrapper { fallback: home homeProps [], context: session, sessionId, sessions }
[ content, footer { } [] ]
[ content, footer { } [] ]
where
where
...
@@ -123,10 +112,10 @@ annuaire = R.createElement annuaireCpt
...
@@ -123,10 +112,10 @@ annuaire = R.createElement annuaireCpt
annuaireCpt :: R.Component SessionNodeProps
annuaireCpt :: R.Component SessionNodeProps
annuaireCpt = here.component "annuaire" cpt where
annuaireCpt = here.component "annuaire" cpt where
cpt props@{
cursor
s, nodeId, session, sessionId, tasks } _ = do
cpt props@{
boxe
s, nodeId, session, sessionId, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks } [ annuaireLayout { frontends, nodeId, session } ]
forested {
boxe
s, tasks } [ annuaireLayout { frontends, nodeId, session } ]
where frontends = defaultFrontends
where frontends = defaultFrontends
corpus :: R2.Component SessionNodeProps
corpus :: R2.Component SessionNodeProps
...
@@ -134,10 +123,10 @@ corpus = R.createElement corpusCpt
...
@@ -134,10 +123,10 @@ corpus = R.createElement corpusCpt
corpusCpt :: R.Component SessionNodeProps
corpusCpt :: R.Component SessionNodeProps
corpusCpt = here.component "corpus" cpt where
corpusCpt = here.component "corpus" cpt where
cpt props@{
cursor
s, nodeId, session, tasks } _ = do
cpt props@{
boxe
s, nodeId, session, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks } [ corpusLayout { nodeId, session } ]
forested {
boxe
s, tasks } [ corpusLayout { nodeId, session } ]
type CorpusDocumentProps =
type CorpusDocumentProps =
( corpusId :: CorpusId
( corpusId :: CorpusId
...
@@ -151,10 +140,10 @@ corpusDocument = R.createElement corpusDocumentCpt
...
@@ -151,10 +140,10 @@ corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt
corpusDocumentCpt = here.component "corpusDocument" cpt
where
where
cpt props@{
cursor
s, corpusId: corpusId', listId, nodeId, session, sessionId, tasks } _ = do
cpt props@{
boxe
s, corpusId: corpusId', listId, nodeId, session, sessionId, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks }
forested {
boxe
s, tasks }
[ documentMainLayout { mCorpusId: corpusId, listId: listId, nodeId, session } [] ]
[ documentMainLayout { mCorpusId: corpusId, listId: listId, nodeId, session } [] ]
where corpusId = Just corpusId'
where corpusId = Just corpusId'
...
@@ -164,10 +153,10 @@ dashboard = R.createElement dashboardCpt
...
@@ -164,10 +153,10 @@ dashboard = R.createElement dashboardCpt
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt = here.component "dashboard" cpt
dashboardCpt = here.component "dashboard" cpt
where
where
cpt props@{
cursor
s, nodeId, session, tasks } _ = do
cpt props@{
boxe
s, nodeId, session, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks } [ dashboardLayout { nodeId, session } [] ]
forested {
boxe
s, tasks } [ dashboardLayout { nodeId, session } [] ]
type DocumentProps = ( listId :: ListId | SessionNodeProps )
type DocumentProps = ( listId :: ListId | SessionNodeProps )
...
@@ -176,10 +165,10 @@ document = R.createElement documentCpt
...
@@ -176,10 +165,10 @@ document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps
documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt where
documentCpt = here.component "document" cpt where
cpt props@{ listId, nodeId, session, sessionId, tasks,
cursor
s } _ = do
cpt props@{ listId, nodeId, session, sessionId, tasks,
boxe
s } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks }
forested {
boxe
s, tasks }
[ documentMainLayout { listId, nodeId, mCorpusId, session } [] ]
[ documentMainLayout { listId, nodeId, mCorpusId, session } [] ]
where mCorpusId = Nothing
where mCorpusId = Nothing
...
@@ -188,15 +177,15 @@ home = R.createElement homeCpt
...
@@ -188,15 +177,15 @@ home = R.createElement homeCpt
homeCpt :: R.Component Props
homeCpt :: R.Component Props
homeCpt = here.component "home" cpt where
homeCpt = here.component "home" cpt where
cpt props@{
cursors: cursor
s@{ sessions, showLogin }, tasks } _ = do
cpt props@{
boxes: boxe
s@{ sessions, showLogin }, tasks } _ = do
pure $ forested {
cursor
s, tasks } [ homeLayout { lang: LL_EN, sessions, showLogin } ]
pure $ forested {
boxe
s, tasks } [ homeLayout { lang: LL_EN, sessions, showLogin } ]
lists :: R2.Component SessionNodeProps
lists :: R2.Component SessionNodeProps
lists = R.createElement listsCpt
lists = R.createElement listsCpt
listsCpt :: R.Component SessionNodeProps
listsCpt :: R.Component SessionNodeProps
listsCpt = here.component "lists" cpt where
listsCpt = here.component "lists" cpt where
cpt props@{
cursor
s: { backend
cpt props@{
boxe
s: { backend
, handed
, handed
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -229,7 +218,7 @@ listsCpt = here.component "lists" cpt where
...
@@ -229,7 +218,7 @@ listsCpt = here.component "lists" cpt where
} []
} []
where frontends = defaultFrontends
where frontends = defaultFrontends
login' ::
Cursor
s -> R.Element
login' ::
Boxe
s -> R.Element
login' { backend, sessions, showLogin: visible } =
login' { backend, sessions, showLogin: visible } =
login { backend
login { backend
, backends: fromFoldable defaultBackends
, backends: fromFoldable defaultBackends
...
@@ -241,7 +230,7 @@ graphExplorer = R.createElement graphExplorerCpt
...
@@ -241,7 +230,7 @@ graphExplorer = R.createElement graphExplorerCpt
graphExplorerCpt :: R.Component SessionNodeProps
graphExplorerCpt :: R.Component SessionNodeProps
graphExplorerCpt = here.component "graphExplorer" cpt where
graphExplorerCpt = here.component "graphExplorer" cpt where
cpt props@{
cursor
s: { backend, handed, route, sessions, showLogin }
cpt props@{
boxe
s: { backend, handed, route, sessions, showLogin }
, nodeId
, nodeId
, session
, session
, tasks } _ = do
, tasks } _ = do
...
@@ -264,10 +253,10 @@ routeFile = R.createElement routeFileCpt
...
@@ -264,10 +253,10 @@ routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt = here.component "routeFile" cpt where
routeFileCpt = here.component "routeFile" cpt where
cpt props@{ nodeId, session, sessionId,
cursor
s, tasks } _ = do
cpt props@{ nodeId, session, sessionId,
boxe
s, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks } [ fileLayout { nodeId, session } ]
forested {
boxe
s, tasks } [ fileLayout { nodeId, session } ]
type RouteFrameProps = (
type RouteFrameProps = (
nodeType :: NodeType
nodeType :: NodeType
...
@@ -279,18 +268,18 @@ routeFrame = R.createElement routeFrameCpt
...
@@ -279,18 +268,18 @@ routeFrame = R.createElement routeFrameCpt
routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt = here.component "routeFrame" cpt where
routeFrameCpt = here.component "routeFrame" cpt where
cpt props@{ nodeId, nodeType, session, sessionId,
cursor
s, tasks } _ = do
cpt props@{ nodeId, nodeType, session, sessionId,
boxe
s, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ forested {
cursor
s, tasks } [ frameLayout { nodeId, nodeType, session } ]
pure $ authed sessionProps $ forested {
boxe
s, tasks } [ frameLayout { nodeId, nodeType, session } ]
team :: R2.Component SessionNodeProps
team :: R2.Component SessionNodeProps
team = R.createElement teamCpt
team = R.createElement teamCpt
teamCpt :: R.Component SessionNodeProps
teamCpt :: R.Component SessionNodeProps
teamCpt = here.component "team" cpt where
teamCpt = here.component "team" cpt where
cpt props@{ nodeId, session, sessionId,
cursor
s, tasks } _ = do
cpt props@{ nodeId, session, sessionId,
boxe
s, tasks } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ forested {
cursor
s, tasks } [ corpusLayout { nodeId, session } ]
pure $ authed sessionProps $ forested {
boxe
s, tasks } [ corpusLayout { nodeId, session } ]
texts :: R2.Component SessionNodeProps
texts :: R2.Component SessionNodeProps
texts = R.createElement textsCpt
texts = R.createElement textsCpt
...
@@ -298,7 +287,7 @@ texts = R.createElement textsCpt
...
@@ -298,7 +287,7 @@ texts = R.createElement textsCpt
textsCpt :: R.Component SessionNodeProps
textsCpt :: R.Component SessionNodeProps
textsCpt = here.component "texts" cpt
textsCpt = here.component "texts" cpt
where
where
cpt props@{
cursor
s: { backend
cpt props@{
boxe
s: { backend
, handed
, handed
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -332,7 +321,7 @@ user = R.createElement userCpt
...
@@ -332,7 +321,7 @@ user = R.createElement userCpt
userCpt :: R.Component SessionNodeProps
userCpt :: R.Component SessionNodeProps
userCpt = here.component "user" cpt where
userCpt = here.component "user" cpt where
cpt props@{
cursors: cursor
s@{ reloadForest, reloadRoot }
cpt props@{
boxes: boxe
s@{ reloadForest, reloadRoot }
, nodeId
, nodeId
, session
, session
, sessionId
, sessionId
...
@@ -340,7 +329,7 @@ userCpt = here.component "user" cpt where
...
@@ -340,7 +329,7 @@ userCpt = here.component "user" cpt where
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
session' <- R.useContext session
session' <- R.useContext session
pure $ authed sessionProps $
pure $ authed sessionProps $
forested {
cursor
s, tasks }
forested {
boxe
s, tasks }
[ userLayout { frontends
[ userLayout { frontends
, nodeId
, nodeId
, reloadForest
, reloadForest
...
@@ -357,7 +346,7 @@ contact = R.createElement contactCpt
...
@@ -357,7 +346,7 @@ contact = R.createElement contactCpt
contactCpt :: R.Component ContactProps
contactCpt :: R.Component ContactProps
contactCpt = here.component "contact" cpt where
contactCpt = here.component "contact" cpt where
cpt props@{ annuaireId, nodeId, session, sessionId, tasks
cpt props@{ annuaireId, nodeId, session, sessionId, tasks
,
cursor
s: { reloadForest, reloadRoot } } _ = do
,
boxe
s: { reloadForest, reloadRoot } } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
let forestedProps = RE.pick props :: Record Props
let forestedProps = RE.pick props :: Record Props
pure $ authed sessionProps $
pure $ authed sessionProps $
...
...
src/Gargantext/Components/Search.purs
View file @
5fe07605
module Gargantext.Components.Search where
module Gargantext.Components.Search where
------------------------------------------------------------------------
import Gargantext.Prelude (class Eq, class Show)
import Data.Argonaut as Argonaut
import Data.Argonaut as Argonaut
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe)
import Gargantext.Prelude (class Eq, class Read, class Show)
import Gargantext.Components.Category.Types (Category)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Gargantext.Utils.Toestand as T2
-- Example:
-- Example:
-- [["machine","learning"],["artificial","intelligence"]]
-- [["machine","learning"],["artificial","intelligence"]]
...
@@ -30,10 +25,7 @@ instance encodeJsonSearchType :: Argonaut.EncodeJson SearchType where
...
@@ -30,10 +25,7 @@ instance encodeJsonSearchType :: Argonaut.EncodeJson SearchType where
encodeJson = genericEnumEncodeJson
encodeJson = genericEnumEncodeJson
------------------------------------------------------------------------
------------------------------------------------------------------------
data SearchQuery =
data SearchQuery = SearchQuery { query :: Array String, expected :: SearchType }
SearchQuery { query :: Array String
, expected :: SearchType
}
derive instance eqSearchQuery :: Eq SearchQuery
derive instance eqSearchQuery :: Eq SearchQuery
derive instance genericSearchQuery :: Generic SearchQuery _
derive instance genericSearchQuery :: Generic SearchQuery _
...
...
src/Gargantext/Components/SessionLoader.purs
View file @
5fe07605
...
@@ -23,7 +23,7 @@ type Props =
...
@@ -23,7 +23,7 @@ type Props =
fallback :: R.Element
fallback :: R.Element
, context :: R.Context Session
, context :: R.Context Session
, sessionId :: SessionId
, sessionId :: SessionId
, sessions :: T.
Cursor
Sessions
, sessions :: T.
Box
Sessions
)
)
sessionWrapper :: R2.Component Props
sessionWrapper :: R2.Component Props
...
...
src/Gargantext/Components/SimpleLayout.purs
View file @
5fe07605
...
@@ -16,7 +16,7 @@ here = R2.here "Gargantext.Components.SimpleLayout"
...
@@ -16,7 +16,7 @@ here = R2.here "Gargantext.Components.SimpleLayout"
-- Simple layout does not accommodate the tree
-- Simple layout does not accommodate the tree
type SimpleLayoutProps = (
type SimpleLayoutProps = (
handed :: T.
Cursor
GT.Handed
handed :: T.
Box
GT.Handed
)
)
simpleLayout :: R2.Component SimpleLayoutProps
simpleLayout :: R2.Component SimpleLayoutProps
...
...
src/Gargantext/Components/Table/Types.purs
View file @
5fe07605
module Gargantext.Components.Table.Types where
module Gargantext.Components.Table.Types where
import Prelude
import Prelude
(class Eq, class Show, (<>))
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe
(..)
)
import Data.Maybe (Maybe)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Tuple (fst, snd)
import Effect.Aff (Aff, launchAff_)
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Gargantext.Sessions (Session, get)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Search (SearchType)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Search
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix (effectLink)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
type Params = { limit :: Int
type Params = { limit :: Int
, offset :: Int
, offset :: Int
, orderBy :: OrderBy
, orderBy :: OrderBy
...
@@ -36,8 +25,6 @@ orderByToForm :: OrderByDirection ColumnName -> String
...
@@ -36,8 +25,6 @@ orderByToForm :: OrderByDirection ColumnName -> String
orderByToForm (ASC (ColumnName x)) = x <> "Asc"
orderByToForm (ASC (ColumnName x)) = x <> "Asc"
orderByToForm (DESC (ColumnName x)) = x <> "Desc"
orderByToForm (DESC (ColumnName x)) = x <> "Desc"
newtype ColumnName = ColumnName String
newtype ColumnName = ColumnName String
derive instance genericColumnName :: Generic ColumnName _
derive instance genericColumnName :: Generic ColumnName _
instance showColumnName :: Show ColumnName where
instance showColumnName :: Show ColumnName where
...
@@ -46,7 +33,6 @@ derive instance eqColumnName :: Eq ColumnName
...
@@ -46,7 +33,6 @@ derive instance eqColumnName :: Eq ColumnName
columnName :: ColumnName -> String
columnName :: ColumnName -> String
columnName (ColumnName c) = c
columnName (ColumnName c) = c
type Props =
type Props =
( syncResetButton :: Array R.Element
( syncResetButton :: Array R.Element
, colNames :: Array ColumnName
, colNames :: Array ColumnName
...
@@ -66,8 +52,6 @@ type TableContainerProps =
...
@@ -66,8 +52,6 @@ type TableContainerProps =
, tableBody :: Array R.Element
, tableBody :: Array R.Element
)
)
type Row = { row :: R.Element, delete :: Boolean }
type Row = { row :: R.Element, delete :: Boolean }
type Rows = Seq.Seq Row
type Rows = Seq.Seq Row
src/Gargantext/Components/TopBar.purs
View file @
5fe07605
module Gargantext.Components.TopBar where
module Gargantext.Components.TopBar where
import Data.Array (reverse)
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -13,14 +11,11 @@ import Gargantext.Prelude
...
@@ -13,14 +11,11 @@ import Gargantext.Prelude
import Gargantext.Components.Themes (themeSwitcher, defaultTheme, allThemes)
import Gargantext.Components.Themes (themeSwitcher, defaultTheme, allThemes)
import Gargantext.Types (Handed(..), reverseHanded)
import Gargantext.Types (Handed(..), reverseHanded)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.TopBar"
here = R2.here "Gargantext.Components.TopBar"
type TopBarProps = (
type TopBarProps = ( handed :: T.Box Handed )
handed :: T.Cursor Handed
)
topBar :: R2.Component TopBarProps
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBar = R.createElement topBarCpt
...
@@ -229,7 +224,7 @@ liNav (LiNav { title : title'
...
@@ -229,7 +224,7 @@ liNav (LiNav { title : title'
type HandedChooserProps = (
type HandedChooserProps = (
handed :: T.
Cursor
Handed
handed :: T.
Box
Handed
)
)
handedChooser :: R2.Component HandedChooserProps
handedChooser :: R2.Component HandedChooserProps
...
@@ -249,6 +244,6 @@ handedChooserCpt = here.component "handedChooser" cpt
...
@@ -249,6 +244,6 @@ handedChooserCpt = here.component "handedChooser" cpt
handedClass LeftHanded = "fa fa-hand-o-left"
handedClass LeftHanded = "fa fa-hand-o-left"
handedClass RightHanded = "fa fa-hand-o-right"
handedClass RightHanded = "fa fa-hand-o-right"
onClick handed = T
2
.modify_ (\h -> case h of
onClick handed = T.modify_ (\h -> case h of
LeftHanded -> RightHanded
LeftHanded -> RightHanded
RightHanded -> LeftHanded) handed
RightHanded -> LeftHanded) handed
src/Gargantext/Hooks.purs
View file @
5fe07605
module Gargantext.Hooks ( useHashRouter ) where
module Gargantext.Hooks ( useHashRouter ) where
import Prelude (Unit,
void,
($))
import Prelude (Unit, ($))
import Reactix as R
import Reactix as R
import Routing.Match (Match)
import Routing.Match (Match)
import Routing.Hash (matches)
import Routing.Hash (matches)
import Toestand as T
import Toestand as T
import Gargantext.Utils.Toestand as T2
-- | Sets up the hash router so it writes the route to the given cell.
-- | Sets up the hash router so it writes the route to the given cell.
-- | Note: if it gets sent to an unrecognised url, it will quietly
-- | Note: if it gets sent to an unrecognised url, it will quietly
-- | drop the change.
-- | drop the change.
useHashRouter :: forall r c. T.Write c r => Match r -> c -> R.Hooks Unit
useHashRouter :: forall r c. T.Write c r => Match r -> c -> R.Hooks Unit
useHashRouter routes cell = R.useEffectOnce $ matches routes h where
useHashRouter routes cell = R.useEffectOnce $ matches routes h where
h _old new = T
2
.write_ new cell
h _old new = T.write_ new cell
-- useSession cell =
-- useSession cell =
src/Gargantext/Hooks/Sigmax.purs
View file @
5fe07605
module Gargantext.Hooks.Sigmax
module Gargantext.Hooks.Sigmax
where
where
import Prelude (Unit, bind, discard, flip, pure, unit, ($), (*>), (<<<), (<>), (>>=), (&&), not, const, map)
import Prelude
( Unit, bind, discard, flip, map, not, pure, unit
, ($), (&&), (*>), (<<<), (<>), (>>=))
import Data.Array as A
import Data.Array as A
import Data.Either (either)
import Data.Either (either)
import Data.Foldable (sequence_, foldl)
import Data.Foldable (sequence_, foldl)
...
@@ -27,7 +28,6 @@ import Toestand as T
...
@@ -27,7 +28,6 @@ import Toestand as T
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Types as ST
import Gargantext.Hooks.Sigmax.Types as ST
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
type Sigma =
type Sigma =
{ sigma :: R.Ref (Maybe Sigma.Sigma)
{ sigma :: R.Ref (Maybe Sigma.Sigma)
...
@@ -114,7 +114,7 @@ dependOnContainer container notFoundMsg f = do
...
@@ -114,7 +114,7 @@ dependOnContainer container notFoundMsg f = do
-- | pausing can be done not only via buttons but also from the initial
-- | pausing can be done not only via buttons but also from the initial
-- | setTimer.
-- | setTimer.
--handleForceAtlasPause sigmaRef (toggled /\ setToggled) mFAPauseRef = do
--handleForceAtlasPause sigmaRef (toggled /\ setToggled) mFAPauseRef = do
handleForceAtlas2Pause :: R.Ref Sigma -> T.
Cursor
ST.ForceAtlasState -> R.Ref (Maybe TimeoutId) -> Effect Unit
handleForceAtlas2Pause :: R.Ref Sigma -> T.
Box
ST.ForceAtlasState -> R.Ref (Maybe TimeoutId) -> Effect Unit
handleForceAtlas2Pause sigmaRef forceAtlasState mFAPauseRef = do
handleForceAtlas2Pause sigmaRef forceAtlasState mFAPauseRef = do
let sigma = R.readRef sigmaRef
let sigma = R.readRef sigmaRef
toggled <- T.read forceAtlasState
toggled <- T.read forceAtlasState
...
@@ -192,15 +192,15 @@ multiSelectUpdate new selected = foldl fld selected new
...
@@ -192,15 +192,15 @@ multiSelectUpdate new selected = foldl fld selected new
Set.insert item selectedAcc
Set.insert item selectedAcc
bindSelectedNodesClick :: Sigma.Sigma -> T.
Cursor
ST.NodeIds -> R.Ref Boolean -> Effect Unit
bindSelectedNodesClick :: Sigma.Sigma -> T.
Box
ST.NodeIds -> R.Ref Boolean -> Effect Unit
bindSelectedNodesClick sigma selectedNodeIds multiSelectEnabledRef =
bindSelectedNodesClick sigma selectedNodeIds multiSelectEnabledRef =
Sigma.bindClickNodes sigma $ \nodes -> do
Sigma.bindClickNodes sigma $ \nodes -> do
let multiSelectEnabled = R.readRef multiSelectEnabledRef
let multiSelectEnabled = R.readRef multiSelectEnabledRef
let nodeIds = Set.fromFoldable $ map _.id nodes
let nodeIds = Set.fromFoldable $ map _.id nodes
if multiSelectEnabled then
if multiSelectEnabled then
T
2
.modify_ (multiSelectUpdate nodeIds) selectedNodeIds
T.modify_ (multiSelectUpdate nodeIds) selectedNodeIds
else
else
T
2
.write_ nodeIds selectedNodeIds
T.write_ nodeIds selectedNodeIds
bindSelectedEdgesClick :: R.Ref Sigma -> R.State ST.EdgeIds -> Effect Unit
bindSelectedEdgesClick :: R.Ref Sigma -> R.State ST.EdgeIds -> Effect Unit
bindSelectedEdgesClick sigmaRef (_ /\ setEdgeIds) =
bindSelectedEdgesClick sigmaRef (_ /\ setEdgeIds) =
...
...
src/Gargantext/Sessions.purs
View file @
5fe07605
...
@@ -24,7 +24,7 @@ import DOM.Simple.Console (log2)
...
@@ -24,7 +24,7 @@ import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Prelude
import Prelude
( Unit, bind,
discard,
otherwise, pure, unit, ($), (*>), (<$>), (<*), (>>=))
( Unit, bind, otherwise, pure, unit, ($), (*>), (<$>), (<*), (>>=))
import Toestand as T
import Toestand as T
import Web.Storage.Storage (getItem, removeItem, setItem)
import Web.Storage.Storage (getItem, removeItem, setItem)
...
@@ -34,7 +34,6 @@ import Gargantext.Components.Nodes.Lists.Types as NT
...
@@ -34,7 +34,6 @@ import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Config.REST as REST
import Gargantext.Config.REST as REST
import Gargantext.Ends (class ToUrl, Backend, toUrl)
import Gargantext.Ends (class ToUrl, Backend, toUrl)
import Gargantext.Utils.Reactix (getls)
import Gargantext.Utils.Reactix (getls)
import Gargantext.Utils.Toestand as T2
load :: forall c. T.Write c Sessions => c -> Effect Sessions
load :: forall c. T.Write c Sessions => c -> Effect Sessions
load cell = do
load cell = do
...
...
src/Gargantext/Utils/CacheAPI.purs
View file @
5fe07605
...
@@ -2,23 +2,19 @@ module Gargantext.Utils.CacheAPI where
...
@@ -2,23 +2,19 @@ module Gargantext.Utils.CacheAPI where
import Control.Monad.Except (runExcept)
import Control.Monad.Except (runExcept)
import Control.Promise (Promise, toAffE)
import Control.Promise (Promise, toAffE)
import Data.Argonaut (class DecodeJson, decodeJson
, class EncodeJson, encodeJson, (:=), (~>), (.:), fromString
)
import Data.Argonaut (class DecodeJson, decodeJson)
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Function.Uncurried (Fn3)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, throwError)
import Effect.Aff (Aff, throwError)
import Effect.Aff.Compat (EffectFnAff, fromEffectFnAff)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Foreign as F
import Foreign as F
import Foreign.Object as O
import Foreign.Object as O
import Milkis as M
import Milkis as M
import Type.Row (class Union)
import Type.Row (class Union)
import Gargantext.Prelude
import Gargantext.Prelude
hiding (add)
import Gargantext.Ends (class ToUrl, toUrl)
import Gargantext.Ends (class ToUrl, toUrl)
import Gargantext.Sessions (Session(..))
import Gargantext.Sessions (Session(..))
...
...
src/Gargantext/Utils/Reload.purs
View file @
5fe07605
...
@@ -2,14 +2,11 @@ module Gargantext.Utils.Reload where
...
@@ -2,14 +2,11 @@ module Gargantext.Utils.Reload where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
import Toestand as T
import Toestand as T
import Gargantext.Utils.Toestand as T2
type Reload = Int
type Reload = Int
type ReloadS = R.State Reload
type ReloadS = R.State Reload
type ReloadSRef = R.Ref
type ReloadSRef = R.Ref
...
@@ -20,11 +17,8 @@ new = R.useState' 0
...
@@ -20,11 +17,8 @@ new = R.useState' 0
bump :: ReloadS -> Effect Unit
bump :: ReloadS -> Effect Unit
bump (_ /\ setReload) = setReload (_ + 1)
bump (_ /\ setReload) = setReload (_ + 1)
bumpCursor :: T.Cursor Reload -> Effect Unit
bumpBox :: T.Box Reload -> Effect Unit
bumpCursor c = T2.modify_ (_ + 1) c
bumpBox c = T.modify_ (_ + 1) c
bumpCell :: T.Cell Reload -> Effect Unit
bumpCell c = T2.modify_ (_ + 1) c
value :: ReloadS -> Reload
value :: ReloadS -> Reload
value (val /\ _) = val
value (val /\ _) = val
...
...
src/Gargantext/Utils/Toestand.purs
View file @
5fe07605
module Gargantext.Utils.Toestand
module Gargantext.Utils.Toestand
( class Reloadable, reload
( class Reloadable, reload, Reload, newReload, InitReload(..), ready, useMemberBox )
, Reload, newReload, InitReload(..), ready
where
, useCursed, useIdentityCursor, useMemberCursor
, write_, modify_
) where
import Prelude (class
Eq, class Ord, Unit, bind, identity, pure, unit, void, ($), (+), (>>=
))
import Prelude (class
Ord, Unit, bind, pure, unit, (+
))
import Data.Set as Set
import Data.Set as Set
import Data.Set (Set)
import Data.Set (Set)
import Effect (Effect)
import Effect (Effect)
...
@@ -22,62 +19,38 @@ class Reloadable t where
...
@@ -22,62 +19,38 @@ class Reloadable t where
newReload :: Reload
newReload :: Reload
newReload = 0
newReload = 0
instance reloadable
CellReload :: Reloadable (T.Cell
Int) where
instance reloadable
BoxReload :: Reloadable (T.Box
Int) where
reload
cell = modify_ (_ + 1) cell
reload
box = T.modify_ (_ + 1) box
instance reloadableCursorReload :: Reloadable (T.Cursor Int) where
instance reloadableInitReloadBox :: Reloadable (c Reload) => Reloadable (T.Box (InitReload c)) where
reload cell = modify_ (_ + 1) cell
reload box = do
val <- T.read box
instance reloadableInitReloadCell :: Reloadable (c Reload) => Reloadable (T.Cell (InitReload c)) where
reload cell = do
val <- T.read cell
case val of
Init -> pure unit
Ready r -> reload r
instance reloadableInitReloadCursor :: Reloadable (c Reload) => Reloadable (T.Cursor (InitReload c)) where
reload cell = do
val <- T.read cell
case val of
case val of
Init -> pure unit
Init -> pure unit
Ready r -> reload r
Ready r -> reload r
--
c is a cell or cursor
wrapping a Reload
--
inner is a Box
wrapping a Reload
data InitReload (
c :: Type -> Type) = Init | Ready (c
Reload)
data InitReload (
inner :: Type -> Type) = Init | Ready (inner
Reload)
-- | Initialises an InitReload
cell with the Reload cell
it contains,
-- | Initialises an InitReload
box with the Reload box
it contains,
-- | if it has not already been initialised.
-- | if it has not already been initialised.
ready :: forall
cell c. T.ReadWrite cell
(InitReload c) => T.ReadWrite (c Reload) Reload
ready :: forall
box c. T.ReadWrite box
(InitReload c) => T.ReadWrite (c Reload) Reload
=>
cell
-> (c Reload) -> Effect Unit
=>
box
-> (c Reload) -> Effect Unit
ready
cell
with = do
ready
box
with = do
val <- T.read
cell
val <- T.read
box
case val of
case val of
Init ->
write_ (Ready with) cell
Init ->
T.write_ (Ready with) box
Ready _ -> pure unit
Ready _ -> pure unit
-- | Turns a Cell into a Cursor.
useIdentityCursor :: forall cell c. T.ReadWrite cell c => cell -> R.Hooks (T.Cursor c)
useIdentityCursor = T.useCursor identity (\a _ -> a)
-- | Creates a cursor directly from a value by creating a cell first.
useCursed :: forall t. t -> R.Hooks (T.Cursor t)
useCursed val = T.useCell val >>= useIdentityCursor
-- | Creates a cursor which presents a Boolean over whether the member
-- | Creates a cursor which presents a Boolean over whether the member
-- | is in the set. Adjusting the value will toggle whether the value
-- | is in the set. Adjusting the value will toggle whether the value
-- | is in the underlying set.
-- | is in the underlying set.
useMember
Cursor
useMember
Box
:: forall
cell v. Ord v => T.ReadWrite cell
(Set v)
:: forall
box v. Ord v => T.ReadWrite box
(Set v)
=> v ->
cell -> R.Hooks (T.Cursor
Boolean)
=> v ->
box -> R.Hooks (T.Box
Boolean)
useMember
Cursor val cell = T.useCursor (Set.member val) (toggleSet val) cell
useMember
Box val box = T.useFocused (Set.member val) (toggleSet val) box
-- utility for useMember
Cursor
-- utility for useMember
Box
toggleSet :: forall s. Ord s => s -> Boolean -> Set s -> Set s
toggleSet :: forall s. Ord s => s -> Boolean -> Set s -> Set s
toggleSet val true set = Set.insert val set
toggleSet val true set = Set.insert val set
toggleSet val false set = Set.delete val set
toggleSet val false set = Set.delete val set
modify_ :: forall cell val. T.ReadWrite cell val => (val -> val) -> cell -> Effect Unit
modify_ f cell = void $ T.modify f cell
write_ :: forall cell val. T.Write cell val => val -> cell -> Effect Unit
write_ val cell = void $ T.write val cell
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