Skip to content

Commit

Permalink
feature: dashboard link in search links to current organization and d…
Browse files Browse the repository at this point in the history
…ataset
  • Loading branch information
vid277 authored and skeptrunedev committed Aug 26, 2024
1 parent 3a5170e commit 527b4a2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions frontends/search/src/components/Atoms/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@ export const Navbar = () => {
return datasetAndUserContext.currentDataset?.()?.dataset.id;
});

const currentOrganizationId = createMemo(() => {
return datasetAndUserContext.currentOrganization?.()?.id;
});

const [isOpen, setIsOpen] = createSignal(false);

//Construct a7b64c7f-01ad-43b2-aaaf-c78192ca3d72/start?org=ca34dafa-7826-41b4-9953-cd58617834f1
const orgDatasetParams = createMemo(() => {
const orgId = currentOrganizationId();
const datasetId = currentDatasetId();
let params = "";
if (datasetId) params += datasetId;
if (orgId && datasetId) params += `/start?org=${orgId}`;
return params;
});

return (
<div class="mx-auto mb-8 w-full max-w-screen-2xl flex-col items-center px-4">
<div class="flex h-16 items-center justify-between">
Expand All @@ -42,13 +56,15 @@ export const Navbar = () => {

<div class="flex items-center justify-end space-x-1 sm:space-x-4">
<a
href={dashboardUrl}
href={`${dashboardUrl}/dashboard/dataset/${orgDatasetParams()}`}
target="_blank"
class="hidden text-center min-[420px]:text-lg min-[920px]:block"
>
Dashboard
</a>
<a
href="https://docs.trieve.ai/api-reference"
target="_blank"
class="hidden text-center min-[420px]:text-lg min-[920px]:block"
>
API Docs
Expand Down Expand Up @@ -130,7 +146,7 @@ export const Navbar = () => {
>
<div class="space-y-1 px-2 pb-3 pt-2">
<a
href={dashboardUrl}
href={`${dashboardUrl}/dashboard/dataset/${orgDatasetParams()}`}
class="block rounded-md bg-neutral-200 py-2 text-base font-medium hover:bg-neutral-300 dark:bg-neutral-700 dark:hover:bg-neutral-800"
>
Dashboard
Expand Down

0 comments on commit 527b4a2

Please sign in to comment.