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
00786471
Commit
00786471
authored
Jun 13, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT] read instance
parent
f0c91864
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
41 deletions
+44
-41
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+2
-2
Types.purs
...text/Components/Forest/Tree/Node/Action/Search/Types.purs
+26
-26
Predefined.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
+15
-12
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+1
-1
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
00786471
...
...
@@ -11,7 +11,7 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Database(..), IMT_org(..), Org(..), SearchQuery(..), allIMTorgs, allOrgs, dataFields, defaultSearchQuery, doc, performSearch,
readOrg,
datafield2database)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Database(..), IMT_org(..), Org(..), SearchQuery(..), allIMTorgs, allOrgs, dataFields, defaultSearchQuery, doc, performSearch, datafield2database)
import Gargantext.Components.Lang (Lang)
import Gargantext.Prelude (Unit, bind, discard, map, pure, show, ($), (&&), (<), (<$>), (<>), (==), read)
import Gargantext.Sessions (Session)
...
...
@@ -342,7 +342,7 @@ orgInput ({datafield} /\ setSearch) orgs =
liItem org = H.option {className : "text-primary center"} [ H.text (show org) ]
onChange e = do
let value = R2.unsafeEventValue e
setSearch $ _ { datafield = Just $ External $ Just $ HAL $ read
Org
value }
setSearch $ _ { datafield = Just $ External $ Just $ HAL $ read value }
{-
filterInput :: R.State String -> R.Element
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs
View file @
00786471
...
...
@@ -167,12 +167,12 @@ instance showOrg :: Show Org where
show (IMT _) = "IMT"
show (Others _) = "Others"
readOrg :: String -> Maybe Org
readOrg
"All_Orgs" = Just $ All_Orgs
readOrg
"CNRS" = Just $ CNRS $ Set.fromFoldable []
readOrg
"IMT" = Just $ IMT $ Set.fromFoldable []
readOrg
"Others" = Just $ Others $ Set.fromFoldable []
readOrg
_ = Nothing
instance readOrg :: Read Org where
read
"All_Orgs" = Just $ All_Orgs
read
"CNRS" = Just $ CNRS $ Set.fromFoldable []
read
"IMT" = Just $ IMT $ Set.fromFoldable []
read
"Others" = Just $ Others $ Set.fromFoldable []
read
_ = Nothing
derive instance eqOrg :: Eq Org
...
...
@@ -246,26 +246,26 @@ instance showIMT_org :: Show IMT_org where
show Telecom_ParisTech = "Telecom_ParisTech"
show Telecom_SudParis = "Telecom_SudParis"
readIMT_org :: String -> Maybe IMT_org
readIMT_org
"All_IMT" = Just All_IMT
readIMT_org
"ARMINES" = Just ARMINES
readIMT_org
"Eurecom" = Just Eurecom
readIMT_org
"IMT_Atlantique" = Just IMT_Atlantique
readIMT_org
"IMT_Business_School" = Just IMT_Business_School
readIMT_org
"IMT_Lille_Douai" = Just IMT_Lille_Douai
readIMT_org
"IMT_Mines_ALES" = Just IMT_Mines_ALES
readIMT_org
"IMT_Mines_Albi" = Just IMT_Mines_Albi
readIMT_org
"Institut_MinesTelecom_Paris" = Just Institut_MinesTelecom_Paris
readIMT_org
"MINES_ParisTech" = Just MINES_ParisTech
readIMT_org
"Mines_Douai" = Just Mines_Douai
readIMT_org
"Mines_Nantes" = Just Mines_Nantes
readIMT_org
"Mines_SaintEtienne" = Just Mines_SaintEtienne
readIMT_org
"Telecom_Bretagne" = Just Telecom_Bretagne
readIMT_org
"Telecom_Ecole_de_Management" = Just Telecom_Ecole_de_Management
readIMT_org
"Telecom_Lille" = Just Telecom_Lille
readIMT_org
"Telecom_ParisTech" = Just Telecom_ParisTech
readIMT_org
"Telecom_SudParis" = Just Telecom_SudParis
readIMT_org
_ = Nothing
instance readIMT_org :: Read IMT_org where
read
"All_IMT" = Just All_IMT
read
"ARMINES" = Just ARMINES
read
"Eurecom" = Just Eurecom
read
"IMT_Atlantique" = Just IMT_Atlantique
read
"IMT_Business_School" = Just IMT_Business_School
read
"IMT_Lille_Douai" = Just IMT_Lille_Douai
read
"IMT_Mines_ALES" = Just IMT_Mines_ALES
read
"IMT_Mines_Albi" = Just IMT_Mines_Albi
read
"Institut_MinesTelecom_Paris" = Just Institut_MinesTelecom_Paris
read
"MINES_ParisTech" = Just MINES_ParisTech
read
"Mines_Douai" = Just Mines_Douai
read
"Mines_Nantes" = Just Mines_Nantes
read
"Mines_SaintEtienne" = Just Mines_SaintEtienne
read
"Telecom_Bretagne" = Just Telecom_Bretagne
read
"Telecom_Ecole_de_Management" = Just Telecom_Ecole_de_Management
read
"Telecom_Lille" = Just Telecom_Lille
read
"Telecom_ParisTech" = Just Telecom_ParisTech
read
"Telecom_SudParis" = Just Telecom_SudParis
read
_ = Nothing
imtStructId :: IMT_org -> Array StructId
imtStructId All_IMT = concat $ map imtStructId allIMTSubOrgs
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
View file @
00786471
...
...
@@ -2,19 +2,17 @@ module Gargantext.Components.Nodes.Corpus.Chart.Predefined where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Ord (genericCompare)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe, fromMaybe)
import Reactix as R
import Gargantext.Prelude
import Data.Maybe (Maybe(..), fromMaybe)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Types (NodeID, Mode(..), TabSubType(..), TabType(..), modeTabType)
import Reactix as R
data PredefinedChart =
...
...
@@ -23,24 +21,29 @@ data PredefinedChart =
| CInstitutesTree
| CTermsMetrics
derive instance genericPredefinedChart :: Generic PredefinedChart _
instance showPredefinedChart :: Show PredefinedChart where
show = genericShow
derive instance eqPredefinedChart :: Eq PredefinedChart
instance ordPredefinedChart :: Ord PredefinedChart where
compare = genericCompare
instance decodePredefinedChart :: DecodeJson PredefinedChart where
decodeJson json = do
obj <- decodeJson json
pure $ readChart' obj
pure $ fromMaybe CDocsHistogram $ read obj
instance encodePredefinedChart :: EncodeJson PredefinedChart where
encodeJson c = encodeJson $ show c
readChart' :: String -> PredefinedChart
readChart' "CDocsHistogram" =
CDocsHistogram
readChart' "CAuthorsPie" =
CAuthorsPie
readChart' "CInstitutesTree" =
CInstitutesTree
readChart' "CTermsMetrics" =
CTermsMetrics
readChart' _ = CDocsHistogram
instance readPredefinedChart :: Read PredefinedChart where
read "CDocsHistogram" = Just
CDocsHistogram
read "CAuthorsPie" = Just
CAuthorsPie
read "CInstitutesTree" = Just
CInstitutesTree
read "CTermsMetrics" = Just
CTermsMetrics
read _ = Nothing
allPredefinedCharts :: Array PredefinedChart
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
00786471
...
...
@@ -122,7 +122,7 @@ renderChartCpt = R.hooksComponent "G.C.N.C.D.renderChart" cpt
where
option pc =
H.option { value: show pc } [ H.text $ show pc ]
onSelectChange e = onChange $
P.readChart'
value
onSelectChange e = onChange $
fromMaybe P.CDocsHistogram $ read
value
where
value = R2.unsafeEventValue e
onRemoveClick _ = onRemove unit
...
...
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