mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-12-06 00:05:30 +00:00
fix(ops): show requester in request error details
This commit is contained in:
1 parent
328db26f45
commit
bb110fda53
2 files changed
+43
-8
No files matched your search
@@ -28,17 +28,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rounded-xl bg-gray-50 p-4 dark:bg-dark-900">
|
||||
<div
|
||||
v-if="!isUpstreamError(detail) || (errorType !== 'upstream' && (detail.user_email || detail.user_id != null))"
|
||||
class="rounded-xl bg-gray-50 p-4 dark:bg-dark-900"
|
||||
>
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-gray-400">
|
||||
{{ isUpstreamError(detail) ? t('admin.ops.errorDetail.account') : t('admin.ops.errorDetail.user') }}
|
||||
{{ t('admin.ops.errorDetail.user') }}
|
||||
</div>
|
||||
<div class="mt-1 text-sm font-medium text-gray-900 dark:text-white">
|
||||
<template v-if="isUpstreamError(detail)">
|
||||
{{ detail.account_name || (detail.account_id != null ? String(detail.account_id) : '—') }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ detail.user_email || (detail.user_id != null ? String(detail.user_id) : '—') }}
|
||||
</template>
|
||||
{{ detail.user_email || (detail.user_id != null ? String(detail.user_id) : '—') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isUpstreamError(detail)" class="rounded-xl bg-gray-50 p-4 dark:bg-dark-900">
|
||||
<div class="text-xs font-bold uppercase tracking-wider text-gray-400">{{ t('admin.ops.errorDetail.account') }}</div>
|
||||
<div class="mt-1 text-sm font-medium text-gray-900 dark:text-white">
|
||||
{{ detail.account_name || (detail.account_id != null ? String(detail.account_id) : '—') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -76,4 +76,34 @@ describe('OpsErrorDetailModal', () => {
|
||||
expect(wrapper.findAll('pre')).toHaveLength(2)
|
||||
expect(wrapper.text()).not.toContain('admin.ops.errorDetail.payloads.upstream_detail')
|
||||
})
|
||||
|
||||
it('shows the requester alongside the account for a provider 400 in request details', async () => {
|
||||
mocks.getRequestErrorDetail.mockResolvedValue({
|
||||
id: 2,
|
||||
created_at: '2026-11-20T00:00:00Z',
|
||||
phase: 'upstream',
|
||||
type: 'upstream_error',
|
||||
error_owner: 'provider',
|
||||
status_code: 400,
|
||||
upstream_status_code: 400,
|
||||
platform: 'openai',
|
||||
account_name: 'test-provider-account',
|
||||
user_id: 42,
|
||||
user_email: 'requester@example.test'
|
||||
})
|
||||
|
||||
const wrapper = shallowMount(OpsErrorDetailModal, {
|
||||
props: { show: true, errorId: 2, errorType: 'request' },
|
||||
global: {
|
||||
stubs: {
|
||||
BaseDialog: { template: '<div><slot /></div>' },
|
||||
Icon: true
|
||||
}
|
||||
}
|
||||
})
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.text()).toContain('test-provider-account')
|
||||
expect(wrapper.text()).toContain('requester@example.test')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user