Resolve requests for request actions

https://feedback.yaak.app/p/plugin-cannot-get-inhereted-parameters-when-rendering-a-request
This commit is contained in:
Gregory Schier
2025-07-10 11:32:03 -07:00
parent 9cd430b3de
commit 333b64e7f3
4 changed files with 27 additions and 12 deletions

View File

@@ -679,7 +679,7 @@ pub async fn send_http_request<R: Runtime>(
})
}
fn resolve_http_request<R: Runtime>(
pub fn resolve_http_request<R: Runtime>(
window: &WebviewWindow<R>,
request: &HttpRequest,
) -> Result<(HttpRequest, String)> {

View File

@@ -2,7 +2,7 @@ extern crate core;
use crate::encoding::read_response_body;
use crate::error::Error::GenericError;
use crate::grpc::{build_metadata, metadata_to_map, resolve_grpc_request};
use crate::http_request::send_http_request;
use crate::http_request::{resolve_http_request, send_http_request};
use crate::import::import_data;
use crate::notifications::YaakNotifier;
use crate::render::{render_grpc_request, render_template};
@@ -36,7 +36,8 @@ use yaak_models::models::{
use yaak_models::query_manager::QueryManagerExt;
use yaak_models::util::{BatchUpsertResult, UpdateSource, get_workspace_export_resources};
use yaak_plugins::events::{
CallGrpcRequestActionRequest, CallHttpRequestActionRequest, FilterResponse,
CallGrpcRequestActionArgs, CallGrpcRequestActionRequest, CallHttpAuthenticationActionArgs,
CallHttpRequestActionArgs, CallHttpRequestActionRequest, FilterResponse,
GetGrpcRequestActionsResponse, GetHttpAuthenticationConfigResponse,
GetHttpAuthenticationSummaryResponse, GetHttpRequestActionsResponse,
GetTemplateFunctionsResponse, InternalEvent, InternalEventPayload, JsonPrimitive,
@@ -836,7 +837,13 @@ async fn cmd_call_http_request_action<R: Runtime>(
req: CallHttpRequestActionRequest,
plugin_manager: State<'_, PluginManager>,
) -> YaakResult<()> {
Ok(plugin_manager.call_http_request_action(&window, req).await?)
Ok(plugin_manager.call_http_request_action(&window, CallHttpRequestActionRequest {
args: CallHttpRequestActionArgs {
http_request: resolve_http_request(&window, &req.args.http_request)?.0,
..req.args
},
..req
}).await?)
}
#[tauri::command]
@@ -845,7 +852,13 @@ async fn cmd_call_grpc_request_action<R: Runtime>(
req: CallGrpcRequestActionRequest,
plugin_manager: State<'_, PluginManager>,
) -> YaakResult<()> {
Ok(plugin_manager.call_grpc_request_action(&window, req).await?)
Ok(plugin_manager.call_grpc_request_action(&window, CallGrpcRequestActionRequest {
args: CallGrpcRequestActionArgs {
grpc_request: resolve_grpc_request(&window, &req.args.grpc_request)?.0,
..req.args
},
..req
}).await?)
}
#[tauri::command]

View File

@@ -1,3 +1,4 @@
import { type } from '@tauri-apps/plugin-os';
import classNames from 'classnames';
import { useAtomValue } from 'jotai';
import React, { memo } from 'react';
@@ -57,7 +58,7 @@ export const WorkspaceHeader = memo(function WorkspaceHeader({ className }: Prop
<LicenseBadge />
)}
<IconButton
icon="square_terminal"
icon={type() == 'macos' ? 'command' : 'square_terminal'}
title="Search or execute a command"
size="sm"
iconColor="secondary"

View File

@@ -8,8 +8,6 @@ const icons = {
alert_triangle: lucide.AlertTriangleIcon,
archive: lucide.ArchiveIcon,
arrow_big_down_dash: lucide.ArrowBigDownDashIcon,
circle_dollar_sign: lucide.CircleDollarSignIcon,
arrow_right_circle: lucide.ArrowRightCircleIcon,
arrow_big_left_dash: lucide.ArrowBigLeftDashIcon,
arrow_big_right: lucide.ArrowBigRightIcon,
arrow_big_right_dash: lucide.ArrowBigRightDashIcon,
@@ -17,13 +15,14 @@ const icons = {
arrow_down: lucide.ArrowDownIcon,
arrow_down_to_dot: lucide.ArrowDownToDotIcon,
arrow_down_to_line: lucide.ArrowDownToLineIcon,
arrow_right_circle: lucide.ArrowRightCircleIcon,
arrow_up: lucide.ArrowUpIcon,
arrow_up_down: lucide.ArrowUpDownIcon,
arrow_up_from_dot: lucide.ArrowUpFromDotIcon,
arrow_up_from_line: lucide.ArrowUpFromLineIcon,
badge_check: lucide.BadgeCheckIcon,
box: lucide.BoxIcon,
book_open_text: lucide.BookOpenText,
box: lucide.BoxIcon,
cake: lucide.CakeIcon,
chat: lucide.MessageSquare,
check: lucide.CheckIcon,
@@ -31,13 +30,15 @@ const icons = {
check_square_checked: lucide.SquareCheckIcon,
check_square_unchecked: lucide.SquareIcon,
chevron_down: lucide.ChevronDownIcon,
chevron_right: lucide.ChevronRightIcon,
chevron_left: lucide.ChevronLeftIcon,
chevron_right: lucide.ChevronRightIcon,
circle_alert: lucide.CircleAlertIcon,
circle_dollar_sign: lucide.CircleDollarSignIcon,
circle_fading_arrow_up: lucide.CircleFadingArrowUpIcon,
clock: lucide.ClockIcon,
code: lucide.CodeIcon,
columns_2: lucide.Columns2Icon,
command: lucide.CommandIcon,
cookie: lucide.CookieIcon,
copy: lucide.CopyIcon,
copy_check: lucide.CopyCheck,
@@ -47,11 +48,11 @@ const icons = {
eye: lucide.EyeIcon,
eye_closed: lucide.EyeOffIcon,
file_code: lucide.FileCodeIcon,
folder_code: lucide.FolderCodeIcon,
filter: lucide.FilterIcon,
flame: lucide.FlameIcon,
flask: lucide.FlaskConicalIcon,
folder: lucide.FolderIcon,
folder_code: lucide.FolderCodeIcon,
folder_git: lucide.FolderGitIcon,
folder_input: lucide.FolderInputIcon,
folder_open: lucide.FolderOpenIcon,
@@ -98,8 +99,8 @@ const icons = {
shield: lucide.ShieldIcon,
shield_check: lucide.ShieldCheckIcon,
shield_off: lucide.ShieldOffIcon,
square_terminal: lucide.SquareTerminalIcon,
sparkles: lucide.SparklesIcon,
square_terminal: lucide.SquareTerminalIcon,
sun: lucide.SunIcon,
table: lucide.TableIcon,
text: lucide.FileTextIcon,