Skip to content

Commit

Permalink
feat(breadcrumb): add cluster (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet authored Jan 17, 2023
1 parent 379bdaf commit 42b1ea1
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import equal from 'fast-deep-equal'
import { Database, Environment, Organization, Project } from 'qovery-typescript-axios'
import { Cluster, Database, Environment, Organization, Project } from 'qovery-typescript-axios'
import React, { useEffect } from 'react'
import { useLocation, useNavigate, useParams } from 'react-router-dom'
import { IconEnum } from '@qovery/shared/enums'
Expand All @@ -10,6 +10,7 @@ import {
APPLICATION_LOGS_URL,
APPLICATION_URL,
CLUSTERS_URL,
CLUSTER_URL,
DATABASE_GENERAL_URL,
DATABASE_URL,
DEPLOYMENT_LOGS_URL,
Expand Down Expand Up @@ -61,6 +62,29 @@ export function BreadcrumbMemo(props: BreadcrumbProps) {
locationIsApplicationLogs ||
locationIsDeploymentLogs

const clustersMenu = [
{
title: 'Clusters',
search: true,
items: clusters
? clusters?.map((cluster: Cluster) => ({
name: cluster.name,
link: {
url: matchLogsRoute
? INFRA_LOGS_URL(organizationId, cluster.id)
: CLUSTER_URL(organizationId, cluster.id),
},
contentLeft: (
<Icon
name="icon-solid-check"
className={`text-sm ${clusterId === cluster.id ? 'text-success-400' : 'text-transparent'}`}
/>
),
}))
: [],
},
]

const projectMenu = [
{
title: 'Projects',
Expand Down Expand Up @@ -191,9 +215,9 @@ export function BreadcrumbMemo(props: BreadcrumbProps) {
isLast={!projectId}
label="Cluster"
data={clusters}
menuItems={[]}
menuItems={clustersMenu}
paramId={clusterId}
link={INFRA_LOGS_URL(organizationId, clusterId)}
link={matchLogsRoute ? INFRA_LOGS_URL(organizationId, clusterId) : CLUSTER_URL(organizationId, clusterId)}
/>
)}
{projectId && (
Expand Down

0 comments on commit 42b1ea1

Please sign in to comment.