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
3a2c002f
Commit
3a2c002f
authored
Mar 18, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[toestand] rewrite Loader to toestand
parent
5bac90ab
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
152 additions
and
67 deletions
+152
-67
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+7
-5
FTree.purs
src/Gargantext/Components/Forest/Tree/Node/Tools/FTree.purs
+13
-5
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+15
-5
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+8
-4
Node.purs
src/Gargantext/Components/Node.purs
+7
-3
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+8
-3
Types.purs
...antext/Components/Nodes/Annuaire/User/Contacts/Types.purs
+30
-18
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+2
-2
Types.purs
src/Gargantext/Components/Nodes/Corpus/Document/Types.purs
+3
-0
Types.purs
src/Gargantext/Components/Nodes/Corpus/Types.purs
+7
-3
Types.purs
src/Gargantext/Components/Nodes/Dashboard/Types.purs
+5
-0
File.purs
src/Gargantext/Components/Nodes/File.purs
+8
-2
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+3
-6
Search.purs
src/Gargantext/Components/Search.purs
+3
-2
Loader.purs
src/Gargantext/Hooks/Loader.purs
+33
-9
No files found.
src/Gargantext/Components/FacetsTable.purs
View file @
3a2c002f
...
@@ -3,9 +3,6 @@
...
@@ -3,9 +3,6 @@
-- 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
( class Eq, class Show, Unit, bind, const, discard, identity, mempty, not
, otherwise, pure, unit, void, ($), (*>), (<$>), (<<<), (<>), (==), (>) )
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Eq (genericEq)
...
@@ -23,6 +20,8 @@ import Reactix as R
...
@@ -23,6 +20,8 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Toestand as T
import Toestand as T
import Gargantext.Prelude
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
...
@@ -106,15 +105,18 @@ newtype ContactsView =
...
@@ -106,15 +105,18 @@ newtype ContactsView =
, annuaireId :: Int
, annuaireId :: Int
, delete :: Boolean
, delete :: Boolean
}
}
derive instance genericContactsView :: Generic ContactsView _
derive instance genericContactsView :: Generic ContactsView _
instance eqContactsView :: Eq ContactsView where
eq = genericEq
instance showContactsView :: Show ContactsView where
instance showContactsView :: Show ContactsView where
show = genericShow
show = genericShow
----------------------------------------------------------------------
----------------------------------------------------------------------
data Rows = Docs { docs :: Seq DocumentsView }
data Rows = Docs { docs :: Seq DocumentsView }
| Contacts { contacts :: Seq ContactsView }
| Contacts { contacts :: Seq ContactsView }
derive instance genericRows :: Generic Rows _
instance eqRows :: Eq Rows where
eq = genericEq
----------------------------------------------------------------------
----------------------------------------------------------------------
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/FTree.purs
View file @
3a2c002f
module Gargantext.Components.Forest.Tree.Node.Tools.FTree where
module Gargantext.Components.Forest.Tree.Node.Tools.FTree where
import Data.Maybe (Maybe(..))
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Gargantext.Prelude
import Gargantext.Types as GT
import Gargantext.Types as GT
import Prelude hiding (div)
-----------------------------------------------------------------------
-----------------------------------------------------------------------
type ID = Int
type ID = Int
...
@@ -12,6 +16,9 @@ type Name = String
...
@@ -12,6 +16,9 @@ type Name = String
-----------------------------------------------------------------------
-----------------------------------------------------------------------
type FTree = NTree LNode
type FTree = NTree LNode
data NTree a = NTree a (Array (NTree a))
data NTree a = NTree a (Array (NTree a))
derive instance genericNTree :: Generic (NTree a) _
instance eqNTree :: Eq a => Eq (NTree a) where
eq (NTree a1 as1) (NTree a2 as2) = (eq a1 a2) && (eq as1 as2)
type Tree = { tree :: FTree
type Tree = { tree :: FTree
, tasks :: Array GT.AsyncTaskWithType
, tasks :: Array GT.AsyncTaskWithType
}
}
...
@@ -29,9 +36,10 @@ newtype LNode =
...
@@ -29,9 +36,10 @@ newtype LNode =
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
, parent_id :: Maybe ID
, parent_id :: Maybe ID
}
}
derive instance newtypeLNode :: Newtype LNode _
derive instance newtypeLNode :: Newtype LNode _
derive instance genericLNode :: Generic LNode _
instance eqLNode :: Eq LNode where
eq = genericEq
instance decodeJsonLNode :: DecodeJson LNode where
instance decodeJsonLNode :: DecodeJson LNode where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
...
src/Gargantext/Components/GraphExplorer/Types.purs
View file @
3a2c002f
...
@@ -65,6 +65,9 @@ newtype GraphSideCorpus = GraphSideCorpus
...
@@ -65,6 +65,9 @@ newtype GraphSideCorpus = GraphSideCorpus
, corpusLabel :: CorpusLabel
, corpusLabel :: CorpusLabel
, listId :: ListId
, listId :: ListId
}
}
derive instance genericGraphSideCorpus :: Generic GraphSideCorpus _
instance eqGraphSideCorpus :: Eq GraphSideCorpus where
eq = genericEq
newtype GraphData = GraphData
newtype GraphData = GraphData
{ nodes :: Array Node
{ nodes :: Array Node
...
@@ -72,8 +75,10 @@ newtype GraphData = GraphData
...
@@ -72,8 +75,10 @@ newtype GraphData = GraphData
, sides :: Array GraphSideCorpus
, sides :: Array GraphSideCorpus
, metaData :: Maybe MetaData
, metaData :: Maybe MetaData
}
}
derive instance newtypeGraphData :: Newtype GraphData _
derive instance newtypeGraphData :: Newtype GraphData _
derive instance genericGraphData :: Generic GraphData _
instance eqGraphData :: Eq GraphData where
eq = genericEq
newtype MetaData = MetaData
newtype MetaData = MetaData
...
@@ -86,6 +91,9 @@ newtype MetaData = MetaData
...
@@ -86,6 +91,9 @@ newtype MetaData = MetaData
, startForceAtlas :: Boolean
, startForceAtlas :: Boolean
, title :: String
, title :: String
}
}
derive instance genericMetaData :: Generic MetaData _
instance eqMetaData :: Eq MetaData where
eq = genericEq
getLegend :: GraphData -> Maybe (Array Legend)
getLegend :: GraphData -> Maybe (Array Legend)
getLegend (GraphData {metaData}) = (\(MetaData m) -> m.legend) <$> metaData
getLegend (GraphData {metaData}) = (\(MetaData m) -> m.legend) <$> metaData
...
@@ -291,7 +299,9 @@ newtype Camera =
...
@@ -291,7 +299,9 @@ newtype Camera =
, x :: Number
, x :: Number
, y :: Number
, y :: Number
}
}
derive instance genericCamera :: Generic Camera _
instance eqCamera :: Eq Camera where
eq = genericEq
instance decodeCamera :: DecodeJson Camera where
instance decodeCamera :: DecodeJson Camera where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -299,7 +309,6 @@ instance decodeCamera :: DecodeJson Camera where
...
@@ -299,7 +309,6 @@ instance decodeCamera :: DecodeJson Camera where
x <- obj .: "x"
x <- obj .: "x"
y <- obj .: "y"
y <- obj .: "y"
pure $ Camera { ratio, x, y }
pure $ Camera { ratio, x, y }
instance jsonEncodeCamera :: EncodeJson Camera where
instance jsonEncodeCamera :: EncodeJson Camera where
encodeJson (Camera c) =
encodeJson (Camera c) =
"ratio" := c.ratio
"ratio" := c.ratio
...
@@ -312,14 +321,15 @@ newtype HyperdataGraph = HyperdataGraph {
...
@@ -312,14 +321,15 @@ newtype HyperdataGraph = HyperdataGraph {
graph :: GraphData
graph :: GraphData
, mCamera :: Maybe Camera
, mCamera :: Maybe Camera
}
}
derive instance genericHyperdataGraph :: Generic HyperdataGraph _
instance eqHyperdataGraph :: Eq HyperdataGraph where
eq = genericEq
instance decodeHyperdataGraph :: DecodeJson HyperdataGraph where
instance decodeHyperdataGraph :: DecodeJson HyperdataGraph where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
graph <- obj .: "graph"
graph <- obj .: "graph"
mCamera <- obj .:? "camera"
mCamera <- obj .:? "camera"
pure $ HyperdataGraph { graph, mCamera }
pure $ HyperdataGraph { graph, mCamera }
instance jsonEncodeHyperdataGraph :: EncodeJson HyperdataGraph where
instance jsonEncodeHyperdataGraph :: EncodeJson HyperdataGraph where
encodeJson (HyperdataGraph c) =
encodeJson (HyperdataGraph c) =
"camera" := c.mCamera
"camera" := c.mCamera
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
3a2c002f
...
@@ -78,7 +78,6 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -78,7 +78,6 @@ module Gargantext.Components.NgramsTable.Core
)
)
where
where
import Gargantext.Prelude
import Control.Monad.State (class MonadState, execState)
import Control.Monad.State (class MonadState, execState)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.:), (.:!), (.:?), (:=), (:=?), (~>), (~>?))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, jsonEmptyObject, (.:), (.:!), (.:?), (:=), (:=?), (~>), (~>?))
import Data.Argonaut.Decode.Error (JsonDecodeError(..))
import Data.Argonaut.Decode.Error (JsonDecodeError(..))
...
@@ -133,6 +132,8 @@ import Partial (crashWith)
...
@@ -133,6 +132,8 @@ import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
import Toestand as T
import Toestand as T
import Gargantext.Prelude
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
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
...
@@ -156,13 +157,14 @@ newtype Versioned a = Versioned
...
@@ -156,13 +157,14 @@ newtype Versioned a = Versioned
{ version :: Version
{ version :: Version
, data :: a
, data :: a
}
}
derive instance genericVersioned :: Generic (Versioned a) _
instance eqVersioned :: Eq a => Eq (Versioned a) where
eq = genericEq
instance encodeJsonVersioned :: EncodeJson a => EncodeJson (Versioned a) where
instance encodeJsonVersioned :: EncodeJson a => EncodeJson (Versioned a) where
encodeJson (Versioned {version, data: data_})
encodeJson (Versioned {version, data: data_})
= "version" := version
= "version" := version
~> "data" := data_
~> "data" := data_
~> jsonEmptyObject
~> jsonEmptyObject
instance decodeJsonVersioned :: DecodeJson a => DecodeJson (Versioned a) where
instance decodeJsonVersioned :: DecodeJson a => DecodeJson (Versioned a) where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -177,7 +179,9 @@ newtype VersionedWithCount a = VersionedWithCount
...
@@ -177,7 +179,9 @@ newtype VersionedWithCount a = VersionedWithCount
, count :: Count
, count :: Count
, data :: a
, data :: a
}
}
derive instance genericVersionedWithCount :: Generic (VersionedWithCount a) _
instance eqVersionedWithCount :: Eq a => Eq (VersionedWithCount a) where
eq = genericEq
instance encodeJsonVersionedWithCount :: EncodeJson a => EncodeJson (VersionedWithCount a) where
instance encodeJsonVersionedWithCount :: EncodeJson a => EncodeJson (VersionedWithCount a) where
encodeJson (VersionedWithCount {count, version, data: data_})
encodeJson (VersionedWithCount {count, version, data: data_})
= "version" := version
= "version" := version
...
...
src/Gargantext/Components/Node.purs
View file @
3a2c002f
module Gargantext.Components.Node
module Gargantext.Components.Node
where
where
import Gargantext.Prelude
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?), (.!=))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?), (.!=))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Gargantext.Prelude
newtype NodePoly a =
newtype NodePoly a =
NodePoly { id :: Int
NodePoly { id :: Int
...
@@ -13,8 +16,9 @@ newtype NodePoly a =
...
@@ -13,8 +16,9 @@ newtype NodePoly a =
, date :: String
, date :: String
, hyperdata :: a
, hyperdata :: a
}
}
derive instance genericNodePoly :: Generic (NodePoly a) _
instance eqNodePoly :: Eq a => Eq (NodePoly a) where
eq = genericEq
instance decodeNodePoly :: (DecodeJson a)
instance decodeNodePoly :: (DecodeJson a)
=> DecodeJson (NodePoly a) where
=> DecodeJson (NodePoly a) where
decodeJson json = do
decodeJson json = do
...
...
src/Gargantext/Components/Nodes/Annuaire.purs
View file @
3a2c002f
...
@@ -2,9 +2,10 @@ module Gargantext.Components.Nodes.Annuaire
...
@@ -2,9 +2,10 @@ module Gargantext.Components.Nodes.Annuaire
-- ( annuaire )
-- ( annuaire )
where
where
import Prelude (bind, const, identity, pure, show, ($), (<$>), (<>))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Array as A
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
...
@@ -240,7 +241,9 @@ contactCellsCpt = here.component "contactCells" cpt where
...
@@ -240,7 +241,9 @@ contactCellsCpt = here.component "contactCells" cpt where
data HyperdataAnnuaire = HyperdataAnnuaire
data HyperdataAnnuaire = HyperdataAnnuaire
{ title :: Maybe String
{ title :: Maybe String
, desc :: Maybe String }
, desc :: Maybe String }
derive instance genericHyperdataAnnuaire :: Generic HyperdataAnnuaire _
instance eqHyperdataAnnuaire :: Eq HyperdataAnnuaire where
eq = genericEq
instance decodeHyperdataAnnuaire :: DecodeJson HyperdataAnnuaire where
instance decodeHyperdataAnnuaire :: DecodeJson HyperdataAnnuaire where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -259,7 +262,9 @@ newtype AnnuaireInfo =
...
@@ -259,7 +262,9 @@ newtype AnnuaireInfo =
, date :: String
, date :: String
, hyperdata :: HyperdataAnnuaire
, hyperdata :: HyperdataAnnuaire
}
}
derive instance genericAnnuaireInfo :: Generic AnnuaireInfo _
instance eqAnnuaireInfo :: Eq AnnuaireInfo where
eq = genericEq
instance decodeAnnuaireInfo :: DecodeJson AnnuaireInfo where
instance decodeAnnuaireInfo :: DecodeJson AnnuaireInfo where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Types.purs
View file @
3a2c002f
module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types where
module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types where
import Prelude (bind, pure, ($))
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (.:!), (.:?), (:=), (~>), jsonEmptyObject)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (.:!), (.:?), (:=), (~>), 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.Lens
import Data.Lens
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Newtype (class Newtype)
import Data.String as S
import Data.String as S
import Gargantext.Prelude
import Gargantext.Utils.DecodeMaybe ((.?|))
import Gargantext.Utils.DecodeMaybe ((.?|))
import Data.Newtype (class Newtype)
-- TODO: should it be a NodePoly HyperdataContact ?
-- TODO: should it be a NodePoly HyperdataContact ?
newtype NodeContact =
newtype NodeContact =
...
@@ -20,7 +24,9 @@ newtype NodeContact =
...
@@ -20,7 +24,9 @@ newtype NodeContact =
, typename :: Maybe Int
, typename :: Maybe Int
, userId :: Maybe Int
, userId :: Maybe Int
}
}
derive instance genericNodeContact :: Generic NodeContact _
instance eqNodeContact :: Eq NodeContact where
eq = genericEq
instance decodeNodeContact :: DecodeJson NodeContact where
instance decodeNodeContact :: DecodeJson NodeContact where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -40,7 +46,6 @@ instance decodeNodeContact :: DecodeJson NodeContact where
...
@@ -40,7 +46,6 @@ instance decodeNodeContact :: DecodeJson NodeContact where
, typename
, typename
, userId
, userId
}
}
derive instance newtypeNodeContact :: Newtype NodeContact _
derive instance newtypeNodeContact :: Newtype NodeContact _
----------------------------------------------------------------------------
----------------------------------------------------------------------------
...
@@ -55,8 +60,9 @@ newtype Contact' =
...
@@ -55,8 +60,9 @@ newtype Contact' =
, typename :: Maybe Int
, typename :: Maybe Int
, userId :: Maybe Int
, userId :: Maybe Int
}
}
derive instance genericContact' :: Generic Contact' _
instance eqContact' :: Eq Contact' where
eq = genericEq
instance decodeContact' :: DecodeJson Contact' where
instance decodeContact' :: DecodeJson Contact' where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -90,8 +96,9 @@ newtype Contact =
...
@@ -90,8 +96,9 @@ newtype Contact =
, typename :: Maybe Int
, typename :: Maybe Int
, userId :: Maybe Int
, userId :: Maybe Int
}
}
derive instance genericContact :: Generic Contact _
instance eqContact :: Eq Contact where
eq = genericEq
instance decodeContact :: DecodeJson Contact where
instance decodeContact :: DecodeJson Contact where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -156,7 +163,9 @@ newtype ContactWho =
...
@@ -156,7 +163,9 @@ newtype ContactWho =
}
}
derive instance newtypeContactWho :: Newtype ContactWho _
derive instance newtypeContactWho :: Newtype ContactWho _
derive instance genericContactWho :: Generic ContactWho _
instance eqContactWho :: Eq ContactWho where
eq = genericEq
instance decodeContactWho :: DecodeJson ContactWho
instance decodeContactWho :: DecodeJson ContactWho
where
where
decodeJson json = do
decodeJson json = do
...
@@ -171,7 +180,6 @@ instance decodeContactWho :: DecodeJson ContactWho
...
@@ -171,7 +180,6 @@ instance decodeContactWho :: DecodeJson ContactWho
let f = fromMaybe [] freetags
let f = fromMaybe [] freetags
pure $ ContactWho {idWho, firstName, lastName, keywords:k, freetags:f}
pure $ ContactWho {idWho, firstName, lastName, keywords:k, freetags:f}
instance encodeContactWho :: EncodeJson ContactWho
instance encodeContactWho :: EncodeJson ContactWho
where
where
encodeJson (ContactWho cw) =
encodeJson (ContactWho cw) =
...
@@ -209,7 +217,9 @@ newtype ContactWhere =
...
@@ -209,7 +217,9 @@ newtype ContactWhere =
, exit :: Maybe String }
, exit :: Maybe String }
derive instance newtypeContactWhere :: Newtype ContactWhere _
derive instance newtypeContactWhere :: Newtype ContactWhere _
derive instance genericContactWhere :: Generic ContactWhere _
instance eqContactWhere :: Eq ContactWhere where
eq = genericEq
instance decodeContactWhere :: DecodeJson ContactWhere
instance decodeContactWhere :: DecodeJson ContactWhere
where
where
decodeJson json = do
decodeJson json = do
...
@@ -228,7 +238,6 @@ instance decodeContactWhere :: DecodeJson ContactWhere
...
@@ -228,7 +238,6 @@ instance decodeContactWhere :: DecodeJson ContactWhere
let l = fromMaybe [] labTeamDepts
let l = fromMaybe [] labTeamDepts
pure $ ContactWhere {organization:o, labTeamDepts:l, role, office, country, city, touch, entry, exit}
pure $ ContactWhere {organization:o, labTeamDepts:l, role, office, country, city, touch, entry, exit}
instance encodeContactWhere :: EncodeJson ContactWhere
instance encodeContactWhere :: EncodeJson ContactWhere
where
where
encodeJson (ContactWhere cw) =
encodeJson (ContactWhere cw) =
...
@@ -264,7 +273,9 @@ newtype ContactTouch =
...
@@ -264,7 +273,9 @@ newtype ContactTouch =
, url :: Maybe String }
, url :: Maybe String }
derive instance newtypeContactTouch :: Newtype ContactTouch _
derive instance newtypeContactTouch :: Newtype ContactTouch _
derive instance genericContactTouch :: Generic ContactTouch _
instance eqContactTouch :: Eq ContactTouch where
eq = genericEq
instance decodeContactTouch :: DecodeJson ContactTouch
instance decodeContactTouch :: DecodeJson ContactTouch
where
where
decodeJson json = do
decodeJson json = do
...
@@ -273,7 +284,6 @@ instance decodeContactTouch :: DecodeJson ContactTouch
...
@@ -273,7 +284,6 @@ instance decodeContactTouch :: DecodeJson ContactTouch
phone <- obj .:? "phone"
phone <- obj .:? "phone"
url <- obj .:? "url"
url <- obj .:? "url"
pure $ ContactTouch {mail, phone, url}
pure $ ContactTouch {mail, phone, url}
instance encodeContactTouch :: EncodeJson ContactTouch
instance encodeContactTouch :: EncodeJson ContactTouch
where
where
encodeJson (ContactTouch ct) =
encodeJson (ContactTouch ct) =
...
@@ -302,7 +312,9 @@ newtype HyperdataContact =
...
@@ -302,7 +312,9 @@ newtype HyperdataContact =
, who :: Maybe ContactWho
, who :: Maybe ContactWho
}
}
derive instance newtypeHyperdataContact :: Newtype HyperdataContact _
derive instance newtypeHyperdataContact :: Newtype HyperdataContact _
derive instance genericHyperdataContact :: Generic HyperdataContact _
instance eqHyperdataContact :: Eq HyperdataContact where
eq = genericEq
instance decodeHyperdataContact :: DecodeJson HyperdataContact
instance decodeHyperdataContact :: DecodeJson HyperdataContact
where
where
decodeJson json = do
decodeJson json = do
...
@@ -319,7 +331,6 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
...
@@ -319,7 +331,6 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
let ou' = fromMaybe [] ou
let ou' = fromMaybe [] ou
pure $ HyperdataContact {bdd, who, ou:ou', title, source, lastValidation, uniqId, uniqIdBdd}
pure $ HyperdataContact {bdd, who, ou:ou', title, source, lastValidation, uniqId, uniqIdBdd}
instance encodeHyperdataContact :: EncodeJson HyperdataContact
instance encodeHyperdataContact :: EncodeJson HyperdataContact
where
where
encodeJson (HyperdataContact {bdd, lastValidation, ou, source, title, uniqId, uniqIdBdd, who}) =
encodeJson (HyperdataContact {bdd, lastValidation, ou, source, title, uniqId, uniqIdBdd, who}) =
...
@@ -350,14 +361,15 @@ newtype HyperdataUser =
...
@@ -350,14 +361,15 @@ newtype HyperdataUser =
shared :: Maybe HyperdataContact
shared :: Maybe HyperdataContact
}
}
derive instance newtypeHyperdataUser :: Newtype HyperdataUser _
derive instance newtypeHyperdataUser :: Newtype HyperdataUser _
derive instance genericHyperdataUser :: Generic HyperdataUser _
instance eqHyperdataUser :: Eq HyperdataUser where
eq = genericEq
instance decodeHyperdataUser :: DecodeJson HyperdataUser
instance decodeHyperdataUser :: DecodeJson HyperdataUser
where
where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
shared <- obj .:? "shared"
shared <- obj .:? "shared"
pure $ HyperdataUser { shared }
pure $ HyperdataUser { shared }
instance encodeHyperdataUser :: EncodeJson HyperdataUser
instance encodeHyperdataUser :: EncodeJson HyperdataUser
where
where
encodeJson (HyperdataUser {shared}) =
encodeJson (HyperdataUser {shared}) =
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
3a2c002f
...
@@ -28,10 +28,10 @@ type MetricsLoadViewProps a = (
...
@@ -28,10 +28,10 @@ type MetricsLoadViewProps a = (
cacheName :: String
cacheName :: String
cacheName = "metrics"
cacheName = "metrics"
metricsLoadView :: forall a. Record (MetricsLoadViewProps a) -> R.Element
metricsLoadView :: forall a.
Eq a =>
Record (MetricsLoadViewProps a) -> R.Element
metricsLoadView p = R.createElement metricsLoadViewCpt p []
metricsLoadView p = R.createElement metricsLoadViewCpt p []
metricsLoadViewCpt :: forall a. R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt :: forall a.
Eq a =>
R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = here.component "metricsLoadView" cpt
metricsLoadViewCpt = here.component "metricsLoadView" cpt
where
where
cpt { getMetrics, loaded, path, reload, session } _ = do
cpt { getMetrics, loaded, path, reload, session } _ = do
...
...
src/Gargantext/Components/Nodes/Corpus/Document/Types.purs
View file @
3a2c002f
...
@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Corpus.Document.Types where
...
@@ -2,6 +2,7 @@ module Gargantext.Components.Nodes.Corpus.Document.Types where
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
...
@@ -167,6 +168,8 @@ derive instance genericDocument :: Generic Document _
...
@@ -167,6 +168,8 @@ derive instance genericDocument :: Generic Document _
derive instance genericDocumentV3 :: Generic DocumentV3 _
derive instance genericDocumentV3 :: Generic DocumentV3 _
derive instance genericStatus :: Generic Status _
derive instance genericStatus :: Generic Status _
instance eqDocument :: Eq Document where
eq = genericEq
instance showDocument :: Show Document where
instance showDocument :: Show Document where
show = genericShow
show = genericShow
...
...
src/Gargantext/Components/Nodes/Corpus/Types.purs
View file @
3a2c002f
module Gargantext.Components.Nodes.Corpus.Types where
module Gargantext.Components.Nodes.Corpus.Types where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (:=), (~>), jsonEmptyObject)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (:=), (~>), jsonEmptyObject)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.List as List
import Data.List as List
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly)
import Gargantext.Components.Node (NodePoly)
import Gargantext.Components.Nodes.Types (FTField, Field(..), FieldType(..), isJSON)
import Gargantext.Components.Nodes.Types (FTField, Field(..), FieldType(..), isJSON)
import Gargantext.Prelude (bind, pure, ($))
newtype Hyperdata =
newtype Hyperdata =
Hyperdata { fields :: List.List FTField }
Hyperdata { fields :: List.List FTField }
derive instance genericHyperdata :: Generic Hyperdata _
instance eqHyperdata :: Eq Hyperdata where
eq = genericEq
instance decodeHyperdata :: DecodeJson Hyperdata where
instance decodeHyperdata :: DecodeJson Hyperdata where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
fields <- obj .: "fields"
fields <- obj .: "fields"
pure $ Hyperdata {fields}
pure $ Hyperdata {fields}
instance encodeHyperdata :: EncodeJson Hyperdata where
instance encodeHyperdata :: EncodeJson Hyperdata where
encodeJson (Hyperdata {fields}) = do
encodeJson (Hyperdata {fields}) = do
"fields" := fields
"fields" := fields
...
...
src/Gargantext/Components/Nodes/Dashboard/Types.purs
View file @
3a2c002f
module Gargantext.Components.Nodes.Dashboard.Types where
module Gargantext.Components.Nodes.Dashboard.Types where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (.:?), (:=), (~>), jsonEmptyObject)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, (.:), (.:?), (:=), (~>), jsonEmptyObject)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.List as List
import Data.List as List
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
...
@@ -20,6 +22,9 @@ newtype Hyperdata =
...
@@ -20,6 +22,9 @@ newtype Hyperdata =
, fields :: List.List FTField
, fields :: List.List FTField
, preferences :: Preferences
, preferences :: Preferences
}
}
derive instance genericHyperdata :: Generic Hyperdata _
instance eqHyperdata :: Eq Hyperdata where
eq = genericEq
instance decodeHyperdata :: DecodeJson Hyperdata where
instance decodeHyperdata :: DecodeJson Hyperdata where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
...
src/Gargantext/Components/Nodes/File.purs
View file @
3a2c002f
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.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
...
@@ -23,7 +25,9 @@ newtype HyperdataFile =
...
@@ -23,7 +25,9 @@ newtype HyperdataFile =
, name :: String
, name :: String
, path :: String
, path :: String
}
}
derive instance genericHyperdataFile :: Generic HyperdataFile _
instance eqHyperdataFile :: Eq HyperdataFile where
eq = genericEq
instance decodeHyperdataFile :: DecodeJson HyperdataFile where
instance decodeHyperdataFile :: DecodeJson HyperdataFile where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
@@ -39,7 +43,9 @@ newtype File =
...
@@ -39,7 +43,9 @@ newtype File =
, hyperdata :: HyperdataFile
, hyperdata :: HyperdataFile
, name :: String
, name :: String
}
}
derive instance genericFile :: Generic File _
instance eqFile :: Eq File where
eq = genericEq
instance decodeFile :: DecodeJson File where
instance decodeFile :: DecodeJson File where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
...
...
src/Gargantext/Components/Nodes/Frame.purs
View file @
3a2c002f
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Nodes.Frame where
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Nodes.Frame where
import Data.Argonaut as Argonaut
import Data.Argonaut as Argonaut
import Data.Argonaut (decodeJson, (.:))
import Data.Argonaut (decodeJson, (.:))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
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(..))
import Data.Maybe (Maybe(..))
...
@@ -26,13 +27,11 @@ here = R2.here "Gargantext.Components.Nodes.Frame"
...
@@ -26,13 +27,11 @@ here = R2.here "Gargantext.Components.Nodes.Frame"
data Hyperdata = Hyperdata { base :: String, frame_id :: String }
data Hyperdata = Hyperdata { base :: String, frame_id :: String }
derive instance eqHyperdata :: Eq Hyperdata
derive instance genericHyperdata :: Generic Hyperdata _
derive instance genericHyperdata :: Generic Hyperdata _
instance eqHyperdata :: Eq Hyperdata where
eq = genericEq
instance showHyperdata :: Show Hyperdata where
instance showHyperdata :: Show Hyperdata where
show = genericShow
show = genericShow
instance decodeJsonHyperdata :: Argonaut.DecodeJson Hyperdata where
instance decodeJsonHyperdata :: Argonaut.DecodeJson Hyperdata where
-- TODO
-- TODO
-- decodeJson = genericSumDecodeJson
-- decodeJson = genericSumDecodeJson
...
@@ -41,8 +40,6 @@ instance decodeJsonHyperdata :: Argonaut.DecodeJson Hyperdata where
...
@@ -41,8 +40,6 @@ instance decodeJsonHyperdata :: Argonaut.DecodeJson Hyperdata where
base <- obj .: "base"
base <- obj .: "base"
frame_id <- obj .: "frame_id"
frame_id <- obj .: "frame_id"
pure $ Hyperdata {base, frame_id}
pure $ Hyperdata {base, frame_id}
instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where
instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
...
...
src/Gargantext/Components/Search.purs
View file @
3a2c002f
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Search where
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Search where
import Gargantext.Prelude (class Eq, class Show)
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.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
...
@@ -74,9 +75,9 @@ data Document =
...
@@ -74,9 +75,9 @@ data Document =
, category :: Int
, category :: Int
, score :: Int
, score :: Int
}
}
derive instance eqDocument :: Eq Document
derive instance genericDocument :: Generic Document _
derive instance genericDocument :: Generic Document _
instance eqDocument :: Eq Document where
eq = genericEq
instance showDocument :: Show Document where
instance showDocument :: Show Document where
show = genericShow
show = genericShow
instance decodeJsonDocument :: Argonaut.DecodeJson Document where
instance decodeJsonDocument :: Argonaut.DecodeJson Document where
...
...
src/Gargantext/Hooks/Loader.purs
View file @
3a2c002f
...
@@ -16,6 +16,9 @@ import Gargantext.Utils.Crypto (Hash)
...
@@ -16,6 +16,9 @@ import Gargantext.Utils.Crypto (Hash)
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.Hooks.Loader"
cacheName :: String
cacheName :: String
cacheName = "cache-api-loader"
cacheName = "cache-api-loader"
...
@@ -23,22 +26,43 @@ clearCache :: Unit -> Aff Unit
...
@@ -23,22 +26,43 @@ clearCache :: Unit -> Aff Unit
clearCache _ = GUC.delete $ GUC.CacheName cacheName
clearCache _ = GUC.delete $ GUC.CacheName cacheName
useLoader :: forall path st. Eq path
useLoader :: forall path st. Eq path
=> Eq st
=> path
=> path
-> (path -> Aff st)
-> (path -> Aff st)
-> (st -> R.Element)
-> (st -> R.Element)
-> R.Hooks R.Element
-> R.Hooks R.Element
useLoader path loader render = do
useLoader path loader' render = do
state <- R.useState' Nothing
state <- T.useBox Nothing
useLoaderEffect path state loader
pure $ maybe (loadingSpinner {}) render (fst state)
useLoaderEffect path state loader'
pure $ loader { path, render, state } []
type LoaderProps path st =
( path :: path
, render :: st -> R.Element
, state :: T.Box (Maybe st) )
useLoaderEffect :: forall st path. Eq path =>
loader :: forall path st. Eq path => Eq st => R2.Component (LoaderProps path st)
loader = R.createElement loaderCpt
loaderCpt :: forall path st. Eq path => Eq st => R.Component (LoaderProps path st)
loaderCpt = here.component "loader" cpt
where
cpt { path, render, state } _ = do
state' <- T.useLive T.unequal state
pure $ maybe (loadingSpinner {}) render state'
useLoaderEffect :: forall st path. Eq path => Eq st =>
path
path
->
R.State
(Maybe st)
->
T.Box
(Maybe st)
-> (path -> Aff st)
-> (path -> Aff st)
-> R.Hooks Unit
-> R.Hooks Unit
useLoaderEffect path state@(state' /\ setState) loader = do
useLoaderEffect path state loader = do
state' <- T.useLive T.unequal state
oPath <- R.useRef path
oPath <- R.useRef path
R.useEffect' $ do
R.useEffect' $ do
...
@@ -49,7 +73,7 @@ useLoaderEffect path state@(state' /\ setState) loader = do
...
@@ -49,7 +73,7 @@ useLoaderEffect path state@(state' /\ setState) loader = do
R.setRef oPath path
R.setRef oPath path
R2.affEffect "G.H.Loader.useLoaderEffect" $ do
R2.affEffect "G.H.Loader.useLoaderEffect" $ do
l <- loader path
l <- loader path
liftEffect $
setState $ const $ Just l
liftEffect $
T.write_ (Just l) state
newtype HashedResponse a = HashedResponse { hash :: Hash, value :: a }
newtype HashedResponse a = HashedResponse { hash :: Hash, value :: a }
...
...
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