add search to package manager components
This commit is contained in:
parent
c2f7546488
commit
bfafffd8cb
|
@ -7,6 +7,7 @@
|
||||||
@inject ILanguageService LanguageService
|
@inject ILanguageService LanguageService
|
||||||
@inject IPackageService PackageService
|
@inject IPackageService PackageService
|
||||||
@inject IStringLocalizer<Add> Localizer
|
@inject IStringLocalizer<Add> Localizer
|
||||||
|
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||||
|
|
||||||
@if (_supportedCultures == null)
|
@if (_supportedCultures == null)
|
||||||
{
|
{
|
||||||
|
@ -22,33 +23,33 @@ else
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<table class="table table-borderless">
|
<table class="table table-borderless">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="name" HelpText="Name Of The Language" ResourceKey="Name">Name:</Label>
|
<Label For="name" HelpText="Name Of The Language" ResourceKey="Name">Name:</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="_code" class="form-control" @bind="@_code">
|
<select id="_code" class="form-control" @bind="@_code">
|
||||||
@foreach (var culture in _availableCultures)
|
@foreach (var culture in _availableCultures)
|
||||||
{
|
{
|
||||||
<option value="@culture.Name">@culture.DisplayName</option>
|
<option value="@culture.Name">@culture.DisplayName</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<Label For="default" HelpText="Indicates Whether Or Not This Language Is The Default For The Site" ResourceKey="IsDefault">Default?</Label>
|
<Label For="default" HelpText="Indicates Whether Or Not This Language Is The Default For The Site" ResourceKey="IsDefault">Default?</Label>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<select id="default" class="form-control" @bind="@_isDefault">
|
<select id="default" class="form-control" @bind="@_isDefault">
|
||||||
<option value="True">@Localizer["Yes"]</option>
|
<option value="True">@Localizer["Yes"]</option>
|
||||||
<option value="False">@Localizer["No"]</option>
|
<option value="False">@Localizer["No"]</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<button type="button" class="btn btn-success" @onclick="SaveLanguage">@Localizer["Save"]</button>
|
<button type="button" class="btn btn-success" @onclick="SaveLanguage">@Localizer["Save"]</button>
|
||||||
}
|
}
|
||||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
@ -56,12 +57,25 @@ else
|
||||||
@if (_packages != null && _packages.Count > 0)
|
@if (_packages != null && _packages.Count > 0)
|
||||||
{
|
{
|
||||||
<ModuleMessage Type="MessageType.Info" Message="Download one or more translations from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
<ModuleMessage Type="MessageType.Info" Message="Download one or more translations from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
||||||
|
|
||||||
|
<table class="table table-borderless" style=" margin: auto; width: 50% !important;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id="search" class="form-control" placeholder="@SharedLocalizer["Search.Hint"]" @bind="@_search" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-primary" @onclick="Search">@SharedLocalizer["Search"]</button>
|
||||||
|
<button type="button" class="btn btn-secondary" @onclick="Reset">@SharedLocalizer["Reset"]</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<Pager Items="@_packages">
|
<Pager Items="@_packages">
|
||||||
<Row>
|
<Row>
|
||||||
<td>
|
<td>
|
||||||
<h3 style="display: inline;"><a href="@context.ProductUrl" target="_new">@context.Name</a></h3> by: <strong><a href="@context.OwnerUrl" target="new">@context.Owner</a></strong><br />
|
<h3 style="display: inline;"><a href="@context.ProductUrl" target="_new">@context.Name</a></h3> by: <strong><a href="@context.OwnerUrl" target="new">@context.Owner</a></strong><br />
|
||||||
<strong>@context.Downloads.ToString("###,###,##0")</strong> downloads | released: <strong>@context.ReleaseDate.ToString("MMM dd, yyyy")</strong> | version: <strong>@context.Version</strong><br />
|
@(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)<br />
|
||||||
@(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)
|
<strong>@(String.Format("{0:n0}", context.Downloads))</strong> @SharedLocalizer["Search.Downloads"] | @SharedLocalizer["Search.Released"]: <strong>@context.ReleaseDate.ToString("MMM dd, yyyy")</strong> | @SharedLocalizer["Search.Version"]: <strong>@context.Version</strong>
|
||||||
</td>
|
</td>
|
||||||
<td style="vertical-align: middle;">
|
<td style="vertical-align: middle;">
|
||||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadLanguage(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadLanguage(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
||||||
|
@ -100,6 +114,7 @@ else
|
||||||
private IEnumerable<Culture> _supportedCultures;
|
private IEnumerable<Culture> _supportedCultures;
|
||||||
private IEnumerable<Culture> _availableCultures;
|
private IEnumerable<Culture> _availableCultures;
|
||||||
private List<Package> _packages;
|
private List<Package> _packages;
|
||||||
|
private string _search = "";
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||||
|
|
||||||
|
@ -111,7 +126,7 @@ else
|
||||||
_supportedCultures = await LocalizationService.GetCulturesAsync();
|
_supportedCultures = await LocalizationService.GetCulturesAsync();
|
||||||
_availableCultures = _supportedCultures
|
_availableCultures = _supportedCultures
|
||||||
.Where(c => !c.Name.Equals(Constants.DefaultCulture) && !languagesCodes.Contains(c.Name));
|
.Where(c => !c.Name.Equals(Constants.DefaultCulture) && !languagesCodes.Contains(c.Name));
|
||||||
_packages = await PackageService.GetPackagesAsync("translation");
|
await LoadTranslations();
|
||||||
|
|
||||||
if (_supportedCultures.Count() == 1)
|
if (_supportedCultures.Count() == 1)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +138,36 @@ else
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task LoadTranslations()
|
||||||
|
{
|
||||||
|
_packages = await PackageService.GetPackagesAsync("translation", _search);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Search()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await LoadTranslations();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error On Search");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Reset()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_search = "";
|
||||||
|
await LoadTranslations();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error On Reset");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task SaveLanguage()
|
private async Task SaveLanguage()
|
||||||
{
|
{
|
||||||
var language = new Language
|
var language = new Language
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
@inject IModuleDefinitionService ModuleDefinitionService
|
@inject IModuleDefinitionService ModuleDefinitionService
|
||||||
@inject IPackageService PackageService
|
@inject IPackageService PackageService
|
||||||
@inject IStringLocalizer<Add> Localizer
|
@inject IStringLocalizer<Add> Localizer
|
||||||
|
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||||
|
|
||||||
@if (_packages != null)
|
@if (_packages != null)
|
||||||
{
|
{
|
||||||
|
@ -13,12 +14,25 @@
|
||||||
{
|
{
|
||||||
<TabPanel Name="Download" ResourceKey="Download">
|
<TabPanel Name="Download" ResourceKey="Download">
|
||||||
<ModuleMessage Type="MessageType.Info" Message="Download one or more modules from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
<ModuleMessage Type="MessageType.Info" Message="Download one or more modules from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
||||||
|
|
||||||
|
<table class="table table-borderless" style=" margin: auto; width: 50% !important;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id="search" class="form-control" placeholder="@SharedLocalizer["Search.Hint"]" @bind="@_search" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-primary" @onclick="Search">@SharedLocalizer["Search"]</button>
|
||||||
|
<button type="button" class="btn btn-secondary" @onclick="Reset">@SharedLocalizer["Reset"]</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<Pager Items="@_packages">
|
<Pager Items="@_packages">
|
||||||
<Row>
|
<Row>
|
||||||
<td>
|
<td>
|
||||||
<h3 style="display: inline;"><a href="@context.ProductUrl" target="_new">@context.Name</a></h3> by: <strong><a href="@context.OwnerUrl" target="new">@context.Owner</a></strong><br />
|
<h3 style="display: inline;"><a href="@context.ProductUrl" target="_new">@context.Name</a></h3> by: <strong><a href="@context.OwnerUrl" target="new">@context.Owner</a></strong><br />
|
||||||
<strong>@context.Downloads.ToString("###,###,##0")</strong> downloads | released: <strong>@context.ReleaseDate.ToString("MMM dd, yyyy")</strong> | version: <strong>@context.Version</strong><br />
|
@(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)<br />
|
||||||
@(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)
|
<strong>@(String.Format("{0:n0}", context.Downloads))</strong> @SharedLocalizer["Search.Downloads"] | @SharedLocalizer["Search.Released"]: <strong>@context.ReleaseDate.ToString("MMM dd, yyyy")</strong> | @SharedLocalizer["Search.Version"]: <strong>@context.Version</strong>
|
||||||
</td>
|
</td>
|
||||||
<td style="vertical-align: middle;">
|
<td style="vertical-align: middle;">
|
||||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadModule(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadModule(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
||||||
|
@ -47,6 +61,7 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Package> _packages;
|
private List<Package> _packages;
|
||||||
|
private string _search = "";
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
|
@ -54,16 +69,7 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
await LoadModuleDefinitions();
|
||||||
_packages = await PackageService.GetPackagesAsync("module");
|
|
||||||
|
|
||||||
foreach (Package package in _packages.ToArray())
|
|
||||||
{
|
|
||||||
if (moduledefinitions.Exists(item => item.PackageName == package.PackageId))
|
|
||||||
{
|
|
||||||
_packages.Remove(package);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +78,45 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task LoadModuleDefinitions()
|
||||||
|
{
|
||||||
|
var moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
|
||||||
|
_packages = await PackageService.GetPackagesAsync("module", _search);
|
||||||
|
|
||||||
|
foreach (Package package in _packages.ToArray())
|
||||||
|
{
|
||||||
|
if (moduledefinitions.Exists(item => item.PackageName == package.PackageId))
|
||||||
|
{
|
||||||
|
_packages.Remove(package);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Search()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await LoadModuleDefinitions();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error On Search");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Reset()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_search = "";
|
||||||
|
await LoadModuleDefinitions();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error On Reset");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task InstallModules()
|
private async Task InstallModules()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -13,7 +13,7 @@ else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Module" ResourceKey="InstallModule" />
|
<ActionLink Action="Add" Text="Install Module" ResourceKey="InstallModule" />
|
||||||
@((MarkupString)" ")
|
@((MarkupString)" ")
|
||||||
<ActionLink Action="Create" Text="Create Module" ResourceKey="CreateModule" />
|
<ActionLink Action="Create" Text="Create Module" ResourceKey="CreateModule" Class="btn btn-secondary" />
|
||||||
|
|
||||||
<Pager Items="@_moduleDefinitions">
|
<Pager Items="@_moduleDefinitions">
|
||||||
<Header>
|
<Header>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
@inject IThemeService ThemeService
|
@inject IThemeService ThemeService
|
||||||
@inject IPackageService PackageService
|
@inject IPackageService PackageService
|
||||||
@inject IStringLocalizer<Add> Localizer
|
@inject IStringLocalizer<Add> Localizer
|
||||||
|
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||||
|
|
||||||
@if (_packages != null)
|
@if (_packages != null)
|
||||||
{
|
{
|
||||||
|
@ -13,12 +14,25 @@
|
||||||
{
|
{
|
||||||
<TabPanel Name="Download" ResourceKey="Download">
|
<TabPanel Name="Download" ResourceKey="Download">
|
||||||
<ModuleMessage Type="MessageType.Info" Message="Download one or more themes from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
<ModuleMessage Type="MessageType.Info" Message="Download one or more themes from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
||||||
|
|
||||||
|
<table class="table table-borderless" style=" margin: auto; width: 50% !important;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id="search" class="form-control" placeholder="@SharedLocalizer["Search.Hint"]" @bind="@_search" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-primary" @onclick="Search">@SharedLocalizer["Search"]</button>
|
||||||
|
<button type="button" class="btn btn-secondary" @onclick="Reset">@SharedLocalizer["Reset"]</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
<Pager Items="@_packages">
|
<Pager Items="@_packages">
|
||||||
<Row>
|
<Row>
|
||||||
<td>
|
<td>
|
||||||
<h3 style="display: inline;"><a href="@context.ProductUrl" target="_new">@context.Name</a></h3> by: <strong><a href="@context.OwnerUrl" target="new">@context.Owner</a></strong><br />
|
<h3 style="display: inline;"><a href="@context.ProductUrl" target="_new">@context.Name</a></h3> @SharedLocalizer["Search.By"]: <strong><a href="@context.OwnerUrl" target="new">@context.Owner</a></strong><br />
|
||||||
<strong>@context.Downloads.ToString("###,###,##0")</strong> downloads | released: <strong>@context.ReleaseDate.ToString("MMM dd, yyyy")</strong> | version: <strong>@context.Version</strong><br />
|
@(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)<br />
|
||||||
@(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)
|
<strong>@(String.Format("{0:n0}", context.Downloads))</strong> @SharedLocalizer["Search.Downloads"] | @SharedLocalizer["Search.Released"]: <strong>@context.ReleaseDate.ToString("MMM dd, yyyy")</strong> | @SharedLocalizer["Search.Version"]: <strong>@context.Version</strong>
|
||||||
</td>
|
</td>
|
||||||
<td style="vertical-align: middle;">
|
<td style="vertical-align: middle;">
|
||||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadTheme(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadTheme(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
||||||
|
@ -47,6 +61,7 @@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Package> _packages;
|
private List<Package> _packages;
|
||||||
|
private string _search = "";
|
||||||
|
|
||||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||||
|
|
||||||
|
@ -54,16 +69,7 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var themes = await ThemeService.GetThemesAsync();
|
await LoadThemes();
|
||||||
_packages = await PackageService.GetPackagesAsync("theme");
|
|
||||||
|
|
||||||
foreach (Package package in _packages.ToArray())
|
|
||||||
{
|
|
||||||
if (themes.Exists(item => item.PackageName == package.PackageId))
|
|
||||||
{
|
|
||||||
_packages.Remove(package);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +78,45 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task LoadThemes()
|
||||||
|
{
|
||||||
|
var themes = await ThemeService.GetThemesAsync();
|
||||||
|
_packages = await PackageService.GetPackagesAsync("theme", _search);
|
||||||
|
|
||||||
|
foreach (Package package in _packages.ToArray())
|
||||||
|
{
|
||||||
|
if (themes.Exists(item => item.PackageName == package.PackageId))
|
||||||
|
{
|
||||||
|
_packages.Remove(package);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Search()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await LoadThemes();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error On Search");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Reset()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_search = "";
|
||||||
|
await LoadThemes();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error On Reset");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task InstallThemes()
|
private async Task InstallThemes()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -14,7 +14,7 @@ else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Theme" />
|
<ActionLink Action="Add" Text="Install Theme" />
|
||||||
@((MarkupString)" ")
|
@((MarkupString)" ")
|
||||||
<ActionLink Action="Create" Text="Create Theme" ResourceKey="CreateTheme" />
|
<ActionLink Action="Create" Text="Create Theme" ResourceKey="CreateTheme" Class="btn btn-secondary" />
|
||||||
|
|
||||||
<Pager Items="@_themes">
|
<Pager Items="@_themes">
|
||||||
<Header>
|
<Header>
|
||||||
|
|
|
@ -210,4 +210,25 @@
|
||||||
<data name="Upload" xml:space="preserve">
|
<data name="Upload" xml:space="preserve">
|
||||||
<value>Upload</value>
|
<value>Upload</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Reset" xml:space="preserve">
|
||||||
|
<value>Reset</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search" xml:space="preserve">
|
||||||
|
<value>Search</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search.Hint" xml:space="preserve">
|
||||||
|
<value>Enter Search Term</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search.By" xml:space="preserve">
|
||||||
|
<value>by</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search.Downloads" xml:space="preserve">
|
||||||
|
<value>downloads</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search.Released" xml:space="preserve">
|
||||||
|
<value>release date</value>
|
||||||
|
</data>
|
||||||
|
<data name="Search.Version" xml:space="preserve">
|
||||||
|
<value>version</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -27,8 +27,7 @@ namespace Oqtane.Services
|
||||||
|
|
||||||
public async Task<List<Package>> GetPackagesAsync(string type, string search)
|
public async Task<List<Package>> GetPackagesAsync(string type, string search)
|
||||||
{
|
{
|
||||||
List<Package> packages = await GetJsonAsync<List<Package>>($"{Apiurl}?type={type}&search={WebUtility.UrlEncode(search)}");
|
return await GetJsonAsync<List<Package>>($"{Apiurl}?type={type}&search={WebUtility.UrlEncode(search)}");
|
||||||
return packages.OrderByDescending(item => item.Downloads).ToList(); // order by popularity
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DownloadPackageAsync(string packageId, string version, string folder)
|
public async Task DownloadPackageAsync(string packageId, string version, string folder)
|
||||||
|
|
|
@ -6,12 +6,12 @@ using System;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using Oqtane.Infrastructure;
|
using Oqtane.Infrastructure;
|
||||||
using Oqtane.Enums;
|
using Oqtane.Enums;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
// ReSharper disable PartialTypeWithSinglePart
|
// ReSharper disable PartialTypeWithSinglePart
|
||||||
|
|
||||||
namespace Oqtane.Controllers
|
namespace Oqtane.Controllers
|
||||||
|
@ -41,8 +41,9 @@ namespace Oqtane.Controllers
|
||||||
List<Package> packages;
|
List<Package> packages;
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Host.Value);
|
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value);
|
||||||
packages = await GetJson<List<Package>>(client, Constants.PackageRegistryUrl + $"/api/registry/packages/?installationid={GetInstallationId()}&type={type.ToLower()}&version={Constants.Version}&search={search}");
|
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(Constants.PackageId, Constants.Version));
|
||||||
|
packages = await GetJson<List<Package>>(client, Constants.PackageRegistryUrl + $"/api/registry/packages/?id={GetInstallationId()}&type={type.ToLower()}&version={Constants.Version}&search={search}");
|
||||||
}
|
}
|
||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
@ -55,8 +56,9 @@ namespace Oqtane.Controllers
|
||||||
Package package = null;
|
Package package = null;
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Host.Value);
|
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value);
|
||||||
package = await GetJson<Package>(client, Constants.PackageRegistryUrl + $"/api/registry/package/?installationid={GetInstallationId()}&packageid={packageid}&version={version}");
|
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(Constants.PackageId, Constants.Version));
|
||||||
|
package = await GetJson<Package>(client, Constants.PackageRegistryUrl + $"/api/registry/package/?id={GetInstallationId()}&package={packageid}&version={version}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (package != null)
|
if (package != null)
|
||||||
|
|
|
@ -58,8 +58,8 @@ namespace Oqtane.Models
|
||||||
public string PackageUrl { get; set; }
|
public string PackageUrl { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if any known security vulnerabilities exist ( only applicable to framework packages )
|
/// Indicates if any known security vulnerabilities exist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Vulnerability { get; set; }
|
public int Vulnerabilities { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 395 KiB After Width: | Height: | Size: 337 KiB |
Loading…
Reference in New Issue
Block a user