mirror of
				https://github.com/MindWorkAI/AI-Studio.git
				synced 2025-10-31 22:20:20 +00:00 
			
		
		
		
	Refactor Plugins component to streamline message handling
This commit is contained in:
		
							parent
							
								
									087ab5257c
								
							
						
					
					
						commit
						fd25f14c47
					
				| @ -1,6 +1,8 @@ | |||||||
| using AIStudio.Components; | using AIStudio.Components; | ||||||
| using AIStudio.Tools.PluginSystem; | using AIStudio.Tools.PluginSystem; | ||||||
| 
 | 
 | ||||||
|  | using Microsoft.AspNetCore.Components; | ||||||
|  | 
 | ||||||
| namespace AIStudio.Pages; | namespace AIStudio.Pages; | ||||||
| 
 | 
 | ||||||
| public partial class Plugins : MSGComponentBase | public partial class Plugins : MSGComponentBase | ||||||
| @ -15,8 +17,7 @@ public partial class Plugins : MSGComponentBase | |||||||
| 
 | 
 | ||||||
|     protected override async Task OnInitializedAsync() |     protected override async Task OnInitializedAsync() | ||||||
|     { |     { | ||||||
|         this.MessageBus.RegisterComponent(this); |         this.ApplyFilters([], [ Event.PLUGINS_RELOADED ]); | ||||||
|         this.MessageBus.ApplyFilters(this, [], [ Event.PLUGINS_RELOADED ]); |  | ||||||
|          |          | ||||||
|         this.groupConfig = new TableGroupDefinition<IPluginMetadata> |         this.groupConfig = new TableGroupDefinition<IPluginMetadata> | ||||||
|         { |         { | ||||||
| @ -48,4 +49,18 @@ public partial class Plugins : MSGComponentBase | |||||||
|         await this.SettingsManager.StoreSettings(); |         await this.SettingsManager.StoreSettings(); | ||||||
|         await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED); |         await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     #region Overrides of MSGComponentBase | ||||||
|  | 
 | ||||||
|  |     protected override async Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default | ||||||
|  |     { | ||||||
|  |         switch (triggeredEvent) | ||||||
|  |         { | ||||||
|  |             case Event.PLUGINS_RELOADED: | ||||||
|  |                 await this.InvokeAsync(this.StateHasChanged); | ||||||
|  |                 break; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     #endregion | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user