Use display name for type column in scripts table
This commit is contained in:
parent
7aabecb882
commit
6df312ef2b
3 changed files with 27 additions and 2 deletions
|
@ -1,12 +1,18 @@
|
||||||
namespace LANCommander.Data.Enums
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace LANCommander.Data.Enums
|
||||||
{
|
{
|
||||||
public enum ScriptType
|
public enum ScriptType
|
||||||
{
|
{
|
||||||
Install,
|
Install,
|
||||||
Uninstall,
|
Uninstall,
|
||||||
|
[Display(Name = "Name Change")]
|
||||||
NameChange,
|
NameChange,
|
||||||
|
[Display(Name = "Key Change")]
|
||||||
KeyChange,
|
KeyChange,
|
||||||
|
[Display(Name = "Save Upload")]
|
||||||
SaveUpload,
|
SaveUpload,
|
||||||
|
[Display(Name = "Save Download")]
|
||||||
SaveDownload
|
SaveDownload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
LANCommander/Extensions/EnumExtensions.cs
Normal file
18
LANCommander/Extensions/EnumExtensions.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace LANCommander.Extensions
|
||||||
|
{
|
||||||
|
public static class EnumExtensions
|
||||||
|
{
|
||||||
|
public static string GetDisplayName(this Enum value)
|
||||||
|
{
|
||||||
|
return value
|
||||||
|
.GetType()
|
||||||
|
.GetMember(value.ToString())
|
||||||
|
.First()
|
||||||
|
.GetCustomAttribute<DisplayAttribute>()?
|
||||||
|
.GetName() ?? value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
@using LANCommander.Data.Enums;
|
@using LANCommander.Data.Enums;
|
||||||
|
@using LANCommander.Extensions;
|
||||||
@using LANCommander.Models
|
@using LANCommander.Models
|
||||||
@using LANCommander.Services
|
@using LANCommander.Services
|
||||||
@using System.IO.Compression;
|
@using System.IO.Compression;
|
||||||
|
@ -68,7 +69,7 @@
|
||||||
<Space Direction="DirectionVHType.Vertical" Size="@("large")" Style="width: 100%">
|
<Space Direction="DirectionVHType.Vertical" Size="@("large")" Style="width: 100%">
|
||||||
<SpaceItem>
|
<SpaceItem>
|
||||||
<Table TItem="Script" DataSource="@Scripts" HidePagination="true">
|
<Table TItem="Script" DataSource="@Scripts" HidePagination="true">
|
||||||
<PropertyColumn Property="s => s.Type" />
|
<PropertyColumn Property="s => s.Type">@context.Type.GetDisplayName()</PropertyColumn>
|
||||||
<PropertyColumn Property="s => s.CreatedBy">
|
<PropertyColumn Property="s => s.CreatedBy">
|
||||||
@context.CreatedBy?.UserName
|
@context.CreatedBy?.UserName
|
||||||
</PropertyColumn>
|
</PropertyColumn>
|
||||||
|
|
Loading…
Add table
Reference in a new issue