110 lines
4.6 KiB
Plaintext
110 lines
4.6 KiB
Plaintext
@using [Owner].[Module].Services
|
|
@using [Owner].[Module].Models
|
|
|
|
@namespace [Owner].[Module]
|
|
@inherits ModuleBase
|
|
@inject I[Module]Service [Module]Service
|
|
@inject NavigationManager NavigationManager
|
|
|
|
@if (_[Module]s == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add [Module]" />
|
|
<br />
|
|
<br />
|
|
@if (@_[Module]s.Count != 0)
|
|
{
|
|
<Pager Items="@_[Module]s">
|
|
<Header>
|
|
<th style="width: 1px;"> </th>
|
|
<th style="width: 1px;"> </th>
|
|
<th>Name</th>
|
|
</Header>
|
|
<Row>
|
|
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.[Module]Id.ToString())" /></td>
|
|
<td><ActionDialog Header="Delete [Module]" Message="@("Are You Sure You Wish To Delete The " + context.Name + " [Module]?")" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" /></td>
|
|
<td>@context.Name</td>
|
|
</Row>
|
|
</Pager>
|
|
}
|
|
else
|
|
{
|
|
<p>No [Module]s To Display</p>
|
|
}
|
|
}
|
|
|
|
<!-- The content below is for informational purposes only and can be safely removed -->
|
|
|
|
<hr />
|
|
[Module] Module Created Successfully. Use Edit Mode To Add A [Module]. You Can Access The Files At The Following Locations:<br /><br />
|
|
[RootPath]Client\<br />
|
|
- [Owner].[Module].Client.csproj - client project<br />
|
|
- _Imports.razor - global imports for module components<br />
|
|
- Edit.razor - component for adding or editing content<br />
|
|
- Index.razor - main component for your module **the content you are reading is in this file**<br />
|
|
- ModuleInfo.cs - implements IModule interface to provide configuration settings for your module<br />
|
|
- Settings.razor - component for managing module settings<br />
|
|
- Services\I[Module]Service.cs - interface for defining service API methods<br />
|
|
- Services\[Module]Service.cs - implements service API interface methods<br /><br />
|
|
[RootPath]Package\<br />
|
|
- [Owner].[Module].nuspec - nuget manifest for packaging module<br />
|
|
- [Owner].[Module].Package.csproj - packaging project<br />
|
|
- debug.cmd - copies assemblies to Oqtane bin folder when in Debug mode<br />
|
|
- release.cmd - creates nuget package and deploys to Oqtane wwwroot/modules folder when in Release mode<br /><br />
|
|
[RootPath]Server\<br />
|
|
- [Owner].[Module].Server.csproj - server project<br />
|
|
- Controllers\[Module]Controller.cs - API methods implemented using a REST pattern<br />
|
|
- Manager\[Module]Manager.cs - implements optional module interfaces for features such as import/export of content<br />
|
|
- Repository\I[Module]Repository.cs - interface for defining repository methods<br />
|
|
- Repository\[Module]Respository.cs - implements repository interface methods for data access using EF Core<br />
|
|
- Repository\[Module]Context.cs - provides a DB Context for data access<br />
|
|
- Scripts\[Owner].[Module].1.0.0.sql - database schema definition script<br />
|
|
- Scripts\[Owner].[Module].Uninstall.sql - database uninstall script<br />
|
|
- wwwroot\Module.css - module style sheet<br /><br />
|
|
[RootPath]Shared\<br />
|
|
- [Owner].[Module].csproj - shared project<br />
|
|
- Models\[Module].cs - model definition<br /><br />
|
|
|
|
<!-- The content above is for informational purposes only and can be safely removed -->
|
|
|
|
@code {
|
|
public override List<Resource> Resources => new List<Resource>()
|
|
{
|
|
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
|
|
new Resource { ResourceType = ResourceType.Script, Url = ModulePath() + "Module.js" }
|
|
};
|
|
|
|
List<[Module]> _[Module]s;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await logger.LogError(ex, "Error Loading [Module] {Error}", ex.Message);
|
|
AddModuleMessage("Error Loading [Module]", MessageType.Error);
|
|
}
|
|
}
|
|
|
|
private async Task Delete([Module] [Module])
|
|
{
|
|
try
|
|
{
|
|
await [Module]Service.Delete[Module]Async([Module].[Module]Id, ModuleState.ModuleId);
|
|
await logger.LogInformation("[Module] Deleted {[Module]}", [Module]);
|
|
_[Module]s = await [Module]Service.Get[Module]sAsync(ModuleState.ModuleId);
|
|
StateHasChanged();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await logger.LogError(ex, "Error Deleting [Module] {[Module]} {Error}", [Module], ex.Message);
|
|
AddModuleMessage("Error Deleting [Module]", MessageType.Error);
|
|
}
|
|
}
|
|
} |