-
Notifications
You must be signed in to change notification settings - Fork 15
feat: support transfer #1995
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
Merged
Merged
feat: support transfer #1995
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3d666c6
WIP
nshestakov 17dbc1b
WIP
nshestakov dfa6436
fix query templates
nshestakov fca0135
revert packages-lock
nshestakov f7b4efb
revert packages-lock
nshestakov 5531c65
revert packages-lock
nshestakov b2f10ae
revert packages-lock
nshestakov 1b827de
Merge branch 'main' into trenasfer
nshestakov fa71cb9
for rebuild
nshestakov d6b9145
use YqlHighlighter
nshestakov a067c7b
use YqlHighlighter 2
nshestakov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
27 changes: 27 additions & 0 deletions
27
src/containers/Tenant/Diagnostics/Overview/TransferInfo/Credentials.tsx
This file contains hidden or 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,27 @@ | ||
import {Label} from '@gravity-ui/uikit'; | ||
|
||
import type {TConnectionParams} from '../../../../../types/api/schema/replication'; | ||
|
||
interface CredentialsProps { | ||
connection?: TConnectionParams; | ||
} | ||
|
||
export function Credentials({connection}: CredentialsProps) { | ||
if (!connection) { | ||
return null; | ||
} | ||
|
||
if (connection.StaticCredentials) { | ||
return ( | ||
<Label value={connection.StaticCredentials.User} theme="normal"> | ||
user | ||
</Label> | ||
); | ||
} | ||
|
||
if ('OAuthToken' in connection) { | ||
return 'OAuth'; | ||
} | ||
|
||
return 'unknown'; | ||
} |
103 changes: 103 additions & 0 deletions
103
src/containers/Tenant/Diagnostics/Overview/TransferInfo/TransferInfo.tsx
This file contains hidden or 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,103 @@ | ||
import type {DefinitionListItem} from '@gravity-ui/components'; | ||
import {Flex, Text} from '@gravity-ui/uikit'; | ||
|
||
import {AsyncReplicationState} from '../../../../../components/AsyncReplicationState'; | ||
import {YDBDefinitionList} from '../../../../../components/YDBDefinitionList/YDBDefinitionList'; | ||
import type {TEvDescribeSchemeResult} from '../../../../../types/api/schema'; | ||
import {getEntityName} from '../../../utils'; | ||
|
||
import {Credentials} from './Credentials'; | ||
import i18n from './i18n'; | ||
|
||
interface TransferProps { | ||
data?: TEvDescribeSchemeResult; | ||
} | ||
|
||
/** Displays overview for Transfer EPathType */ | ||
export function TransferInfo({data}: TransferProps) { | ||
const entityName = getEntityName(data?.PathDescription); | ||
|
||
if (!data) { | ||
return ( | ||
<div className="error"> | ||
{i18n('noData')} {entityName} | ||
</div> | ||
); | ||
} | ||
|
||
const transferItems = prepareTransferItems(data); | ||
|
||
return ( | ||
<Flex direction="column" gap="4"> | ||
<YDBDefinitionList title={entityName} items={transferItems} /> | ||
</Flex> | ||
); | ||
} | ||
|
||
function prepareTransferItems(data: TEvDescribeSchemeResult) { | ||
const transferDescription = data.PathDescription?.ReplicationDescription || {}; | ||
const state = transferDescription.State; | ||
const srcConnectionParams = transferDescription.Config?.SrcConnectionParams || {}; | ||
const {Endpoint, Database} = srcConnectionParams; | ||
const target = transferDescription.Config?.TransferSpecific?.Targets[0]; | ||
const srcPath = target?.SrcPath; | ||
const dstPath = target?.DstPath; | ||
const transformLambda = target?.TransformLambda; | ||
|
||
const info: DefinitionListItem[] = []; | ||
|
||
if (state) { | ||
info.push({ | ||
name: i18n('state.label'), | ||
content: <AsyncReplicationState state={state} />, | ||
}); | ||
} | ||
|
||
if (Endpoint) { | ||
info.push({ | ||
name: i18n('srcConnection.endpoint.label'), | ||
copyText: Endpoint, | ||
content: <Text variant="code-inline-2">{Endpoint}</Text>, | ||
}); | ||
} | ||
|
||
if (Database) { | ||
info.push({ | ||
name: i18n('srcConnection.database.label'), | ||
copyText: Database, | ||
content: <Text variant="code-inline-2">{Database}</Text>, | ||
}); | ||
} | ||
|
||
if (srcConnectionParams) { | ||
info.push({ | ||
name: i18n('credentials.label'), | ||
content: <Credentials connection={srcConnectionParams} />, | ||
}); | ||
} | ||
|
||
info.push({ | ||
name: i18n('srcPath.label'), | ||
copyText: srcPath, | ||
content: <Text variant="code-inline-2">{srcPath}</Text>, | ||
}); | ||
|
||
info.push({ | ||
name: i18n('dstPath.label'), | ||
copyText: dstPath, | ||
content: <Text variant="code-inline-2">{dstPath}</Text>, | ||
}); | ||
|
||
// TODO use true pre | ||
info.push({ | ||
name: i18n('transformLambda.label'), | ||
copyText: transformLambda, | ||
content: ( | ||
<Text variant="code-2" whiteSpace="nowrap"> | ||
<pre>{transformLambda}</pre> | ||
</Text> | ||
), | ||
}); | ||
|
||
return info; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/containers/Tenant/Diagnostics/Overview/TransferInfo/i18n/en.json
This file contains hidden or 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,10 @@ | ||
{ | ||
"credentials.label": "Credentials", | ||
"noData": "No data for entity:", | ||
"srcConnection.database.label": "Source Database Path", | ||
"srcConnection.endpoint.label": "Source Cluster Endpoint", | ||
"state.label": "State", | ||
"srcPath.label": "Source Topic", | ||
"dstPath.label": "Destination Table", | ||
"transformLambda.label": "Transformation Lambda" | ||
} |
7 changes: 7 additions & 0 deletions
7
src/containers/Tenant/Diagnostics/Overview/TransferInfo/i18n/index.ts
This file contains hidden or 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,7 @@ | ||
import {registerKeysets} from '../../../../../../utils/i18n'; | ||
|
||
import en from './en.json'; | ||
|
||
const COMPONENT = 'ydb-diagnostics-transfer-info'; | ||
|
||
export default registerKeysets(COMPONENT, {en}); |
1 change: 1 addition & 0 deletions
1
src/containers/Tenant/Diagnostics/Overview/TransferInfo/index.ts
This file contains hidden or 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 './TransferInfo'; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.