Commit 755821ba authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-merge' into dev

parents 844ae099 7ca6c353
...@@ -4,6 +4,10 @@ import Data.Array (fromFoldable) ...@@ -4,6 +4,10 @@ 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 Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Forest (forest) import Gargantext.Components.Forest (forest)
import Gargantext.Components.GraphExplorer (explorerLayout) import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Lang (LandingLang(..)) import Gargantext.Components.Lang (LandingLang(..))
...@@ -26,9 +30,6 @@ import Gargantext.Routes (AppRoute(..)) ...@@ -26,9 +30,6 @@ 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 Prelude
import Reactix as R
import Reactix.DOM.HTML as H
-- 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
...@@ -48,33 +49,32 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where ...@@ -48,33 +49,32 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
treeReload <- R.useState' 0 treeReload <- R.useState' 0
let forested child = forestLayout { child let backends = fromFoldable defaultBackends
, frontends let ff f session = R.fragment [ f session, footer { session } ]
, reload: treeReload let forested child = forestLayout { child
, route: fst route , frontends
, sessions: fst sessions , reload: treeReload
, showLogin: snd showLogin } , route: fst route
let mCurrentRoute = fst route , sessions: fst sessions
let backends = fromFoldable defaultBackends , showLogin: snd showLogin }
let ff f session = R.fragment [ f session, footer { session } ] let mCurrentRoute = fst route
let withSession sid f = let withSession sid f =
maybe' (const $ forested $ homeLayout LL_EN) (ff f) $ Sessions.lookup sid (fst sessions) 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 { backends, sessions, visible: showLogin }
false -> false ->
case fst route of case fst route of
Home -> forested $ homeLayout LL_EN Home -> forested $ homeLayout LL_EN
Login -> login { sessions, backends, visible: showLogin } Login -> login { backends, sessions, visible: showLogin }
--Folder sid _ -> withSession sid $ \_ -> forested (folder {}) Folder sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
Folder sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session } FolderPrivate sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
FolderPrivate sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session } FolderPublic sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
FolderPublic sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session } FolderShared sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
FolderShared sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session } Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session } RouteFrameWrite sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session }
RouteFrameWrite sid nodeId -> withSession sid $ \session -> forested $ frameLayout { key: show nodeId, nodeId, session } RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session }
RouteFrameCalc sid nodeId -> withSession sid $ \session -> forested $ frameLayout { key: show nodeId, nodeId, session } Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { key: show nodeId, nodeId, session }
Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { nodeId, session, frontends } Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { nodeId, session, frontends }
Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { nodeId, session } Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { nodeId, session }
Dashboard sid nodeId -> withSession sid $ \session -> forested $ dashboardLayout { nodeId, session } Dashboard sid nodeId -> withSession sid $ \session -> forested $ dashboardLayout { nodeId, session }
...@@ -107,13 +107,24 @@ type ForestLayoutProps = ...@@ -107,13 +107,24 @@ type ForestLayoutProps =
) )
forestLayout :: Record ForestLayoutProps -> R.Element forestLayout :: Record ForestLayoutProps -> R.Element
forestLayout { child, frontends, reload, route, sessions, showLogin } = do forestLayout props = R.createElement forestLayoutCpt props []
R.fragment [ topBar {}, R2.row [main] ]
forestLayoutCpt :: R.Component ForestLayoutProps
forestLayoutCpt = R.hooksComponent "G.C.A.forestLayout" cpt
where
cpt props _ = do
pure $ R.fragment [ topBar {}, forestLayoutMain props ]
forestLayoutMain :: Record ForestLayoutProps -> R.Element
forestLayoutMain props = R.createElement forestLayoutMainCpt props []
forestLayoutMainCpt :: R.Component ForestLayoutProps
forestLayoutMainCpt = R.hooksComponent "G.C.A.forestLayoutMain" cpt
where where
main = cpt { child, frontends, reload, route, sessions, showLogin } _ = do
R.fragment pure $ R2.row [
[ H.div {className: "col-md-2", style: {paddingTop: "60px"}} H.div { className: "col-md-2", style: { paddingTop: "60px" } }
[ forest { frontends, reload, route, sessions, showLogin } ] [ forest { frontends, reload, route, sessions, showLogin } ]
, mainPage child , mainPage child
] ]
......
module Gargantext.Components.Nodes.Annuaire where module Gargantext.Components.Nodes.Annuaire where
import Prelude (bind, const, identity, pure, show, ($), (<$>), (<>))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Array as A import Data.Array as A
import Data.List as L import Data.List as L
...@@ -31,18 +32,38 @@ newtype IndividuView = ...@@ -31,18 +32,38 @@ newtype IndividuView =
-- | Top level layout component. Loads an annuaire by id and renders -- | Top level layout component. Loads an annuaire by id and renders
-- | the annuaire using the result -- | the annuaire using the result
type LayoutProps = ( nodeId :: Int, session :: Session, frontends :: Frontends ) type LayoutProps = (
frontends :: Frontends
, nodeId :: Int
, session :: Session
)
annuaireLayout :: Record LayoutProps -> R.Element annuaireLayout :: Record LayoutProps -> R.Element
annuaireLayout props = R.createElement annuaireLayoutCpt props [] annuaireLayout props = R.createElement annuaireLayoutCpt props []
annuaireLayoutCpt :: R.Component LayoutProps annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt = R.hooksComponent "G.P.Annuaire.annuaireLayout" cpt annuaireLayoutCpt = R.hooksComponent "G.C.N.A.annuaireLayout" cpt
where
cpt { frontends, nodeId, session } _ = do
let sid = sessionId session
pure $ annuaireLayoutWithKey { frontends, key: show sid <> "-" <> show nodeId, nodeId, session }
type KeyLayoutProps = (
key :: String
| LayoutProps
)
annuaireLayoutWithKey :: Record KeyLayoutProps -> R.Element
annuaireLayoutWithKey props = R.createElement annuaireLayoutWithKeyCpt props []
annuaireLayoutWithKeyCpt :: R.Component KeyLayoutProps
annuaireLayoutWithKeyCpt = R.hooksComponent "G.C.N.A.annuaireLayoutWithKey" cpt
where where
cpt {nodeId, session, frontends} _ = do cpt { frontends, nodeId, session } _ = do
path <- R.useState' nodeId path <- R.useState' nodeId
useLoader (fst path) (getAnnuaireInfo session) $ useLoader (fst path) (getAnnuaireInfo session) $
\info -> annuaire {session, path, info, frontends} \info -> annuaire { frontends, info, path, session }
type AnnuaireProps = type AnnuaireProps =
( session :: Session ( session :: Session
......
...@@ -18,7 +18,8 @@ import Gargantext.Ends (Frontends) ...@@ -18,7 +18,8 @@ import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==)) import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==))
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put) import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..)) import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
...@@ -133,15 +134,35 @@ infoRender (Tuple title content) = ...@@ -133,15 +134,35 @@ infoRender (Tuple title content) =
[ H.span { className: "badge badge-default badge-pill"} [ H.text title ] [ H.span { className: "badge badge-default badge-pill"} [ H.text title ]
, H.span {} [H.text content] ] , H.span {} [H.text content] ]
type LayoutProps = ( frontends :: Frontends, nodeId :: Int, session :: Session ) type LayoutProps = (
frontends :: Frontends
, nodeId :: Int
, session :: Session
)
type KeyLayoutProps = (
key :: String
| LayoutProps
)
userLayout :: Record LayoutProps -> R.Element userLayout :: Record LayoutProps -> R.Element
userLayout props = R.createElement userLayoutCpt props [] userLayout props = R.createElement userLayoutCpt props []
userLayoutCpt :: R.Component LayoutProps userLayoutCpt :: R.Component LayoutProps
userLayoutCpt = R.hooksComponent "G.C.Nodes.Annuaire.User.Contacts.userLayout" cpt userLayoutCpt = R.hooksComponent "G.C.N.A.U.C.userLayout" cpt
where
cpt { frontends, nodeId, session } _ = do
let sid = sessionId session
pure $ userLayoutWithKey { frontends, key: show sid <> "-" <> show nodeId, nodeId, session }
userLayoutWithKey :: Record KeyLayoutProps -> R.Element
userLayoutWithKey props = R.createElement userLayoutWithKeyCpt props []
userLayoutWithKeyCpt :: R.Component KeyLayoutProps
userLayoutWithKeyCpt = R.hooksComponent "G.C.N.A.U.C.userLayoutWithKey" cpt
where where
cpt {frontends, nodeId, session} _ = do cpt { frontends, nodeId, session } _ = do
reload <- R.useState' 0 reload <- R.useState' 0
useLoader {nodeId, reload: fst reload, session} getContactWithReload $ useLoader {nodeId, reload: fst reload, session} getContactWithReload $
......
...@@ -24,7 +24,7 @@ import Gargantext.Components.Nodes.Corpus.Types (CorpusData, FTField, Field(..), ...@@ -24,7 +24,7 @@ import Gargantext.Components.Nodes.Corpus.Types (CorpusData, FTField, Field(..),
import Gargantext.Data.Array as GDA import Gargantext.Data.Array as GDA
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI, Children)) import Gargantext.Routes (SessionRoute(NodeAPI, Children))
import Gargantext.Sessions (Session, get, put) import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..), AffTableResult) import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as Crypto import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -41,13 +41,25 @@ type KeyProps = ...@@ -41,13 +41,25 @@ type KeyProps =
| Props | Props
) )
corpusLayout :: Record KeyProps -> R.Element corpusLayout :: Record Props -> R.Element
corpusLayout props = R.createElement corpusLayoutCpt props [] corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayoutCpt :: R.Component KeyProps corpusLayoutCpt :: R.Component Props
corpusLayoutCpt = R.hooksComponent "G.C.N.C.corpusLayout" cpt corpusLayoutCpt = R.hooksComponent "G.C.N.C.corpusLayout" cpt
where where
cpt {nodeId, session} _ = do cpt { nodeId, session } _ = do
let sid = sessionId session
pure $ corpusLayoutWithKey { key: show sid <> "-" <> show nodeId, nodeId, session }
corpusLayoutWithKey :: Record KeyProps -> R.Element
corpusLayoutWithKey props = R.createElement corpusLayoutWithKeyCpt props []
corpusLayoutWithKeyCpt :: R.Component KeyProps
corpusLayoutWithKeyCpt = R.hooksComponent "G.C.N.C.corpusLayoutWithKey" cpt
where
cpt { nodeId, session } _ = do
reload <- R.useState' 0 reload <- R.useState' 0
useLoader {nodeId, reload: fst reload, session} loadCorpusWithReload $ useLoader {nodeId, reload: fst reload, session} loadCorpusWithReload $
......
...@@ -8,15 +8,16 @@ import Data.Tuple.Nested ((/\)) ...@@ -8,15 +8,16 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (launchAff_) import Effect.Aff (launchAff_)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Dashboard.Types as DT import Gargantext.Components.Nodes.Dashboard.Types as DT
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (NodeID) import Gargantext.Types (NodeID)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
type Props = type Props =
( nodeId :: NodeID ( nodeId :: NodeID
...@@ -29,7 +30,23 @@ dashboardLayout props = R.createElement dashboardLayoutCpt props [] ...@@ -29,7 +30,23 @@ dashboardLayout props = R.createElement dashboardLayoutCpt props []
dashboardLayoutCpt :: R.Component Props dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt = R.hooksComponent "G.C.N.C.D.dashboardLayout" cpt dashboardLayoutCpt = R.hooksComponent "G.C.N.C.D.dashboardLayout" cpt
where where
cpt params@{nodeId, session} _ = do cpt { nodeId, session } _ = do
let sid = sessionId session
pure $ dashboardLayoutWithKey { key: show sid <> "-" <> show nodeId, nodeId, session }
type KeyProps = (
key :: String
| Props
)
dashboardLayoutWithKey :: Record KeyProps -> R.Element
dashboardLayoutWithKey props = R.createElement dashboardLayoutWithKeyCpt props []
dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = R.hooksComponent "G.C.N.C.D.dashboardLayoutWithKey" cpt
where
cpt { nodeId, session } _ = do
reload <- R.useState' 0 reload <- R.useState' 0
useLoader {nodeId, reload: fst reload, session} DT.loadDashboardWithReload $ useLoader {nodeId, reload: fst reload, session} DT.loadDashboardWithReload $
......
module Gargantext.Components.Nodes.Corpus.Document where module Gargantext.Components.Nodes.Corpus.Document where
import Prelude (class Show, bind, mempty, pure, ($), (<>)) import Prelude (class Show, bind, mempty, pure, show, ($), (<>))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:?))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
...@@ -22,7 +22,7 @@ import Gargantext.Components.NgramsTable.Core ...@@ -22,7 +22,7 @@ import Gargantext.Components.NgramsTable.Core
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..)) import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get) import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (CTabNgramType(..), NodeType(..), TabSubType(..), TabType(..), TermList, ScoreType(..)) import Gargantext.Types (CTabNgramType(..), NodeType(..), TabSubType(..), TabType(..), TermList, ScoreType(..))
import Gargantext.Utils as U import Gargantext.Utils as U
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -363,20 +363,45 @@ docViewClass :: ReactClass { children :: Children ...@@ -363,20 +363,45 @@ docViewClass :: ReactClass { children :: Children
} }
docViewClass = createClass "DocumentView" docViewSpec initialState docViewClass = createClass "DocumentView" docViewSpec initialState
type LayoutProps = ( session :: Session, nodeId :: Int, listId :: Int, corpusId :: Maybe Int ) type LayoutProps = (
corpusId :: Maybe Int
, listId :: Int
, nodeId :: Int
, session :: Session
)
documentLayout :: Record LayoutProps -> R.Element documentLayout :: Record LayoutProps -> R.Element
documentLayout props = R.createElement documentLayoutCpt props [] documentLayout props = R.createElement documentLayoutCpt props []
documentLayoutCpt :: R.Component LayoutProps documentLayoutCpt :: R.Component LayoutProps
documentLayoutCpt = R.hooksComponent "G.P.Corpus.Document.documentLayout" cpt documentLayoutCpt = R.hooksComponent "G.C.N.C.D.documentLayout" cpt
where where
cpt {session, nodeId, listId, corpusId} _ = do cpt { corpusId, listId, nodeId, session } _ = do
let sid = sessionId session
pure $ documentLayoutWithKey { corpusId
, key: show sid <> "-" <> show nodeId
, listId
, nodeId
, session }
type KeyLayoutProps = (
key :: String
| LayoutProps
)
documentLayoutWithKey :: Record KeyLayoutProps -> R.Element
documentLayoutWithKey props = R.createElement documentLayoutWithKeyCpt props []
documentLayoutWithKeyCpt :: R.Component KeyLayoutProps
documentLayoutWithKeyCpt = R.hooksComponent "G.C.N.C.D.documentLayoutWithKey" cpt
where
cpt { corpusId, listId, nodeId, session } _ = do
useLoader path loadData $ \loaded -> useLoader path loadData $ \loaded ->
R2.createElement' docViewClass {path, loaded} [] R2.createElement' docViewClass {path, loaded} []
where where
tabType = TabDocument (TabNgramType CTabTerms) tabType = TabDocument (TabNgramType CTabTerms)
path = {session, nodeId, listIds: [listId], corpusId, tabType} path = { corpusId, listIds: [listId], nodeId, session, tabType }
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
...@@ -3,21 +3,22 @@ module Gargantext.Components.Nodes.Frame where ...@@ -3,21 +3,22 @@ module Gargantext.Components.Nodes.Frame where
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Tuple (fst) import Data.Tuple (fst)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (NodeType(..))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
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 Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson) --import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Data.Argonaut (decodeJson, (.:)) import Data.Argonaut (decodeJson, (.:))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
data Hyperdata = data Hyperdata =
Hyperdata { base :: String Hyperdata { base :: String
, frame_id :: String , frame_id :: String
...@@ -56,13 +57,24 @@ type KeyProps = ...@@ -56,13 +57,24 @@ type KeyProps =
| Props | Props
) )
frameLayout :: Record KeyProps -> R.Element frameLayout :: Record Props -> R.Element
frameLayout props = R.createElement frameLayoutCpt props [] frameLayout props = R.createElement frameLayoutCpt props []
frameLayoutCpt :: R.Component KeyProps frameLayoutCpt :: R.Component Props
frameLayoutCpt = R.hooksComponent "G.C.N.C.writeLayout" cpt frameLayoutCpt = R.hooksComponent "G.C.N.F.frameLayout" cpt
where where
cpt {nodeId, session} _ = do cpt {nodeId, session} _ = do
let sid = sessionId session
pure $ frameLayoutWithKey { key: show sid <> "-" <> show nodeId, nodeId, session }
frameLayoutWithKey :: Record KeyProps -> R.Element
frameLayoutWithKey props = R.createElement frameLayoutWithKeyCpt props []
frameLayoutWithKeyCpt :: R.Component KeyProps
frameLayoutWithKeyCpt = R.hooksComponent "G.C.N.F.frameLayoutWithKey" cpt
where
cpt { nodeId, session } _ = do
reload <- R.useState' 0 reload <- R.useState' 0
useLoader {nodeId, reload: fst reload, session} loadframeWithReload $ useLoader {nodeId, reload: fst reload, session} loadframeWithReload $
......
...@@ -9,22 +9,43 @@ import Gargantext.Components.Nodes.Lists.Tabs as Tabs ...@@ -9,22 +9,43 @@ import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session, sessionId)
------------------------------------------------------------------------ ------------------------------------------------------------------------
------------------------------------------------------------------------ ------------------------------------------------------------------------
type Props = ( session :: Session, nodeId :: Int ) type Props = (
nodeId :: Int
, session :: Session
)
listsLayout :: Record Props -> R.Element listsLayout :: Record Props -> R.Element
listsLayout props = R.createElement listsLayoutCpt props [] listsLayout props = R.createElement listsLayoutCpt props []
listsLayoutCpt :: R.Component Props listsLayoutCpt :: R.Component Props
listsLayoutCpt = R.hooksComponent "G.P.Lists.listsLayout" cpt listsLayoutCpt = R.hooksComponent "G.C.N.L.listsLayout" cpt
where where
cpt path@{session} _ = cpt path@{ nodeId, session } _ = do
let sid = sessionId session
pure $ listsLayoutWithKey { key: show sid <> "-" <> show nodeId, nodeId, session }
type KeyProps = (
key :: String
| Props
)
listsLayoutWithKey :: Record KeyProps -> R.Element
listsLayoutWithKey props = R.createElement listsLayoutWithKeyCpt props []
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt = R.hooksComponent "G.C.N.L.listsLayoutWithKey" cpt
where
cpt { nodeId, session } _ = do
let path = { nodeId, session }
useLoader path loadCorpusWithChild $ useLoader path loadCorpusWithChild $
\corpusData@{corpusId, defaultListId, corpusNode: NodePoly poly} -> \corpusData@{ corpusId, corpusNode: NodePoly poly, defaultListId } ->
let { name, date, hyperdata : Hyperdata h} = poly let { date, hyperdata : Hyperdata h, name } = poly
CorpusInfo {desc,query,authors} = getCorpusInfo h.fields CorpusInfo {desc,query,authors} = getCorpusInfo h.fields
in in
R.fragment R.fragment
......
...@@ -17,29 +17,48 @@ import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..), getC ...@@ -17,29 +17,48 @@ import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..), getC
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..)) import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
-------------------------------------------------------- --------------------------------------------------------
type Props = ( frontends :: Frontends, session :: Session, nodeId :: Int ) type Props = (
frontends :: Frontends
, nodeId :: Int
, session :: Session
)
textsLayout :: Record Props -> R.Element textsLayout :: Record Props -> R.Element
textsLayout props = R.createElement textsLayoutCpt props [] textsLayout props = R.createElement textsLayoutCpt props []
------------------------------------------------------------------------ ------------------------------------------------------------------------
textsLayoutCpt :: R.Component Props textsLayoutCpt :: R.Component Props
textsLayoutCpt = R.hooksComponent "G.C.Nodes.Texts.textsLayout" cpt where textsLayoutCpt = R.hooksComponent "G.C.N.T.textsLayout" cpt where
cpt {session,nodeId,frontends} _ = do cpt { frontends, nodeId, session } _ = do
pure $ loader {session, nodeId} loadCorpusWithChild paint let sid = sessionId session
where
paint corpusData@{corpusId, corpusNode, defaultListId} = pure $ textsLayoutWithKey { frontends, key: show sid <> "-" <> show nodeId, nodeId, session }
R.fragment [ Table.tableHeaderLayout headerProps, tabs' ]
where type KeyProps = (
NodePoly { name, date, hyperdata: Hyperdata h } = corpusNode key :: String
CorpusInfo {desc,query,authors} = getCorpusInfo h.fields | Props
tabs' = tabs {session, corpusId, corpusData, frontends} )
title = "Corpus " <> name
headerProps = { title, desc, query, date, user:authors } textsLayoutWithKey :: Record KeyProps -> R.Element
textsLayoutWithKey props = R.createElement textsLayoutWithKeyCpt props []
textsLayoutWithKeyCpt = R.hooksComponent "G.C.N.T.textsLayoutWithKey" cpt
where
cpt { frontends, nodeId, session } _ = do
pure $ loader {session, nodeId} loadCorpusWithChild paint
where
paint corpusData@{corpusId, corpusNode, defaultListId} =
R.fragment [ Table.tableHeaderLayout headerProps, tabs' ]
where
NodePoly { name, date, hyperdata: Hyperdata h } = corpusNode
CorpusInfo {desc,query,authors} = getCorpusInfo h.fields
tabs' = tabs {session, corpusId, corpusData, frontends}
title = "Corpus " <> name
headerProps = { title, desc, query, date, user:authors }
data Mode = MoreLikeFav | MoreLikeTrash data Mode = MoreLikeFav | MoreLikeTrash
......
...@@ -41,7 +41,7 @@ versionCpt = R.hooksComponent "G.C.A.version" cpt ...@@ -41,7 +41,7 @@ versionCpt = R.hooksComponent "G.C.A.version" cpt
pure $ case version == versionBack of pure $ case version == versionBack of
true -> H.a { className: "fa fa-check-circle-o" true -> H.a { className: "fa fa-check-circle-o"
, "text-decoration": "none" , textDecoration: "none"
, title: "Versions match: frontend (" , title: "Versions match: frontend ("
<> version <> version
<> "), backend (" <> "), backend ("
...@@ -49,7 +49,7 @@ versionCpt = R.hooksComponent "G.C.A.version" cpt ...@@ -49,7 +49,7 @@ versionCpt = R.hooksComponent "G.C.A.version" cpt
<> ")" <> ")"
} [] } []
false -> H.a { className: "fa fa-exclamation-triangle" false -> H.a { className: "fa fa-exclamation-triangle"
, "text-decoration": "none" , textDecoration: "none"
, title: "Versions mismatch: frontend (" , title: "Versions mismatch: frontend ("
<> version <> version
<> "), backend (" <> "), backend ("
......
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