Commit 0614de16 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-doc-annotation-issue

parents 7b97b8dc 50bd539c
...@@ -55,9 +55,9 @@ forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where ...@@ -55,9 +55,9 @@ forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where
, asyncTasks , asyncTasks
, frontends , frontends
, mCurrentRoute: Just route , mCurrentRoute: Just route
, session: s
, openNodes , openNodes
, reload , reload
, session: s
} }
plus :: R2.Setter Boolean -> R.Element plus :: R2.Setter Boolean -> R.Element
......
...@@ -59,20 +59,20 @@ treeView props = R.createElement treeViewCpt props [] ...@@ -59,20 +59,20 @@ treeView props = R.createElement treeViewCpt props []
treeViewCpt = R.hooksComponent "G.C.Tree.treeView" cpt treeViewCpt = R.hooksComponent "G.C.Tree.treeView" cpt
where where
cpt { root cpt { root
, mCurrentRoute , asyncTasks
, session
, frontends , frontends
, mCurrentRoute
, openNodes , openNodes
, reload , reload
, asyncTasks , session
} _children = pure } _children = pure
$ treeLoadView { root $ treeLoadView { root
, mCurrentRoute , asyncTasks
, session
, frontends , frontends
, mCurrentRoute
, openNodes , openNodes
, reload , reload
, asyncTasks , session
} }
treeLoadView :: Record Props -> R.Element treeLoadView :: Record Props -> R.Element
...@@ -83,11 +83,11 @@ treeLoadView p = R.createElement treeLoadViewCpt p [] ...@@ -83,11 +83,11 @@ treeLoadView p = R.createElement treeLoadViewCpt p []
where where
cpt { root cpt { root
, asyncTasks , asyncTasks
, mCurrentRoute
, session
, frontends , frontends
, mCurrentRoute
, openNodes , openNodes
, reload , reload
, session
} _children = do } _children = do
let fetch _ = getNodeTree session root let fetch _ = getNodeTree session root
let paint loaded = loadedTreeView { asyncTasks let paint loaded = loadedTreeView { asyncTasks
...@@ -123,9 +123,9 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p [] ...@@ -123,9 +123,9 @@ loadedTreeView p = R.createElement loadedTreeViewCpt p []
, mCurrentRoute , mCurrentRoute
, openNodes , openNodes
, reload , reload
, session
, tasks , tasks
, tree , tree
, session
} _ = pure $ H.ul { className: "tree"} } _ = pure $ H.ul { className: "tree"}
[ toHtml { asyncTasks [ toHtml { asyncTasks
, frontends , frontends
......
...@@ -5,6 +5,11 @@ import Data.Nullable (null) ...@@ -5,6 +5,11 @@ import Data.Nullable (null)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff) import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import React.SyntheticEvent as E
import Reactix as R
import Reactix.DOM.HTML as H
import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox) import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileContents(..)) import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileContents(..))
...@@ -28,10 +33,6 @@ import Gargantext.Types (Name, ID) ...@@ -28,10 +33,6 @@ import Gargantext.Types (Name, ID)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Popover as Popover import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import React.SyntheticEvent as E
import Reactix as R
import Reactix.DOM.HTML as H
import Web.File.FileReader.Aff (readAsText)
-- Main Node -- Main Node
...@@ -50,7 +51,7 @@ nodeMainSpan :: Record NodeMainSpanProps ...@@ -50,7 +51,7 @@ nodeMainSpan :: Record NodeMainSpanProps
-> R.Element -> R.Element
nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el p [] nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el p []
where where
el = R.hooksComponent "G.C.F.T.N.B.NodeMainSpan" cpt el = R.hooksComponent "G.C.F.T.N.NodeMainSpan" cpt
cpt props@{id, mCurrentRoute, name, nodeType, tasks: { onTaskFinish, tasks }} _ = do cpt props@{id, mCurrentRoute, name, nodeType, tasks: { onTaskFinish, tasks }} _ = do
-- only 1 popup at a time is allowed to be opened -- only 1 popup at a time is allowed to be opened
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile) droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
...@@ -71,16 +72,15 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el ...@@ -71,16 +72,15 @@ nodeMainSpan p@{ dispatch, folderOpen, frontends, session } = R.createElement el
, mNodePopupView props (onPopoverClose popoverRef) , mNodePopupView props (onPopoverClose popoverRef)
] ]
else H.div {} [] else H.div {} []
, H.a { href: (url frontends (GT.NodePath (sessionId session) nodeType (Just id))) , H.a { href: url frontends $ GT.NodePath (sessionId session) nodeType (Just id) }
} [ nodeText { isSelected: mCurrentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
[ nodeText { isSelected: mAppRouteId mCurrentRoute == Just id
, name: name' props , name: name' props
} ] } ]
, nodeActions { id , nodeActions { id
, nodeType , nodeType
, refreshTree: const $ dispatch RefreshTree , refreshTree: const $ dispatch RefreshTree
, session } , session }
, fileTypeView {dispatch, droppedFile, id, isDragOver, nodeType} , fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType }
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t , H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie , barType: Pie
, corpusId: id , corpusId: id
...@@ -221,24 +221,3 @@ nodeActionsCpt = R.hooksComponent "G.C.F.T.N.B.nodeActions" cpt ...@@ -221,24 +221,3 @@ nodeActionsCpt = R.hooksComponent "G.C.F.T.N.B.nodeActions" cpt
-- END nodeActions -- END nodeActions
mAppRouteId :: Maybe Routes.AppRoute -> Maybe Int
mAppRouteId (Just (Routes.Folder _ id)) = Just id
mAppRouteId (Just (Routes.FolderPrivate _ id)) = Just id
mAppRouteId (Just (Routes.FolderPublic _ id)) = Just id
mAppRouteId (Just (Routes.FolderShared _ id)) = Just id
mAppRouteId (Just (Routes.Team _ id)) = Just id
mAppRouteId (Just (Routes.Corpus _ id)) = Just id
mAppRouteId (Just (Routes.PGraphExplorer _ id)) = Just id
mAppRouteId (Just (Routes.Dashboard _ id)) = Just id
mAppRouteId (Just (Routes.Texts _ id)) = Just id
mAppRouteId (Just (Routes.Lists _ id)) = Just id
mAppRouteId (Just (Routes.Annuaire _ id)) = Just id
mAppRouteId (Just (Routes.UserPage _ id)) = Just id
mAppRouteId (Just (Routes.RouteFrameWrite _ id)) = Just id
mAppRouteId (Just (Routes.RouteFrameCalc _ id)) = Just id
mAppRouteId (Just (Routes.Document _ id _ )) = Just id
mAppRouteId (Just (Routes.ContactPage _ id _ )) = Just id
mAppRouteId (Just (Routes.CorpusDocument _ id _ _)) = Just id
mAppRouteId _ = Nothing
...@@ -4,6 +4,7 @@ import Prelude ...@@ -4,6 +4,7 @@ import Prelude
import Data.Foldable (oneOf) import Data.Foldable (oneOf)
import Data.Int (floor) import Data.Int (floor)
import Routing.Match (Match, lit, num, str) import Routing.Match (Match, lit, num, str)
import Gargantext.Routes (AppRoute(..)) import Gargantext.Routes (AppRoute(..))
import Gargantext.Types (SessionId(..)) import Gargantext.Types (SessionId(..))
......
...@@ -2,8 +2,10 @@ module Gargantext.Routes where ...@@ -2,8 +2,10 @@ module Gargantext.Routes where
import Prelude import Prelude
import Data.Maybe (Maybe) import Data.Maybe (Maybe(..))
import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType, Id, Limit, ListId, NgramsGetOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList, NgramsGetTableAllOpts) import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType, Id, Limit, ListId, NgramsGetOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList, NgramsGetTableAllOpts)
import Gargantext.Types as GT
data AppRoute data AppRoute
= Home = Home
...@@ -95,3 +97,16 @@ appPath (ContactPage s a i) = "annuaire/" <> show s <> "/" <> show a <> "/con ...@@ -95,3 +97,16 @@ appPath (ContactPage s a i) = "annuaire/" <> show s <> "/" <> show a <> "/con
appPath (RouteFrameWrite s i) = "write/" <> show s <> "/" <> show i appPath (RouteFrameWrite s i) = "write/" <> show s <> "/" <> show i
appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i appPath (RouteFrameCalc s i) = "calc/" <> show s <> "/" <> show i
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
nodeTypeAppRoute GT.NodeContact s i = Just $ Annuaire s i
nodeTypeAppRoute GT.Corpus s i = Just $ Corpus s i
nodeTypeAppRoute GT.Dashboard s i = Just $ Dashboard s i
nodeTypeAppRoute GT.Graph s i = Just $ PGraphExplorer s i
nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i
nodeTypeAppRoute GT.FolderPrivate s i = Just $ FolderPrivate s i
nodeTypeAppRoute GT.FolderPublic s i = Just $ FolderPublic s i
nodeTypeAppRoute GT.FolderShared s i = Just $ FolderShared s i
nodeTypeAppRoute GT.NodeUser s i = Just $ UserPage s i
nodeTypeAppRoute GT.Texts s i = Just $ Texts s i
nodeTypeAppRoute _ _ _ = Nothing
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