From 7a6ab60d309fec5ba0e0670b1206ae3339d75244 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Fri, 17 Jan 2025 15:23:15 -0800 Subject: [PATCH] Tweaks for JWT auth --- packages/plugin-runtime-types/package.json | 2 +- .../src/bindings/events.ts | 38 ++++++++++++++++++- src-tauri/yaak-plugins/bindings/events.ts | 38 ++++++++++++++++++- src-tauri/yaak-plugins/src/events.rs | 12 +++++- src-web/components/DynamicForm.tsx | 23 +++++++---- .../components/Settings/SettingsGeneral.tsx | 1 + src-web/components/Settings/SettingsProxy.tsx | 3 +- src-web/components/core/Input.tsx | 11 ++++-- src-web/components/core/Label.tsx | 28 ++++++++++---- src-web/components/core/PlainInput.tsx | 7 +++- src-web/components/core/Select.tsx | 12 ++---- 11 files changed, 142 insertions(+), 33 deletions(-) diff --git a/packages/plugin-runtime-types/package.json b/packages/plugin-runtime-types/package.json index 5682cc1a..5278bfe3 100644 --- a/packages/plugin-runtime-types/package.json +++ b/packages/plugin-runtime-types/package.json @@ -1,6 +1,6 @@ { "name": "@yaakapp/api", - "version": "0.2.29", + "version": "0.3.2", "main": "lib/index.js", "typings": "./lib/index.d.ts", "files": [ diff --git a/packages/plugin-runtime-types/src/bindings/events.ts b/packages/plugin-runtime-types/src/bindings/events.ts index 584b9e06..5ec1a780 100644 --- a/packages/plugin-runtime-types/src/bindings/events.ts +++ b/packages/plugin-runtime-types/src/bindings/events.ts @@ -67,6 +67,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -81,6 +85,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -90,7 +98,15 @@ export type FormInputEditor = { /** * Placeholder for the text input */ -placeholder?: string | null, language: EditorLanguage, name: string, +placeholder?: string | null, +/** + * Don't show the editor gutter (line numbers, folds, etc.) + */ +hideGutter?: boolean, +/** + * Language for syntax highlighting + */ +language?: EditorLanguage, name: string, /** * Whether the user must fill in the argument */ @@ -99,6 +115,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -121,6 +141,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -135,6 +159,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -153,6 +181,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -177,6 +209,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ diff --git a/src-tauri/yaak-plugins/bindings/events.ts b/src-tauri/yaak-plugins/bindings/events.ts index 584b9e06..5ec1a780 100644 --- a/src-tauri/yaak-plugins/bindings/events.ts +++ b/src-tauri/yaak-plugins/bindings/events.ts @@ -67,6 +67,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -81,6 +85,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -90,7 +98,15 @@ export type FormInputEditor = { /** * Placeholder for the text input */ -placeholder?: string | null, language: EditorLanguage, name: string, +placeholder?: string | null, +/** + * Don't show the editor gutter (line numbers, folds, etc.) + */ +hideGutter?: boolean, +/** + * Language for syntax highlighting + */ +language?: EditorLanguage, name: string, /** * Whether the user must fill in the argument */ @@ -99,6 +115,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -121,6 +141,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -135,6 +159,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -153,6 +181,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ @@ -177,6 +209,10 @@ optional?: boolean, * The label of the input */ label?: string, +/** + * Visually hide the label of the input + */ +hideLabel?: boolean, /** * The default value */ diff --git a/src-tauri/yaak-plugins/src/events.rs b/src-tauri/yaak-plugins/src/events.rs index aaeba1a1..566c9f4a 100644 --- a/src-tauri/yaak-plugins/src/events.rs +++ b/src-tauri/yaak-plugins/src/events.rs @@ -379,6 +379,10 @@ pub struct FormInputBase { #[ts(optional)] pub label: Option, + /// Visually hide the label of the input + #[ts(optional)] + pub hide_label: Option, + /// The default value #[ts(optional)] pub default_value: Option, @@ -430,7 +434,13 @@ pub struct FormInputEditor { #[ts(optional = nullable)] pub placeholder: Option, - pub language: EditorLanguage, + /// Don't show the editor gutter (line numbers, folds, etc.) + #[ts(optional)] + pub hide_gutter: Option, + + /// Language for syntax highlighting + #[ts(optional)] + pub language: Option, } #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] diff --git a/src-web/components/DynamicForm.tsx b/src-web/components/DynamicForm.tsx index 71d3ce44..2987b27a 100644 --- a/src-web/components/DynamicForm.tsx +++ b/src-web/components/DynamicForm.tsx @@ -13,6 +13,7 @@ import { useCallback } from 'react'; import { useActiveRequest } from '../hooks/useActiveRequest'; import { useFolders } from '../hooks/useFolders'; import { useHttpRequests } from '../hooks/useHttpRequests'; +import { capitalize } from '../lib/capitalize'; import { fallbackRequestName } from '../lib/fallbackRequestName'; import { Checkbox } from './core/Checkbox'; import { Editor } from './core/Editor/Editor'; @@ -46,7 +47,7 @@ export function DynamicForm>({ ); return ( - + {config.map((a, i) => { switch (a.type) { case 'select': @@ -66,7 +67,7 @@ export function DynamicForm>({ arg={a} useTemplating={useTemplating || false} onChange={(v) => setDataAttr(a.name, v)} - value={data[a.name] ? String(data[a.name]) : ''} + value={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG} /> ); case 'editor': @@ -77,7 +78,7 @@ export function DynamicForm>({ arg={a} useTemplating={useTemplating || false} onChange={(v) => setDataAttr(a.name, v)} - value={data[a.name] ? String(data[a.name]) : ''} + value={data[a.name] ? String(data[a.name]) : DYNAMIC_FORM_NULL_ARG} /> ); case 'checkbox': @@ -137,7 +138,7 @@ function TextArg({ -