Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/Sidebar/B4aSidebar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const B4aSidebar = ({
}
return (
<div className={styles.submenu}>
{subsections.map(({ name, link, badge, children: groupChildren }) => {
{subsections.map(({ name, link, badge, gated, children: groupChildren }) => {
if (groupChildren) {
const isGroupActive = subsection === name || groupChildren.some(c => c.name === subsection);
const groupLink = link.startsWith('/') ? prefix + link : link;
Expand Down Expand Up @@ -189,6 +189,8 @@ const B4aSidebar = ({
}

const active = subsection === name;
// Opt-in: only items flagged `gated` are locked when the app is unreachable.
const itemDisabled = gated ? !canAccess(currentApp.serverInfo, link.replace(/^\//, '')) : false;
link = link.startsWith('/') ? prefix + link : link;
return (
<SidebarSubItem
Expand All @@ -199,6 +201,7 @@ const B4aSidebar = ({
actionHandler={active ? actionHandler : null}
active={active}
badge={badge}
disabled={itemDisabled}
>
{active ? children : null}
</SidebarSubItem>
Expand Down
3 changes: 2 additions & 1 deletion src/dashboard/DashboardView.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ export default class DashboardView extends React.Component {

cloudCodeSubSections.push({
name: 'Config',
link: '/config'
link: '/config',
gated: true
});

// if (!isLocked && features.logs && Object.keys(features.logs).some(key => features.logs[key])) {
Expand Down
5 changes: 5 additions & 0 deletions src/lib/serverInfo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export const ALWAYS_ALLOWED_ROUTES = [
'overview',
'Cloud Code',
'cloud_code',
'jobs',
'deployments',
'webhooks',
'web-deployment',
'Overview',
'Web Deployment',
Expand Down
Loading