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

[TREE] Refresh (WIP)

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