Commit 3ae4e5d5 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-scroll-fix

parents 7f26dc38 69db70a9
...@@ -3235,6 +3235,13 @@ ...@@ -3235,6 +3235,13 @@
"repo": "https://github.com/natefaubion/purescript-variant.git", "repo": "https://github.com/natefaubion/purescript-variant.git",
"version": "v6.0.1" "version": "v6.0.1"
}, },
"versions": {
"dependencies": [
"prelude"
],
"repo": "https://github.com/hdgarrood/purescript-versions.git",
"version": "v5.0.1"
},
"web-clipboard": { "web-clipboard": {
"dependencies": [ "dependencies": [
"web-html" "web-html"
......
{ {
"name": "Gargantext",
"version": "0.0.0.4",
"scripts": { "scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall", "rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall", "rebuild-set": "spago psc-package-insdhall",
......
...@@ -135,6 +135,11 @@ let additions = ...@@ -135,6 +135,11 @@ let additions =
[ "prelude", "maybe", "strings" ] [ "prelude", "maybe", "strings" ]
"https://github.com/truqu/purescript-read" "https://github.com/truqu/purescript-read"
"v1.0.1" "v1.0.1"
, versions =
mkPackage
[ "prelude" ]
"https://github.com/hdgarrood/purescript-versions.git"
"v5.0.1"
} }
in upstream ⫽ overrides ⫽ additions in upstream ⫽ overrides ⫽ additions
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"tuples-native", "tuples-native",
"uint", "uint",
"uri", "uri",
"versions",
"web-html" "web-html"
] ]
} }
...@@ -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)
...@@ -30,6 +32,7 @@ import Gargantext.Routes (AppRoute(..)) ...@@ -30,6 +32,7 @@ import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (Sessions, useSessions) import Gargantext.Sessions (Sessions, useSessions)
import Gargantext.Sessions as Sessions import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Version as GV
-- TODO (what does this mean?) -- TODO (what does this mean?)
-- tree changes endConfig state => trigger endConfig change in outerLayout, layoutFooter etc -- tree changes endConfig state => trigger endConfig change in outerLayout, layoutFooter etc
...@@ -50,7 +53,10 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where ...@@ -50,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 ->
...@@ -85,7 +91,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where ...@@ -85,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
...@@ -221,34 +227,65 @@ liNav (LiNav { title : title' ...@@ -221,34 +227,65 @@ 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' "No Backend Version"
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" , 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." }
} [ H.text ", Copyrights "
[ H.text ", Copyrights " , H.span { className: "glyphicon glyphicon-copyright-mark" } []
, H.span { className: "glyphicon glyphicon-copyright-mark" } [] , H.text " CNRS 2017-Present"
, H.text " CNRS 2017-Present" ]
] , H.a { href: "http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE"
, H.a { href: "http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE" , target: "blank"
, target: "blank" , title: "Legal instructions of the project."
, title: "Legal instructions of the project." }
} [ H.text ", Licences aGPLV3 and CECILL variant Affero compliant" ]
[ H.text ", Licences aGPLV3 and CECILL variant Affero compliant" ] , H.text "."
, H.text "." ]]
]]
] ]
...@@ -14,6 +14,12 @@ import Data.Set as Set ...@@ -14,6 +14,12 @@ import Data.Set as Set
import Data.Tuple (fst, snd, Tuple(..)) import Data.Tuple (fst, snd, Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Math (log)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as RH
import Record as Record
import Gargantext.Components.Forest (forest) import Gargantext.Components.Forest (forest)
import Gargantext.Components.Graph as Graph import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Controls as Controls import Gargantext.Components.GraphExplorer.Controls as Controls
...@@ -30,11 +36,6 @@ import Gargantext.Sessions (Session, Sessions, get) ...@@ -30,11 +36,6 @@ import Gargantext.Sessions (Session, Sessions, get)
import Gargantext.Types as Types import Gargantext.Types as Types
import Gargantext.Utils.Range as Range import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Math (log)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as RH
import Record as Record
type GraphId = Int type GraphId = Int
......
'use strict';
const pkg = require('../../package.json');
exports.version = pkg.version;
module Gargantext.Version where
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Config.REST as REST
import Gargantext.Ends (toUrl)
import Gargantext.Sessions (Session(..))
type Version = String
foreign import version :: Version
getBackendVersion :: Session -> Aff Version
getBackendVersion (Session { backend }) = REST.get Nothing (toUrl backend "version")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment