Skip to content

Commit 7df4461

Browse files
gatzjamesjackkav
authored andcommitted
fix auth indicator
1 parent a5ff16a commit 7df4461

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

packages/insomnia/src/ui/components/panes/request-group-pane.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Tab, TabList, TabPanel, Tabs } from 'react-aria-components';
33
import { useRouteLoaderData } from 'react-router-dom';
44

55
import { Settings } from '../../../models/settings';
6+
import { getAuthObjectOrNull } from '../../../network/authentication';
67
import { useRequestGroupPatcher } from '../../hooks/use-request';
78
import { useActiveRequestSyncVCSVersion, useGitVCSVersion } from '../../hooks/use-vcs-version';
89
import { RequestGroupLoaderData } from '../../routes/request-group';
@@ -45,6 +46,9 @@ export const RequestGroupPane: FC<{ settings: Settings }> = ({ settings }) => {
4546
}
4647
};
4748

49+
const requestGroupAuth = getAuthObjectOrNull(activeRequestGroup.authentication);
50+
const isNoneOrInherited = requestGroupAuth?.type === 'none' || requestGroupAuth === null;
51+
4852
return (
4953
<>
5054
<Tabs aria-label='Request group tabs' className="flex-1 w-full h-full flex flex-col">
@@ -53,7 +57,12 @@ export const RequestGroupPane: FC<{ settings: Settings }> = ({ settings }) => {
5357
className='flex-shrink-0 h-full flex items-center justify-between cursor-pointer gap-2 outline-none select-none px-3 py-1 text-[--hl] aria-selected:text-[--color-font] hover:bg-[--hl-sm] hover:text-[--color-font] aria-selected:bg-[--hl-xs] aria-selected:focus:bg-[--hl-sm] aria-selected:hover:bg-[--hl-sm] focus:bg-[--hl-sm] transition-colors duration-300'
5458
id='auth'
5559
>
56-
Auth
60+
<span>Auth</span>
61+
{!isNoneOrInherited && (
62+
<span className='p-1 min-w-6 h-6 flex items-center justify-center text-xs rounded-lg border border-solid border-[--hl]'>
63+
<span className='w-2 h-2 bg-green-500 rounded-full' />
64+
</span>
65+
)}
5766
</Tab>
5867
<Tab
5968
className='flex-shrink-0 h-full flex items-center justify-between cursor-pointer gap-2 outline-none select-none px-3 py-1 text-[--hl] aria-selected:text-[--color-font] hover:bg-[--hl-sm] hover:text-[--color-font] aria-selected:bg-[--hl-xs] aria-selected:focus:bg-[--hl-sm] aria-selected:hover:bg-[--hl-sm] focus:bg-[--hl-sm] transition-colors duration-300'

packages/insomnia/src/ui/components/panes/request-pane.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ export const RequestPane: FC<Props> = ({
9595
getContentTypeFromHeaders(activeRequest.headers) ||
9696
activeRequest.body.mimeType;
9797
const isBodyEmpty = Boolean(typeof activeRequest.body.mimeType !== 'string' && !activeRequest.body.text);
98-
const hasAuthentication = getAuthObjectOrNull(activeRequest.authentication)?.type !== 'none';
98+
const requestAuth = getAuthObjectOrNull(activeRequest.authentication);
99+
const isNoneOrInherited = requestAuth?.type === 'none' || requestAuth === null;
99100

100101
return (
101102
<Pane type="request">
@@ -140,7 +141,7 @@ export const RequestPane: FC<Props> = ({
140141
>
141142
<span>Auth</span>
142143

143-
{hasAuthentication && (
144+
{!isNoneOrInherited && (
144145
<span className='p-1 min-w-6 h-6 flex items-center justify-center text-xs rounded-lg border border-solid border-[--hl]'>
145146
<span className='w-2 h-2 bg-green-500 rounded-full' />
146147
</span>

packages/insomnia/src/ui/components/websockets/websocket-request-pane.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ export const WebSocketRequestPane: FC<Props> = ({ environment }) => {
281281
const urlHasQueryParameters = activeRequest.url.indexOf('?') >= 0;
282282
// Reset the response pane state when we switch requests, the environment gets modified, or the (Git|Sync)VCS version changes
283283
const uniqueKey = `${environment?.modified}::${requestId}::${gitVersion}::${activeRequestSyncVersion}::${activeRequestMeta.activeResponseId}`;
284-
const hasAuthentication = getAuthObjectOrNull(activeRequest.authentication)?.type !== 'none';
284+
const requestAuth = getAuthObjectOrNull(activeRequest.authentication);
285+
const isNoneOrInherited = requestAuth?.type === 'none' || requestAuth === null;
285286

286287
return (
287288
<Pane type="request">
@@ -322,7 +323,7 @@ export const WebSocketRequestPane: FC<Props> = ({ environment }) => {
322323
id='auth'
323324
>
324325
<span>Auth</span>
325-
{hasAuthentication && (
326+
{!isNoneOrInherited && (
326327
<span className='p-1 min-w-6 h-6 flex items-center justify-center text-xs rounded-lg border border-solid border-[--hl]'>
327328
<span className='w-2 h-2 bg-green-500 rounded-full' />
328329
</span>

0 commit comments

Comments
 (0)