Skip to content
Closed
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 @@ -62,15 +62,6 @@ export const environments = createQueryKeys('environments', {
)
},
}),
// TODO [To update once rust-backed will be deployed]: To remove
// NOTE: Value is set by WebSocket
checkRunningStatusClosed: (clusterId: string) => ({
queryKey: [clusterId],
queryFn() {
// eslint-disable-next-line @typescript-eslint/no-empty-function
return new Promise<{ clusterId: string; reason: string }>(() => {})
},
}),
details: ({ environmentId }: { environmentId: string }) => ({
queryKey: [environmentId],
async queryFn() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { twMerge, upperCaseFirstLetter } from '@qovery/shared/util-js'
import { CreateCloneEnvironmentModal } from '../create-clone-environment-modal/create-clone-environment-modal'
import { EnvironmentActionToolbar } from '../environment-action-toolbar/environment-action-toolbar'
import { EnvironmentMode } from '../environment-mode/environment-mode'
import { useCheckRunningStatusClosed } from '../hooks/use-check-running-status-closed/use-check-running-status-closed'
import { useEnvironments } from '../hooks/use-environments/use-environments'
import { EnvironmentListSkeleton } from './environment-list-skeleton'

Expand Down Expand Up @@ -88,30 +87,6 @@ function EnvironmentStatusCell({
runningStatus?: RunningState
value?: string
}) {
const { data: checkRunningStatusClosed } = useCheckRunningStatusClosed({
clusterId: environment.cluster_id,
})
// TODO [To update once rust-backed will be deployed]: To remove
if (checkRunningStatusClosed) {
return (
<Tooltip content="See cluster">
<Link
as="button"
to={CLUSTER_URL(environment.organization.id, environment.cluster_id)}
onClick={(e) => e.stopPropagation()}
className="gap-2 whitespace-nowrap text-sm"
size="md"
color="neutral"
variant="outline"
radius="full"
>
<StatusChip status="UNAVAILABLE" />
Status unavailable
</Link>
</Tooltip>
)
}

return (
<Skeleton width={102} height={34} show={!value}>
<Tooltip content="See overview">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Skeleton, StatusChip, type StatusChipProps } from '@qovery/shared/ui'
import { useCheckRunningStatusClosed } from '../hooks/use-check-running-status-closed/use-check-running-status-closed'
import { useDeploymentStatus } from '../hooks/use-deployment-status/use-deployment-status'
import { useEnvironment } from '../hooks/use-environment/use-environment'
import { useRunningStatus } from '../hooks/use-running-status/use-running-status'

/**
Expand Down Expand Up @@ -45,17 +43,7 @@ function DeploymentStateChip({ environmentId, mode, ...props }: DeploymentStateC
type RunningStateChipProps = Omit<EnvironmentStateChipProps, 'mode'>

function RunningStateChip({ environmentId, ...props }: RunningStateChipProps) {
const { data: environment } = useEnvironment({ environmentId })
const { data: runningStatus } = useRunningStatus({ environmentId })
const { data: checkRunningStatusClosed } = useCheckRunningStatusClosed({
clusterId: environment?.cluster_id ?? '',
})

// TODO [To update once rust-backed will be deployed]: To remove
if (checkRunningStatusClosed) {
return <StatusChip status="STOPPED" {...props} />
}

return (
<Skeleton width={16} height={16} show={!runningStatus?.state} rounded>
<StatusChip status={runningStatus?.state} {...props} />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,6 @@ export const services = createQueryKeys('services', {
return new Promise<ApplicationStatusDto | DatabaseStatusDto | TerraformStatusDto | null>(() => {})
},
}),
// TODO [To update once rust-backed will be deployed]: To remove
checkRunningStatusClosed: (clusterId: string, environmentId: string) => ({
queryKey: [clusterId, environmentId],
// NOTE: Value is set by WebSocket
queryFn() {
// eslint-disable-next-line @typescript-eslint/no-empty-function
return new Promise<{ clusterId: string; environmentId: string; reason: string }>(() => {})
},
}),
metrics: (environmentId: string, serviceId: string) => ({
queryKey: [environmentId, serviceId],
// NOTE: Value is set by WebSocket
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ exports[`SelectCommitModal should match snapshot 1`] = `
aria-hidden="true"
class="fa-solid fa-code-commit absolute left-0 top-1 -translate-x-1/2 text-neutral-300 dark:text-neutral-350"
/>
Commit
Commits
on
Jan 01, 0123
Apr 03, 2026
</div>
<div
class="border-l border-neutral-250 pb-5 pl-5 pt-3 dark:border-neutral-350"
Expand Down Expand Up @@ -150,25 +150,6 @@ exports[`SelectCommitModal should match snapshot 1`] = `
</span>
</div>
</label>
</div>
</div>
<div
class="pl-2"
>
<div
class="relative pl-5 text-sm font-medium text-neutral-350"
>
<i
aria-hidden="true"
class="fa-solid fa-code-commit absolute left-0 top-1 -translate-x-1/2 text-neutral-300 dark:text-neutral-350"
/>
Commit
on
Jan 01, 0456
</div>
<div
class="border-l border-neutral-250 pb-5 pl-5 pt-3 dark:border-neutral-350"
>
<label
class="-mt-px flex w-full flex-row gap-3 border border-neutral-250 p-3 first:rounded-t-md last:rounded-b-md dark:border-neutral-350 bg-neutral-100 dark:bg-neutral-500"
>
Expand Down Expand Up @@ -211,7 +192,7 @@ exports[`SelectCommitModal should match snapshot 1`] = `
class="text-neutral-350 dark:text-neutral-50"
>
committed
1571 years
0 seconds
ago
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,54 @@
import { renderWithProviders, screen } from '@qovery/shared/util-tests'
import { SelectCommitModal } from './select-commit-modal'

jest.mock('@qovery/shared/util-dates', () => {
const actual = jest.requireActual('@qovery/shared/util-dates')
return {
...actual,
/** Relative time drifts between runs; snapshot must stay stable. */
timeAgo: () => '0 seconds',
/**
* `commitsByDay` keys use local `toDateString()` but `dateToFormat` uses UTC — CI vs dev timezones
* otherwise flip the header (e.g. Apr 02 vs Apr 03).
*/
dateToFormat: (date: string, format: string) => {
if (format === 'MMM dd, yyyy') {
return 'Apr 03, 2026'
}
return actual.dateToFormat(date, format)
},
}
})

