Merge branch 'fix/webhook-scope-filter-enum-storage' into 'main'
fix(webhook): scope_filter Hibernate ordinal bug + UI toggle active See merge request 2-6/2-6-4/terravault/ordinis!167
This commit is contained in:
@@ -33,6 +33,7 @@ import {
|
||||
useRetryWebhookDelivery,
|
||||
useRotateWebhookSecret,
|
||||
useTestWebhook,
|
||||
useUpdateWebhook,
|
||||
} from '@/api/mutations'
|
||||
import type { WebhookTestPingResult } from '@/api/client'
|
||||
import { SCOPE_DOT } from '@/lib/scope-style'
|
||||
@@ -63,6 +64,7 @@ function WebhookDetailPage() {
|
||||
}
|
||||
const rotateMut = useRotateWebhookSecret()
|
||||
const deleteMut = useDeleteWebhook()
|
||||
const updateMut = useUpdateWebhook()
|
||||
const retryMut = useRetryWebhookDelivery()
|
||||
const testMut = useTestWebhook()
|
||||
const [testResult, setTestResult] = useState<WebhookTestPingResult | null>(null)
|
||||
@@ -161,9 +163,38 @@ function WebhookDetailPage() {
|
||||
<code className="text-mono break-all">{data.url}</code>
|
||||
</InfoRow>
|
||||
<InfoRow label={t('webhooks.col.status')}>
|
||||
<Badge variant={data.active ? 'success' : 'neutral'}>
|
||||
{data.active ? t('webhooks.active') : t('webhooks.inactive')}
|
||||
</Badge>
|
||||
<div className="flex items-center gap-3">
|
||||
<Badge variant={data.active ? 'success' : 'neutral'}>
|
||||
{data.active ? t('webhooks.active') : t('webhooks.inactive')}
|
||||
</Badge>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
// Toggle active. PUT requires full payload — пересобираем
|
||||
// из current state + переворачиваем active. Backend
|
||||
// service treats PUT как full replace, поэтому все
|
||||
// поля должны быть переданы.
|
||||
updateMut.mutate({
|
||||
id: data.id,
|
||||
payload: {
|
||||
name: data.name,
|
||||
url: data.url,
|
||||
scopeFilter: data.scopeFilter ?? undefined,
|
||||
dictionaryFilter: data.dictionaryFilter ?? undefined,
|
||||
eventTypeFilter: data.eventTypeFilter ?? undefined,
|
||||
description: data.description ?? undefined,
|
||||
active: !data.active,
|
||||
},
|
||||
})
|
||||
}}
|
||||
disabled={updateMut.isPending}
|
||||
className="text-cap text-accent hover:underline disabled:opacity-50"
|
||||
>
|
||||
{data.active
|
||||
? t('webhooks.action.deactivate', { defaultValue: 'Деактивировать' })
|
||||
: t('webhooks.action.activate', { defaultValue: 'Активировать' })}
|
||||
</button>
|
||||
</div>
|
||||
</InfoRow>
|
||||
<InfoRow label={t('webhooks.field.scopeFilter')}>
|
||||
{data.scopeFilter && data.scopeFilter.length > 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user