-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display connection state in connection setting page (#13394)
* Display Connection State in Setting page * memoize callback * rendering and confirmaton * setState API * Input validation * remove JSON step * rename apiMethod to `updateState` * test and adjust route * skip if sync is running * prevent state update when sync is running * code editor component * errors fixed * scss style * make linter happy * Back to monaco editor * Remove ability to edit state * Adjust FE code * Fix CSS problem * Update airbyte-webapp/src/locales/en.json Co-authored-by: Edmundo Ruiz Ghanem <168664+edmundito@users.noreply.github.com> * just use PRE to render state for now Co-authored-by: Tim Roes <tim@airbyte.io> Co-authored-by: Edmundo Ruiz Ghanem <168664+edmundito@users.noreply.github.com>
- Loading branch information
1 parent
828efb6
commit e208d2c
Showing
13 changed files
with
1,227 additions
and
1,066 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Editor from "@monaco-editor/react"; | ||
import React from "react"; | ||
|
||
interface CodeEditorProps { | ||
height?: string; | ||
code: string; | ||
language?: string; | ||
} | ||
|
||
export const CodeEditor: React.FC<CodeEditorProps> = ({ code, height, language }) => { | ||
return ( | ||
<Editor | ||
height={height ?? "200px"} | ||
language={language} | ||
value={code} | ||
options={{ | ||
lineNumbersMinChars: 2, | ||
readOnly: true, | ||
matchBrackets: "always", | ||
minimap: { | ||
enabled: false, | ||
}, | ||
}} | ||
/> | ||
); | ||
}; |
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 @@ | ||
export * from "./CodeEditor"; |
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,9 +1,10 @@ | ||
import styled from "styled-components"; | ||
|
||
export const Card = styled.div<{ full?: boolean }>` | ||
export const Card = styled.div<{ full?: boolean; $withPadding?: boolean }>` | ||
width: ${({ full }) => (full ? "100%" : "auto")}; | ||
background: ${({ theme }) => theme.whiteColor}; | ||
border-radius: 10px; | ||
box-shadow: 0 2px 4px ${({ theme }) => theme.cardShadowColor}; | ||
padding: ${({ $withPadding }) => ($withPadding ? "20px" : undefined)}; | ||
//border: 1px solid ${({ theme }) => theme.greyColor20}; | ||
`; |
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
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
30 changes: 30 additions & 0 deletions
30
airbyte-webapp/src/pages/ConnectionPage/pages/ConnectionItemPage/components/StateBlock.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,30 @@ | ||
import React, { useMemo } from "react"; | ||
import { FormattedMessage, useIntl } from "react-intl"; | ||
|
||
import { H5, Card } from "components"; | ||
|
||
import { useGetConnectionState } from "hooks/services/useConnectionHook"; | ||
|
||
interface StateBlockProps { | ||
connectionId: string; | ||
} | ||
|
||
export const StateBlock: React.FC<StateBlockProps> = ({ connectionId }) => { | ||
const { formatMessage } = useIntl(); | ||
const state = useGetConnectionState(connectionId); | ||
|
||
const stateString = useMemo(() => { | ||
return state?.state | ||
? JSON.stringify(state.state, null, 2) | ||
: formatMessage({ id: "tables.connectionState.noConnectionState" }); | ||
}, [formatMessage, state.state]); | ||
|
||
return ( | ||
<Card $withPadding> | ||
<H5 bold> | ||
<FormattedMessage id={"tables.connectionState.title"} /> | ||
</H5> | ||
<pre style={{ maxHeight: 200, overflowY: "scroll" }}>{stateString}</pre> | ||
</Card> | ||
); | ||
}; |
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