Skip to content

Commit

Permalink
Merge pull request #1562 from memphisdev/RND-392-redis-connector-ui
Browse files Browse the repository at this point in the history
RND-392-redis-connector-ui
  • Loading branch information
SvetaMemphis authored Dec 27, 2023
2 parents 02df8b7 + 519b775 commit 4368dc4
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 7 deletions.
10 changes: 7 additions & 3 deletions ui_src/src/components/connectorModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import { httpRequest } from '../../services/http';
import CloudModal from '../cloudModal';
import { isCloud } from '../../services/valueConvertor';
import { sendTrace } from '../../services/genericServices';
import { connectorTypes } from '../../connectors';
import { connectorTypesSource } from '../../connectors';
import { connectorTypesSink } from '../../connectors';

const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => {
const [stationState, stationDispatch] = useContext(StationStoreContext);
Expand All @@ -54,7 +55,10 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => {
}, [open]);

useEffect(() => {
let connectorType = connectorTypes.find((connector) => connector.name === formFields?.type);
let connectorType =
formFields?.connector_type === 'Source'
? connectorTypesSource.find((connector) => connector.name === formFields?.type)
: connectorTypesSink.find((connector) => connector.name === formFields?.type);
formFields?.type && setConnectorInputFields(connectorType?.inputs[formFields?.connector_type]);
}, [formFields?.type, formFields?.connector_type]);

Expand Down Expand Up @@ -305,7 +309,7 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => {
radiusType="semi-round"
height="40px"
popupClassName="select-options"
options={connectorTypes}
options={formFields?.connector_type === 'Source' ? connectorTypesSource : connectorTypesSink}
value={formFields?.type}
onChange={(e) => {
updateFormState('type', e);
Expand Down
26 changes: 26 additions & 0 deletions ui_src/src/connectors/assets/redisIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions ui_src/src/connectors/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import S3LogoIcon from './assets/s3LogoIcon.svg';
import KafkaIcon from './assets/kafkaIcon.svg';
import KinesisIcon from './assets/awsKinesis.svg';
import RedisIcon from './assets/redisIcon.svg';

import { kafka } from './kafka';
import { kinesis } from './kinesis';
import { redis } from './redis';

export const connectorTypes = [
export const connectorTypesSource = [
{ name: 'Kafka', icon: KafkaIcon, comment: 'Supported version: 0.9 and above', inputs: kafka },
// { name: 'kinesis', icon: KinesisIcon, inputs: kinesis },
{ name: 'S3', icon: S3LogoIcon, disabled: true, soon: true }
];

export const connectorTypesSink = [
{ name: 'Kafka', icon: KafkaIcon, comment: 'Supported version: 0.9 and above', inputs: kafka },
{ name: 'Redis', icon: RedisIcon, inputs: redis },
{ name: 'S3', icon: S3LogoIcon, disabled: true, soon: true }
];
71 changes: 71 additions & 0 deletions ui_src/src/connectors/redis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
export const redis = {
Sink: [
{
name: 'name',
display: 'Connector name',
type: 'string',
required: true,
description: 'Note that the sink connector name is also consumer group name'
},
{
name: 'redis_type',
display: 'Type',
type: 'select',
options: ['KV'],
required: true
// placeholder: 'type'
},
{
name: 'addr',
display: 'Addr',
type: 'string',
placeholder: 'host:port',
required: true,
description: '',
children: false
},
{
name: 'username',
display: 'Username',
type: 'string',
required: false
},
{
name: 'password',
display: 'Password',
type: 'string',
required: false
},
{
name: 'db',
display: 'DB',
type: 'string',
required: true,
placeholder: 0,
description: 'The Redis database number to use'
},
{
name: 'key_header',
display: 'Key header',
description: 'The name of the header in Memphis message, to take the Redis key from',
type: 'string',
required: true
},
{
name: 'memphis_batch_size',
display: 'Memphis batch size (messages)',
type: 'string',
required: false,
placeholder: 100,
description: 'The buffer size used by Memphis to accumulate and handle incoming messages before processing'
},
{
name: 'memphis_max_time_wait',
display: 'Max time to wait for a batch of messages (seconds)',
placeholder: 2,
type: 'string',
required: false,
description: 'The duration which a batch of messages is awaited till processing'
}
]
};

0 comments on commit 4368dc4

Please sign in to comment.