Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(weave): Project sidebar takes in models access param #2565

Merged
merged 4 commits into from
Oct 2, 2024
Merged
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
19 changes: 14 additions & 5 deletions weave-js/src/components/FancyPage/useProjectSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ export const useProjectSidebar = (
viewingRestricted: boolean,
hasModelsData: boolean,
hasWeaveData: boolean,
hasTraceBackend: boolean = true
hasTraceBackend: boolean = true,
hasModelsAccess: boolean = true
): FancyPageSidebarItem[] => {
// Should show models sidebar items if we have models data or if we don't have a trace backend
const showModelsSidebarItems = hasModelsData || !hasTraceBackend;
let showModelsSidebarItems = hasModelsData || !hasTraceBackend;
// Should show weave sidebar items if we have weave data and we have a trace backend
const showWeaveSidebarItems = hasWeaveData && hasTraceBackend;
let showWeaveSidebarItems = hasWeaveData && hasTraceBackend;

const isModelsOnly = showModelsSidebarItems && !showWeaveSidebarItems;
const isWeaveOnly = !showModelsSidebarItems && showWeaveSidebarItems;
let isModelsOnly = showModelsSidebarItems && !showWeaveSidebarItems;
let isWeaveOnly = !showModelsSidebarItems && showWeaveSidebarItems;

if (!hasModelsAccess) {
showModelsSidebarItems = false;
isModelsOnly = false;

showWeaveSidebarItems = true;
isWeaveOnly = true;
}

const isNoSidebarItems = !showModelsSidebarItems && !showWeaveSidebarItems;
const isBothSidebarItems = showModelsSidebarItems && showWeaveSidebarItems;
Expand Down
Loading