mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Added MultiSelect input control for provider settings
Signed-off-by: Robin Dadswell <robin@dadswell.email>
This commit is contained in:
@@ -142,10 +142,34 @@ namespace Readarr.Http.ClientSchema
|
||||
|
||||
private static List<SelectOption> GetSelectOptions(Type selectOptions)
|
||||
{
|
||||
var options = from Enum e in Enum.GetValues(selectOptions)
|
||||
select new SelectOption { Value = Convert.ToInt32(e), Name = e.ToString() };
|
||||
var options = selectOptions.GetFields().Where(v => v.IsStatic).Select(v =>
|
||||
{
|
||||
var name = v.Name.Replace('_', ' ');
|
||||
var value = Convert.ToInt32(v.GetRawConstantValue());
|
||||
var attrib = v.GetCustomAttribute<FieldOptionAttribute>();
|
||||
if (attrib != null)
|
||||
{
|
||||
return new SelectOption
|
||||
{
|
||||
Value = value,
|
||||
Name = attrib.Label ?? name,
|
||||
Order = attrib.Order,
|
||||
Hint = attrib.Hint ?? $"({value})"
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new SelectOption
|
||||
{
|
||||
Value = value,
|
||||
Name = name,
|
||||
Order = value,
|
||||
Hint = $"({value})"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return options.OrderBy(o => o.Value).ToList();
|
||||
return options.OrderBy(o => o.Order).ToList();
|
||||
}
|
||||
|
||||
private static Func<object, object> GetValueConverter(Type propertyType)
|
||||
|
||||
Reference in New Issue
Block a user