first commit
This commit is contained in:
34
src/web/dataadapters/RedisLookupAdapterDocumentation.jsx
Normal file
34
src/web/dataadapters/RedisLookupAdapterDocumentation.jsx
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Graylog, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the Server Side Public License, version 1,
|
||||
* as published by MongoDB, Inc.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* Server Side Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the Server Side Public License
|
||||
* along with this program. If not, see
|
||||
* <http://www.mongodb.com/licensing/server-side-public-license>.
|
||||
*/
|
||||
/* eslint-disable react/no-unescaped-entities, no-template-curly-in-string */
|
||||
import React from 'react';
|
||||
|
||||
class RedisLookupAdapterDocumentation extends React.Component {
|
||||
render() {
|
||||
const style = { marginBottom: 10 };
|
||||
return (
|
||||
<div>
|
||||
<p style={style}>
|
||||
The Redis Lookup data adapter lookup redis for the given key and returns the values .
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterDocumentation;
|
85
src/web/dataadapters/RedisLookupAdapterFieldSet.jsx
Normal file
85
src/web/dataadapters/RedisLookupAdapterFieldSet.jsx
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Graylog, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the Server Side Public License, version 1,
|
||||
* as published by MongoDB, Inc.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* Server Side Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the Server Side Public License
|
||||
* along with this program. If not, see
|
||||
* <http://www.mongodb.com/licensing/server-side-public-license>.
|
||||
*/
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
//import { Button } from 'components/graylog';
|
||||
import { Input } from 'components/bootstrap';
|
||||
|
||||
class RedisLookupAdapterFieldSet extends React.Component {
|
||||
static propTypes = {
|
||||
config: PropTypes.shape({
|
||||
redis_host: PropTypes.string.isRequired,
|
||||
}).isRequired,
|
||||
updateConfig: PropTypes.func.isRequired,
|
||||
handleFormEvent: PropTypes.func.isRequired,
|
||||
validationState: PropTypes.func.isRequired,
|
||||
validationMessage: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
handleSelect = (fieldName) => {
|
||||
return (selectedIndicator) => {
|
||||
const config = lodash.cloneDeep(this.props.config);
|
||||
config[fieldName] = selectedIndicator;
|
||||
this.props.updateConfig(config);
|
||||
};
|
||||
};
|
||||
|
||||
render() {
|
||||
const { config } = this.props;
|
||||
|
||||
return (
|
||||
<fieldset>
|
||||
<Input type="text"
|
||||
id="redis_host"
|
||||
name="redis_host"
|
||||
label="Redis host"
|
||||
required
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_host', 'Your Redis Host')}
|
||||
bsStyle={this.props.validationState('redis_host')}
|
||||
value={config.redis_host}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
<Input type="text"
|
||||
id="redis_port"
|
||||
name="redis_port"
|
||||
label="Redis port"
|
||||
required
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_port', 'Redis port instance is listening on')}
|
||||
bsStyle={this.props.validationState('redis_port')}
|
||||
value={config.redis_port}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
<Input type="text"
|
||||
id="redis_database"
|
||||
name="redis_database"
|
||||
label="Redis database"
|
||||
required
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_database', 'Redis database')}
|
||||
bsStyle={this.props.validationState('redis_database')}
|
||||
value={config.redis_database}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default RedisLookupAdapterFieldSet;
|
42
src/web/dataadapters/RedisLookupAdapterSummary.jsx
Normal file
42
src/web/dataadapters/RedisLookupAdapterSummary.jsx
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Graylog, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the Server Side Public License, version 1,
|
||||
* as published by MongoDB, Inc.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* Server Side Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the Server Side Public License
|
||||
* along with this program. If not, see
|
||||
* <http://www.mongodb.com/licensing/server-side-public-license>.
|
||||
*/
|
||||
// eslint-disable-next-line react/prefer-stateless-function
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
class RedisLookupAdapterSummary extends React.Component {
|
||||
static propTypes = {
|
||||
dataAdapter: PropTypes.shape({
|
||||
config: PropTypes.shape({
|
||||
redis_host: PropTypes.string.isRequired,
|
||||
}),
|
||||
}),
|
||||
};
|
||||
|
||||
render() {
|
||||
const { config } = this.props.dataAdapter;
|
||||
|
||||
return (
|
||||
<dl>
|
||||
<dt>Redis host</dt>
|
||||
<dd>{config.redis_host || 'n/a'}</dd>
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterSummary;
|
Reference in New Issue
Block a user