Some tweaks for beta

This commit is contained in:
Gregory Schier
2024-08-19 19:10:08 -07:00
parent 323e27a047
commit 0763c1b9b8
6 changed files with 20 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@yaakapp/api", "name": "@yaakapp/api",
"version": "0.1.9", "version": "0.1.10",
"main": "lib/index.js", "main": "lib/index.js",
"typings": "./lib/index.d.ts", "typings": "./lib/index.d.ts",
"files": [ "files": [

View File

@@ -1,3 +1,3 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
export type FindHttpResponsesRequest = { requestId: string, limit: bigint | null, }; export type FindHttpResponsesRequest = { requestId: string, limit: number | null, };

View File

@@ -1974,10 +1974,13 @@ async fn handle_plugin_event<R: Runtime>(
None None
} }
InternalEventPayload::FindHttpResponsesRequest(req) => { InternalEventPayload::FindHttpResponsesRequest(req) => {
let http_responses = let http_responses = list_http_responses(
list_http_responses(app_handle, req.request_id.as_str(), req.limit) app_handle,
.await req.request_id.as_str(),
.unwrap_or_default(); req.limit.map(|l| l as i64),
)
.await
.unwrap_or_default();
Some(InternalEventPayload::FindHttpResponsesResponse( Some(InternalEventPayload::FindHttpResponsesResponse(
FindHttpResponsesResponse { http_responses }, FindHttpResponsesResponse { http_responses },
)) ))

View File

@@ -364,7 +364,7 @@ pub struct GetHttpRequestByIdResponse {
#[ts(export)] #[ts(export)]
pub struct FindHttpResponsesRequest { pub struct FindHttpResponsesRequest {
pub request_id: String, pub request_id: String,
pub limit: Option<i64>, pub limit: Option<i32>,
} }
#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)]

View File

@@ -9,6 +9,7 @@ import type {
import { useCallback, useMemo, useState } from 'react'; import { useCallback, useMemo, useState } from 'react';
import type { FnArg } from '../gen/FnArg'; import type { FnArg } from '../gen/FnArg';
import type { Tokens } from '../gen/Tokens'; import type { Tokens } from '../gen/Tokens';
import { useActiveRequest } from '../hooks/useActiveRequest';
import { useDebouncedValue } from '../hooks/useDebouncedValue'; import { useDebouncedValue } from '../hooks/useDebouncedValue';
import { useHttpRequests } from '../hooks/useHttpRequests'; import { useHttpRequests } from '../hooks/useHttpRequests';
import { useRenderTemplate } from '../hooks/useRenderTemplate'; import { useRenderTemplate } from '../hooks/useRenderTemplate';
@@ -207,6 +208,7 @@ function HttpRequestArg({
onChange: (v: string) => void; onChange: (v: string) => void;
}) { }) {
const httpRequests = useHttpRequests(); const httpRequests = useHttpRequests();
const activeRequest = useActiveRequest();
return ( return (
<Select <Select
label={arg.label ?? arg.name} label={arg.label ?? arg.name}
@@ -214,10 +216,12 @@ function HttpRequestArg({
onChange={onChange} onChange={onChange}
value={value} value={value}
options={[ options={[
...httpRequests.map((r) => ({ ...httpRequests
label: fallbackRequestName(r), .filter((r) => r.id != activeRequest?.id)
value: r.id, .map((r) => ({
})), label: fallbackRequestName(r),
value: r.id,
})),
]} ]}
/> />
); );

View File

@@ -41,9 +41,9 @@ export function twig({
templateFunctions.map((fn) => { templateFunctions.map((fn) => {
const shortArgs = const shortArgs =
fn.args fn.args
.slice(0, 2) .slice(0, 1)
.map((a) => a.name) .map((a) => a.name)
.join(', ') + (fn.args.length > 2 ? ', …' : ''); .join(', ') + (fn.args.length > 1 ? ', …' : '');
return { return {
name: fn.name, name: fn.name,
type: 'function', type: 'function',