Commit 11568684 authored by Fabien Maniere's avatar Fabien Maniere

adding an option to open or not the tree levels

parent 53800640
Pipeline #6142 passed with stages
in 15 minutes and 6 seconds
......@@ -88,6 +88,7 @@ componentCpt = here.component "breadcrumb" cpt where
breadcrumbView { format: "default"
, route: route'
, session: session''
, openTreeNodes: true
}
]
-- ,
......@@ -141,9 +142,10 @@ componentCpt = here.component "breadcrumb" cpt where
]
type BreadcrumbViewProps =
( format :: String
, route :: AppRoute
, session :: Session
( format :: String
, route :: AppRoute
, session :: Session
, openTreeNodes :: Boolean
)
......@@ -151,7 +153,7 @@ breadcrumbView :: R2.Leaf BreadcrumbViewProps
breadcrumbView = R2.leaf breadcrumbViewCpt
breadcrumbViewCpt :: R.Component BreadcrumbViewProps
breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
hCpt hp { format, route, session } _ = do
hCpt hp { format, route, session, openTreeNodes } _ = do
useLoader { errorHandler: Nothing
, herePrefix: hp
......@@ -163,6 +165,7 @@ breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
, items
, session
-- , reload: reload
, openTreeNodes
} []
}
......@@ -171,16 +174,17 @@ type BreadcrumbViewMainProps =
, items :: BreadcrumbInfo
, session :: Session
-- , reload :: T.Box T2.Reload
, openTreeNodes :: Boolean
)
breadcrumbViewMain :: R2.Component BreadcrumbViewMainProps
breadcrumbViewMain = R.createElement breadcrumbViewMainCpt
breadcrumbViewMainCpt :: R.Component BreadcrumbViewMainProps
breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
cpt { items: { parents }, session, format } _ = do
cpt { items: { parents }, session, format, openTreeNodes } _ = do
-- session' <- T.useLive T.unequal session
let items = makeBreadcrumbElements parents session format
let items = makeBreadcrumbElements parents session format openTreeNodes
-- case session of
-- Nothing -> pure $ H.div {} []
......@@ -190,8 +194,8 @@ breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
R.fragment items
makeBreadcrumbElements :: Array TreeNode -> Session -> String -> Array R.Element
makeBreadcrumbElements items' session format = makeBreadcrumbElementsMap <$> items' where
makeBreadcrumbElements :: Array TreeNode -> Session -> String -> Boolean -> Array R.Element
makeBreadcrumbElements items' session format openTreeNodes = makeBreadcrumbElementsMap <$> items' where
makeBreadcrumbElementsMap :: TreeNode -> R.Element
makeBreadcrumbElementsMap node = breadcrumbItem { linkId: node.id
, linkNodeType: node.node_type
......@@ -201,6 +205,7 @@ breadcrumbViewMainCpt = here.component "breadcrumbViewMainCpt" cpt where
-- , reload: props.reload
-- , style: FolderUp
, format: format
, openTreeNodes: openTreeNodes
}
type BreadcrumbItemProps =
......@@ -212,6 +217,7 @@ type BreadcrumbItemProps =
-- , style :: FolderStyle
, text :: String
, format :: String
, openTreeNodes :: Boolean
)
breadcrumbItem :: R2.Leaf BreadcrumbItemProps
......@@ -226,15 +232,21 @@ breadcrumbItemCpt = here.component "breadcrumbItemCpt" cpt where
-- , reload
-- , style
, format
, openTreeNodes
} _ = do
boxes@{ forestOpen } <- Store.use
boxes@{ route } <- Store.use
let sid = sessionId session
let rootId = treeId session
let currentNodeIdFromUrl = mkNodeId session linkId
-- R.unsafeHooksEffect $ T.modify_ (openNodesInsert (currentNodeIdFromUrl)) forestOpen
if openTreeNodes then
R.unsafeHooksEffect $ T.modify_ (openNodesInsert (currentNodeIdFromUrl)) forestOpen
else
pure unit
pure $
......
......@@ -359,7 +359,7 @@ renderBackendCpt = here.component "renderBackend" cpt where
{}
[
B.icon
{ name: "database"
{ name: "server"
}
]
,
......
......@@ -197,6 +197,7 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
, breadcrumbView { format: "text"
, route: getRouteFromSearchResult sd session
, session
, openTreeNodes: false
}
]
]
......@@ -220,6 +221,7 @@ treeSearchRenderCpt = here.component "treeSearchRenderCpt" cpt where
, breadcrumbView { format: "text"
, route: getRouteFromSearchResult sd session
, session: session
, openTreeNodes: false
}
]
]
......
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