-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🪟 🎉 Add connector builder logs viewer and improve page/slice state (#…
…18949) * change splitter to be single bar, and rename props * add logs viewer to testing panel * make log display height 100% * remove comment * clean up some styling, and add record count to tab title * cleanup + only render paginator and slice selector when necessary * move selected slice/page state into context and fix bug with state between streams * fix tab keys * pull LogsDisplay out into its own component to simplify ResultDisplay * simplify ResultDisplay prop Co-authored-by: Tim Roes <[email protected]>
- Loading branch information
Showing
18 changed files
with
252 additions
and
109 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
airbyte-webapp/src/components/StreamTestingPanel/LogsDisplay.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@use "scss/colors"; | ||
@use "scss/variables"; | ||
|
||
.container { | ||
padding-top: variables.$spacing-sm; | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
} | ||
|
||
.header { | ||
background-color: colors.$grey-50; | ||
display: flex; | ||
align-items: center; | ||
gap: variables.$spacing-md; | ||
padding: variables.$spacing-sm variables.$spacing-md; | ||
} | ||
|
||
.numLogsDisplay { | ||
border-radius: variables.$border-radius-md; | ||
background-color: colors.$blue; | ||
padding: 1px variables.$spacing-sm; | ||
color: colors.$white; | ||
} | ||
|
||
.logsDisplay { | ||
overflow-y: auto; | ||
height: 100%; | ||
} |
29 changes: 29 additions & 0 deletions
29
airbyte-webapp/src/components/StreamTestingPanel/LogsDisplay.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
import { Text } from "components/ui/Text"; | ||
|
||
import { StreamReadLogsItem } from "core/request/ConnectorBuilderClient"; | ||
|
||
import styles from "./LogsDisplay.module.scss"; | ||
|
||
interface LogsDisplayProps { | ||
logs: StreamReadLogsItem[]; | ||
} | ||
|
||
export const LogsDisplay: React.FC<LogsDisplayProps> = ({ logs }) => { | ||
return ( | ||
<div className={styles.container}> | ||
<div className={styles.header}> | ||
<Text size="sm" bold> | ||
<FormattedMessage id="connectorBuilder.connectorLogs" /> | ||
</Text> | ||
<Text className={styles.numLogsDisplay} size="xs" bold> | ||
{logs.length} | ||
</Text> | ||
</div> | ||
<div className={styles.logsDisplay}> | ||
<pre>{JSON.stringify(logs, null, 2)}</pre> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 20 additions & 21 deletions
41
airbyte-webapp/src/components/StreamTestingPanel/ResultDisplay.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,44 @@ | ||
import classNames from "classnames"; | ||
import { useState } from "react"; | ||
|
||
import { Paginator } from "components/ui/Paginator"; | ||
import { Text } from "components/ui/Text"; | ||
|
||
import { StreamRead } from "core/request/ConnectorBuilderClient"; | ||
import { StreamReadSlicesItem } from "core/request/ConnectorBuilderClient"; | ||
import { useConnectorBuilderState } from "services/connectorBuilder/ConnectorBuilderStateService"; | ||
|
||
import { PageDisplay } from "./PageDisplay"; | ||
import styles from "./ResultDisplay.module.scss"; | ||
import { SliceSelector } from "./SliceSelector"; | ||
|
||
interface ResultDisplayProps { | ||
streamRead: StreamRead; | ||
slices: StreamReadSlicesItem[]; | ||
className?: string; | ||
} | ||
|
||
export const ResultDisplay: React.FC<ResultDisplayProps> = ({ streamRead, className }) => { | ||
const [selectedSliceIndex, setSelectedSliceIndex] = useState(0); | ||
const [selectedPage, setSelectedPage] = useState(0); | ||
export const ResultDisplay: React.FC<ResultDisplayProps> = ({ slices, className }) => { | ||
const { selectedSlice, selectedPage, setSelectedSlice, setSelectedPage } = useConnectorBuilderState(); | ||
|
||
const handlePageChange = (selectedPageIndex: number) => { | ||
setSelectedPage(selectedPageIndex); | ||
}; | ||
|
||
const slice = streamRead.slices[selectedSliceIndex]; | ||
const slice = slices[selectedSlice]; | ||
const numPages = slice.pages.length; | ||
const page = slice.pages[selectedPage]; | ||
|
||
return ( | ||
<div className={classNames(className, styles.container)}> | ||
<SliceSelector | ||
className={styles.sliceSelector} | ||
slices={streamRead.slices} | ||
selectedSliceIndex={selectedSliceIndex} | ||
onSelect={setSelectedSliceIndex} | ||
/> | ||
{slices.length > 1 && ( | ||
<SliceSelector | ||
className={styles.sliceSelector} | ||
slices={slices} | ||
selectedSliceIndex={selectedSlice} | ||
onSelect={setSelectedSlice} | ||
/> | ||
)} | ||
<PageDisplay className={styles.pageDisplay} page={page} /> | ||
<div className={styles.paginator}> | ||
<Text className={styles.pageLabel}>Page:</Text> | ||
<Paginator numPages={numPages} onPageChange={handlePageChange} selectedPage={selectedPage} /> | ||
</div> | ||
{slice.pages.length > 1 && ( | ||
<div className={styles.paginator}> | ||
<Text className={styles.pageLabel}>Page:</Text> | ||
<Paginator numPages={numPages} onPageChange={setSelectedPage} selectedPage={selectedPage} /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
right: 0; | ||
left: 0; | ||
width: 100%; | ||
z-index: 1; | ||
} | ||
|
||
.option { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.