Skip to content

Commit

Permalink
Merge pull request #2982 from sbwalker/dev
Browse files Browse the repository at this point in the history
Package enhancements for Marketplace
  • Loading branch information
sbwalker authored Jul 9, 2023
2 parents 1b2de37 + 9a3b458 commit 5abf0df
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 12 deletions.
7 changes: 5 additions & 2 deletions Oqtane.Client/Modules/Controls/Section.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
<hr class="app-rule" />
</div>
<div class="collapse @_show" id="@Name">
@ChildContent
@if (ChildContent != null)
{
@ChildContent
}
</div>

@code {
Expand All @@ -26,7 +29,7 @@
private string _show = string.Empty;

[Parameter]
public RenderFragment ChildContent { get; set; }
public RenderFragment ChildContent { get; set; } = null;

[Parameter]
public string Name { get; set; } // required - the name of the section
Expand Down
11 changes: 11 additions & 0 deletions Oqtane.Client/Services/Interfaces/IPackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ public interface IPackageService
/// <returns></returns>
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package);

/// <summary>
/// Returns a list of packages matching the given parameters
/// </summary>
/// <param name="type"></param>
/// <param name="search"></param>
/// <param name="price"></param>
/// <param name="package"></param>
/// <param name="sort"></param>
/// <returns></returns>
Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package, string sort);

/// <summary>
/// Returns a specific package
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion Oqtane.Client/Services/PackageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ public async Task<List<Package>> GetPackagesAsync(string type)

public async Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package)
{
return await GetJsonAsync<List<Package>>($"{Apiurl}?type={type}&search={WebUtility.UrlEncode(search)}&price={price}&package={package}");
return await GetPackagesAsync(type, search, price, package, "");
}

public async Task<List<Package>> GetPackagesAsync(string type, string search, string price, string package, string sort)
{
return await GetJsonAsync<List<Package>>($"{Apiurl}?type={type}&search={WebUtility.UrlEncode(search)}&price={price}&package={package}&sort={sort}");
}

public async Task<Package> GetPackageAsync(string packageId, string version)
Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Server/Controllers/FolderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Folder Get(int id)
public Folder GetByPath(int siteId, string path)
{
var folderPath = WebUtility.UrlDecode(path).Replace("\\", "/");
if (!folderPath.EndsWith("/"))
if (!folderPath.EndsWith("/") && folderPath != "")
{
folderPath += "/";
}
Expand Down
4 changes: 2 additions & 2 deletions Oqtane.Server/Controllers/PackageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PackageController(IInstallationManager installationManager, IWebHostEnvir

// GET: api/<controller>?type=x&search=y&price=z&package=a
[HttpGet]
public async Task<IEnumerable<Package>> Get(string type, string search, string price, string package)
public async Task<IEnumerable<Package>> Get(string type, string search, string price, string package, string sort)
{
// get packages
List<Package> packages = new List<Package>();
Expand All @@ -44,7 +44,7 @@ public async Task<IEnumerable<Package>> Get(string type, string search, string p
{
client.DefaultRequestHeaders.Add("Referer", HttpContext.Request.Scheme + "://" + HttpContext.Request.Host.Value);
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(Constants.PackageId, Constants.Version));
packages = await GetJson<List<Package>>(client, Constants.PackageRegistryUrl + $"/api/registry/packages/?id={_configManager.GetInstallationId()}&type={type.ToLower()}&version={Constants.Version}&search={search}&price={price}&package={package}");
packages = await GetJson<List<Package>>(client, Constants.PackageRegistryUrl + $"/api/registry/packages/?id={_configManager.GetInstallationId()}&type={type.ToLower()}&version={Constants.Version}&search={search}&price={price}&package={package}&sort={sort}");
}
}
return packages;
Expand Down
6 changes: 0 additions & 6 deletions Oqtane.Server/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@
using Oqtane.Security;
using System.Net;
using Oqtane.Enums;
using Oqtane.Extensions;
using Oqtane.Infrastructure;
using Oqtane.Repository;
using Oqtane.Modules.Admin.Users;
using System.IO;
using Oqtane.Services;
using Oqtane.UI;
using System;

namespace Oqtane.Controllers
{
Expand Down
1 change: 1 addition & 0 deletions Oqtane.Server/Repository/ModuleDefinitionRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public ModuleDefinition FilterModuleDefinition(ModuleDefinition moduleDefinition
ModuleDefinition.IsPortable = moduleDefinition.IsPortable;
ModuleDefinition.Resources = moduleDefinition.Resources;
ModuleDefinition.IsEnabled = moduleDefinition.IsEnabled;
ModuleDefinition.PackageName = moduleDefinition.PackageName;
}

return ModuleDefinition;
Expand Down
1 change: 1 addition & 0 deletions Oqtane.Server/Repository/ThemeRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public List<Theme> FilterThemes(List<Theme> themes)
Theme.Containers = theme.Containers;
Theme.ThemeSettingsType = theme.ThemeSettingsType;
Theme.ContainerSettingsType = theme.ContainerSettingsType;
Theme.PackageName = theme.PackageName;
Themes.Add(Theme);
}

Expand Down
10 changes: 10 additions & 0 deletions Oqtane.Shared/Models/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public class Package
/// </summary>
public string Description { get; set; }

/// <summary>
/// logo
/// </summary>
public int? LogoFileId { get; set; }

/// <summary>
/// License for the Package.
/// </summary>
Expand Down Expand Up @@ -62,6 +67,11 @@ public class Package
/// </summary>
public string PackageUrl { get; set; }

/// <summary>
/// The direct Url for getting support for the product
/// </summary>
public string SupportUrl { get; set; }

/// <summary>
/// Indicates if any known security vulnerabilities exist
/// </summary>
Expand Down

0 comments on commit 5abf0df

Please sign in to comment.