Skip to content

Commit

Permalink
feat(environment-logs): add new version (#1726)
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBonnet authored Oct 21, 2024
1 parent 5ff1a84 commit 3874d32
Show file tree
Hide file tree
Showing 99 changed files with 2,741 additions and 984 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports[`ClusterActionToolbar should match manage deployment snapshot 1`] = `
<div
aria-labelledby="radix-:r6:"
aria-orientation="vertical"
class="flex w-[258px] flex-col gap-1 rounded-md bg-neutral-50 p-3 shadow-[0_0_32px_rgba(0,0,0,0.08)] data-[state=open]:data-[side=bottom]:animate-slidein-up-md-faded data-[state=open]:data-[side=left]:animate-slidein-right-sm-faded data-[state=open]:data-[side=right]:animate-slidein-left-md-faded data-[state=open]:data-[side=top]:animate-slidein-down-md-faded dark:bg-neutral-550"
class="flex w-[258px] flex-col gap-1 rounded-md bg-neutral-50 p-3 shadow-[0_0_32px_rgba(0,0,0,0.08)] data-[state=open]:data-[side=bottom]:animate-slidein-up-md-faded data-[state=open]:data-[side=left]:animate-slidein-right-sm-faded data-[state=open]:data-[side=right]:animate-slidein-left-md-faded data-[state=open]:data-[side=top]:animate-slidein-down-md-faded dark:border dark:border-neutral-500 dark:bg-neutral-550"
data-align="start"
data-orientation="vertical"
data-radix-menu-content=""
Expand All @@ -120,7 +120,7 @@ exports[`ClusterActionToolbar should match manage deployment snapshot 1`] = `
tabindex="-1"
>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550 relative"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550 relative"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -133,7 +133,7 @@ exports[`ClusterActionToolbar should match manage deployment snapshot 1`] = `
Update
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand Down Expand Up @@ -264,7 +264,7 @@ exports[`ClusterActionToolbar should match other actions snapshot 1`] = `
<div
aria-labelledby="radix-:r12:"
aria-orientation="vertical"
class="flex w-[258px] flex-col gap-1 rounded-md bg-neutral-50 p-3 shadow-[0_0_32px_rgba(0,0,0,0.08)] data-[state=open]:data-[side=bottom]:animate-slidein-up-md-faded data-[state=open]:data-[side=left]:animate-slidein-right-sm-faded data-[state=open]:data-[side=right]:animate-slidein-left-md-faded data-[state=open]:data-[side=top]:animate-slidein-down-md-faded dark:bg-neutral-550"
class="flex w-[258px] flex-col gap-1 rounded-md bg-neutral-50 p-3 shadow-[0_0_32px_rgba(0,0,0,0.08)] data-[state=open]:data-[side=bottom]:animate-slidein-up-md-faded data-[state=open]:data-[side=left]:animate-slidein-right-sm-faded data-[state=open]:data-[side=right]:animate-slidein-left-md-faded data-[state=open]:data-[side=top]:animate-slidein-down-md-faded dark:border dark:border-neutral-500 dark:bg-neutral-550"
data-align="start"
data-orientation="vertical"
data-radix-menu-content=""
Expand All @@ -277,7 +277,7 @@ exports[`ClusterActionToolbar should match other actions snapshot 1`] = `
tabindex="-1"
>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -290,7 +290,7 @@ exports[`ClusterActionToolbar should match other actions snapshot 1`] = `
Access info
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -303,7 +303,7 @@ exports[`ClusterActionToolbar should match other actions snapshot 1`] = `
See audit logs
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -316,7 +316,7 @@ exports[`ClusterActionToolbar should match other actions snapshot 1`] = `
Copy identifier
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand Down Expand Up @@ -465,7 +465,7 @@ exports[`ClusterActionToolbar should match outdated snapshot 1`] = `
<div
aria-labelledby="radix-:r1p:"
aria-orientation="vertical"
class="flex w-[258px] flex-col gap-1 rounded-md bg-neutral-50 p-3 shadow-[0_0_32px_rgba(0,0,0,0.08)] data-[state=open]:data-[side=bottom]:animate-slidein-up-md-faded data-[state=open]:data-[side=left]:animate-slidein-right-sm-faded data-[state=open]:data-[side=right]:animate-slidein-left-md-faded data-[state=open]:data-[side=top]:animate-slidein-down-md-faded dark:bg-neutral-550"
class="flex w-[258px] flex-col gap-1 rounded-md bg-neutral-50 p-3 shadow-[0_0_32px_rgba(0,0,0,0.08)] data-[state=open]:data-[side=bottom]:animate-slidein-up-md-faded data-[state=open]:data-[side=left]:animate-slidein-right-sm-faded data-[state=open]:data-[side=right]:animate-slidein-left-md-faded data-[state=open]:data-[side=top]:animate-slidein-down-md-faded dark:border dark:border-neutral-500 dark:bg-neutral-550"
data-align="start"
data-orientation="vertical"
data-radix-menu-content=""
Expand All @@ -478,7 +478,7 @@ exports[`ClusterActionToolbar should match outdated snapshot 1`] = `
tabindex="-1"
>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -491,7 +491,7 @@ exports[`ClusterActionToolbar should match outdated snapshot 1`] = `
Access info
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -504,7 +504,7 @@ exports[`ClusterActionToolbar should match outdated snapshot 1`] = `
See audit logs
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand All @@ -517,7 +517,7 @@ exports[`ClusterActionToolbar should match outdated snapshot 1`] = `
Copy identifier
</div>
<div
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 dark:border-solid dark:border-neutral-500 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
class="px-3 flex items-center h-9 text-sm font-medium rounded-sm outline-none data-[highlighted]:bg-brand-50 data-[highlighted]:text-brand-500 dark:data-[highlighted]:bg-neutral-400 dark:text-neutral-100 cursor-pointer text-neutral-400 hover:bg-brand-50 hover:text-brand-500 dark:hover:bg-neutral-550"
data-orientation="vertical"
data-radix-collection-item=""
role="menuitem"
Expand Down
12 changes: 12 additions & 0 deletions libs/domains/environment-logs/feature/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions libs/domains/environment-logs/feature/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions libs/domains/environment-logs/feature/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# feature

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test feature` to execute the unit tests via [Jest](https://jestjs.io).
11 changes: 11 additions & 0 deletions libs/domains/environment-logs/feature/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable */
export default {
displayName: 'feature',
preset: '../../../../jest.preset.js',
transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../../../coverage/libs/domains/environment-logs/feature',
}
9 changes: 9 additions & 0 deletions libs/domains/environment-logs/feature/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "feature",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/domains/environment-logs/feature/src",
"projectType": "library",
"tags": [],
"// targets": "to see all targets run: nx show project feature --web",
"targets": {}
}
2 changes: 2 additions & 0 deletions libs/domains/environment-logs/feature/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/environment-stages/environment-stages'
export * from './lib/list-pre-check-logs/list-pre-check-logs'
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { ENVIRONMENT_LOGS_URL, ENVIRONMENT_PRE_CHECK_LOGS_URL } from '@qovery/shared/routes'
import { renderWithProviders, screen } from '@qovery/shared/util-tests'
import { EnvironmentStages, type EnvironmentStagesProps } from './environment-stages'

describe('EnvironmentStages', () => {
const defaultProps: EnvironmentStagesProps = {
environment: {
id: 'env-1',
name: 'Test Environment',
organization: { id: 'org-1' },
project: { id: 'proj-1' },
cloud_provider: {
provider: 'AWS',
},
},
environmentStatus: {
state: 'RUNNING',
},
hideSkipped: false,
setHideSkipped: jest.fn(),
deploymentStages: [],
preCheckStage: {
status: 'SUCCESS',
total_duration_sec: 120,
},
}

it('renders loading spinner when deploymentStages is undefined', () => {
renderWithProviders(<EnvironmentStages {...defaultProps} deploymentStages={undefined} />)
expect(screen.getByTestId('spinner')).toBeInTheDocument()
})

it('renders pre-check stage when preCheckStage is provided', () => {
renderWithProviders(<EnvironmentStages {...defaultProps} />)
expect(screen.getByText('Pre-check')).toBeInTheDocument()
})

it('renders children when deploymentStages is provided', () => {
renderWithProviders(
<EnvironmentStages {...defaultProps}>
<div data-testid="child-content">Child Content</div>
</EnvironmentStages>
)
expect(screen.getByTestId('child-content')).toBeInTheDocument()
})

it('renders the "Hide skipped" checkbox', () => {
renderWithProviders(<EnvironmentStages {...defaultProps} />)
expect(screen.getByLabelText('Hide skipped')).toBeInTheDocument()
})

it('renders the correct link for pre-check logs', () => {
renderWithProviders(<EnvironmentStages {...defaultProps} />)
const logLink = screen.getByText('Pre-check logs').closest('a')
expect(logLink).toHaveAttribute(
'href',
ENVIRONMENT_LOGS_URL('org-1', 'proj-1', 'env-1') + ENVIRONMENT_PRE_CHECK_LOGS_URL()
)
})
})
Loading

0 comments on commit 3874d32

Please sign in to comment.