Commit 3df5b689 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TREE] Refresh (WIP)

parent 99ca6f6e
...@@ -31,13 +31,20 @@ forestCpt :: R.Component Props ...@@ -31,13 +31,20 @@ forestCpt :: R.Component Props
forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where forestCpt = R.hooksComponent "G.C.Forest.forest" cpt where
cpt {frontends, route, sessions, showLogin } _ = do cpt {frontends, route, sessions, showLogin } _ = do
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: Set TreeId) openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: Set TreeId)
R2.useCache (frontends /\ route /\ sessions /\ fst openNodes) (cpt' openNodes showLogin) reload <- R.useState' (0 :: Int)
cpt' openNodes showLogin (frontends /\ route /\ sessions /\ openNodesState) = do R2.useCache (frontends /\ route /\ sessions /\ fst openNodes) (cpt' reload openNodes showLogin)
cpt' reload openNodes showLogin (frontends /\ route /\ sessions /\ openNodesState) = do
pure $ R.fragment $ A.cons (plus showLogin) trees pure $ R.fragment $ A.cons (plus showLogin) trees
where where
trees = tree <$> unSessions sessions trees = tree <$> unSessions sessions
tree s@(Session {treeId}) = tree s@(Session {treeId}) =
treeView { root: treeId, frontends, mCurrentRoute: Just route, session: s, openNodes } treeView { root: treeId
, frontends
, mCurrentRoute: Just route
, session: s
, openNodes
, reload
}
plus :: R2.Setter Boolean -> R.Element plus :: R2.Setter Boolean -> R.Element
plus showLogin = plus showLogin =
......
...@@ -29,6 +29,7 @@ type Props = ( root :: ID ...@@ -29,6 +29,7 @@ type Props = ( root :: ID
, session :: Session , session :: Session
, frontends :: Frontends , frontends :: Frontends
, openNodes :: R.State (Set TreeId) , openNodes :: R.State (Set TreeId)
, reload :: R.State Int
) )
treeView :: Record Props -> R.Element treeView :: Record Props -> R.Element
......
...@@ -44,7 +44,7 @@ uploadFileViewCpt d = R.hooksComponent "UploadFileView" cpt ...@@ -44,7 +44,7 @@ uploadFileViewCpt d = R.hooksComponent "UploadFileView" cpt
[ R2.select {className: "col-md-12 form-control" [ R2.select {className: "col-md-12 form-control"
, on: {change: onChangeFileType fileType} , on: {change: onChangeFileType fileType}
} }
(map renderOption [CSV, PresseRIS]) (map renderOption [CSV, CSV_HAL])
] ]
, H.div {} , H.div {}
[ uploadButton d id mContents fileType ] [ uploadButton d id mContents fileType ]
...@@ -127,7 +127,7 @@ fileTypeView d p (Just (DroppedFile {contents, fileType}) /\ setDroppedFile) (_ ...@@ -127,7 +127,7 @@ fileTypeView d p (Just (DroppedFile {contents, fileType}) /\ setDroppedFile) (_
[ R2.select {className: "col-md-12 form-control" [ R2.select {className: "col-md-12 form-control"
, on: {change: onChange} , on: {change: onChange}
} }
(map renderOption [CSV, PresseRIS]) (map renderOption [CSV, CSV_HAL])
] ]
where where
onChange e = onChange e =
......
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