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

Merge branch 'dev' into dev-scroll-fix

parents 7f26dc38 69db70a9
......@@ -3235,6 +3235,13 @@
"repo": "https://github.com/natefaubion/purescript-variant.git",
"version": "v6.0.1"
},
"versions": {
"dependencies": [
"prelude"
],
"repo": "https://github.com/hdgarrood/purescript-versions.git",
"version": "v5.0.1"
},
"web-clipboard": {
"dependencies": [
"web-html"
......
{
"name": "Gargantext",
"version": "0.0.0.4",
"scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall",
......
......@@ -135,6 +135,11 @@ let additions =
[ "prelude", "maybe", "strings" ]
"https://github.com/truqu/purescript-read"
"v1.0.1"
, versions =
mkPackage
[ "prelude" ]
"https://github.com/hdgarrood/purescript-versions.git"
"v5.0.1"
}
in upstream ⫽ overrides ⫽ additions
......@@ -40,6 +40,7 @@
"tuples-native",
"uint",
"uri",
"versions",
"web-html"
]
}
......@@ -6,11 +6,13 @@ import Data.Array (fromFoldable)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..), maybe')
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Data.Lang (LandingLang(..))
import Gargantext.Components.Folder (folder)
import Gargantext.Components.Forest (forest)
import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Login (login)
......@@ -30,6 +32,7 @@ import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (Sessions, useSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2
import Gargantext.Version as GV
-- TODO (what does this mean?)
-- tree changes endConfig state => trigger endConfig change in outerLayout, layoutFooter etc
......@@ -50,7 +53,10 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
let forested = forestLayout frontends (fst sessions) (fst route) (snd showLogin)
let mCurrentRoute = fst route
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
true -> forested $ login { sessions, backends, visible: showLogin }
false ->
......@@ -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 route showLogin child = do
R.fragment [ topBar {}, R2.row [main], footer {} ]
R.fragment [ topBar {}, R2.row [main], footer { } ]
where
main =
R.fragment
......@@ -221,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' "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 props = R.createElement footerCpt props []
footerCpt :: R.Component ()
footerCpt = R.staticComponent "G.C.Layout.footer" cpt
footerCpt = R.hooksComponent "G.C.A.footer" cpt
where
cpt _ _ =
H.div { className: "container" }
cpt _ _ = do
pure $ H.div { className: "container" }
[ H.hr {}
, H.footer {}
[ H.p {}
[ H.text "Gargantext "
, H.span {className: "glyphicon glyphicon-registration-mark"} []
, H.text ", version 4.0"
, H.a { href: "http://www.cnrs.fr"
, target: "blank"
, title: "Project hosted by CNRS."
......@@ -251,4 +289,3 @@ footerCpt = R.staticComponent "G.C.Layout.footer" cpt
, H.text "."
]]
]
......@@ -14,6 +14,12 @@ import Data.Set as Set
import Data.Tuple (fst, snd, Tuple(..))
import Data.Tuple.Nested ((/\))
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.Graph as Graph
import Gargantext.Components.GraphExplorer.Controls as Controls
......@@ -30,11 +36,6 @@ import Gargantext.Sessions (Session, Sessions, get)
import Gargantext.Types as Types
import Gargantext.Utils.Range as Range
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
......
'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