-
Notifications
You must be signed in to change notification settings - Fork 97
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
UI for Snowflake Peer #474
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2789ee1
Boilerplate for create peer UI
Amogh-Bharadwaj b71a594
feat: apis for validate and create peer
Amogh-Bharadwaj 1a98f3f
ui for create pg peer
Amogh-Bharadwaj f95d1b6
create peer for postgres
Amogh-Bharadwaj 0c2baac
routes back to list
Amogh-Bharadwaj 4dc68c0
more generalisation, tweaks
Amogh-Bharadwaj 6e2ea1b
lint
Amogh-Bharadwaj 1b87f49
minor change
Amogh-Bharadwaj cae2f4c
refactors routes, cleans code
Amogh-Bharadwaj 619fb8e
fix: form errors
Amogh-Bharadwaj abd9b1c
fix: name of config component
Amogh-Bharadwaj a713fed
snowflake peer
Amogh-Bharadwaj 27ef6f0
adds info for fields, visual changes
Amogh-Bharadwaj 13db06c
adds noreferrer
Amogh-Bharadwaj 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
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 was deleted.
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
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,69 @@ | ||
import { SnowflakeConfig } from '@/grpc_generated/peers'; | ||
import { Setting } from './common'; | ||
|
||
export const snowflakeSetting: Setting[] = [ | ||
{ | ||
label: 'Account ID', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, accountId: value })), | ||
}, | ||
{ | ||
label: 'Username', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, username: value })), | ||
}, | ||
{ | ||
label: 'Private Key', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, privateKey: value })), | ||
type: 'file', | ||
}, | ||
{ | ||
label: 'Warehouse', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, warehouse: value })), | ||
}, | ||
{ | ||
label: 'Database', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, database: value })), | ||
}, | ||
{ | ||
label: 'Role', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, role: value })), | ||
}, | ||
{ | ||
label: 'Query Timeout', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, queryTimeout: parseInt(value, 10) || 0 })), | ||
}, | ||
{ | ||
label: 'S3 Integration', | ||
stateHandler: (value, setter) => | ||
setter((curr) => ({ ...curr, s3Integration: value })), | ||
}, | ||
{ | ||
label: 'Password', | ||
stateHandler: (value, setter) => { | ||
if (!value.length) { | ||
// remove password key from state if empty | ||
setter((curr) => { | ||
delete curr['password']; | ||
return curr; | ||
}); | ||
} else setter((curr) => ({ ...curr, password: value })); | ||
}, | ||
}, | ||
]; | ||
|
||
export const blankSnowflakeSetting: SnowflakeConfig = { | ||
accountId: '', | ||
privateKey: '', | ||
username: '', | ||
warehouse: '', | ||
database: '', | ||
role: '', | ||
queryTimeout: 0, | ||
s3Integration: '', | ||
}; |
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 |
---|---|---|
|
@@ -42,3 +42,67 @@ export const pgSchema = z.object({ | |
.max(100, 'Transaction snapshot too long (100 char limit)') | ||
.optional(), | ||
}); | ||
|
||
export const sfSchema = z.object({ | ||
accountId: z | ||
.string({ | ||
required_error: 'Account ID is required', | ||
invalid_type_error: 'Account ID must be a string', | ||
}) | ||
.nonempty({ message: 'Account ID must be non-empty' }) | ||
.max(255, 'Account ID must be less than 255 characters'), | ||
privateKey: z | ||
.string({ | ||
required_error: 'Private Key is required', | ||
invalid_type_error: 'Private Key must be a string', | ||
}) | ||
.nonempty({ message: 'Private Key must be non-empty' }), | ||
username: z | ||
.string({ | ||
required_error: 'Username is required', | ||
invalid_type_error: 'Username must be a number', | ||
}) | ||
.nonempty({ message: 'Username must be non-empty' }) | ||
.max(255, 'Port must be below 65535'), | ||
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. this is for username |
||
database: z | ||
.string({ | ||
required_error: 'Database is required', | ||
invalid_type_error: 'Database must be a string', | ||
}) | ||
.nonempty({ message: 'Database must be non-empty' }) | ||
.max(255, 'Database must be less than 100 characters'), | ||
warehouse: z | ||
.string({ | ||
required_error: 'Warehouse is required', | ||
invalid_type_error: 'Warehouse must be a string', | ||
}) | ||
.nonempty({ message: 'Warehouse must be non-empty' }) | ||
.max(255, 'Warehouse must be less than 64 characters'), | ||
role: z | ||
.string({ | ||
invalid_type_error: 'Role must be a string', | ||
}) | ||
.nonempty({ message: 'Role must be non-empty' }) | ||
.max(255, 'Role must be below 255 characters'), | ||
queryTimeout: z | ||
.number({ | ||
invalid_type_error: 'Query timeout must be a number', | ||
}) | ||
.int() | ||
.min(0, 'Query timeout must be a positive integer') | ||
.max(65535, 'Query timeout must be below 65535 seconds') | ||
.optional(), | ||
password: z | ||
.string({ | ||
invalid_type_error: 'Password must be a string', | ||
}) | ||
.max(255, 'Password must be less than 255 characters') | ||
.optional() | ||
.transform((e) => (e === '' ? undefined : e)), | ||
s3Integration: z | ||
.string({ | ||
invalid_type_error: 's3Integration must be a string', | ||
}) | ||
.max(255, 's3Integration must be less than 255 characters') | ||
.optional(), | ||
}); |
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,5 +1,5 @@ | ||
import { PostgresConfig } from '@/grpc_generated/peers'; | ||
import { PostgresConfig, SnowflakeConfig } from '@/grpc_generated/peers'; | ||
import { Dispatch, SetStateAction } from 'react'; | ||
|
||
export type PeerConfig = PostgresConfig; | ||
export type PeerConfig = PostgresConfig | SnowflakeConfig; | ||
export type PeerSetter = Dispatch<SetStateAction<PeerConfig>>; |
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.
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.
can you create an issue to upload pkey file and link it here?