Merge pull request #5181 from sbwalker/dev
add ability to Synchronize local modules and themes with Marketplace
This commit is contained in:
commit
09f5e158dd
@ -73,7 +73,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="url" HelpText="The reference url of the module" ResourceKey="ReferenceUrl">Reference Url: </Label>
|
<Label Class="col-sm-3" For="url" HelpText="The url of the module" ResourceKey="Url">Url: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input id="url" class="form-control" @bind="@_url" disabled />
|
<input id="url" class="form-control" @bind="@_url" disabled />
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,8 +17,8 @@ else
|
|||||||
<div class="row mb-3 align-items-center">
|
<div class="row mb-3 align-items-center">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<ActionLink Action="Add" Text="Install Module" ResourceKey="InstallModule" />
|
<ActionLink Action="Add" Text="Install Module" ResourceKey="InstallModule" />
|
||||||
@((MarkupString)" ")
|
<ActionLink Action="Create" Text="Create Module" ResourceKey="CreateModule" Class="btn btn-secondary ps-2" />
|
||||||
<ActionLink Action="Create" Text="Create Module" ResourceKey="CreateModule" Class="btn btn-secondary" />
|
<button type="button" class="btn btn-secondary pw-2" @onclick="@Synchronize">@Localizer["Synchronize"]</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select class="form-select" @onchange="(e => CategoryChanged(e))">
|
<select class="form-select" @onchange="(e => CategoryChanged(e))">
|
||||||
@ -220,4 +220,27 @@ else
|
|||||||
_category = (string)e.Value;
|
_category = (string)e.Value;
|
||||||
await LoadModuleDefinitions();
|
await LoadModuleDefinitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Synchronize()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
foreach (var moduleDefinition in _moduleDefinitions)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(moduleDefinition.PackageName) && !_packages.Any(item => item.PackageId == moduleDefinition.PackageName))
|
||||||
|
{
|
||||||
|
var package = await PackageService.GetPackageAsync(moduleDefinition.PackageName, moduleDefinition.Version, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HideProgressIndicator();
|
||||||
|
AddModuleMessage(Localizer["Success.Module.Synchronize"], MessageType.Success);
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, true));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Synchronizing Modules {Error}", ex.Message);
|
||||||
|
AddModuleMessage(Localizer["Error.Module.Synchronize"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="url" HelpText="The reference url of the theme" ResourceKey="ReferenceUrl">Reference Url: </Label>
|
<Label Class="col-sm-3" For="url" HelpText="The url of the theme" ResourceKey="Url">Url: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input id="url" class="form-control" @bind="@_url" disabled />
|
<input id="url" class="form-control" @bind="@_url" disabled />
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<ActionLink Action="Add" Text="Install Theme" ResourceKey="InstallTheme" />
|
<ActionLink Action="Add" Text="Install Theme" ResourceKey="InstallTheme" />
|
||||||
@((MarkupString)" ")
|
<ActionLink Action="Create" Text="Create Theme" ResourceKey="CreateTheme" Class="btn btn-secondary ps-2" />
|
||||||
<ActionLink Action="Create" Text="Create Theme" ResourceKey="CreateTheme" Class="btn btn-secondary" />
|
<button type="button" class="btn btn-secondary pw-2" @onclick="@Synchronize">@Localizer["Synchronize"]</button>
|
||||||
|
|
||||||
<Pager Items="@_themes">
|
<Pager Items="@_themes">
|
||||||
<Header>
|
<Header>
|
||||||
@ -173,4 +173,27 @@ else
|
|||||||
AddModuleMessage(Localizer["Error.Theme.Delete"], MessageType.Error);
|
AddModuleMessage(Localizer["Error.Theme.Delete"], MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Synchronize()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ShowProgressIndicator();
|
||||||
|
foreach (var theme in _themes)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(theme.PackageName) && !_packages.Any(item => item.PackageId == theme.PackageName))
|
||||||
|
{
|
||||||
|
await PackageService.GetPackageAsync(theme.PackageName, theme.Version, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HideProgressIndicator();
|
||||||
|
AddModuleMessage(Localizer["Success.Theme.Synchronize"], MessageType.Success);
|
||||||
|
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, true));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Synchronizing Themes {Error}", ex.Message);
|
||||||
|
AddModuleMessage(Localizer["Error.Theme.Synchronize"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -147,8 +147,8 @@
|
|||||||
<data name="Owner.HelpText" xml:space="preserve">
|
<data name="Owner.HelpText" xml:space="preserve">
|
||||||
<value>The owner or creator of the module</value>
|
<value>The owner or creator of the module</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReferenceUrl.HelpText" xml:space="preserve">
|
<data name="Url.HelpText" xml:space="preserve">
|
||||||
<value>The reference url of the module</value>
|
<value>The url of the module</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Contact.HelpText" xml:space="preserve">
|
<data name="Contact.HelpText" xml:space="preserve">
|
||||||
<value>The contact for the module</value>
|
<value>The contact for the module</value>
|
||||||
@ -171,8 +171,8 @@
|
|||||||
<data name="Owner.Text" xml:space="preserve">
|
<data name="Owner.Text" xml:space="preserve">
|
||||||
<value>Owner: </value>
|
<value>Owner: </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReferenceUrl.Text" xml:space="preserve">
|
<data name="Url.Text" xml:space="preserve">
|
||||||
<value>Reference Url: </value>
|
<value>Url: </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Contact.Text" xml:space="preserve">
|
<data name="Contact.Text" xml:space="preserve">
|
||||||
<value>Contact: </value>
|
<value>Contact: </value>
|
||||||
|
@ -159,4 +159,13 @@
|
|||||||
<data name="Enabled" xml:space="preserve">
|
<data name="Enabled" xml:space="preserve">
|
||||||
<value>Enabled?</value>
|
<value>Enabled?</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Synchronize" xml:space="preserve">
|
||||||
|
<value>Synchronize</value>
|
||||||
|
</data>
|
||||||
|
<data name="Success.Module.Synchronize" xml:space="preserve">
|
||||||
|
<value>Modules Have Been Successfully Synchronized With The Marketplace</value>
|
||||||
|
</data>
|
||||||
|
<data name="Error.Module.Synchronize" xml:space="preserve">
|
||||||
|
<value>Error Synchronizing Modules With The Marketplace</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -132,8 +132,8 @@
|
|||||||
<data name="Owner.Text" xml:space="preserve">
|
<data name="Owner.Text" xml:space="preserve">
|
||||||
<value>Owner: </value>
|
<value>Owner: </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReferenceUrl.Text" xml:space="preserve">
|
<data name="Url.Text" xml:space="preserve">
|
||||||
<value>Reference Url: </value>
|
<value>Url: </value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Contact.Text" xml:space="preserve">
|
<data name="Contact.Text" xml:space="preserve">
|
||||||
<value>Contact: </value>
|
<value>Contact: </value>
|
||||||
@ -153,8 +153,8 @@
|
|||||||
<data name="Owner.HelpText" xml:space="preserve">
|
<data name="Owner.HelpText" xml:space="preserve">
|
||||||
<value>The owner or creator of the theme</value>
|
<value>The owner or creator of the theme</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReferenceUrl.HelpText" xml:space="preserve">
|
<data name="Url.HelpText" xml:space="preserve">
|
||||||
<value>The reference url of the theme</value>
|
<value>The url of the theme</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Contact.HelpText" xml:space="preserve">
|
<data name="Contact.HelpText" xml:space="preserve">
|
||||||
<value>The contact for the theme</value>
|
<value>The contact for the theme</value>
|
||||||
|
@ -159,4 +159,13 @@
|
|||||||
<data name="Assign" xml:space="preserve">
|
<data name="Assign" xml:space="preserve">
|
||||||
<value>Assign</value>
|
<value>Assign</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Synchronize" xml:space="preserve">
|
||||||
|
<value>Synchronize</value>
|
||||||
|
</data>
|
||||||
|
<data name="Success.Theme.Synchronize" xml:space="preserve">
|
||||||
|
<value>Themes Have Been Successfully Synchronized With The Marketplace</value>
|
||||||
|
</data>
|
||||||
|
<data name="Error.Theme.Synchronize" xml:space="preserve">
|
||||||
|
<value>Error Synchronizing Themes With The Marketplace</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -90,9 +90,7 @@ namespace Oqtane.Controllers
|
|||||||
package = await GetJson<Package>(client, url + $"/api/registry/package/?id={_configManager.GetInstallationId()}&package={packageid}&version={version}&download={download}&email={WebUtility.UrlEncode(GetPackageRegistryEmail())}");
|
package = await GetJson<Package>(client, url + $"/api/registry/package/?id={_configManager.GetInstallationId()}&package={packageid}&version={version}&download={download}&email={WebUtility.UrlEncode(GetPackageRegistryEmail())}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (package != null)
|
if (package != null && bool.Parse(install))
|
||||||
{
|
|
||||||
if (bool.Parse(install))
|
|
||||||
{
|
{
|
||||||
using (var httpClient = new HttpClient())
|
using (var httpClient = new HttpClient())
|
||||||
{
|
{
|
||||||
@ -113,11 +111,6 @@ namespace Oqtane.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Create, "Package {PackageId}.{Version} Is Not Registered In The Marketplace", packageid, version);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return package;
|
return package;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user