Skip to content

Commit

Permalink
Also convert plugin error popover title
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Sep 26, 2023
1 parent 4b7c24a commit 8c55f5f
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions frontend/src/scenes/plugins/plugin/PluginError.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import { Button, Tag } from 'antd'
import { ClearOutlined } from '@ant-design/icons'
import { PluginErrorType } from '~/types'
import { Tag } from 'antd'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'
import { dayjs } from 'lib/dayjs'
import { LemonDropdown } from '@posthog/lemon-ui'
import { LemonButton, LemonDropdown } from '@posthog/lemon-ui'
import { TZLabel } from '@posthog/apps-common'
import { IconClose } from 'lib/lemon-ui/icons'

export function PluginError({ error, reset }: { error: PluginErrorType; reset?: () => void }): JSX.Element | null {
if (!error) {
return null
}
return (
<LemonDropdown
title={<div style={{ textAlign: 'center' }}>{dayjs(error.time).format('YYYY-MM-DD - HH:mm:ss')}</div>}
overlay={
<>
{reset ? (
<Button size="small" onClick={reset} style={{ float: 'right', marginLeft: 10 }}>
<ClearOutlined /> Delete
</Button>
) : null}
<div>
{error.name ? <strong>{error.name}: </strong> : ''}
{error.message}
<div className="flex items-center">
<span className="grow mr-2">
{error.name ? <strong>{error.name} </strong> : ''}
<TZLabel time={error.time} />
</span>
{reset ? (
<LemonButton size="small" type="secondary" onClick={reset} icon={<IconClose />}>
Clear
</LemonButton>
) : null}
</div>
{error.stack ? (
<CodeSnippet wrap style={{ fontSize: 10 }} language={Language.JavaScript}>
Expand Down

0 comments on commit 8c55f5f

Please sign in to comment.