Skip to content

Commit

Permalink
add support for navbar customization
Browse files Browse the repository at this point in the history
  • Loading branch information
jjackzhn committed Dec 11, 2024
1 parent bcd2fcf commit 76da554
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
include apache::mod::authz_user
include letsencrypt
include openondemand
include stdlib

include profile_ondemand::navbar

if $enable_xdmod_export {
include profile_ondemand::xdmod_export
Expand Down
56 changes: 56 additions & 0 deletions manifests/navbar.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# @summary Configure the navigation bar for OOD
#
# @param include_default
# Whether to include the default navbar items. Defaults to true
#
# @param navbar_items
# Array of items to put in the navbar (left side)
#
# @param helpbar_items
# Array of items to put in the helpbar (right side)
#
class profile_ondemand::navbar (
Boolean $include_default = true,
Optional[Array[Hash]] $navbar_items = undef,
Optional[Array[Hash]] $helpbar_items = undef,
) {
if $include_default {
$_content = {
nav_bar => [
'apps',
'files',
'jobs',
'clusters',
'interactive apps',
] +
pick($navbar_items, [])
+ [
'sessions',
],
help_bar => pick($helpbar_items, []) + [
'develop',
'help',
'user',
'logout',
],
}
} else {
if ! $navbar_items and ! $helpbar_items {
err('Open OnDemand has an empty navigation bar!')
}
$_content = {
nav_bar => pick($navbar_items, []),
help_bar => pick($helpbar_items, []),
}
}

file { '/etc/ood/config/ondemand.d/custom-navbar.yml':
ensure => 'file',
mode => '0644',
content => join([
'# File managed by Puppet - DO NOT EDIT',
to_yaml($_content),
'',
], "\n"),
}
}

0 comments on commit 76da554

Please sign in to comment.