Updated plugin version control. Added notification system to web ui
This commit is contained in:
@@ -81,11 +81,11 @@
|
||||
|
||||
Logger.Log($"Deleting plugin {pluginName}", this);
|
||||
|
||||
bool result = await PluginManager.UninstallPluginByName(pluginName);
|
||||
var response = await PluginManager.UninstallPluginByName(pluginName);
|
||||
|
||||
if (!result)
|
||||
if (!response.IsSuccess)
|
||||
{
|
||||
Logger.Log($"Failed to delete plugin {pluginName}", this, LogType.Error);
|
||||
Logger.Log(response.Message, this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -100,14 +100,14 @@
|
||||
private async Task PluginDetailsButtonClick(string pluginName)
|
||||
{
|
||||
Logger.Log($"Getting plugin details for {pluginName}", this);
|
||||
var pluginDetails = await PluginManager.GetPluginDataByName(pluginName);
|
||||
if (pluginDetails == null)
|
||||
var response = await PluginManager.GetPluginDataByName(pluginName);
|
||||
if (!response.IsSuccess)
|
||||
{
|
||||
Logger.Log($"Failed to get details for plugin {pluginName}", this, LogType.Error);
|
||||
Logger.Log(response.Message, this, LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_selectedPluginDetails = pluginDetails;
|
||||
_selectedPluginDetails = response.Data;
|
||||
_showPluginDetailsModal = true;
|
||||
|
||||
Logger.Log($"Plugin details for {pluginName} retrieved", this);
|
||||
|
||||
@@ -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