diff --git a/src-tauri/.sqlx/query-11394af12419cca3be3a26dff9275514ea2a44504e3c7a568a9578c64b5713d1.json b/src-tauri/.sqlx/query-11394af12419cca3be3a26dff9275514ea2a44504e3c7a568a9578c64b5713d1.json deleted file mode 100644 index c09da185..00000000 --- a/src-tauri/.sqlx/query-11394af12419cca3be3a26dff9275514ea2a44504e3c7a568a9578c64b5713d1.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "SQLite", - "query": "\n INSERT INTO http_requests (\n id, workspace_id, folder_id, name, url, url_parameters, method, body, body_type,\n authentication, authentication_type, headers, sort_priority\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n name = excluded.name,\n folder_id = excluded.folder_id,\n method = excluded.method,\n headers = excluded.headers,\n body = excluded.body,\n body_type = excluded.body_type,\n authentication = excluded.authentication,\n authentication_type = excluded.authentication_type,\n url = excluded.url,\n url_parameters = excluded.url_parameters,\n sort_priority = excluded.sort_priority\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 13 - }, - "nullable": [] - }, - "hash": "11394af12419cca3be3a26dff9275514ea2a44504e3c7a568a9578c64b5713d1" -} diff --git a/src-tauri/.sqlx/query-467b87ad1209a4653b1dc8462d79236a655240c5b402fa9fd75c12ebd9bb6b86.json b/src-tauri/.sqlx/query-467b87ad1209a4653b1dc8462d79236a655240c5b402fa9fd75c12ebd9bb6b86.json deleted file mode 100644 index f77a9243..00000000 --- a/src-tauri/.sqlx/query-467b87ad1209a4653b1dc8462d79236a655240c5b402fa9fd75c12ebd9bb6b86.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "SQLite", - "query": "\n INSERT INTO grpc_requests (\n id, name, workspace_id, folder_id, sort_priority, url, service, method, message,\n authentication_type, authentication, metadata\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n name = excluded.name,\n folder_id = excluded.folder_id,\n sort_priority = excluded.sort_priority,\n url = excluded.url,\n service = excluded.service,\n method = excluded.method,\n message = excluded.message,\n authentication_type = excluded.authentication_type,\n authentication = excluded.authentication,\n metadata = excluded.metadata\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 12 - }, - "nullable": [] - }, - "hash": "467b87ad1209a4653b1dc8462d79236a655240c5b402fa9fd75c12ebd9bb6b86" -} diff --git a/src-tauri/.sqlx/query-5af82cd333895d3d7d67a92f37b0feb338f615b88aea2bd09cb5809008c645a3.json b/src-tauri/.sqlx/query-5af82cd333895d3d7d67a92f37b0feb338f615b88aea2bd09cb5809008c645a3.json new file mode 100644 index 00000000..f82deaec --- /dev/null +++ b/src-tauri/.sqlx/query-5af82cd333895d3d7d67a92f37b0feb338f615b88aea2bd09cb5809008c645a3.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "\n INSERT INTO grpc_requests (\n id, name, workspace_id, folder_id, sort_priority, url, service, method, message,\n authentication_type, authentication, metadata\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n workspace_id = excluded.workspace_id,\n name = excluded.name,\n folder_id = excluded.folder_id,\n sort_priority = excluded.sort_priority,\n url = excluded.url,\n service = excluded.service,\n method = excluded.method,\n message = excluded.message,\n authentication_type = excluded.authentication_type,\n authentication = excluded.authentication,\n metadata = excluded.metadata\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 12 + }, + "nullable": [] + }, + "hash": "5af82cd333895d3d7d67a92f37b0feb338f615b88aea2bd09cb5809008c645a3" +} diff --git a/src-tauri/.sqlx/query-5f2f40062abbe93e23b38876319cf16d4d2b3f8d0be32ffe7848528c725e1429.json b/src-tauri/.sqlx/query-5f2f40062abbe93e23b38876319cf16d4d2b3f8d0be32ffe7848528c725e1429.json new file mode 100644 index 00000000..7d7cb86d --- /dev/null +++ b/src-tauri/.sqlx/query-5f2f40062abbe93e23b38876319cf16d4d2b3f8d0be32ffe7848528c725e1429.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "\n INSERT INTO http_requests (\n id, workspace_id, folder_id, name, url, url_parameters, method, body, body_type,\n authentication, authentication_type, headers, sort_priority\n )\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (id) DO UPDATE SET\n updated_at = CURRENT_TIMESTAMP,\n workspace_id = excluded.workspace_id,\n name = excluded.name,\n folder_id = excluded.folder_id,\n method = excluded.method,\n headers = excluded.headers,\n body = excluded.body,\n body_type = excluded.body_type,\n authentication = excluded.authentication,\n authentication_type = excluded.authentication_type,\n url = excluded.url,\n url_parameters = excluded.url_parameters,\n sort_priority = excluded.sort_priority\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 13 + }, + "nullable": [] + }, + "hash": "5f2f40062abbe93e23b38876319cf16d4d2b3f8d0be32ffe7848528c725e1429" +} diff --git a/src-tauri/.sqlx/query-05dca7fe15ab1bf03952e94498ef3130e16f752da72782783696eb2cca4736d5.json b/src-tauri/.sqlx/query-daa61066517df649e7c80a8ce407839ad502e8e5e43aa8c02e049865acbbae75.json similarity index 88% rename from src-tauri/.sqlx/query-05dca7fe15ab1bf03952e94498ef3130e16f752da72782783696eb2cca4736d5.json rename to src-tauri/.sqlx/query-daa61066517df649e7c80a8ce407839ad502e8e5e43aa8c02e049865acbbae75.json index bfe436e1..ed194a49 100644 --- a/src-tauri/.sqlx/query-05dca7fe15ab1bf03952e94498ef3130e16f752da72782783696eb2cca4736d5.json +++ b/src-tauri/.sqlx/query-daa61066517df649e7c80a8ce407839ad502e8e5e43aa8c02e049865acbbae75.json @@ -1,6 +1,6 @@ { "db_name": "SQLite", - "query": "\n SELECT\n id, model, created_at, updated_at, theme, appearance,\n theme_dark, theme_light, update_channel,\n interface_font_size, interface_scale, editor_font_size, editor_soft_wrap, \n open_workspace_new_window\n FROM settings\n WHERE id = 'default'\n ", + "query": "\n SELECT\n id, model, created_at, updated_at, theme, appearance,\n theme_dark, theme_light, update_channel,\n interface_font_size, interface_scale, editor_font_size, editor_soft_wrap,\n open_workspace_new_window\n FROM settings\n WHERE id = 'default'\n ", "describe": { "columns": [ { @@ -94,5 +94,5 @@ true ] }, - "hash": "05dca7fe15ab1bf03952e94498ef3130e16f752da72782783696eb2cca4736d5" + "hash": "daa61066517df649e7c80a8ce407839ad502e8e5e43aa8c02e049865acbbae75" } diff --git a/src-tauri/src/models.rs b/src-tauri/src/models.rs index 82cca640..1bc9c568 100644 --- a/src-tauri/src/models.rs +++ b/src-tauri/src/models.rs @@ -562,6 +562,7 @@ pub async fn upsert_grpc_request( VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT (id) DO UPDATE SET updated_at = CURRENT_TIMESTAMP, + workspace_id = excluded.workspace_id, name = excluded.name, folder_id = excluded.folder_id, sort_priority = excluded.sort_priority, @@ -892,7 +893,7 @@ async fn get_settings(mgr: &impl Manager) -> Result SELECT id, model, created_at, updated_at, theme, appearance, theme_dark, theme_light, update_channel, - interface_font_size, interface_scale, editor_font_size, editor_soft_wrap, + interface_font_size, interface_scale, editor_font_size, editor_soft_wrap, open_workspace_new_window FROM settings WHERE id = 'default' @@ -1125,6 +1126,7 @@ pub async fn upsert_http_request( VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT (id) DO UPDATE SET updated_at = CURRENT_TIMESTAMP, + workspace_id = excluded.workspace_id, name = excluded.name, folder_id = excluded.folder_id, method = excluded.method, diff --git a/src-web/components/DefaultLayout.tsx b/src-web/components/DefaultLayout.tsx index 9278f67a..59280ea0 100644 --- a/src-web/components/DefaultLayout.tsx +++ b/src-web/components/DefaultLayout.tsx @@ -1,16 +1,21 @@ -import { Outlet } from 'react-router-dom'; -import { DialogProvider } from './DialogContext'; -import { GlobalHooks } from './GlobalHooks'; -import { ToastProvider } from './ToastContext'; import classNames from 'classnames'; -import { useOsInfo } from '../hooks/useOsInfo'; import { motion } from 'framer-motion'; +import { Outlet } from 'react-router-dom'; +import { useOsInfo } from '../hooks/useOsInfo'; +import { DialogProvider, Dialogs } from './DialogContext'; +import { GlobalHooks } from './GlobalHooks'; +import { ToastProvider, Toasts } from './ToastContext'; export function DefaultLayout() { const osInfo = useOsInfo(); return ( + <> + {/* Must be inside all the providers, so they have access to them */} + + + { actions, }; - return ( - - {children} - {dialogs.map((props: DialogEntry) => ( - - ))} - - ); + return {children}; }; function DialogInstance({ id, render, ...props }: DialogEntry) { @@ -67,3 +60,14 @@ function DialogInstance({ id, render, ...props }: DialogEntry) { } export const useDialog = () => useContext(DialogContext).actions; + +export function Dialogs() { + const { dialogs } = useContext(DialogContext); + return ( + <> + {dialogs.map((props: DialogEntry) => ( + + ))} + + ); +} diff --git a/src-web/components/GlobalHooks.tsx b/src-web/components/GlobalHooks.tsx index f38c5902..6bce9e4c 100644 --- a/src-web/components/GlobalHooks.tsx +++ b/src-web/components/GlobalHooks.tsx @@ -1,6 +1,7 @@ import { useQueryClient } from '@tanstack/react-query'; import { getCurrent } from '@tauri-apps/api/webviewWindow'; import { useEffect } from 'react'; +import { useActiveWorkspace } from '../hooks/useActiveWorkspace'; import { useClipboardText } from '../hooks/useClipboardText'; import { useCommandPalette } from '../hooks/useCommandPalette'; import { cookieJarsQueryKey } from '../hooks/useCookieJars'; @@ -32,8 +33,12 @@ import { monokaiProDefault } from '../lib/theme/themes/monokai-pro'; import { rosePineDefault } from '../lib/theme/themes/rose-pine'; import { yaakDark } from '../lib/theme/themes/yaak'; import { getThemeCSS } from '../lib/theme/window'; +import { InlineCode } from './core/InlineCode'; +import { useToast } from './ToastContext'; export function GlobalHooks() { + const toast = useToast(); + // Include here so they always update, even if no component references them useRecentWorkspaces(); useRecentEnvironments(); @@ -44,6 +49,21 @@ export function GlobalHooks() { useCommandPalette(); useNotificationToast(); + const activeWorkspace = useActiveWorkspace(); + + useEffect(() => { + if (activeWorkspace == null) return; + toast.show({ + id: 'workspace-changed', + timeout: 3000, + message: ( + <> + Switched workspace to {activeWorkspace.name} + + ), + }); + }, [activeWorkspace, toast]); + const queryClient = useQueryClient(); const { wasUpdatedExternally } = useRequestUpdateKey(null); diff --git a/src-web/components/GrpcConnectionMessagesPane.tsx b/src-web/components/GrpcConnectionMessagesPane.tsx index 3d3bbe98..ee56908c 100644 --- a/src-web/components/GrpcConnectionMessagesPane.tsx +++ b/src-web/components/GrpcConnectionMessagesPane.tsx @@ -63,9 +63,9 @@ export function GrpcConnectionMessagesPane({ style, methodType, activeRequest }: firstSlot={() => activeConnection && (
- + - {events.length} messages + {events.length} Messages {isResponseLoading(activeConnection) && ( )} diff --git a/src-web/components/GrpcConnectionSetupPane.tsx b/src-web/components/GrpcConnectionSetupPane.tsx index ce497269..c08d7050 100644 --- a/src-web/components/GrpcConnectionSetupPane.tsx +++ b/src-web/components/GrpcConnectionSetupPane.tsx @@ -13,7 +13,7 @@ import { BearerAuth } from './BearerAuth'; import { Button } from './core/Button'; import { Icon } from './core/Icon'; import { IconButton } from './core/IconButton'; -import { PairEditor } from './core/PairEditor'; +import { PairOrBulkEditor } from './core/PairOrBulkEditor'; import { RadioDropdown } from './core/RadioDropdown'; import { HStack, VStack } from './core/Stacks'; import type { TabItem } from './core/Tabs/Tabs'; @@ -209,7 +209,7 @@ export function GrpcConnectionSetupPane({ rightSlot={} disabled={isStreaming || services == null} className={classNames( - 'font-mono text-sm min-w-[5rem] !ring-0', + 'font-mono text-editor min-w-[5rem] !ring-0', paneSize < 400 && 'flex-1', )} > @@ -291,7 +291,8 @@ export function GrpcConnectionSetupPane({ )} - void; +} + +export function MoveToWorkspaceDialog({ onDone, request, activeWorkspaceId }: Props) { + const workspaces = useWorkspaces(); + const queryClient = useQueryClient(); + const updateHttpRequest = useUpdateAnyHttpRequest(); + const updateGrpcRequest = useUpdateAnyGrpcRequest(); + const toast = useToast(); + const routes = useAppRoutes(); + const [selectedWorkspaceId, setSelectedWorkspaceId] = useState(activeWorkspaceId); + + return ( + +