mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-17 06:19:41 +02:00
Fix lint errors
This commit is contained in:
@@ -176,7 +176,6 @@ export function GrpcRequestPane({
|
|||||||
<UrlBar
|
<UrlBar
|
||||||
key={forceUpdateKey}
|
key={forceUpdateKey}
|
||||||
url={activeRequest.url ?? ''}
|
url={activeRequest.url ?? ''}
|
||||||
method={null}
|
|
||||||
submitIcon={null}
|
submitIcon={null}
|
||||||
forceUpdateKey={forceUpdateKey}
|
forceUpdateKey={forceUpdateKey}
|
||||||
placeholder="localhost:50051"
|
placeholder="localhost:50051"
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ import type { GenericCompletionConfig } from './core/Editor/genericCompletion';
|
|||||||
import { InlineCode } from './core/InlineCode';
|
import { InlineCode } from './core/InlineCode';
|
||||||
import type { Pair } from './core/PairEditor';
|
import type { Pair } from './core/PairEditor';
|
||||||
import { PlainInput } from './core/PlainInput';
|
import { PlainInput } from './core/PlainInput';
|
||||||
import { TabContent, TabItem, Tabs } from './core/Tabs/Tabs';
|
import { TabContent, Tabs } from './core/Tabs/Tabs';
|
||||||
|
import type { TabItem } from './core/Tabs/Tabs';
|
||||||
import { EmptyStateText } from './EmptyStateText';
|
import { EmptyStateText } from './EmptyStateText';
|
||||||
import { FormMultipartEditor } from './FormMultipartEditor';
|
import { FormMultipartEditor } from './FormMultipartEditor';
|
||||||
import { FormUrlencodedEditor } from './FormUrlencodedEditor';
|
import { FormUrlencodedEditor } from './FormUrlencodedEditor';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { HttpRequest, patchModel } from '@yaakapp-internal/models';
|
import type { HttpRequest } from '@yaakapp-internal/models';
|
||||||
|
import { patchModel } from '@yaakapp-internal/models';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { memo, useCallback, useMemo } from 'react';
|
import { memo, useCallback, useMemo } from 'react';
|
||||||
import { showPrompt } from '../lib/prompt';
|
import { showPrompt } from '../lib/prompt';
|
||||||
@@ -32,9 +33,12 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
|
|||||||
request,
|
request,
|
||||||
className,
|
className,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const handleChange = useCallback(async (method: string) => {
|
const handleChange = useCallback(
|
||||||
await patchModel(request, { method });
|
async (method: string) => {
|
||||||
}, []);
|
await patchModel(request, { method });
|
||||||
|
},
|
||||||
|
[request],
|
||||||
|
);
|
||||||
|
|
||||||
const itemsAfter = useMemo<DropdownItem[]>(
|
const itemsAfter = useMemo<DropdownItem[]>(
|
||||||
() => [
|
() => [
|
||||||
@@ -57,7 +61,7 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[],
|
[handleChange],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -68,7 +72,7 @@ export const RequestMethodDropdown = memo(function RequestMethodDropdown({
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
>
|
>
|
||||||
<Button size="xs" className={classNames(className, 'text-text-subtle hover:text')}>
|
<Button size="xs" className={classNames(className, 'text-text-subtle hover:text')}>
|
||||||
<HttpMethodTag request={request}/>
|
<HttpMethodTag request={request} />
|
||||||
</Button>
|
</Button>
|
||||||
</RadioDropdown>
|
</RadioDropdown>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -54,10 +54,9 @@ const TAB_DESCRIPTION = 'description';
|
|||||||
const nonActiveRequestUrlsAtom = atom((get) => {
|
const nonActiveRequestUrlsAtom = atom((get) => {
|
||||||
const activeRequestId = get(activeRequestIdAtom);
|
const activeRequestId = get(activeRequestIdAtom);
|
||||||
const requests = get(allRequestsAtom);
|
const requests = get(allRequestsAtom);
|
||||||
const urls = requests
|
return requests
|
||||||
.filter((r) => r.id !== activeRequestId)
|
.filter((r) => r.id !== activeRequestId)
|
||||||
.map((r): GenericCompletionOption => ({ type: 'constant', label: r.url }));
|
.map((r): GenericCompletionOption => ({ type: 'constant', label: r.url }));
|
||||||
return urls;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const memoNotActiveRequestUrlsAtom = deepEqualAtom(nonActiveRequestUrlsAtom);
|
const memoNotActiveRequestUrlsAtom = deepEqualAtom(nonActiveRequestUrlsAtom);
|
||||||
@@ -227,7 +226,6 @@ export function WebsocketRequestPane({ style, fullHeight, className, activeReque
|
|||||||
onUrlChange={handleUrlChange}
|
onUrlChange={handleUrlChange}
|
||||||
forceUpdateKey={forceUpdateKey}
|
forceUpdateKey={forceUpdateKey}
|
||||||
isLoading={activeResponse != null && activeResponse.state !== 'closed'}
|
isLoading={activeResponse != null && activeResponse.state !== 'closed'}
|
||||||
method={null}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Tabs
|
<Tabs
|
||||||
|
|||||||
@@ -55,10 +55,9 @@ export function WebsocketResponsePane({ activeRequest }: Props) {
|
|||||||
if (hexDump) {
|
if (hexDump) {
|
||||||
return activeEvent?.message ? hexy(activeEvent?.message) : '';
|
return activeEvent?.message ? hexy(activeEvent?.message) : '';
|
||||||
}
|
}
|
||||||
const text = activeEvent?.message
|
return activeEvent?.message
|
||||||
? new TextDecoder('utf-8').decode(Uint8Array.from(activeEvent.message))
|
? new TextDecoder('utf-8').decode(Uint8Array.from(activeEvent.message))
|
||||||
: '';
|
: '';
|
||||||
return text;
|
|
||||||
}, [activeEvent?.message, hexDump]);
|
}, [activeEvent?.message, hexDump]);
|
||||||
|
|
||||||
const language = languageFromContentType(null, message);
|
const language = languageFromContentType(null, message);
|
||||||
@@ -152,7 +151,7 @@ export function WebsocketResponsePane({ activeRequest }: Props) {
|
|||||||
title="Copy message"
|
title="Copy message"
|
||||||
icon="copy"
|
icon="copy"
|
||||||
size="xs"
|
size="xs"
|
||||||
onClick={() => copyToClipboard(formattedMessage.data ?? '')}
|
onClick={() => copyToClipboard(formattedMessage ?? '')}
|
||||||
/>
|
/>
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
@@ -183,7 +182,7 @@ export function WebsocketResponsePane({ activeRequest }: Props) {
|
|||||||
) : (
|
) : (
|
||||||
<Editor
|
<Editor
|
||||||
language={language}
|
language={language}
|
||||||
defaultValue={formattedMessage.data ?? ''}
|
defaultValue={formattedMessage ?? ''}
|
||||||
wrapLines={false}
|
wrapLines={false}
|
||||||
readOnly={true}
|
readOnly={true}
|
||||||
stateKey={null}
|
stateKey={null}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { GrpcRequest, HttpRequest, settingsAtom, WebsocketRequest } from '@yaakapp-internal/models';
|
import { settingsAtom } from '@yaakapp-internal/models';
|
||||||
|
import type { GrpcRequest, HttpRequest, WebsocketRequest } from '@yaakapp-internal/models';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ function ActualEventStreamViewer({ response }: Props) {
|
|||||||
|
|
||||||
function FormattedEditor({ text, language }: { text: string; language: EditorProps['language'] }) {
|
function FormattedEditor({ text, language }: { text: string; language: EditorProps['language'] }) {
|
||||||
const formatted = useFormatText({ text, language, pretty: true });
|
const formatted = useFormatText({ text, language, pretty: true });
|
||||||
if (formatted.data == null) return null;
|
if (formatted == null) return null;
|
||||||
return <Editor readOnly defaultValue={formatted.data} language={language} stateKey={null} />;
|
return <Editor readOnly defaultValue={formatted} language={language} stateKey={null} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
function EventRow({
|
function EventRow({
|
||||||
|
|||||||
Reference in New Issue
Block a user