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
20c42e79
Commit
20c42e79
authored
Mar 20, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[version] show version footer (front & back) & warning if mismatch
parent
36874450
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
8 deletions
+45
-8
App.purs
src/Gargantext/Components/App.purs
+45
-8
No files found.
src/Gargantext/Components/App.purs
View file @
20c42e79
...
@@ -6,11 +6,13 @@ import Data.Array (fromFoldable)
...
@@ -6,11 +6,13 @@ import Data.Array (fromFoldable)
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), maybe')
import Data.Maybe (Maybe(..), maybe')
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect.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.Components.Data.Lang (LandingLang(..))
import Gargantext.Components.Data.Lang (LandingLang(..))
import Gargantext.Components.Folder (folder)
import Gargantext.Components.Forest (forest)
import Gargantext.Components.Forest (forest)
import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Login (login)
import Gargantext.Components.Login (login)
...
@@ -51,7 +53,10 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
...
@@ -51,7 +53,10 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
let forested = forestLayout frontends (fst sessions) (fst route) (snd showLogin)
let forested = forestLayout frontends (fst sessions) (fst route) (snd showLogin)
let mCurrentRoute = fst route
let mCurrentRoute = fst route
let backends = fromFoldable defaultBackends
let backends = fromFoldable defaultBackends
let withSession = \sid f -> maybe' (\_ -> forested $ homeLayout LL_EN) f $ Sessions.lookup sid (fst sessions)
let ff f session = R.fragment [ f session, version { session } ]
let withSession sid f =
maybe' (const $ forested $ homeLayout LL_EN) (ff f) $ Sessions.lookup sid (fst sessions)
pure $ case fst showLogin of
pure $ case fst showLogin of
true -> forested $ login { sessions, backends, visible: showLogin }
true -> forested $ login { sessions, backends, visible: showLogin }
false ->
false ->
...
@@ -86,7 +91,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
...
@@ -86,7 +91,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
forestLayout :: Frontends -> Sessions -> AppRoute -> R2.Setter Boolean -> R.Element -> R.Element
forestLayout :: Frontends -> Sessions -> AppRoute -> R2.Setter Boolean -> R.Element -> R.Element
forestLayout frontends sessions route showLogin child = do
forestLayout frontends sessions route showLogin child = do
R.fragment [ topBar {}, R2.row [main], footer {} ]
R.fragment [ topBar {}, R2.row [main], footer {
} ]
where
where
main =
main =
R.fragment
R.fragment
...
@@ -222,20 +227,52 @@ liNav (LiNav { title : title'
...
@@ -222,20 +227,52 @@ liNav (LiNav { title : title'
]
]
]
]
type VersionProps =
(
session :: Sessions.Session
)
version :: Record VersionProps -> R.Element
version props = R.createElement versionCpt props []
versionCpt :: R.Component VersionProps
versionCpt = R.hooksComponent "G.C.A.version" cpt
where
cpt { session } _ = do
(ver /\ setVer) <- R.useState' ""
R.useEffect' $ do
launchAff_ $ do
v <- GV.getBackendVersion session
liftEffect $ setVer $ const v
pure $ H.div { className: "container" } [
H.footer {}
[
H.span {} [ H.text $ "Frontend version: " <> GV.version <> ", " ]
, H.span {} [ H.text $ "backend version: " <> ver ]
, warning ver GV.version
]
]
warning backendVer frontendVer =
if backendVer == frontendVer then
H.div {} []
else
H.div { className: "text-danger" } [ H.text "Versions do not match" ]
footer :: {} -> R.Element
footer :: {} -> R.Element
footer props = R.createElement footerCpt props []
footer props = R.createElement footerCpt props []
footerCpt :: R.Component ()
footerCpt :: R.Component ()
footerCpt = R.
staticComponent "G.C.Layout
.footer" cpt
footerCpt = R.
hooksComponent "G.C.A
.footer" cpt
where
where
cpt _ _ =
cpt _ _ =
do
H.div { className: "container" }
pure $
H.div { className: "container" }
[ H.hr {}
[ H.hr {}
, H.footer {}
, H.footer {}
[ H.p {}
[ H.p {}
[ H.text "Gargantext "
[ H.text "Gargantext "
, H.span {className: "glyphicon glyphicon-registration-mark"} []
, H.span {className: "glyphicon glyphicon-registration-mark"} []
, H.text $ ", version 4.0 (frontend: " <> GV.version <> ", backend: TODO)"
, H.a { href: "http://www.cnrs.fr"
, H.a { href: "http://www.cnrs.fr"
, target: "blank"
, target: "blank"
, title: "Project hosted by CNRS."
, title: "Project hosted by CNRS."
...
...
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