-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display additional failure information when sync is expanded and jump to relevant log line #12896
Changes from all commits
f81fe90
9b818bc
e13cedf
72604f6
873a6b8
99e2302
47f6383
a4d29d7
5555e40
c98a677
49bc3b0
5a25024
db57953
212ba44
f1760bf
8647e80
9355d5c
a52b43b
a001ed2
27efa7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import dayjs from "dayjs"; | ||
import { useIntl } from "react-intl"; | ||
import styled from "styled-components"; | ||
|
||
import { AttemptRead } from "core/request/AirbyteClient"; | ||
|
||
type IProps = { | ||
attempts?: AttemptRead[]; | ||
}; | ||
|
||
const ExpandedFailureContainer = styled.div` | ||
font-size: 12px; | ||
line-height: 15px; | ||
padding: 10px; | ||
padding-left: 40px; | ||
color: ${({ theme }) => theme.greyColor40}; | ||
`; | ||
|
||
const FailureDateDisplay = styled.span` | ||
font-style: italic; | ||
`; | ||
|
||
const getFailureFromAttempt = (attempt: AttemptRead) => { | ||
return attempt.failureSummary?.failures[0]; | ||
}; | ||
|
||
const ErrorDetails: React.FC<IProps> = ({ attempts }) => { | ||
const { formatMessage } = useIntl(); | ||
|
||
if (!attempts?.length) { | ||
return null; | ||
} | ||
|
||
const getInternalFailureMessage = (attempt: AttemptRead) => { | ||
const failure = getFailureFromAttempt(attempt); | ||
const failureMessage = failure?.internalMessage ?? formatMessage({ id: "errorView.unknown" }); | ||
|
||
return `${formatMessage({ | ||
id: "sources.additionalFailureInfo", | ||
})}: ${failureMessage}`; | ||
}; | ||
|
||
const attempt = attempts[attempts.length - 1]; | ||
const failure = getFailureFromAttempt(attempt); | ||
|
||
if (!failure) { | ||
return null; | ||
} | ||
|
||
const internalMessage = getInternalFailureMessage(attempt); | ||
return ( | ||
<ExpandedFailureContainer> | ||
{!!failure.timestamp && ( | ||
<FailureDateDisplay>{dayjs.utc(failure.timestamp).format("YYYY-MM-DD HH:mm:ss")} - </FailureDateDisplay> | ||
)} | ||
{internalMessage} | ||
</ExpandedFailureContainer> | ||
); | ||
}; | ||
|
||
export default ErrorDetails; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
import { LazyLog } from "react-lazylog"; | ||
import styled from "styled-components"; | ||
|
@@ -47,8 +46,10 @@ const Logs: React.FC<LogsProps> = ({ logsArray }) => { | |
lineClassName="logLine" | ||
highlightLineClassName="highlightLogLine" | ||
selectableLines | ||
follow | ||
follow={true} | ||
style={{ background: "transparent" }} | ||
scrollToLine={undefined} | ||
highlight={[]} | ||
Comment on lines
+51
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a hack to prevent it from scrolling to a specific line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep - and it was undocumented and super hard to find. That's why I left this in so we would remember this for the future when we get to #12128 |
||
/> | ||
) : ( | ||
<FormattedMessage id="sources.emptyLogs" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// This file should contain all stateful modification that need to be made to libraries. | ||
// In general this is a bad pattern that should try to be avoided, but some libraries will | ||
// require plugins to be registered to their global instance. This file encapsulates all those | ||
// stateful modifications. | ||
|
||
import dayjs from "dayjs"; | ||
import customParseFormat from "dayjs/plugin/customParseFormat"; | ||
import utc from "dayjs/plugin/utc"; | ||
|
||
// Configure dayjs instance | ||
dayjs.extend(customParseFormat); | ||
dayjs.extend(utc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, we prefer it without the
={true}