mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(ui): Notification-related string/UI edits and field validation (#985)
This commit is contained in:
@@ -40,16 +40,15 @@ const messages = defineMessages({
|
||||
agentenabled: 'Enable Agent',
|
||||
webhookUrl: 'Webhook URL',
|
||||
authheader: 'Authorization Header',
|
||||
validationJsonPayloadRequired: 'You must provide a JSON Payload',
|
||||
webhookUrlPlaceholder: 'Remote webhook URL',
|
||||
webhooksettingssaved: 'Webhook notification settings saved!',
|
||||
validationJsonPayloadRequired: 'You must provide a valid JSON payload',
|
||||
webhooksettingssaved: 'Webhook notification settings saved successfully!',
|
||||
webhooksettingsfailed: 'Webhook notification settings failed to save.',
|
||||
testsent: 'Test notification sent!',
|
||||
test: 'Test',
|
||||
notificationtypes: 'Notification Types',
|
||||
resetPayload: 'Reset to Default JSON Payload',
|
||||
resetPayloadSuccess: 'JSON reset to default payload.',
|
||||
customJson: 'Custom JSON Payload',
|
||||
resetPayload: 'Reset to Default',
|
||||
resetPayloadSuccess: 'JSON payload reset successfully!',
|
||||
customJson: 'JSON Payload',
|
||||
templatevariablehelp: 'Template Variable Help',
|
||||
validationWebhookUrl: 'You must provide a valid URL',
|
||||
});
|
||||
@@ -71,14 +70,18 @@ const NotificationsWebhook: React.FC = () => {
|
||||
),
|
||||
jsonPayload: Yup.string()
|
||||
.required(intl.formatMessage(messages.validationJsonPayloadRequired))
|
||||
.test('validate-json', 'Invalid JSON', (value) => {
|
||||
try {
|
||||
JSON.parse(value ?? '');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
.test(
|
||||
'validate-json',
|
||||
intl.formatMessage(messages.validationJsonPayloadRequired),
|
||||
(value) => {
|
||||
try {
|
||||
JSON.parse(value ?? '');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
if (!data && !error) {
|
||||
@@ -173,14 +176,7 @@ const NotificationsWebhook: React.FC = () => {
|
||||
</label>
|
||||
<div className="form-input">
|
||||
<div className="flex max-w-lg rounded-md shadow-sm">
|
||||
<Field
|
||||
id="webhookUrl"
|
||||
name="webhookUrl"
|
||||
type="text"
|
||||
placeholder={intl.formatMessage(
|
||||
messages.webhookUrlPlaceholder
|
||||
)}
|
||||
/>
|
||||
<Field id="webhookUrl" name="webhookUrl" type="text" />
|
||||
</div>
|
||||
{errors.webhookUrl && touched.webhookUrl && (
|
||||
<div className="error">{errors.webhookUrl}</div>
|
||||
|
Reference in New Issue
Block a user