reformat jsx files
This commit is contained in:
parent
3544104196
commit
43d91b9bd1
@ -1,36 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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.<br/>
|
||||
It supports writing key/values to Redis (SET command). <br/>
|
||||
All created keys will have the TTL configured for the data adapter.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterDocumentation;
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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 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.<br/>
|
||||
It supports writing key/values to Redis (SET command). <br/>
|
||||
All created keys will have the TTL configured for the data adapter.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterDocumentation;
|
||||
|
@ -1,116 +1,115 @@
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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" />
|
||||
<Input type="text"
|
||||
id="redis_ttl"
|
||||
name="redis_ttl"
|
||||
label="Redis key TTL"
|
||||
required
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_ttl', 'Redis key TTL in seconds. Set -1 to not expire keys')}
|
||||
bsStyle={this.props.validationState('redis_ttl')}
|
||||
value={config.redis_ttl}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
<Input type="text"
|
||||
id="redis_username"
|
||||
name="redis_username"
|
||||
label="Redis username"
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_username', 'Redis username. Leave empty for no auth or "requirepass" authentication')}
|
||||
bsStyle={this.props.validationState('redis_username')}
|
||||
value={config.redis_username}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
<Input type="password"
|
||||
id="redis_password"
|
||||
label="Redis password"
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_password', 'Redis password. Leave empty for no auth')}
|
||||
bsStyle={this.props.validationState('redis_password')}
|
||||
value={config.redis_password}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9">
|
||||
</Input>
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export default RedisLookupAdapterFieldSet;
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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" />
|
||||
<Input type="text"
|
||||
id="redis_ttl"
|
||||
name="redis_ttl"
|
||||
label="Redis key TTL"
|
||||
required
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_ttl', 'Redis key TTL in seconds. Set -1 to not expire keys')}
|
||||
bsStyle={this.props.validationState('redis_ttl')}
|
||||
value={config.redis_ttl}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
<Input type="text"
|
||||
id="redis_username"
|
||||
name="redis_username"
|
||||
label="Redis username"
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_username', 'Redis username. Leave empty for no auth or "requirepass" authentication')}
|
||||
bsStyle={this.props.validationState('redis_username')}
|
||||
value={config.redis_username}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9" />
|
||||
<Input type="password"
|
||||
id="redis_password"
|
||||
label="Redis password"
|
||||
onChange={this.props.handleFormEvent}
|
||||
help={this.props.validationMessage('redis_password', 'Redis password. Leave empty for no auth')}
|
||||
bsStyle={this.props.validationState('redis_password')}
|
||||
value={config.redis_password}
|
||||
labelClassName="col-sm-3"
|
||||
wrapperClassName="col-sm-9">
|
||||
</Input>
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterFieldSet;
|
||||
|
@ -1,52 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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>
|
||||
<dt>Redis port</dt>
|
||||
<dd>{config.redis_port || 'n/a'}</dd>
|
||||
<dt>Redis database</dt>
|
||||
<dd>{config.redis_database}</dd>
|
||||
<dt>Redis key TTL</dt>
|
||||
<dd>{config.redis_ttl || 'n/a'}</dd>
|
||||
<dt>Redis username</dt>
|
||||
<dd>{config.redis_username || 'n/a'}</dd>
|
||||
<dt>Redis password</dt>
|
||||
<dd>******</dd>
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterSummary;
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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>
|
||||
<dt>Redis port</dt>
|
||||
<dd>{config.redis_port || 'n/a'}</dd>
|
||||
<dt>Redis database</dt>
|
||||
<dd>{config.redis_database}</dd>
|
||||
<dt>Redis key TTL</dt>
|
||||
<dd>{config.redis_ttl || 'n/a'}</dd>
|
||||
<dt>Redis username</dt>
|
||||
<dd>{config.redis_username || 'n/a'}</dd>
|
||||
<dt>Redis password</dt>
|
||||
<dd>******</dd>
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default RedisLookupAdapterSummary;
|
||||
|
@ -1,39 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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 no-unused-vars
|
||||
import webpackEntry from 'webpack-entry';
|
||||
|
||||
import { PluginManifest, PluginStore } from 'graylog-web-plugin/plugin';
|
||||
import packageJson from '../../package.json';
|
||||
|
||||
import RedisLookupAdapterDocumentation from './dataadapters/RedisLookupAdapterDocumentation';
|
||||
import RedisLookupAdapterFieldSet from './dataadapters/RedisLookupAdapterFieldSet';
|
||||
import RedisLookupAdapterSummary from './dataadapters/RedisLookupAdapterSummary';
|
||||
|
||||
const manifest = new PluginManifest(packageJson, {
|
||||
lookupTableAdapters: [
|
||||
{
|
||||
type: 'RedisLookup',
|
||||
displayName: 'Redis Lookup',
|
||||
formComponent: RedisLookupAdapterFieldSet,
|
||||
summaryComponent: RedisLookupAdapterSummary,
|
||||
documentationComponent: RedisLookupAdapterDocumentation,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
PluginStore.register(manifest);
|
||||
/*
|
||||
* Copyright (C) 2024 johan@nosd.in
|
||||
*
|
||||
* 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 no-unused-vars
|
||||
import webpackEntry from 'webpack-entry';
|
||||
|
||||
import { PluginManifest, PluginStore } from 'graylog-web-plugin/plugin';
|
||||
import packageJson from '../../package.json';
|
||||
|
||||
import RedisLookupAdapterDocumentation from './dataadapters/RedisLookupAdapterDocumentation';
|
||||
import RedisLookupAdapterFieldSet from './dataadapters/RedisLookupAdapterFieldSet';
|
||||
import RedisLookupAdapterSummary from './dataadapters/RedisLookupAdapterSummary';
|
||||
|
||||
const manifest = new PluginManifest(packageJson, {
|
||||
lookupTableAdapters: [
|
||||
{
|
||||
type: 'RedisLookup',
|
||||
displayName: 'Redis Lookup',
|
||||
formComponent: RedisLookupAdapterFieldSet,
|
||||
summaryComponent: RedisLookupAdapterSummary,
|
||||
documentationComponent: RedisLookupAdapterDocumentation,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
PluginStore.register(manifest);
|
||||
|
Loading…
x
Reference in New Issue
Block a user