diff --git a/new-lamassu-admin/src/pages/Services/FormRenderer.js b/new-lamassu-admin/src/pages/Services/FormRenderer.js
index 31413ea7..776c78b7 100644
--- a/new-lamassu-admin/src/pages/Services/FormRenderer.js
+++ b/new-lamassu-admin/src/pages/Services/FormRenderer.js
@@ -4,12 +4,19 @@ import { Formik, Form, FastField } from 'formik'
import * as R from 'ramda'
import React from 'react'
+import ErrorMessage from 'src/components/ErrorMessage'
import { Button } from 'src/components/buttons'
import { SecretInput } from 'src/components/inputs/formik'
+import { spacer } from 'src/styling/variables'
const styles = {
+ footer: {
+ display: 'flex',
+ flexDirection: 'row',
+ margin: [['auto', 0, spacer * 4, 0]]
+ },
button: {
- margin: [['auto', 0, 32, 'auto']]
+ margin: [['auto', 0, 0, 'auto']]
},
form: {
flex: 1,
@@ -61,29 +68,36 @@ const FormRenderer = ({
initialValues={values}
validationSchema={validationSchema}
onSubmit={saveNonEmptySecret}>
-
+ {({ errors }) => (
+
+ )}
)
}
diff --git a/new-lamassu-admin/src/pages/Services/Services.js b/new-lamassu-admin/src/pages/Services/Services.js
index c7cd93ea..966038c9 100644
--- a/new-lamassu-admin/src/pages/Services/Services.js
+++ b/new-lamassu-admin/src/pages/Services/Services.js
@@ -119,7 +119,7 @@ const Services = () => {
{editingSchema && (
setEditingSchema(null)}
open={true}>
{
return Yup.object().shape({
- apiKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- privateKey: Yup.string()
- .max(100, 'Too long')
+ apiKey: Yup.string('The API key must be a string')
+ .max(100, 'The API key is too long')
+ .required('The API key is required'),
+ privateKey: Yup.string('The private key must be a string')
+ .max(100, 'The private key is too long')
.test(secretTest(account?.privateKey))
})
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/bitgo.js b/new-lamassu-admin/src/pages/Services/schemas/bitgo.js
index c9d9508f..974cdbc9 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/bitgo.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/bitgo.js
@@ -98,37 +98,52 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- token: Yup.string()
- .max(100, 'Too long')
- .required(),
- BTCWalletId: Yup.string().max(100, 'Too long'),
+ token: Yup.string('The token must be a string')
+ .max(100, 'The token is too long')
+ .required('The token is required'),
+ BTCWalletId: Yup.string('The BTC wallet ID must be a string').max(
+ 100,
+ 'The BTC wallet ID is too long'
+ ),
BTCWalletPassphrase: buildTestValidation(
'BTCWalletId',
account?.BTCWalletPassphrase
),
- LTCWalletId: Yup.string().max(100, 'Too long'),
+ LTCWalletId: Yup.string('The LTC wallet ID must be a string').max(
+ 100,
+ 'The LTC wallet ID is too long'
+ ),
LTCWalletPassphrase: buildTestValidation(
'LTCWalletId',
account?.LTCWalletPassphrase
),
- ZECWalletId: Yup.string().max(100, 'Too long'),
+ ZECWalletId: Yup.string('The ZEC wallet ID must be a string').max(
+ 100,
+ 'The ZEC wallet ID is too long'
+ ),
ZECWalletPassphrase: buildTestValidation(
'ZECWalletId',
account?.ZECWalletPassphrase
),
- BCHWalletId: Yup.string().max(100, 'Too long'),
+ BCHWalletId: Yup.string('The BCH wallet ID must be a string').max(
+ 100,
+ 'The BCH wallet ID is too long'
+ ),
BCHWalletPassphrase: buildTestValidation(
'BCHWalletId',
account?.BCHWalletPassphrase
),
- DASHWalletId: Yup.string().max(100, 'Too long'),
+ DASHWalletId: Yup.string('The DASH wallet ID must be a string').max(
+ 100,
+ 'The DASH wallet ID is too long'
+ ),
DASHWalletPassphrase: buildTestValidation(
'DASHWalletId',
account?.DASHWalletPassphrase
),
- environment: Yup.string()
+ environment: Yup.string('The environment must be a string')
.matches(/(prod|test)/)
- .required()
+ .required('The environment is required')
})
}
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/bitstamp.js b/new-lamassu-admin/src/pages/Services/schemas/bitstamp.js
index 0c65c798..82817853 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/bitstamp.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/bitstamp.js
@@ -32,14 +32,14 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- clientId: Yup.string()
- .max(100, 'Too long')
- .required(),
- key: Yup.string()
- .max(100, 'Too long')
- .required(),
- secret: Yup.string()
- .max(100, 'Too long')
+ clientId: Yup.string('The client ID must be a string')
+ .max(100, 'The client ID is too long')
+ .required('The client ID is required'),
+ key: Yup.string('The key must be a string')
+ .max(100, 'The key is too long')
+ .required('The key is required'),
+ secret: Yup.string('The secret must be a string')
+ .max(100, 'The secret is too long')
.test(secretTest(account?.secret))
})
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/blockcypher.js b/new-lamassu-admin/src/pages/Services/schemas/blockcypher.js
index b6047f07..5d7d178b 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/blockcypher.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/blockcypher.js
@@ -38,13 +38,13 @@ export default {
],
getValidationSchema: () => {
return Yup.object().shape({
- token: Yup.string()
- .max(100, 'Too long')
- .required(),
- confidenceFactor: Yup.number()
- .integer('Please input a positive integer')
- .positive('Please input a positive integer')
- .required()
+ token: Yup.string('The token must be a string')
+ .max(100, 'The token is too long')
+ .required('The token is required'),
+ confidenceFactor: Yup.number('The confidence factor must be a number')
+ .integer('The confidence factor must be an integer')
+ .positive('The confidence factor must be positive')
+ .required('The confidence factor is required')
})
}
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/cex.js b/new-lamassu-admin/src/pages/Services/schemas/cex.js
index a2108afd..07102df4 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/cex.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/cex.js
@@ -25,11 +25,11 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- apiKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- privateKey: Yup.string()
- .max(100, 'Too long')
+ apiKey: Yup.string('The API key must be a string')
+ .max(100, 'The API key is too long')
+ .required('The API key is required'),
+ privateKey: Yup.string('The private key must be a string')
+ .max(100, 'The private key is too long')
.test(secretTest(account?.privateKey))
})
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js b/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js
index cd08a6c4..b5b6d22f 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/ciphertrace.js
@@ -37,10 +37,12 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- authorizationValue: Yup.string()
+ authorizationValue: Yup.string('The score threshold must be a string')
+ .required('The authorization value is required')
.max(100, 'Too long')
.test(secretTest(account?.authorizationValue)),
- scoreThreshold: Yup.number()
+ scoreThreshold: Yup.number('The score threshold must be a number')
+ .required('A score threshold is required')
.min(1, 'The number should be between 1 and 10')
.max(10, 'The number should be between 1 and 10')
.test(secretTest(account?.scoreThreshold))
diff --git a/new-lamassu-admin/src/pages/Services/schemas/ftx.js b/new-lamassu-admin/src/pages/Services/schemas/ftx.js
index 125b5f80..48b130f1 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/ftx.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/ftx.js
@@ -25,11 +25,11 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- apiKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- privateKey: Yup.string()
- .max(100, 'Too long')
+ apiKey: Yup.string('The API key must be a string')
+ .max(100, 'The API key is too long')
+ .required('The API key is required'),
+ privateKey: Yup.string('The private key must be a string')
+ .max(100, 'The private key is too long')
.test(secretTest(account?.privateKey))
})
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/infura.js b/new-lamassu-admin/src/pages/Services/schemas/infura.js
index a7c00270..c2669ba0 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/infura.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/infura.js
@@ -31,15 +31,15 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- apiKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- apiSecret: Yup.string()
- .max(100, 'Too long')
+ apiKey: Yup.string('The API key must be a string')
+ .max(100, 'The API key is too long')
+ .required('The API key is required'),
+ apiSecret: Yup.string('The API secret must be a string')
+ .max(100, 'The API secret is too long')
.test(secretTest(account?.apiSecret)),
- endpoint: Yup.string()
- .max(100, 'Too long')
- .required()
+ endpoint: Yup.string('The endpoint must be a string')
+ .max(100, 'The endpoint is too long')
+ .required('The endpoint is required')
})
}
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/itbit.js b/new-lamassu-admin/src/pages/Services/schemas/itbit.js
index 1675affb..22e48c57 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/itbit.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/itbit.js
@@ -37,17 +37,17 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- userId: Yup.string()
- .max(100, 'Too long')
- .required(),
- walletId: Yup.string()
- .max(100, 'Too long')
- .required(),
- clientKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- clientSecret: Yup.string()
- .max(100, 'Too long')
+ userId: Yup.string('The user ID must be a string')
+ .max(100, 'The user ID is too long')
+ .required('The user ID is required'),
+ walletId: Yup.string('The wallet ID must be a string')
+ .max(100, 'The wallet ID is too long')
+ .required('The wallet ID is required'),
+ clientKey: Yup.string('The client key must be a string')
+ .max(100, 'The client key is too long')
+ .required('The client key is required'),
+ clientSecret: Yup.string('The client secret must be a string')
+ .max(100, 'The client secret is too long')
.test(secretTest(account?.clientSecret))
})
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/kraken.js b/new-lamassu-admin/src/pages/Services/schemas/kraken.js
index 71fd024c..dc7b090c 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/kraken.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/kraken.js
@@ -25,11 +25,11 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- apiKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- privateKey: Yup.string()
- .max(100, 'Too long')
+ apiKey: Yup.string('The API key must be a string')
+ .max(100, 'The API key is too long')
+ .required('The API key is required'),
+ privateKey: Yup.string('The private key must be a string')
+ .max(100, 'The private key is too long')
.test(secretTest(account?.privateKey))
})
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/mailgun.js b/new-lamassu-admin/src/pages/Services/schemas/mailgun.js
index 59eca131..151344e9 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/mailgun.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/mailgun.js
@@ -32,20 +32,20 @@ export default {
],
getValidationSchema: () => {
return Yup.object().shape({
- apiKey: Yup.string()
- .max(100, 'Too long')
- .required(),
- domain: Yup.string()
- .max(100, 'Too long')
- .required(),
- fromEmail: Yup.string()
- .max(100, 'Too long')
- .email('Please input a valid email address')
- .required(),
- toEmail: Yup.string()
- .max(100, 'Too long')
- .email('Please input a valid email address')
- .required()
+ apiKey: Yup.string('The API key must be a string')
+ .max(100, 'The API key is too long')
+ .required('The API key is required'),
+ domain: Yup.string('The domain must be a string')
+ .max(100, 'The domain is too long')
+ .required('The domain is required'),
+ fromEmail: Yup.string('The from email must be a string')
+ .max(100, 'The from email is too long')
+ .email('The from email must be a valid email address')
+ .required('The from email is required'),
+ toEmail: Yup.string('The to email must be a string')
+ .max(100, 'The to email is too long')
+ .email('The to email must be a valid email address')
+ .required('The to email is required')
})
}
}
diff --git a/new-lamassu-admin/src/pages/Services/schemas/singlebitgo.js b/new-lamassu-admin/src/pages/Services/schemas/singlebitgo.js
index a8d11ed2..5af804ca 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/singlebitgo.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/singlebitgo.js
@@ -44,18 +44,20 @@ const singleBitgo = code => ({
}
],
validationSchema: Yup.object().shape({
- token: Yup.string()
- .max(100, 'Too long')
- .required(),
- environment: Yup.string()
+ token: Yup.string('The token must be a string')
+ .max(100, 'The token is too long')
+ .required('The token is required'),
+ environment: Yup.string('The environment must be a string')
.matches(/(prod|test)/)
- .required(),
- [`${code}WalletId`]: Yup.string()
- .max(100, 'Too long')
- .required(),
- [`${code}WalletPassphrase`]: Yup.string()
- .max(100, 'Too long')
- .required()
+ .required('The environment is required'),
+ [`${code}WalletId`]: Yup.string(`The ${code} wallet ID must be a string`)
+ .max(100, `The ${code} wallet ID is too long`)
+ .required(`The ${code} wallet ID is required`),
+ [`${code}WalletPassphrase`]: Yup.string(
+ `The ${code} passphrase must be a string`
+ )
+ .max(100, `The ${code} wallet passphrase is too long`)
+ .required(`The ${code} wallet passphrase is required`)
})
})
diff --git a/new-lamassu-admin/src/pages/Services/schemas/twilio.js b/new-lamassu-admin/src/pages/Services/schemas/twilio.js
index 297229dc..a38aafa0 100644
--- a/new-lamassu-admin/src/pages/Services/schemas/twilio.js
+++ b/new-lamassu-admin/src/pages/Services/schemas/twilio.js
@@ -35,18 +35,18 @@ export default {
],
getValidationSchema: account => {
return Yup.object().shape({
- accountSid: Yup.string()
- .max(100, 'Too long')
- .required(),
- authToken: Yup.string()
- .max(100, 'Too long')
+ accountSid: Yup.string('The account SID must be a string')
+ .max(100, 'The account SID is too long')
+ .required('The account SID is required'),
+ authToken: Yup.string('The auth token must be a string')
+ .max(100, 'The auth token is too long')
.test(secretTest(account?.authToken)),
- fromNumber: Yup.string()
- .max(100, 'Too long')
- .required(),
- toNumber: Yup.string()
- .max(100, 'Too long')
- .required()
+ fromNumber: Yup.string('The from number must be a string')
+ .max(100, 'The from number is too long')
+ .required('The from number is required'),
+ toNumber: Yup.string('The to number must be a string')
+ .max(100, 'The to number is too long')
+ .required('The to number is required')
})
}
}