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
f805b5c2
Commit
f805b5c2
authored
Jul 17, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] public url
parent
62014c06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
21 deletions
+18
-21
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+18
-21
No files found.
src/Gargantext/Components/Nodes/Home/Public.purs
View file @
f805b5c2
module Gargantext.Components.Nodes.Home.Public where
module Gargantext.Components.Nodes.Home.Public where
import D
OM.Simple.Console (log
)
import D
ata.Array.NonEmpty (toArray
)
import Data.
Tuple (fst)
import Data.
Array as Array
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 Data.NonEmpty (head)
import Data.String (take)
import Data.String (take)
import Data.Tuple (fst)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Config (
publicBackend
)
import Gargantext.Config (
defaultBackends
)
import Gargantext.Config.REST (get)
import Gargantext.Config.REST (get)
import Gargantext.Ends (backendUrl)
import Gargantext.Ends (backendUrl, Backend(..))
import Gargantext.Prelude
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Data.Traversable (traverse)
type PublicProps = (publicDatas :: (Array PublicData)
type PublicProps = (publicDatas :: (Array PublicData)
-- , session :: Session
-- , session :: Session
...
@@ -47,16 +49,23 @@ instance encodeJsonPublicData :: Argonaut.EncodeJson PublicData where
...
@@ -47,16 +49,23 @@ instance encodeJsonPublicData :: Argonaut.EncodeJson PublicData where
encodeJson = genericSumEncodeJson
encodeJson = genericSumEncodeJson
------------------------------------------------------------------------
------------------------------------------------------------------------
type LoadData = ()
type LoadData = ()
type LoadProps = (reload :: Int)
type LoadProps = (reload :: Int)
loadPublicData :: Record LoadProps -> Aff (Array PublicData)
loadPublicData :: Record LoadProps -> Aff (Array PublicData)
loadPublicData _l = do
loadPublicData _l = do
backend <- liftEffect publicBackend
--
backend <- liftEffect publicBackend
_ <- liftEffect (log backend)
let backend = head defaultBackends
get Nothing (backendUrl backend "public")
get Nothing (backendUrl backend "public")
{-
let
ok = ["local.cnrs", "devel.inshs.cnrs"]
backends = Array.filter (\(Backend {name}) -> Array.elem name ok) (toArray defaultBackends)
Array.concat <$> traverse (\backend -> get Nothing (backendUrl backend "public")) backends
-}
renderPublic :: R.Element
renderPublic :: R.Element
renderPublic = R.createElement renderPublicCpt {} []
renderPublic = R.createElement renderPublicCpt {} []
...
@@ -65,18 +74,6 @@ renderPublicCpt = R.hooksComponent "G.C.N.Home.Public.renderPublic" cpt
...
@@ -65,18 +74,6 @@ renderPublicCpt = R.hooksComponent "G.C.N.Home.Public.renderPublic" cpt
where
where
cpt {} _ = do
cpt {} _ = do
reload <- R.useState' 0
reload <- R.useState' 0
{-
(pds /\ setPds) :: R.State PublicProps <- R.useState' ( replicate 6 (PublicData { title: "Title"
, abstract : foldl (<>) "" $ replicate 100 "abstract "
, img: "images/Gargantextuel-212x300.jpg"
, url : "https://.."
, date: "YY/MM/DD"
, database: "database"
, author : "Author"
}
)
)
-}
useLoader { reload: fst reload } loadPublicData (\pd -> publicLayout {publicDatas: pd})
useLoader { reload: fst reload } loadPublicData (\pd -> publicLayout {publicDatas: pd})
...
...
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