addressed consistency between theme loading and moduledefinition loading, added theme detailed UI view
This commit is contained in:
		| @ -1,4 +1,5 @@ | ||||
| @namespace Oqtane.Modules.Admin.Themes | ||||
| @using System.Net | ||||
| @inherits ModuleBase | ||||
| @inject NavigationManager NavigationManager | ||||
| @inject IThemeService ThemeService | ||||
| @ -14,25 +15,27 @@ else | ||||
|  | ||||
|     <Pager Items="@_themes"> | ||||
|         <Header> | ||||
|             <th> </th> | ||||
|             <th> </th> | ||||
|             <th>Name</th> | ||||
|             <th>Version</th> | ||||
|             <th> </th> | ||||
|         </Header> | ||||
|         <Row> | ||||
|             <td><ActionLink Action="View" Parameters="@($"name=" + WebUtility.UrlEncode(context.ThemeName))" /></td> | ||||
|             <td> | ||||
|                 @if (context.AssemblyName != "Oqtane.Client") | ||||
|                 { | ||||
|                     { | ||||
|                     <ActionDialog Header="Delete Theme" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Theme?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTheme(context))" /> | ||||
|                 } | ||||
|                     } | ||||
|             </td> | ||||
|             <td>@context.Name</td> | ||||
|             <td>@context.Version</td> | ||||
|             <td> | ||||
|                 @if (UpgradeAvailable(context.ThemeName, context.Version)) | ||||
|                 { | ||||
|                     { | ||||
|                     <button type="button" class="btn btn-success" @onclick=@(async () => await DownloadTheme(context.ThemeName, context.Version))>Upgrade</button> | ||||
|                 } | ||||
|                     } | ||||
|             </td> | ||||
|         </Row> | ||||
|     </Pager> | ||||
|  | ||||
							
								
								
									
										101
									
								
								Oqtane.Client/Modules/Admin/Themes/View.razor
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								Oqtane.Client/Modules/Admin/Themes/View.razor
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,101 @@ | ||||
| @namespace Oqtane.Modules.Admin.Themes | ||||
| @using System.Net | ||||
| @inherits ModuleBase | ||||
| @inject IThemeService ThemeService | ||||
| @inject NavigationManager NavigationManager | ||||
|  | ||||
| <table class="table table-borderless"> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="name" HelpText="The name of the theme">Name: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="name" class="form-control" @bind="@_name" disabled /> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="themename" HelpText="The internal name of the module">Internal Name: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="themename" class="form-control" @bind="@_themeName" disabled /> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="version" HelpText="The version of the thene">Version: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="version" class="form-control" @bind="@_version" disabled /> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="owner" HelpText="The owner or creator of the theme">Owner: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="owner" class="form-control" @bind="@_owner" disabled /> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="url" HelpText="The reference url of the theme">Reference Url: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="url" class="form-control" @bind="@_url" disabled /> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="contact" HelpText="The contact for the theme">Contact: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input id="contact" class="form-control" @bind="@_contact" disabled /> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="license" HelpText="The license of the theme">License: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea> | ||||
|         </td> | ||||
|     </tr> | ||||
| </table> | ||||
| <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> | ||||
|  | ||||
| @code { | ||||
|     private string _themeName = ""; | ||||
|     private string _name; | ||||
|     private string _version; | ||||
|     private string _owner = ""; | ||||
|     private string _url = ""; | ||||
|     private string _contact = ""; | ||||
|     private string _license = ""; | ||||
|  | ||||
|     public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; | ||||
|  | ||||
|     protected override async Task OnInitializedAsync() | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             _themeName = WebUtility.UrlDecode(PageState.QueryString["name"]); | ||||
|             var themes = await ThemeService.GetThemesAsync(); | ||||
|             var theme = themes.FirstOrDefault(item => item.ThemeName == _themeName); | ||||
|             if (theme != null) | ||||
|             { | ||||
|                 _name = theme.Name; | ||||
|                 _version = theme.Version; | ||||
|                 _owner = theme.Owner; | ||||
|                 _url = theme.Url; | ||||
|                 _contact = theme.Contact; | ||||
|                 _license = theme.License; | ||||
|             } | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
|             await logger.LogError(ex, "Error Loading Theme {ThemeName} {Error}", _themeName, ex.Message); | ||||
|             AddModuleMessage("Error Loading Theme", MessageType.Error); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker