From 4740993d663d0ee4bfb25fe90ac05aacd436d155 Mon Sep 17 00:00:00 2001 From: Priya Date: Wed, 4 Mar 2020 13:02:18 -0600 Subject: [PATCH] Remove awsKeySecret (#424) --- .gitignore | 1 - src/web/aws/common/AdditionalFields.jsx | 9 ++++----- src/web/aws/common/awsAuth.js | 21 --------------------- src/web/aws/common/hooks/useFetch.js | 8 ++++---- 4 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 src/web/aws/common/awsAuth.js diff --git a/.gitignore b/.gitignore index 551e19c0d..023ca1397 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,3 @@ node build build.config.js.sample /cache/ -src/web/aws/common/awsKeySecret.js diff --git a/src/web/aws/common/AdditionalFields.jsx b/src/web/aws/common/AdditionalFields.jsx index 2f4b347f1..ff2f84474 100644 --- a/src/web/aws/common/AdditionalFields.jsx +++ b/src/web/aws/common/AdditionalFields.jsx @@ -3,6 +3,7 @@ import styled from 'styled-components'; import PropTypes from 'prop-types'; import { Icon } from 'components/common'; +import { Button } from 'components/graylog'; const AdditionalFields = ({ children, className, onToggle, title, visible }) => { const [fieldsVisible, setFieldsVisible] = useState(visible); @@ -14,7 +15,7 @@ const AdditionalFields = ({ children, className, onToggle, title, visible }) => return (
- + {title} @@ -44,14 +45,12 @@ const AdditionalFieldsContent = styled.div` padding: 0 100px 0 25px; `; -const ToggleAdditionalFields = styled.button` +const ToggleAdditionalFields = styled(Button)` border: 0; - color: #16ace3; - font-size: 14px; display: block; + font-size: 14px; :hover { - color: #5e123b; text-decoration: underline; } `; diff --git a/src/web/aws/common/awsAuth.js b/src/web/aws/common/awsAuth.js deleted file mode 100644 index 5b5859d3f..000000000 --- a/src/web/aws/common/awsAuth.js +++ /dev/null @@ -1,21 +0,0 @@ -const awsAuth = ({ awsCloudWatchAwsKey, awsCloudWatchAwsSecret }) => { - /* - For development, create a sibling file named `awsKeySecret.js` in the current directory. - ```module.exports = { key: 'YOUR_REAL_KEY', secret: 'YOUR_REAL_SECRET' };``` - This file is already set in .gitignore so it won't be commited - */ - - const key = awsCloudWatchAwsKey ? awsCloudWatchAwsKey.value : ''; - const secret = awsCloudWatchAwsSecret ? awsCloudWatchAwsSecret.value : ''; - const auth = { key, secret }; - - try { - // eslint-disable-next-line global-require - const realAuth = require('./awsKeySecret'); - return { ...auth, ...realAuth }; - } catch (e) { - return auth; - } -}; - -export default awsAuth; diff --git a/src/web/aws/common/hooks/useFetch.js b/src/web/aws/common/hooks/useFetch.js index 2b9d15694..7592d145b 100644 --- a/src/web/aws/common/hooks/useFetch.js +++ b/src/web/aws/common/hooks/useFetch.js @@ -1,10 +1,9 @@ import { useContext, useEffect, useState } from 'react'; -import URLUtils from 'util/URLUtils'; +import { qualifyUrl } from 'util/URLUtils'; import fetch from 'logic/rest/FetchProvider'; import { FormDataContext } from '../../context/FormData'; -import awsAuth from '../awsAuth'; /* useFetch Custom Hook @@ -53,8 +52,7 @@ const useFetch = (url, setHook = () => {}, method = 'GET', options = {}) => { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [data, setData] = useState(null); - const { key, secret } = awsAuth(formData); - const qualifiedURL = fetchUrl ? URLUtils.qualifyUrl(fetchUrl) : null; + const qualifiedURL = fetchUrl ? qualifyUrl(fetchUrl) : null; useEffect(() => { let isFetchable = !!qualifiedURL; @@ -71,6 +69,8 @@ const useFetch = (url, setHook = () => {}, method = 'GET', options = {}) => { awsEndpointIAM = { value: undefined }, awsEndpointDynamoDB = { value: undefined }, awsEndpointKinesis = { value: undefined }, + key = undefined, + secret = undefined, } = formData; if (method === 'GET') {