mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console): hide success rate on the hook details page when no request happened (#3897)
This commit is contained in:
parent
37c3f5952d
commit
e7ee0a9523
1 changed files with 14 additions and 9 deletions
|
@ -42,6 +42,7 @@ function WebhookDetails() {
|
||||||
const { data, error, mutate } = useSWR<HookResponse, RequestError>(
|
const { data, error, mutate } = useSWR<HookResponse, RequestError>(
|
||||||
id && buildUrl(`api/hooks/${id}`, { includeExecutionStats: String(true) })
|
id && buildUrl(`api/hooks/${id}`, { includeExecutionStats: String(true) })
|
||||||
);
|
);
|
||||||
|
const { executionStats } = data ?? {};
|
||||||
const isLoading = !data && !error;
|
const isLoading = !data && !error;
|
||||||
const api = useApi();
|
const api = useApi();
|
||||||
|
|
||||||
|
@ -113,18 +114,22 @@ function WebhookDetails() {
|
||||||
<div className={styles.metadata}>
|
<div className={styles.metadata}>
|
||||||
<div className={styles.title}>{data.name}</div>
|
<div className={styles.title}>{data.name}</div>
|
||||||
<div>
|
<div>
|
||||||
{isEnabled ? (
|
{isEnabled && executionStats ? (
|
||||||
<div className={styles.state}>
|
<div className={styles.state}>
|
||||||
<SuccessRate
|
{executionStats.requestCount > 0 && (
|
||||||
className={styles.successRate}
|
<>
|
||||||
successCount={data.executionStats.successCount}
|
<SuccessRate
|
||||||
totalCount={data.executionStats.requestCount}
|
className={styles.successRate}
|
||||||
/>
|
successCount={executionStats.successCount}
|
||||||
<DynamicT forKey="webhook_details.success_rate" />
|
totalCount={executionStats.requestCount}
|
||||||
<div className={styles.verticalBar} />
|
/>
|
||||||
|
<DynamicT forKey="webhook_details.success_rate" />
|
||||||
|
<div className={styles.verticalBar} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<DynamicT
|
<DynamicT
|
||||||
forKey="webhook_details.requests"
|
forKey="webhook_details.requests"
|
||||||
interpolation={{ value: data.executionStats.requestCount }}
|
interpolation={{ value: executionStats.requestCount }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|
Loading…
Reference in a new issue