Show toast after plugin reload

This commit is contained in:
Gregory Schier
2024-09-09 12:36:05 -07:00
parent c0707bb246
commit 36890b9a32
2 changed files with 10 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ use yaak_plugin_runtime::events::{
CallHttpRequestActionRequest, FilterResponse, FindHttpResponsesResponse, CallHttpRequestActionRequest, FilterResponse, FindHttpResponsesResponse,
GetHttpRequestActionsResponse, GetHttpRequestByIdResponse, GetTemplateFunctionsResponse, GetHttpRequestActionsResponse, GetHttpRequestByIdResponse, GetTemplateFunctionsResponse,
InternalEvent, InternalEventPayload, PluginBootResponse, RenderHttpRequestResponse, InternalEvent, InternalEventPayload, PluginBootResponse, RenderHttpRequestResponse,
SendHttpRequestResponse, SendHttpRequestResponse, ShowToastRequest, ToastVariant,
}; };
use yaak_plugin_runtime::handle::PluginHandle; use yaak_plugin_runtime::handle::PluginHandle;
use yaak_templates::{Parser, Tokens}; use yaak_templates::{Parser, Tokens};
@@ -2092,7 +2092,7 @@ async fn handle_plugin_event<R: Runtime>(
if plugin.directory != plugin_handle.dir { if plugin.directory != plugin_handle.dir {
continue; continue;
} }
upsert_plugin( upsert_plugin(
&w, &w,
Plugin { Plugin {
@@ -2104,6 +2104,14 @@ async fn handle_plugin_event<R: Runtime>(
.await .await
.unwrap(); .unwrap();
} }
let toast_event = plugin_handle.build_event_to_send(
&InternalEventPayload::ShowToastRequest(ShowToastRequest {
message: "Plugin Reloaded".to_string(),
variant: ToastVariant::Info,
}),
None,
);
Box::pin(handle_plugin_event(app_handle, &toast_event, plugin_handle)).await;
None None
} }
InternalEventPayload::SendHttpRequestRequest(req) => { InternalEventPayload::SendHttpRequestRequest(req) => {

View File

@@ -17,8 +17,6 @@ export function useActiveWorkspaceChangedToast() {
// Don't notify on the first load // Don't notify on the first load
if (id === null) return; if (id === null) return;
console.log('HELLO?', activeWorkspace?.id, id, window.location);
toast.show({ toast.show({
id: 'workspace-changed', id: 'workspace-changed',
timeout: 3000, timeout: 3000,