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
9b25a3dd
Commit
9b25a3dd
authored
Jul 17, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] quick fix for public data from dev backend
parent
f805b5c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
27 deletions
+51
-27
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+8
-3
Config.purs
src/Gargantext/Config.purs
+43
-24
No files found.
src/Gargantext/Components/Nodes/Home/Public.purs
View file @
9b25a3dd
...
@@ -11,7 +11,7 @@ import Data.String (take)
...
@@ -11,7 +11,7 @@ import Data.String (take)
import Data.Tuple (fst)
import Data.Tuple (fst)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Config (
defaultBackends
)
import Gargantext.Config (
publicBackend
)
import Gargantext.Config.REST (get)
import Gargantext.Config.REST (get)
import Gargantext.Ends (backendUrl, Backend(..))
import Gargantext.Ends (backendUrl, Backend(..))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -52,13 +52,18 @@ instance encodeJsonPublicData :: Argonaut.EncodeJson PublicData where
...
@@ -52,13 +52,18 @@ instance encodeJsonPublicData :: Argonaut.EncodeJson PublicData where
type LoadData = ()
type LoadData = ()
type LoadProps = (reload :: Int)
type LoadProps = (reload :: Int)
-- | WIP still finding the right way to chose the default public backend
loadPublicData :: Record LoadProps -> Aff (Array PublicData)
loadPublicData :: Record LoadProps -> Aff (Array PublicData)
loadPublicData _l = do
loadPublicData _l = do
-- This solution is error prone (url needs to be cleaned)
--backend <- liftEffect publicBackend
--backend <- liftEffect publicBackend
let backend = head defaultBackends
-- This solution for development only, with local backend
-- let backend = head defaultBackends
let backend = publicBackend
get Nothing (backendUrl backend "public")
get Nothing (backendUrl backend "public")
{-
{-
| Another solution: get all data
let
let
ok = ["local.cnrs", "devel.inshs.cnrs"]
ok = ["local.cnrs", "devel.inshs.cnrs"]
backends = Array.filter (\(Backend {name}) -> Array.elem name ok) (toArray defaultBackends)
backends = Array.filter (\(Backend {name}) -> Array.elem name ok) (toArray defaultBackends)
...
...
src/Gargantext/Config.purs
View file @
9b25a3dd
...
@@ -10,24 +10,54 @@ import Gargantext.Utils (location)
...
@@ -10,24 +10,54 @@ import Gargantext.Utils (location)
import Gargantext.Prelude (bind, pure, ($))
import Gargantext.Prelude (bind, pure, ($))
defaultBackends :: NonEmpty Array Backend
defaultBackends :: NonEmpty Array Backend
defaultBackends = local :| [prod, partner, demo, dev]
defaultBackends = backend_local :| [ backend_prod
where
, backend_partner
prod = backend V10 "/api/" "https://v4.gargantext.org" "iscpif.cnrs"
, backend_demo
partner = backend V10 "/api/" "https://imtv4.gargantext.org" "institut-mines-telecom.imt"
, backend_dev
demo = backend V10 "/api/" "https://demo.gargantext.org" "demo.inshs.cnrs"
]
dev = backend V10 "/api/" "https://dev.gargantext.org" "devel.inshs.cnrs"
local = backend V10 "/api/" "http://localhost:8008" "local.cnrs"
backend_prod :: Backend
backend_prod = backend V10 "/api/" "https://v4.gargantext.org" "iscpif.cnrs"
backend_partner :: Backend
backend_partner = backend V10 "/api/" "https://imtv4.gargantext.org" "institut-mines-telecom.imt"
backend_demo :: Backend
backend_demo = backend V10 "/api/" "https://demo.gargantext.org" "demo.inshs.cnrs"
backend_dev :: Backend
backend_dev = backend V10 "/api/" "https://dev.gargantext.org" "devel.inshs.cnrs"
backend_local :: Backend
backend_local = backend V10 "/api/" "http://localhost:8008" "local.cnrs"
-- | public Backend
-- When user is not logged, use the location of the window
publicBackend :: Backend
publicBackend = backend_dev
publicBackend' :: Effect Backend
publicBackend' = do
url <- location
pure $ Backend { name : "Public Backend"
, baseUrl : url
, prePath : "api/"
, version : V10
}
defaultApps :: NonEmpty Array Frontend
defaultApps :: NonEmpty Array Frontend
defaultApps = relative :| [prod, dev, demo, haskell, caddy]
defaultApps = relative :| [prod, dev, demo, haskell, caddy]
where
where
relative = frontend "/#/" "" "Relative"
relative = frontend "/#/" ""
"Relative"
prod = frontend "/#/" "https://v4.gargantext.org" "v4.gargantext.org"
prod = frontend "/#/" "https://v4.gargantext.org"
"v4.gargantext.org"
dev = frontend "/#/" "https://dev.gargantext.org" "gargantext.org (dev)"
dev = frontend "/#/" "https://dev.gargantext.org"
"gargantext.org (dev)"
demo = frontend "/#/" "https://demo.gargantext.org" "gargantext.org (demo)"
demo = frontend "/#/" "https://demo.gargantext.org" "gargantext.org (demo)"
haskell = frontend "/#/" "http://localhost:8008" "localhost.gargantext"
haskell = frontend "/#/" "http://localhost:8008"
"localhost.gargantext"
python = frontend "/#/" "http://localhost:8000" "localhost.python"
python = frontend "/#/" "http://localhost:8000"
"localhost.python"
caddy = frontend "/#/" "http://localhost:2015" "localhost.caddy"
caddy = frontend "/#/" "http://localhost:2015"
"localhost.caddy"
defaultStatics :: NonEmpty Array Frontend
defaultStatics :: NonEmpty Array Frontend
defaultStatics = relative :| []
defaultStatics = relative :| []
...
@@ -43,17 +73,6 @@ defaultStatic = head defaultStatics
...
@@ -43,17 +73,6 @@ defaultStatic = head defaultStatics
defaultFrontends :: Frontends
defaultFrontends :: Frontends
defaultFrontends = Frontends { app: defaultApp, static: defaultStatic }
defaultFrontends = Frontends { app: defaultApp, static: defaultStatic }
-- | public Backend
-- When user is not logged, use the location of the window
publicBackend :: Effect Backend
publicBackend = do
url <- location
pure $ Backend { name : "Public Backend"
, baseUrl : url
, prePath : "api/"
, version : V10
}
changePort :: String -> String
changePort :: String -> String
changePort = S.replace (S.Pattern "http://localhost:8000/") (S.Replacement "http://localhost:8008/")
changePort = S.replace (S.Pattern "http://localhost:8000/") (S.Replacement "http://localhost:8008/")
...
...
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