mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 16:11:10 +00:00
Hides the settings button for plugins that have no settings.
This commit is contained in:
1 parent
1fe67b26d5
commit
0dd241bdb4
2 files changed
+186
-1
No files matched your search
+9
-1
@@ -54,8 +54,16 @@ public class PluginsIndexViewEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
PluginDto[] plugins = await _apiHttpClient.GetAsync<PluginDto[]>(ApiRoutes.Plugins.GET_PLUGINS, cancellationToken).ConfigureAwait(false);
|
||||
Dictionary<Guid, PluginSettingsDto> settingsByPluginId = [];
|
||||
foreach (PluginDto plugin in plugins)
|
||||
{
|
||||
if (plugin.LoadStatus == Lumina.Presentation.Web.Common.Enums.Plugins.PluginLoadStatus.Loaded)
|
||||
settingsByPluginId[plugin.Id] = await _apiHttpClient.GetAsync<PluginSettingsDto>(ApiRoutes.Plugins.GET_PLUGIN_SETTINGS.Replace("{pluginId}", plugin.Id.ToString()), cancellationToken).ConfigureAwait(false);
|
||||
{
|
||||
PluginSettingsDto pluginSettings = await _apiHttpClient.GetAsync<PluginSettingsDto>(ApiRoutes.Plugins.GET_PLUGIN_SETTINGS.Replace("{pluginId}", plugin.Id.ToString()), cancellationToken).ConfigureAwait(false);
|
||||
// A plugin that exposes an empty settings schema has nothing to configure, so it is left out of the map the view renders
|
||||
// the settings buttons and panels from, instead of showing a Settings button that opens an empty panel.
|
||||
if (pluginSettings.Schema.Count > 0)
|
||||
settingsByPluginId[plugin.Id] = pluginSettings;
|
||||
}
|
||||
}
|
||||
Dictionary<string, object?> viewData = new() { ["pluginSettings"] = settingsByPluginId };
|
||||
return View("/Core/Views/Admin/Plugins.cshtml", plugins, viewData);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user