Skip to content
Merged
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 @@ -200,3 +200,14 @@ describe('AuditLogs layering', () => {
expect(tableHeader).toHaveClass('z-dropdown')
})
})

describe('AuditLogs event filter', () => {
it('should list the Operator update event types in the Event filter', async () => {
const { userEvent } = renderWithProviders(<AuditLogs {...props} events={[]} isLoading={false} />)

await userEvent.click(screen.getByText('Event'))

const menuItems = screen.getAllByTestId('menuItem').map((item) => item.textContent)
expect(menuItems).toEqual(expect.arrayContaining(['Operator update', 'Maintenance operator']))
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,28 @@ describe('RowEvent', () => {
}
)

it.each([
[OrganizationEventType.OPERATOR_UPDATE, 'Operator Update', 'fa-rocket-launch'],
[OrganizationEventType.MAINTENANCE_OPERATOR, 'Maintenance · Operator Update', 'fa-wrench'],
[OrganizationEventType.TRIGGER_DEPLOY, 'Trigger Deploy', 'fa-rocket-launch'],
[OrganizationEventType.MAINTENANCE, 'Maintenance', 'fa-wrench'],
])('should render %s with its label and icon', (eventType, label, iconClass) => {
renderWithProviders(
<RowEvent
{...props}
event={{
...props.event,
event_type: eventType,
target_type: OrganizationEventTargetType.CLUSTER,
sub_target_type: null,
}}
/>
)

expect(screen.getByTestId('tag')).toHaveTextContent(new RegExp(`^${label}$`))
expect(screen.getByTestId('row-event').querySelector(`.${iconClass}`)).toBeInTheDocument()
})

it('should render Agent task for the agentic workflow target type', () => {
renderWithProviders(
<RowEvent
Expand Down
14 changes: 9 additions & 5 deletions libs/domains/audit-logs/feature/src/lib/row-event/row-event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ export interface RowEventProps {
validTargetIds?: ValidTargetIds
}

const formatEventName = (eventName: string) => {
return eventName.split('_').map(upperCaseFirstLetter).join(' ')
}
const formatEventName = (eventType?: OrganizationEventType) =>
match(eventType)
.with(OrganizationEventType.MAINTENANCE_OPERATOR, () => 'Maintenance · Operator Update')
.otherwise((type) => (type ?? '').split('_').map(upperCaseFirstLetter).join(' '))

const serviceOverviewUrl = (organizationId: string, projectId: string, environmentId: string, serviceId: string) =>
`/organization/${organizationId}/project/${projectId}/environment/${environmentId}/service/${serviceId}/overview`
Expand Down Expand Up @@ -174,14 +175,17 @@ export function RowEvent(props: RowEventProps) {
OrganizationEventType.TRIGGER_STOP,
OrganizationEventType.TRIGGER_TERRAFORM_FORCE_UNLOCK,
OrganizationEventType.TRIGGER_TERRAFORM_MIGRATE_STATE,
OrganizationEventType.OPERATOR_UPDATE,
() => <Icon iconName="rocket-launch" className="text-neutral-subtle" />
)
.with(OrganizationEventType.DELETE, OrganizationEventType.DELETED, () => (
<Icon iconName="trash-can" className="text-neutral-subtle" />
))
.with(OrganizationEventType.CLONE, () => <Icon iconName="copy" className="text-neutral-subtle" />)
.with(OrganizationEventType.DRY_RUN, () => <Icon iconName="rotate-right" className="text-neutral-subtle" />)
.with(OrganizationEventType.MAINTENANCE, () => <Icon iconName="wrench" className="text-neutral-subtle" />)
.with(OrganizationEventType.MAINTENANCE, OrganizationEventType.MAINTENANCE_OPERATOR, () => (
<Icon iconName="wrench" className="text-neutral-subtle" />
))
.with(OrganizationEventType.FORCE_RUN_SUCCEEDED, () => (
<Icon iconName="circle-check" className="text-neutral-subtle" />
))
Expand Down Expand Up @@ -235,7 +239,7 @@ export function RowEvent(props: RowEventProps) {
<Skeleton height={10} width={80} show={isPlaceholder}>
<span className="block truncate whitespace-nowrap">
<span className={isEventTypeFailed ? 'text-negative' : 'text-brand'}>
{formatEventName(event.event_type ?? '')}
{formatEventName(event.event_type)}
</span>
{event.sub_target_type && (
<span className="text-neutral">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"mermaid": "11.6.0",
"monaco-editor": "0.53.0",
"posthog-js": "1.345.1",
"qovery-typescript-axios": "1.1.1007",
"qovery-typescript-axios": "1.1.1010",
"react": "19.3.0",
"react-country-flag": "3.0.2",
"react-datepicker": "4.12.0",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6285,7 +6285,7 @@ __metadata:
prettier: 3.2.5
prettier-plugin-tailwindcss: 0.5.14
pretty-quick: 4.0.0
qovery-typescript-axios: 1.1.1007
qovery-typescript-axios: 1.1.1010
qovery-ws-typescript-axios: 0.1.666
react: 19.3.0
react-country-flag: 3.0.2
Expand Down Expand Up @@ -24656,12 +24656,12 @@ __metadata:
languageName: node
linkType: hard

"qovery-typescript-axios@npm:1.1.1007":
version: 1.1.1007
resolution: "qovery-typescript-axios@npm:1.1.1007"
"qovery-typescript-axios@npm:1.1.1010":
version: 1.1.1010
resolution: "qovery-typescript-axios@npm:1.1.1010"
dependencies:
axios: 1.20.0
checksum: f8662f1567d11edcbe0119c2db44ceeb0b1f0181517b31ca70c89173872dde9fde0f07087b48cbd0d81372c4399675191b520378e9021539ecca100182a5bba8
checksum: a1957c4f49a2c1d131d3826751e0e650f8494c8819e8d1dba0f0989d69f76f7ef6588a3636e950a92cfb5c46b8380fa17863a47ced60d046f181ca31c1e94c01
languageName: node
linkType: hard

Expand Down
Loading