XPath plugin

This commit is contained in:
Gregory Schier
2024-01-15 21:27:47 -08:00
parent 5e75d8c9a7
commit d6331022ad
15 changed files with 8542 additions and 133 deletions

View File

@@ -59,7 +59,7 @@ export const EnvironmentActionsDropdown = memo(function EnvironmentActionsDropdo
key: 'edit',
label: 'Manage Environments',
hotkeyAction: 'environmentEditor.toggle',
leftSlot: <Icon icon="gear" />,
leftSlot: <Icon icon="box" />,
onSelect: showEnvironmentDialog,
}
: {

View File

@@ -78,7 +78,7 @@ export function SettingsDropdown() {
key: 'settings',
label: 'Settings',
hotkeyAction: 'settings.show',
leftSlot: <Icon icon="gear" />,
leftSlot: <Icon icon="settings" />,
onSelect: () => {
dialog.show({
id: 'settings',
@@ -109,7 +109,7 @@ export function SettingsDropdown() {
},
]}
>
<IconButton size="sm" title="Main Menu" icon="gear" className="pointer-events-auto" />
<IconButton size="sm" title="Main Menu" icon="settings" className="pointer-events-auto" />
</Dropdown>
);
}

View File

@@ -7,6 +7,7 @@ import { ReactComponent as LeftPanelVisibleIcon } from '../../assets/icons/LeftP
const icons = {
archive: lucide.ArchiveIcon,
box: lucide.BoxIcon,
chat: lucide.MessageSquare,
check: lucide.CheckIcon,
chevronDown: lucide.ChevronDownIcon,
@@ -20,7 +21,6 @@ const icons = {
eyeClosed: lucide.EyeOffIcon,
filter: lucide.FilterIcon,
flask: lucide.FlaskConicalIcon,
gear: lucide.CogIcon,
keyboard: lucide.KeyboardIcon,
magicWand: lucide.Wand2Icon,
externalLink: lucide.ExternalLinkIcon,
@@ -29,6 +29,8 @@ const icons = {
question: lucide.ShieldQuestionIcon,
plus: lucide.PlusIcon,
plusCircle: lucide.PlusCircleIcon,
settings: lucide.SettingsIcon,
settings2: lucide.Settings2Icon,
trash: lucide.TrashIcon,
update: lucide.RefreshCcwIcon,
upload: lucide.UploadIcon,

View File

@@ -104,8 +104,12 @@ export function Tabs({
className={btnClassName}
rightSlot={
<Icon
size="sm"
icon="chevronDown"
className={classNames('-mr-1.5', isActive ? 'opacity-100' : 'opacity-20')}
className={classNames(
'-mr-1.5 mt-0.5',
isActive ? 'opacity-100' : 'opacity-20',
)}
/>
}
>

View File

@@ -31,7 +31,10 @@ export function TextViewer({ response, pretty }: Props) {
setFilterText('');
}, [setFilterText, toggleIsSearching]);
const actions = contentType?.startsWith('application/json') && (
const isJson = contentType?.includes('json');
const isXml = contentType?.includes('xml') || contentType?.includes('html');
const canFilter = isJson || isXml;
const actions = canFilter && (
<HStack className="w-full" justifyContent="end" space={1}>
{isSearching && (
<Input
@@ -39,8 +42,8 @@ export function TextViewer({ response, pretty }: Props) {
autoFocus
containerClassName="bg-gray-50"
size="sm"
placeholder="Filter response"
label="Filter with JSONPath"
placeholder={isJson ? 'JSONPath expression' : 'XPath expression'}
label="Filter expression"
name="filter"
defaultValue={filterText}
onKeyDown={(e) => e.key === 'Escape' && clearSearch()}