diff --git a/.idea/.idea.HopFrame/.idea/workspace.xml b/.idea/.idea.HopFrame/.idea/workspace.xml
index fe37142..8e6c065 100644
--- a/.idea/.idea.HopFrame/.idea/workspace.xml
+++ b/.idea/.idea.HopFrame/.idea/workspace.xml
@@ -11,12 +11,11 @@
-
-
-
+
-
-
+
+
+
@@ -240,7 +239,7 @@
-
+
@@ -546,7 +545,15 @@
1738770468949
-
+
+
+ 1738773315593
+
+
+
+ 1738773315593
+
+
@@ -597,7 +604,6 @@
-
@@ -622,6 +628,7 @@
-
+
+
\ No newline at end of file
diff --git a/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor b/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor
index 628f380..11cc7ad 100644
--- a/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor
+++ b/src/HopFrame.Web/Components/Pages/HopFrameTablePage.razor
@@ -21,7 +21,7 @@
@_config?.DisplayName
- @if (!DisplaySelection) {
+ @if (!DisplaySelection && _buttonToggles.ShowRefreshButton) {
- @if (_hasCreatePolicy && DisplayActions) {
- Add Entry
+ @if (_hasCreatePolicy && DisplayActions && _buttonToggles.ShowAddEntityButton) {
+ Add Entity
}
@foreach (var button in _pluginButtons.Where(pb => pb.IsForTable(_config)).Where(pb => pb.Position == PluginButtonPosition.TopRight)) {
@@ -85,13 +85,13 @@
}
- @if (_hasUpdatePolicy) {
+ @if (_hasUpdatePolicy && _buttonToggles.ShowEditButton) {
}
- @if (_hasDeletePolicy) {
+ @if (_hasDeletePolicy && _buttonToggles.ShowDeleteButton) {
@@ -182,6 +182,7 @@
private readonly CancellationTokenSource _tokenSource = new();
private List _pluginButtons = new();
+ private DefaultButtonToggles _buttonToggles = new();
protected override void OnInitialized() {
_config ??= Explorer.GetTable(TableDisplayName);
@@ -197,11 +198,12 @@
return;
}
- var eventResult = await PluginOrchestrator.DispatchEvent(new PageInitializedEvent(this) {
+ var eventResult = await PluginOrchestrator.DispatchEvent(new TableInitializedEvent(this) {
Table = _config!
});
if (eventResult.IsCanceled) return;
_pluginButtons = eventResult.PluginButtons;
+ _buttonToggles = eventResult.DefaultButtons;
_hasUpdatePolicy = await Handler.IsAuthenticatedAsync(_config?.UpdatePolicy);
_hasDeletePolicy = await Handler.IsAuthenticatedAsync(_config?.DeletePolicy);
@@ -223,6 +225,7 @@
public void Dispose() {
_searchCancel.Dispose();
+ _tokenSource.Dispose();
}
private CancellationTokenSource _searchCancel = new();
diff --git a/src/HopFrame.Web/Plugins/Events/PageInitializedEvent.cs b/src/HopFrame.Web/Plugins/Events/TableInitializedEvent.cs
similarity index 87%
rename from src/HopFrame.Web/Plugins/Events/PageInitializedEvent.cs
rename to src/HopFrame.Web/Plugins/Events/TableInitializedEvent.cs
index bdcf8c9..2f3080b 100644
--- a/src/HopFrame.Web/Plugins/Events/PageInitializedEvent.cs
+++ b/src/HopFrame.Web/Plugins/Events/TableInitializedEvent.cs
@@ -4,8 +4,9 @@ using Microsoft.FluentUI.AspNetCore.Components;
namespace HopFrame.Web.Plugins.Events;
-public class PageInitializedEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
+public class TableInitializedEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
public List PluginButtons { get; } = new();
+ public DefaultButtonToggles DefaultButtons { get; set; } = new();
public void AddPageButton(string title, Func callback, bool pushRight = false, IconInfo? icon = null) {
PluginButtons.Add(new() {
@@ -91,3 +92,10 @@ public enum PluginButtonPosition {
TopRight = 1,
OnEntry = 2
}
+
+public struct DefaultButtonToggles() {
+ public bool ShowRefreshButton { get; set; } = true;
+ public bool ShowAddEntityButton { get; set; } = true;
+ public bool ShowDeleteButton { get; set; } = true;
+ public bool ShowEditButton { get; set; } = true;
+}
diff --git a/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs b/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs
index ad2fe03..7bb0e56 100644
--- a/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs
+++ b/src/HopFrame.Web/Plugins/Internal/PluginOrchestrator.cs
@@ -54,5 +54,4 @@ internal sealed class PluginOrchestrator(IServiceProvider services) : IPluginOrc
return @event;
}
-
}
\ No newline at end of file