From 720fc2818fed50efdf662af612503fae71dbce97 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] Frontend Placeholders from the Backend (cherry picked from commit 69f5963f6f1e80e3f598bdb13792b7413fcc13b1) --- frontend/src/Components/Form/ProviderFieldFormGroup.js | 3 +++ src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs | 1 + src/Sonarr.Http/ClientSchema/Field.cs | 2 ++ src/Sonarr.Http/ClientSchema/SchemaBuilder.cs | 3 ++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/Components/Form/ProviderFieldFormGroup.js b/frontend/src/Components/Form/ProviderFieldFormGroup.js index eb0844b8c..6c1587830 100644 --- a/frontend/src/Components/Form/ProviderFieldFormGroup.js +++ b/frontend/src/Components/Form/ProviderFieldFormGroup.js @@ -65,6 +65,7 @@ function ProviderFieldFormGroup(props) { label, helpText, helpLink, + placeholder, value, type, advanced, @@ -97,6 +98,7 @@ function ProviderFieldFormGroup(props) { label={label} helpText={helpText} helpLink={helpLink} + placeholder={placeholder} value={value} values={getSelectValues(selectOptions)} errors={errors} @@ -122,6 +124,7 @@ ProviderFieldFormGroup.propTypes = { label: PropTypes.string.isRequired, 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 8a3973ea2..d0ea32af1 100644 --- a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs +++ b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs @@ -23,6 +23,7 @@ namespace NzbDrone.Core.Annotations 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/Sonarr.Http/ClientSchema/Field.cs b/src/Sonarr.Http/ClientSchema/Field.cs index 8c2e312e6..92fa40550 100644 --- a/src/Sonarr.Http/ClientSchema/Field.cs +++ b/src/Sonarr.Http/ClientSchema/Field.cs @@ -19,6 +19,8 @@ namespace Sonarr.Http.ClientSchema public string Section { get; set; } public string Hidden { get; set; } public PrivacyLevel Privacy { get; set; } + public string Placeholder { get; set; } + public Field Clone() { return (Field)MemberwiseClone(); diff --git a/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs b/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs index 72c1079af..540e0c4b0 100644 --- a/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs +++ b/src/Sonarr.Http/ClientSchema/SchemaBuilder.cs @@ -119,7 +119,8 @@ namespace Sonarr.Http.ClientSchema Advanced = fieldAttribute.Advanced, Type = fieldAttribute.Type.ToString().FirstCharToLower(), Section = fieldAttribute.Section, - Privacy = fieldAttribute.Privacy + Privacy = fieldAttribute.Privacy, + Placeholder = fieldAttribute.Placeholder }; if (fieldAttribute.Type == FieldType.Select || fieldAttribute.Type == FieldType.TagSelect)