Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
useDeploymentStatus,
useEnvironment,
} from '@qovery/domains/environments/feature'
import { isEditableService } from '@qovery/domains/services/data-access'
import { isArgoCd, isEditableService } from '@qovery/domains/services/data-access'
import { ArgoCdServiceList, useServices } from '@qovery/domains/services/feature'
import { Heading, Icon, Link, Navbar, Section, Tooltip } from '@qovery/shared/ui'

Expand Down Expand Up @@ -58,10 +58,7 @@ function RouteComponent() {
const activeTabId = tabs.find((tab) => matchRoute({ to: tab.routeId }))?.id
const isServicesListTab = activeTabId === 'services'
const qoveryServicesCount = useMemo(() => services.filter(isEditableService).length, [services])
const argoCdServicesCount = useMemo(
() => services.filter((service) => !isEditableService(service)).length,
[services]
)
const argoCdServicesCount = useMemo(() => services.filter(isArgoCd).length, [services])
const hasQoveryServices = qoveryServicesCount > 0
const hasArgoCdServices = argoCdServicesCount > 0
const shouldDisplayQoveryServicesSubtitle = isServicesListTab && hasArgoCdServices
Expand Down Expand Up @@ -130,7 +127,7 @@ function RouteComponent() {
<div className="flex flex-col gap-3">
{shouldDisplayQoveryServicesSubtitle && (
<Heading level={3} className="font-medium text-neutral-subtle">
Qovery native services
Qovery services
</Heading>
)}
{shouldDisplayArgoCdServicesAboveQovery ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { createFileRoute } from '@tanstack/react-router'
import { Navigate, createFileRoute, useParams } from '@tanstack/react-router'
import { Suspense } from 'react'
import { isArgoCd } from '@qovery/domains/services/data-access'
import { ArgoCdManifest, useServiceSummary } from '@qovery/domains/services/feature'
import { ErrorBoundary, LoaderSpinner } from '@qovery/shared/ui'
import { useDocumentTitle } from '@qovery/shared/util-hooks'

export const Route = createFileRoute(
Expand All @@ -7,8 +11,44 @@ export const Route = createFileRoute(
component: RouteComponent,
})

function RouteComponent() {
function ManifestLoader() {
return (
<div className="flex min-h-page-container flex-1 items-center justify-center bg-background">
<LoaderSpinner />
</div>
)
}

function ManifestRouteContent() {
const { organizationId = '', projectId = '', environmentId = '', serviceId = '' } = useParams({ strict: false })
const { data: service } = useServiceSummary({
environmentId,
serviceId,
enabled: Boolean(environmentId) && Boolean(serviceId),
suspense: true,
})

useDocumentTitle('Service - Manifest')

return <div className="flex min-h-page-container flex-1 bg-background" />
if (!service || !isArgoCd(service)) {
return (
<Navigate
to="/organization/$organizationId/project/$projectId/environment/$environmentId/service/$serviceId/overview"
params={{ organizationId, projectId, environmentId, serviceId }}
replace
/>
)
}

return <ArgoCdManifest />
}

function RouteComponent() {
return (
<ErrorBoundary>
<Suspense fallback={<ManifestLoader />}>
<ManifestRouteContent />
</Suspense>
</ErrorBoundary>
)
}
4 changes: 2 additions & 2 deletions apps/console/src/routes/_authenticated/organization/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Suspense, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { useClusters } from '@qovery/domains/clusters/feature'
import { useEnvironment } from '@qovery/domains/environments/feature'
import { useProject } from '@qovery/domains/projects/feature'
import { type AnyService, isEditableService, isManagedDatabase } from '@qovery/domains/services/data-access'
import { type AnyService, isArgoCd, isEditableService, isManagedDatabase } from '@qovery/domains/services/data-access'
import { useRecentServices, useServiceSummary } from '@qovery/domains/services/feature'
import { AssistantPanelOutlet, AssistantProvider } from '@qovery/shared/assistant/feature'
import { DevopsCopilotContext } from '@qovery/shared/devops-copilot/context'
Expand Down Expand Up @@ -252,7 +252,7 @@ function createRoutePatternRegex(routeIdPattern: string): RegExp {
}

function getServiceTabs(service?: AnyService, cluster?: Cluster) {
const isArgoCdService = service ? !isEditableService(service) : false
const isArgoCdService = service ? isArgoCd(service) : false

if (isArgoCdService) {
return SERVICE_TABS.filter((tab) => ARGOCD_SERVICE_TAB_IDS.includes(tab.id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`ContainerRegistryServicesListModal should match snapshots 1`] = `
class="fa-regular fa-magnifying-glass absolute left-3 top-1/2 block -translate-y-1/2 text-base leading-none text-neutral-subtle"
/>
<input
class="w-full rounded border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
class="w-full rounded-md border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
data-testid="input-search"
name="search"
placeholder="Search by project, environment, service name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`GitTokenServicesListModal should match snapshots 1`] = `
class="fa-regular fa-magnifying-glass absolute left-3 top-1/2 block -translate-y-1/2 text-base leading-none text-neutral-subtle"
/>
<input
class="w-full rounded border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
class="w-full rounded-md border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
data-testid="input-search"
name="search"
placeholder="Search by project, environment, service name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`HelmRepositoryServicesListModal should match snapshots 1`] = `
class="fa-regular fa-magnifying-glass absolute left-3 top-1/2 block -translate-y-1/2 text-base leading-none text-neutral-subtle"
/>
<input
class="w-full rounded border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
class="w-full rounded-md border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
data-testid="input-search"
name="search"
placeholder="Search by project, environment, service name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`LabelAnnotationItemsListModal should match snapshots with annotation 1`
class="fa-regular fa-magnifying-glass absolute left-3 top-1/2 block -translate-y-1/2 text-base leading-none text-neutral-subtle"
/>
<input
class="w-full rounded border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
class="w-full rounded-md border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
data-testid="input-search"
name="search"
placeholder="Search by project, environment, service, or cluster name"
Expand Down Expand Up @@ -192,7 +192,7 @@ exports[`LabelAnnotationItemsListModal should match snapshots with label 1`] = `
class="fa-regular fa-magnifying-glass absolute left-3 top-1/2 block -translate-y-1/2 text-base leading-none text-neutral-subtle"
/>
<input
class="w-full rounded border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
class="w-full rounded-md border border-neutral bg-surface-neutral pl-10 pr-6 text-neutral placeholder:text-neutral-subtle focus:border-brand-strong focus:outline-none focus:transition-[border-color] h-9 text-sm"
data-testid="input-search"
name="search"
placeholder="Search by project, environment, service, or cluster name"
Expand Down
1 change: 0 additions & 1 deletion libs/domains/service-terraform/feature/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from './source-setting/source-setting'
export * from './lib/hooks/use-terraform-resources/use-terraform-resources'
export * from './lib/terraform-resources-section/terraform-resources-section'
export * from './lib/resource-details/resource-details'
export * from './lib/resource-tree-list/resource-tree-list'
export * from './lib/hooks/use-terraform-available-versions/use-terraform-available-versions'
export * from './lib/terraform-configuration-settings/terraform-configuration-settings'
export * from './lib/terraform-general-data/terraform-general-data'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type ReactElement, useEffect, useMemo, useState } from 'react'
import { ResourceTreeList } from '@qovery/shared/console-shared'
import { EmptyState, InputSearch, LoaderSpinner } from '@qovery/shared/ui'
import { useTerraformResources } from '../hooks/use-terraform-resources/use-terraform-resources'
import { ResourceDetails } from '../resource-details/resource-details'
import { ResourceTreeList } from '../resource-tree-list/resource-tree-list'
import { matchesSearch } from '../utils/matches-search'

export interface TerraformResourcesSectionProps {
Expand Down Expand Up @@ -73,17 +73,11 @@ export function TerraformResourcesSection({ terraformId }: TerraformResourcesSec

return (
<div className="flex h-page-container flex-col gap-4">
{/* Split panel: Tree list (with search) and Details */}
<div className="flex h-full">
{/* Left panel: Search + Resource tree list */}
<div className="flex w-1/4 flex-shrink-0 flex-col overflow-y-scroll border-r border-neutral">
{/* Search bar */}
<div className="flex-shrink-0 p-4 pb-0">
<InputSearch placeholder="Search resources…" className="w-full" onChange={setSearchQuery} />
</div>
<div className="flex w-[266px] flex-shrink-0 flex-col gap-4 overflow-x-hidden overflow-y-scroll rounded-r-md border-r border-neutral bg-surface-neutral-subtle p-3">
<InputSearch placeholder="Search resources…" className="w-full" onChange={setSearchQuery} />

{/* Tree list */}
<div className="flex-1 p-4">
<div className="min-h-0 flex-1">
<ResourceTreeList
resources={data}
selectedResourceId={selectedResourceId}
Expand All @@ -93,8 +87,7 @@ export function TerraformResourcesSection({ terraformId }: TerraformResourcesSec
</div>
</div>

{/* Right panel: Resource details */}
<div className="w-3/4 flex-1 overflow-y-scroll">
<div className="min-w-0 flex-1 overflow-y-scroll">
<ResourceDetails resource={selectedResource} />
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ export function isHelm(service: AnyService): service is Helm {
return service.service_type === 'HELM'
}

export function isArgoCd(service: AnyService): service is ArgoCd {
return service.service_type === 'ARGOCD_APP'
}

export function isEditableService(service: AnyService): service is EditableService {
return service.service_type !== 'ARGOCD_APP'
}
Expand Down Expand Up @@ -270,6 +274,13 @@ export const services = createQueryKeys('services', {
return (response.data.results ?? []).filter((service) => service.service_type === 'ARGOCD_APP')
},
}),
argocdManifest: (serviceId: string) => ({
queryKey: [serviceId],
async queryFn() {
const response = await argoCdApi.getArgoCdAppManifest(serviceId)
return response.data
},
}),
list: (environmentId: string) => ({
queryKey: [environmentId],
async queryFn() {
Expand Down
2 changes: 2 additions & 0 deletions libs/domains/services/feature/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export * from './lib/hooks/use-service-summary/use-service-summary'
export * from './lib/hooks/use-service/use-service'
export * from './lib/hooks/use-services/use-services'
export * from './lib/hooks/use-argocd-services/use-argocd-services'
export * from './lib/hooks/use-argocd-manifest/use-argocd-manifest'
export * from './lib/hooks/use-service-deployment-and-running-statuses/use-service-deployment-and-running-statuses'
export * from './lib/hooks/use-delete-all-services/use-delete-all-services'
export * from './lib/hooks/use-delete-service/use-delete-service'
Expand All @@ -55,6 +56,7 @@ export * from './lib/hooks/use-recent-services/use-recent-services'
export * from './lib/hooks/use-favorite-services/use-favorite-services'
export * from './lib/service-actions/service-actions'
export * from './lib/argocd-service-list/argocd-service-list'
export * from './lib/argocd-manifest/argocd-manifest'
export * from './lib/service-deployment-status-label/service-deployment-status-label'
export * from './lib/service-overview/service-header/service-header'
export * from './lib/service-links-popover/service-links-popover'
Expand Down
Loading
Loading