From 69f5963f6f1e80e3f598bdb13792b7413fcc13b1 Mon Sep 17 00:00:00 2001 From: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com> Date: Sun, 14 Nov 2021 21:49:21 +0000 Subject: [PATCH] New: Frontend Placeholders from the Backend --- frontend/src/Components/Form/ProviderFieldFormGroup.js | 3 +++ src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs | 1 + src/Prowlarr.Http/ClientSchema/Field.cs | 1 + src/Prowlarr.Http/ClientSchema/SchemaBuilder.cs | 3 ++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/Components/Form/ProviderFieldFormGroup.js b/frontend/src/Components/Form/ProviderFieldFormGroup.js index 89b54369b..2b32e0e38 100644 --- a/frontend/src/Components/Form/ProviderFieldFormGroup.js +++ b/frontend/src/Components/Form/ProviderFieldFormGroup.js @@ -68,6 +68,7 @@ function ProviderFieldFormGroup(props) { label, helpText, helpLink, + placeholder, value, type, advanced, @@ -100,6 +101,7 @@ function ProviderFieldFormGroup(props) { label={label} helpText={helpText} helpLink={helpLink} + placeholder={placeholder} value={value} values={getSelectValues(selectOptions)} errors={errors} @@ -125,6 +127,7 @@ ProviderFieldFormGroup.propTypes = { label: PropTypes.string, helpText: PropTypes.string, helpLink: PropTypes.string, + placeholder: PropTypes.string, value: PropTypes.any, type: PropTypes.string.isRequired, advanced: PropTypes.bool.isRequired, diff --git a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs index e68db5a2c..bb56e1a02 100644 --- a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs +++ b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs @@ -23,6 +23,7 @@ public FieldDefinitionAttribute(int order) public string Section { get; set; } public HiddenType Hidden { get; set; } public PrivacyLevel Privacy { get; set; } + public string Placeholder { get; set; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] diff --git a/src/Prowlarr.Http/ClientSchema/Field.cs b/src/Prowlarr.Http/ClientSchema/Field.cs index 61db3cfc2..1e6f58ff4 100644 --- a/src/Prowlarr.Http/ClientSchema/Field.cs +++ b/src/Prowlarr.Http/ClientSchema/Field.cs @@ -19,6 +19,7 @@ public class Field public string SelectOptionsProviderAction { get; set; } public string Section { get; set; } public string Hidden { get; set; } + public string Placeholder { get; set; } public Field Clone() { diff --git a/src/Prowlarr.Http/ClientSchema/SchemaBuilder.cs b/src/Prowlarr.Http/ClientSchema/SchemaBuilder.cs index 0874ec7d6..f370d7762 100644 --- a/src/Prowlarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Prowlarr.Http/ClientSchema/SchemaBuilder.cs @@ -101,7 +101,8 @@ private static FieldMapping[] GetFieldMapping(Type type, string prefix, Func