|
|
|
@ -108,7 +108,7 @@ namespace Radarr.Http.ClientSchema
|
|
|
|
|
Placeholder = fieldAttribute.Placeholder
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (fieldAttribute.Type == FieldType.Select || fieldAttribute.Type == FieldType.TagSelect)
|
|
|
|
|
if (fieldAttribute.Type is FieldType.Select or FieldType.TagSelect)
|
|
|
|
|
{
|
|
|
|
|
if (fieldAttribute.SelectOptionsProviderAction.IsNotNullOrWhiteSpace())
|
|
|
|
|
{
|
|
|
|
@ -157,11 +157,15 @@ namespace Radarr.Http.ClientSchema
|
|
|
|
|
{
|
|
|
|
|
if (selectOptions.IsEnum)
|
|
|
|
|
{
|
|
|
|
|
var options = selectOptions.GetFields().Where(v => v.IsStatic).Select(v =>
|
|
|
|
|
var options = selectOptions
|
|
|
|
|
.GetFields()
|
|
|
|
|
.Where(v => v.IsStatic && !v.GetCustomAttributes(false).OfType<ObsoleteAttribute>().Any())
|
|
|
|
|
.Select(v =>
|
|
|
|
|
{
|
|
|
|
|
var name = v.Name.Replace('_', ' ');
|
|
|
|
|
var value = Convert.ToInt32(v.GetRawConstantValue());
|
|
|
|
|
var attrib = v.GetCustomAttribute<FieldOptionAttribute>();
|
|
|
|
|
|
|
|
|
|
if (attrib != null)
|
|
|
|
|
{
|
|
|
|
|
return new SelectOption
|
|
|
|
@ -172,15 +176,13 @@ namespace Radarr.Http.ClientSchema
|
|
|
|
|
Hint = attrib.Hint ?? $"({value})"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return new SelectOption
|
|
|
|
|
{
|
|
|
|
|
Value = value,
|
|
|
|
|
Name = name,
|
|
|
|
|
Order = value
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return options.OrderBy(o => o.Order).ToList();
|
|
|
|
|