jest.mock('../hooks/use-last-deployed-commit/use-last-deployed-commit', () => {
return {
...jest.requireActual('../hooks/use-last-deployed-commit/use-last-deployed-commit'),
useLastDeployedCommit: () => ({
data: {
commits: [
{ created_at: '123', author_name: 'foo', git_commit_id: '123', message: 'lorem', tag: '' },
{ created_at: '456', author_name: 'foo', git_commit_id: '456', message: 'ipsum', tag: '' },
{
created_at: '2026-04-03T13:25:12.247Z',
author_name: 'foo',
git_commit_id: '123',
message: 'lorem',
tag: '',
},
{
created_at: '2026-04-03T13:25:12.247Z',
author_name: 'foo',
git_commit_id: '456',
message: 'ipsum',
tag: '',
},
],
delta: 1,
deployedCommit: { created_at: '456', author_name: 'foo', git_commit_id: '456', message: 'ipsum', tag: '' },
deployedCommit: {
created_at: '2026-04-03T13:25:12.247Z',
author_name: 'foo',
git_commit_id: '456',
message: 'ipsum',
tag: '',
},
},
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
import {
APPLICATION_GENERAL_URL,
APPLICATION_URL,
CLUSTER_URL,
DATABASE_GENERAL_URL,
DATABASE_URL,
DEPLOYMENT_LOGS_VERSION_URL,
Expand Down Expand Up @@ -74,7 +73,6 @@ import {
twMerge,
upperCaseFirstLetter,
} from '@qovery/shared/util-js'
import { useCheckRunningStatusClosed } from '../hooks/use-check-running-status-closed/use-check-running-status-closed'
import { useListDeploymentStages } from '../hooks/use-list-deployment-stages/use-list-deployment-stages'
import { useServices } from '../hooks/use-services/use-services'
import { LastCommit } from '../last-commit/last-commit'
Expand Down Expand Up @@ -334,10 +332,6 @@ export function ServiceList({ environment, className, ...props }: ServiceListPro
} = environment
const { data: services = [], isLoading: isServicesLoading } = useServices({ environmentId })
const { data: deploymentStages } = useListDeploymentStages({ environmentId })
const { data: checkRunningStatusClosed } = useCheckRunningStatusClosed({
clusterId,
environmentId,
})
const [sorting, setSorting] = useState<SortingState>([])
const [rowSelection, setRowSelection] = useState<RowSelectionState>({})
const navigate = useNavigate()
Expand Down Expand Up @@ -495,27 +489,6 @@ export function ServiceList({ environment, className, ...props }: ServiceListPro
.with(undefined, () => info.getValue())
.exhaustive()

// TODO [To update once rust-backed will be deployed]: Remove this workaround
if (checkRunningStatusClosed) {
return (
<Tooltip content="See cluster">
<Link
as="button"
to={CLUSTER_URL(organizationId, environment.cluster_id)}
onClick={(e) => e.stopPropagation()}
className="gap-2 whitespace-nowrap text-sm"
size="md"
color="neutral"
variant="outline"
radius="full"
>
<StatusChip status="UNAVAILABLE" />
Status unavailable
</Link>
</Tooltip>
)
}

const serviceStatus = match(service)
.with({ serviceType: 'DATABASE', mode: 'MANAGED' }, (s) => s.deploymentStatus?.state)
.otherwise((s) => s.runningStatus?.state)
Expand Down Expand Up @@ -779,7 +752,7 @@ export function ServiceList({ environment, className, ...props }: ServiceListPro
},
}),
],
[columnHelper, organizationId, projectId, environmentId, navigate, checkRunningStatusClosed, environment]
[columnHelper, organizationId, projectId, environmentId, environment]
)

const table = useReactTable({
Expand Down
15 changes: 13 additions & 2 deletions libs/pages/layout/src/lib/feature/layout/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useAuth0 } from '@auth0/auth0-react'
import posthog from 'posthog-js'
import { type PropsWithChildren, memo, useEffect } from 'react'
import { type PropsWithChildren, memo, useEffect, useMemo } from 'react'
import { redirect, useParams } from 'react-router-dom'
import { useClusters } from '@qovery/domains/clusters/feature'
import { useEnvironment } from '@qovery/domains/environments/feature'
Expand Down Expand Up @@ -29,6 +29,17 @@ export function Layout(props: PropsWithChildren<LayoutProps>) {

const { data: environment } = useEnvironment({ environmentId })

/** One cluster when env is known; avoid N /status sockets (all org clusters) while env is still loading. */
const statusWebSocketClusters = useMemo(() => {
if (environmentId) {
if (environment) {
return [{ id: environment.cluster_id }]
}
return []
}
return clusters
}, [clusters, environment, environmentId])

useEffect(() => {
const organizationIds = organizations.map(({ id }) => id)

Expand Down Expand Up @@ -67,7 +78,7 @@ export function Layout(props: PropsWithChildren<LayoutProps>) {
* XXX: Here we are limited by the websocket API which requires a clusterId
* We need to instantiate one hook per clusterId to get the complete environment statuses of the page
*/
(environment ? [{ id: environment.cluster_id }] : clusters).map(
statusWebSocketClusters.map(
({ id }) =>
organizationId && (
<StatusWebSocketListenerMemo
Expand Down
Loading
Loading