Updated plugin version control. Added notification system to web ui
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
@using DiscordBotCore.Logging
|
||||
@using DiscordBotCore.PluginManagement
|
||||
|
||||
@using WebUI.Models
|
||||
@using WebUI.Services
|
||||
|
||||
@inject NotificationService NotificationService
|
||||
|
||||
|
||||
<h3>Available Plugins</h3>
|
||||
@if (_onlinePlugins.Any())
|
||||
@@ -113,10 +118,18 @@ else
|
||||
|
||||
private async Task InstallPlugin(int pluginId)
|
||||
{
|
||||
var pluginData = await PluginManager.GetPluginDataById(pluginId);
|
||||
if (pluginData == null)
|
||||
var response = await PluginManager.GetPluginDataById(pluginId);
|
||||
if (!response.IsSuccess)
|
||||
{
|
||||
Logger.Log($"Plugin data not found for ID: {pluginId}", this);
|
||||
Logger.Log(response.Message, this);
|
||||
return;
|
||||
}
|
||||
|
||||
var pluginData = response.Data;
|
||||
|
||||
if (pluginData is null)
|
||||
{
|
||||
Logger.Log("Plugin data is null.", this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,6 +145,9 @@ else
|
||||
await PluginManager.InstallPlugin(pluginData, progress);
|
||||
|
||||
Logger.Log($"Plugin {pluginData.Name} installed successfully.", this);
|
||||
|
||||
NotificationService.Notify($"Plugin {pluginData.Name} installed successfully!", NotificationType.Success);
|
||||
|
||||
CloseInstallPercentageModal();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user