Commit 7b463fdd authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev-tree-reload' into dev-bootstrap-v4-upgrade

parents 87460766 3b60b4ef
......@@ -696,10 +696,18 @@ li .leaf:hover a.settings {
text-decoration: line-through;
}
.action-search {
margin: 10px;
}
.context-menu {
position: fixed;
}
.search-bar {
margin: 10px;
}
.range {
width: 400px;
/* some space for the right knob */
......
{"version":3,"sourceRoot":"","sources":["../../src/sass/_menu.sass","../../src/sass/_context_menu.sass","../../src/sass/_graph.sass","../../src/sass/_login.sass","../../src/sass/_tree.sass","../../src/sass/_code_editor.sass","../../src/sass/_styles.sass","../../src/sass/_range_slider.sass"],"names":[],"mappings":"AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;EACI;EACA;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;;;AAEF;AACI;EACA;;;AAEJ;AACI;EACA;;;AAGJ;AACA;EACI;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;EACA;;;AAEF;EACE;;;AC7CF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AClBF;EACE;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAnBA;EACE;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;;AAWN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAxCA;EACA;EAEA;EAuCE;EACA;;AACF;EACE;;AACF;EACE;;AAEF;EACE;;AAEF;EApDA;EACA;EAEA;EAmDE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AAGA;EACE;EACA;;AACN;EACE;;AACF;EACE;;AAEF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;ACvFJ;EACE;;;AAOF;EACE;;AACA;EACE;EACA;;;AAEJ;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAGF;EACE;;AAEE;EACE;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;AACN;EACE;EACA;EACA;EACA;;;AAGN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAEJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;;;AAGF;EACE;;;AAEJ;EACI;EACA;;;AAEJ;EACI;EACA;;;AAGF;EACE;;;AAEJ;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AC1KF;EACE;;;AAGA;EACE;EACA;;AACA;EACE;;AACF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAER;EACE;;AAEE;EACE;;AACA;EACE;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;AACF;EACE;;AAGN;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AAIR;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAEV;EACE;;AACF;EACE;;AAEE;EACE;;AACF;EACE;;AACN;EACE;;AAEE;EACE;EACA;;;AAGR;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;;AAIF;EACE;;AAEA;EACE;;;AC/HR;EACE;;AAEA;EACE;;AACA;EACE;;AACJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EArDR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AA2DM;EACE;EACA;EACA;EACA;EACA;EA7DR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAmEE;EACE;EACA;EACA;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAGE;EACE;;AAEF;EACE;;;ACtGV;EACE;;AACF;EACE;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAGE;EACE;EACA;;AAEF;EACE;EACA;;;AAEV;EACE;;AACA;EACE;EACA;EACA;;;AAKE;EACE;EACA;;AACF;EACE;;AACA;EACE;;AACJ;EACE;;;AAER;EACE;;;AC3CF;EACE;AACA;EACA;;AAEA;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA","file":"sass.css"}
\ No newline at end of file
{"version":3,"sourceRoot":"","sources":["../../src/sass/_menu.sass","../../src/sass/_context_menu.sass","../../src/sass/_graph.sass","../../src/sass/_login.sass","../../src/sass/_tree.sass","../../src/sass/_code_editor.sass","../../src/sass/_styles.sass","../../src/sass/_range_slider.sass"],"names":[],"mappings":"AAAA;AAEA;AACA;AACA;AACA;AACA;AAEA;EACI;EACA;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;;;AAEF;AACI;EACA;;;AAEJ;AACI;EACA;;;AAGJ;AACA;EACI;;;AAEJ;EACI;EACA;EACA;EACA;;;AAEJ;EACE;EACA;;;AAEF;EACE;;;AC7CF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;;;AClBF;EACE;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAnBA;EACE;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;;AAWN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EAxCA;EACA;EAEA;EAuCE;EACA;;AACF;EACE;;AACF;EACE;;AAEF;EACE;;AAEF;EApDA;EACA;EAEA;EAmDE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AAGA;EACE;EACA;;AACN;EACE;;AACF;EACE;;AAEF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;ACvFJ;EACE;;;AAOF;EACE;;AACA;EACE;EACA;;;AAEJ;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAEF;EACE;;;AAGF;EACE;;AAEE;EACE;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAKJ;EACE;EACA;EACA;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;AACN;EACE;EACA;EACA;EACA;;;AAGN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;;AAGE;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;;AAEJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;;;AAGF;EACE;;;AAEJ;EACI;EACA;;;AAEJ;EACI;EACA;;;AAGF;EACE;;;AAEJ;EACE;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;;;AC1KF;EACE;;;AAGA;EACE;EACA;;AACA;EACE;;AACF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAER;EACE;;AAEE;EACE;;AACA;EACE;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;;AACF;EACE;;AAGN;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AAIR;EACE;;AACF;EACE;;AACA;EACE;EACA;;AAEE;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAEV;EACE;;AACF;EACE;;AAEE;EACE;;AACF;EACE;;AACN;EACE;;AAEE;EACE;EACA;;;AAGR;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEF;EACE;;;AAIF;EACE;;AAEA;EACE;;;AC/HR;EACE;;AAEA;EACE;;AACA;EACE;;AACJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EArDR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AA2DM;EACE;EACA;EACA;EACA;EACA;EA7DR;EACA;EACA;EACA;EACA;EACA;EACA;EAlBA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAmEE;EACE;EACA;EACA;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;EACA;;AAGE;EACE;;AAEF;EACE;;;ACtGV;EACE;;AACF;EACE;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAGE;EACE;EACA;;AAEF;EACE;EACA;;;AAEV;EACE;;AACA;EACE;EACA;EACA;;;AAKE;EACE;EACA;;AACF;EACE;;AACA;EACE;;AACJ;EACE;;;AAER;EACE;;;AAEF;EACE;;;AAEF;EACE;;;ACjDF;EACE;AACA;EACA;;AAEA;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA","file":"sass.css"}
\ No newline at end of file
......@@ -64,9 +64,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
let forested = forestLayout { appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......@@ -74,9 +74,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
let forestedTB = forestLayoutWithTopBar { appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......@@ -89,7 +89,6 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
, visible: showLogin
}
]
let mCurrentRoute = fst route
let withSession sid f = maybe' defaultView (ff f) (Sessions.lookup sid (fst sessions))
let sessionUpdate s = snd sessions $ Sessions.Update s
......@@ -139,9 +138,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......@@ -162,10 +161,10 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
simpleLayout { handed } [
explorerLayout { asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, graphId
, handed: fst handed
, mCurrentRoute
, session
, sessions: (fst sessions)
, showLogin
......@@ -190,9 +189,9 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
appReload
, asyncTasksRef
, backend
, currentRoute: fst route
, frontends
, handed
, route: fst route
, sessions: fst sessions
, showLogin: snd showLogin
, treeReloadRef
......
......@@ -27,9 +27,9 @@ type Props = (
appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: Handed
, route :: AppRoute
, sessions :: Sessions
, showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe ReloadS)
......@@ -37,62 +37,63 @@ type Props = (
forest :: R2.Component Props
forest = R.createElement forestCpt
where
forestCpt :: R.Component Props
forestCpt = R.hooksComponentWithModule thisModule "forest" cpt
forestCpt :: R.Component Props
forestCpt = R.hooksComponentWithModule thisModule "forest" cpt where
cpt { appReload
, asyncTasksRef
, backend
, frontends
, handed
, route
, sessions
, showLogin
, treeReloadRef } _ = do
-- NOTE: this is a hack to reload the tree view on demand
reload <- R.useState' (0 :: Reload)
asyncTasks <- GAT.useTasks appReload reload
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: OpenNodes)
-- TODO If `treeReloadRef` is set, `reload` state should be updated
R.useEffect' $ do
R.setRef asyncTasksRef $ Just asyncTasks
case R.readRef treeReloadRef of
Nothing -> R.setRef treeReloadRef $ Just reload
Just _ -> pure unit
R2.useCache (
frontends
/\ route
/\ sessions
/\ fst openNodes
/\ fst appReload
/\ fst reload
/\ (fst asyncTasks).storage
/\ handed
)
(cpt' openNodes asyncTasks appReload reload showLogin backend)
cpt' openNodes asyncTasks appReload reload showLogin backend (frontends /\ route /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
pure $ H.div { className: "forest" } $ [plus handed showLogin backend] <> trees
where
trees = tree <$> unSessions sessions
tree s@(Session {treeId}) =
treeView { appReload
, asyncTasks
, frontends
, handed
, mCurrentRoute: Just route
, openNodes
, reload
, root: treeId
, session: s
} []
cpt { appReload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, sessions
, showLogin
, treeReloadRef } _ = do
-- NOTE: this is a hack to reload the tree view on demand
reload <- R.useState' (0 :: Reload)
asyncTasks <- GAT.useTasks appReload reload
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: OpenNodes)
-- TODO If `treeReloadRef` is set, `reload` state should be updated
R.useEffect' $ do
R.setRef asyncTasksRef $ Just asyncTasks
case R.readRef treeReloadRef of
Nothing -> R.setRef treeReloadRef $ Just reload
Just _ -> pure unit
R2.useCache (
frontends
/\ currentRoute
/\ sessions
/\ fst openNodes
/\ fst appReload
/\ fst reload
/\ (fst asyncTasks).storage
/\ handed
)
(cpt' openNodes asyncTasks appReload reload showLogin backend)
cpt' openNodes asyncTasks appReload reload showLogin backend (frontends /\ currentRoute /\ sessions /\ _ /\ _ /\ _ /\ _ /\ handed) = do
pure $ H.div { className: "forest" } $ [plus handed showLogin backend] <> trees
where
trees = tree <$> unSessions sessions
tree s@(Session {treeId}) =
treeView { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, openNodes
, reload
, root: treeId
, session: s
} []
plus :: Handed -> R.Setter Boolean -> R.State (Maybe Backend) -> R.Element
plus handed showLogin backend = H.div { className: "row" } [
H.button { title: "Add or remove connections to the server(s)."
H.button { className: "btn btn-secondary col-5 " <> if handed == RightHanded then "ml-1 mr-auto" else "ml-auto mr-1"
, on: {click}
, className: "btn btn-secondary col-5 " <> if handed == RightHanded then "ml-1 mr-auto" else "ml-auto mr-1"
, title: "Add or remove connections to the server(s)."
}
[ H.div { "type": ""
, className: "fa fa-universal-access" -- fa-lg
......@@ -114,9 +115,9 @@ type ForestLayoutProps = (
appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: R.State Handed
, route :: AppRoute
, sessions :: Sessions
, showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe ReloadS)
......@@ -124,10 +125,10 @@ type ForestLayoutProps = (
forestLayout :: R2.Component ForestLayoutProps
forestLayout props = R.createElement forestLayoutCpt props
forestLayoutCpt :: R.Component ForestLayoutProps
forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
where
forestLayoutCpt :: R.Component ForestLayoutProps
forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
cpt props@{ handed } children = do
pure $ R.fragment [ topBar { handed } [], forestLayoutMain props children ]
......@@ -135,10 +136,10 @@ forestLayoutCpt = R.hooksComponentWithModule thisModule "forestLayout" cpt
-- while the remaining ones are put into the main view
forestLayoutWithTopBar :: R2.Component ForestLayoutProps
forestLayoutWithTopBar props = R.createElement forestLayoutWithTopBarCpt props
forestLayoutWithTopBarCpt :: R.Component ForestLayoutProps
forestLayoutWithTopBarCpt = R.hooksComponentWithModule thisModule "forestLayoutWithTopBar" cpt
where
forestLayoutWithTopBarCpt :: R.Component ForestLayoutProps
forestLayoutWithTopBarCpt = R.hooksComponentWithModule thisModule "forestLayoutWithTopBar" cpt
cpt props@{ handed } children = do
let { head: topBarChild, tail: mainChildren } =
fromMaybe { head: H.div {} [], tail: [] } $ A.uncons children
......@@ -149,10 +150,10 @@ forestLayoutWithTopBarCpt = R.hooksComponentWithModule thisModule "forestLayoutW
forestLayoutMain :: R2.Component ForestLayoutProps
forestLayoutMain props = R.createElement forestLayoutMainCpt props
forestLayoutMainCpt :: R.Component ForestLayoutProps
forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" cpt
where
forestLayoutMainCpt :: R.Component ForestLayoutProps
forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" cpt
cpt props children = do
pure $ forestLayoutRaw props [
mainPage {} children
......@@ -160,16 +161,16 @@ forestLayoutMainCpt = R.hooksComponentWithModule thisModule "forestLayoutMain" c
forestLayoutRaw :: R2.Component ForestLayoutProps
forestLayoutRaw props = R.createElement forestLayoutRawCpt props
forestLayoutRawCpt :: R.Component ForestLayoutProps
forestLayoutRawCpt = R.hooksComponentWithModule thisModule "forestLayoutRaw" cpt
where
forestLayoutRawCpt :: R.Component ForestLayoutProps
forestLayoutRawCpt = R.hooksComponentWithModule thisModule "forestLayoutRaw" cpt
cpt { appReload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, route
, sessions
, showLogin
, treeReloadRef } children = do
......@@ -183,9 +184,9 @@ forestLayoutRawCpt = R.hooksComponentWithModule thisModule "forestLayoutRaw" cpt
forest { appReload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed: fst handed
, route
, sessions
, showLogin
, treeReloadRef } []
......@@ -194,10 +195,10 @@ forestLayoutRawCpt = R.hooksComponentWithModule thisModule "forestLayoutRaw" cpt
mainPage :: R2.Component ()
mainPage = R.createElement mainPageCpt
mainPageCpt :: R.Component ()
mainPageCpt = R.hooksComponentWithModule thisModule "mainPage" cpt
where
mainPageCpt :: R.Component ()
mainPageCpt = R.hooksComponentWithModule thisModule "mainPage" cpt
cpt {} children = do
pure $ H.div {className: "col-md-10"} [
H.div {id: "page-wrapper"} [
......
......@@ -46,9 +46,9 @@ thisModule = "Gargantext.Components.Forest.Tree"
------------------------------------------------------------------------
type CommonProps = (
appReload :: GT.ReloadS
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: GT.Handed
, mCurrentRoute :: Maybe AppRoute
, openNodes :: R.State OpenNodes
, reload :: GT.ReloadS
, session :: Session
......@@ -69,9 +69,9 @@ treeView = R.createElement elCpt
cpt { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, root
......@@ -79,9 +79,9 @@ treeView = R.createElement elCpt
} _children = do
pure $ treeLoadView { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, root
......@@ -96,9 +96,9 @@ treeLoadView = R.createElement elCpt
cpt { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, root
......@@ -106,9 +106,9 @@ treeLoadView = R.createElement elCpt
} _children = do
let fetch _ = getNodeTree session root
-- let paint loaded = loadedTreeView { asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload
-- , session
......@@ -117,9 +117,9 @@ treeLoadView = R.createElement elCpt
-- } []
let paint loaded = loadedTreeViewFirstLevel { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, session
......@@ -151,9 +151,9 @@ type TreeViewProps = (
-- cpt { appReload
-- , asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload
-- , session
......@@ -164,9 +164,9 @@ type TreeViewProps = (
-- H.div { className: if handed == GT.RightHanded then "righthanded" else "lefthanded" } [
-- toHtml { appReload
-- , asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload
-- , session
......@@ -184,9 +184,9 @@ loadedTreeViewFirstLevel = R.createElement elCpt
cpt { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, session
......@@ -197,9 +197,9 @@ loadedTreeViewFirstLevel = R.createElement elCpt
H.div { className: if handed == GT.RightHanded then "righthanded" else "lefthanded" } [
toHtmlFirstLevel { appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, reloadTree: reload
......@@ -229,9 +229,9 @@ type ToHtmlProps = (
-- cpt p@{ appReload
-- , asyncTasks
-- , currentRoute
-- , frontends
-- , handed
-- , mCurrentRoute
-- , openNodes
-- , reload: reload@(_ /\ setReload)
-- , session
......@@ -264,13 +264,13 @@ type ToHtmlProps = (
-- pure $ H.li { className: if A.null ary then "no-children" else "with-children" }
-- [ nodeSpan { appReload
-- , asyncTasks
-- , currentRoute
-- , dispatch: pAction
-- , folderOpen
-- , frontends
-- , handed
-- , id
-- , isLeaf: A.null ary
-- , mCurrentRoute
-- , name
-- , nodeType
-- , session
......@@ -301,9 +301,9 @@ toHtmlFirstLevel = R.createElement elCpt
cpt p@{ appReload
, asyncTasks
, currentRoute
, frontends
, handed
, mCurrentRoute
, openNodes
, reload: reload@(_ /\ setReload)
, reloadTree
......@@ -330,13 +330,13 @@ toHtmlFirstLevel = R.createElement elCpt
pure $ H.li { className: if A.null ary then "no-children" else "with-children" } $
[ nodeSpan { appReload
, asyncTasks
, currentRoute
, dispatch: pAction
, folderOpen
, frontends
, handed
, id
, isLeaf: A.null ary
, mCurrentRoute
, name
, nodeType
, session
......@@ -425,11 +425,11 @@ childNodeFirstLevel = R.createElement elCpt
cpt props@{ appReload
, asyncTasks
, currentRoute
, folderOpen
, id
, frontends
, handed
, mCurrentRoute
, openNodes
, reload
, reloadTree
......@@ -439,10 +439,10 @@ childNodeFirstLevel = R.createElement elCpt
let fetch _ = getNodeTreeFirstLevel session id
let paint loaded = childNodeFirstLevelPaint { appReload
, asyncTasks
, currentRoute
, folderOpen
, frontends
, handed
, mCurrentRoute
, openNodes
, reload: cptReload
, reloadTree
......
......@@ -44,11 +44,11 @@ thisModule = "Gargantext.Components.Forest.Tree.Node"
type NodeMainSpanProps = (
appReload :: GT.ReloadS
, asyncTasks :: GAT.Reductor
, currentRoute :: Routes.AppRoute
, folderOpen :: R.State Boolean
, frontends :: Frontends
, id :: ID
, isLeaf :: IsLeaf
, mCurrentRoute :: Maybe Routes.AppRoute
, name :: Name
, nodeType :: GT.NodeType
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
......@@ -59,28 +59,28 @@ type IsLeaf = Boolean
nodeSpan :: R2.Component NodeMainSpanProps
nodeSpan = R.createElement nodeSpanCpt
nodeSpanCpt :: R.Component NodeMainSpanProps
nodeSpanCpt = R.hooksComponentWithModule thisModule "nodeSpan" cpt
where
nodeSpanCpt :: R.Component NodeMainSpanProps
nodeSpanCpt = R.hooksComponentWithModule thisModule "nodeSpan" cpt
cpt props children = do
pure $ H.div {} ([ nodeMainSpan props [] ] <> children)
nodeMainSpan :: R2.Component NodeMainSpanProps
nodeMainSpan = R.createElement nodeMainSpanCpt
nodeMainSpanCpt :: R.Component NodeMainSpanProps
nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
where
nodeMainSpanCpt :: R.Component NodeMainSpanProps
nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
cpt props@{ appReload
, asyncTasks: (asyncTasks /\ dispatchAsyncTasks)
, currentRoute
, dispatch
, folderOpen
, frontends
, handed
, id
, isLeaf
, mCurrentRoute
, name
, nodeType
, session
......@@ -100,7 +100,7 @@ nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
GT.LeftHanded -> reverse
GT.RightHanded -> identity
let isSelected = mCurrentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
let isSelected = Just currentRoute == Routes.nodeTypeAppRoute nodeType (sessionId session) id
pure $ H.span (dropProps droppedFile isDragOver)
$ ordering
......@@ -142,8 +142,8 @@ nodeMainSpanCpt = R.hooksComponentWithModule thisModule "nodeMainSpan" cpt
, nodeActions { id
, nodeType
, refreshTree: const $ dispatch RefreshTree
, session
, triggerRefresh: const $ dispatch RefreshTree
}
......@@ -242,33 +242,33 @@ fldr nt open = if open
type NodeActionsProps =
( id :: ID
, nodeType :: GT.NodeType
, refreshTree :: Unit -> Aff Unit
, session :: Session
, triggerRefresh :: Unit -> Aff Unit
)
nodeActions :: Record NodeActionsProps -> R.Element
nodeActions p = R.createElement nodeActionsCpt p []
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = R.hooksComponentWithModule thisModule "nodeActions" cpt
where
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = R.hooksComponentWithModule thisModule "nodeActions" cpt
cpt { id
, nodeType: GT.Graph
, refreshTree
, session
, triggerRefresh
} _ = do
useLoader id (graphVersions session) $ \gv ->
nodeActionsGraph { id
, graphVersions: gv
, session
, triggerRefresh: triggerRefresh refreshTree
, triggerRefresh
}
cpt { id
, nodeType: GT.NodeList
, refreshTree
, session
, triggerRefresh
} _ = do
useLoader { nodeId: id, session } loadCorpusWithChild $
\{ corpusId } ->
......@@ -276,13 +276,12 @@ nodeActionsCpt = R.hooksComponentWithModule thisModule "nodeActions" cpt
, nodeId: corpusId
, nodeType: GT.TabNgramType GT.CTabTerms
, session
, triggerRefresh: triggerRefresh refreshTree
, triggerRefresh
}
cpt _ _ = do
pure $ H.div {} []
graphVersions session graphId = GraphAPI.graphVersions { graphId, session }
triggerRefresh refreshTree = refreshTree
-- END nodeActions
......@@ -3,17 +3,20 @@ module Gargantext.Components.Forest.Tree.Node.Action.Search where
import Data.Maybe (Maybe)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar (searchBar)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Lang (allLangs)
import Gargantext.Prelude (Unit, bind, pure, unit, ($), (<>))
import Gargantext.Sessions (Session)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Reactix as R
import Reactix.DOM.HTML as H
-- | Action : Search
......@@ -24,7 +27,7 @@ actionSearch :: Session
-> R.Hooks R.Element
actionSearch session id dispatch nodePopup = do
search <- R.useState' $ defaultSearch { node_id = id }
pure $ R.fragment [ H.p {"style": {"margin" :"10px"}}
pure $ R.fragment [ H.p { className: "action-search" }
[ H.text $ "Search and create a private "
<> "corpus with the search query as corpus name." ]
, searchBar { langs: allLangs
......@@ -41,6 +44,7 @@ actionSearch session id dispatch nodePopup = do
searchOn dispatch' p task = do
_ <- launchAff $ dispatch' (DoSearch task)
-- close popup
_ <- launchAff $ dispatch' ClosePopover
-- TODO
--snd p $ const Nothing
pure unit
module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar
( Props, searchBar, searchBarCpt
( Props
, searchBar
) where
import Data.Tuple.Nested ((/\))
......@@ -25,13 +26,13 @@ type Props = ( langs :: Array Lang
searchBar :: Record Props -> R.Element
searchBar props = R.createElement searchBarCpt props []
searchBarCpt :: R.Component Props
searchBarCpt = R.hooksComponentWithModule thisModule "searchBar" cpt
where
searchBarCpt :: R.Component Props
searchBarCpt = R.hooksComponentWithModule thisModule "searchBar" cpt
cpt {langs, onSearch, search: search@(s /\ _), session} _ = do
--onSearchChange session s
pure $ H.div {"style": {"margin" :"10px"}}
pure $ H.div { className: "search-bar" }
[ searchField { databases:allDatabases
, langs
, onSearch
......
......@@ -45,12 +45,12 @@ type Props =
searchField :: Record Props -> R.Element
searchField p = R.createElement searchFieldComponent p []
--searchFieldComponent :: R.Memo Props
--searchFieldComponent = R.memo (R.hooksComponentWithModule thisModule "searchField" cpt) eqProps
searchFieldComponent :: R.Component Props
searchFieldComponent = R.hooksComponentWithModule thisModule "searchField" cpt
where
--searchFieldComponent :: R.Memo Props
--searchFieldComponent = R.memo (R.hooksComponentWithModule thisModule "searchField" cpt) eqProps
searchFieldComponent :: R.Component Props
searchFieldComponent = R.hooksComponentWithModule thisModule "searchField" cpt
cpt props@{onSearch, search: search@(s /\ _)} _ = do
iframeRef <- R.useRef null
let params =
......@@ -361,15 +361,15 @@ type SubmitButtonProps =
submitButton :: Record SubmitButtonProps -> R.Element
submitButton p = R.createElement submitButtonComponent p []
submitButtonComponent :: R.Component SubmitButtonProps
submitButtonComponent = R.hooksComponentWithModule thisModule "submitButton" cpt
where
submitButtonComponent :: R.Component SubmitButtonProps
submitButtonComponent = R.hooksComponentWithModule thisModule "submitButton" cpt
cpt {onSearch, search: (mySearch /\ _), session} _ =
pure $
H.button { className: "btn btn-primary"
, "type" : "button"
, on : {click: doSearch onSearch session mySearch}
, on : { click: doSearch onSearch session mySearch }
, style : { width: "100%" }
} [ H.text "Launch Search" ]
......
......@@ -48,10 +48,10 @@ type CommonProps =
nodePopupView :: Record NodePopupProps -> R.Element
nodePopupView p = R.createElement nodePopupCpt p []
nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt = R.hooksComponentWithModule thisModule "nodePopupView" cpt
where
nodePopupCpt :: R.Component NodePopupProps
nodePopupCpt = R.hooksComponentWithModule thisModule "nodePopupView" cpt
cpt p _ = do
isOpen <- R.useState' false
......
......@@ -44,10 +44,10 @@ thisModule = "Gargantext.Components.GraphExplorer"
type LayoutProps = (
asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, graphId :: GET.GraphId
, handed :: Types.Handed
, mCurrentRoute :: AppRoute
, session :: Session
, sessions :: Sessions
, showLogin :: R.State Boolean
......@@ -94,13 +94,13 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
where
cpt props@{ asyncTasksRef
, backend
, currentRoute
, frontends
, graph
, graphId
, graphVersion
, handed
, hyperdataGraph
, mCurrentRoute
, mMetaData
, session
, sessions
......@@ -161,9 +161,9 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
, R2.row $ mainLayout handed $
tree { asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, mCurrentRoute
, reload: treeReload
, sessions
, show: fst controls.showTree
......@@ -219,14 +219,14 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
tree :: Record TreeProps -> R.Element
tree { show: false } = RH.div { id: "tree" } []
tree { asyncTasksRef, backend, frontends, handed, mCurrentRoute: route, reload, sessions, showLogin, treeReloadRef } =
tree { asyncTasksRef, backend, frontends, handed, currentRoute, reload, sessions, showLogin, treeReloadRef } =
RH.div {className: "col-md-2 graph-tree"} [
forest { appReload: reload
, asyncTasksRef
, backend
, currentRoute
, frontends
, handed
, route
, sessions
, showLogin
, treeReloadRef } []
......@@ -243,9 +243,9 @@ type TreeProps =
(
asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, frontends :: Frontends
, handed :: Types.Handed
, mCurrentRoute :: AppRoute
, reload :: Types.ReloadS
, sessions :: Sessions
, show :: Boolean
......
......@@ -40,5 +40,11 @@
.trash
text-decoration: line-through
.action-search
margin: 10px
.context-menu
position: fixed
.search-bar
margin: 10px
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