mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
fix clicking on the workspace card title should navigate to the workspace (#7631)
This commit is contained in:
parent
136db3e74b
commit
7087a4932a
@ -707,7 +707,27 @@ const ProjectRoute: FC = () => {
|
|||||||
loading: loadingBackendProjects.includes(file.remoteId) || pullFileFetcher.formData?.get('backendProjectId') && pullFileFetcher.formData?.get('backendProjectId') === file.remoteId,
|
loading: loadingBackendProjects.includes(file.remoteId) || pullFileFetcher.formData?.get('backendProjectId') && pullFileFetcher.formData?.get('backendProjectId') === file.remoteId,
|
||||||
presence: workspacePresence,
|
presence: workspacePresence,
|
||||||
};
|
};
|
||||||
|
}).map(file => ({
|
||||||
|
...file,
|
||||||
|
action: () => {
|
||||||
|
// hack to workaround gridlist not have access to workspace scope
|
||||||
|
if (file.scope === 'unsynced') {
|
||||||
|
if (activeProject?.remoteId && file.remoteId) {
|
||||||
|
return pullFileFetcher.submit({ backendProjectId: file.remoteId, remoteId: activeProject.remoteId }, {
|
||||||
|
method: 'POST',
|
||||||
|
action: `/organization/${organizationId}/project/${projectId}/remote-collections/pull`,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const activity = scopeToActivity(file.scope);
|
||||||
|
navigate(
|
||||||
|
`/organization/${organizationId}/project/${projectId}/workspace/${file.id}/${activity}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
const projectsWithPresence = projects.filter(p =>
|
const projectsWithPresence = projects.filter(p =>
|
||||||
projectListFilter ? p.name?.toLowerCase().includes(projectListFilter.toLowerCase()) : true
|
projectListFilter ? p.name?.toLowerCase().includes(projectListFilter.toLowerCase()) : true
|
||||||
@ -1322,26 +1342,6 @@ const ProjectRoute: FC = () => {
|
|||||||
aria-label="Files"
|
aria-label="Files"
|
||||||
className="data-[empty]:flex data-[empty]:justify-center grid [grid-template-columns:repeat(auto-fit,200px)] [grid-template-rows:repeat(auto-fit,200px)] gap-4 p-[--padding-md]"
|
className="data-[empty]:flex data-[empty]:justify-center grid [grid-template-columns:repeat(auto-fit,200px)] [grid-template-rows:repeat(auto-fit,200px)] gap-4 p-[--padding-md]"
|
||||||
items={filesWithPresence}
|
items={filesWithPresence}
|
||||||
onAction={id => {
|
|
||||||
// hack to workaround gridlist not have access to workspace scope
|
|
||||||
const file = files.find(f => f.id === id);
|
|
||||||
invariant(file, 'File not found');
|
|
||||||
if (file.scope === 'unsynced') {
|
|
||||||
if (activeProject?.remoteId && file.remoteId) {
|
|
||||||
return pullFileFetcher.submit({ backendProjectId: file.remoteId, remoteId: activeProject.remoteId }, {
|
|
||||||
method: 'POST',
|
|
||||||
action: `/organization/${organizationId}/project/${projectId}/remote-collections/pull`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const activity = scopeToActivity(file.scope);
|
|
||||||
navigate(
|
|
||||||
`/organization/${organizationId}/project/${projectId}/workspace/${id}/${activity}`
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
renderEmptyState={() => {
|
renderEmptyState={() => {
|
||||||
if (workspaceListFilter) {
|
if (workspaceListFilter) {
|
||||||
return (
|
return (
|
||||||
@ -1372,6 +1372,7 @@ const ProjectRoute: FC = () => {
|
|||||||
key={item.id}
|
key={item.id}
|
||||||
id={item.id}
|
id={item.id}
|
||||||
textValue={item.name}
|
textValue={item.name}
|
||||||
|
onAction={item.action}
|
||||||
className={`flex-1 overflow-hidden flex-col outline-none p-[--padding-md] flex select-none w-full rounded-md hover:shadow-md aspect-square ring-1 ring-[--hl-md] hover:ring-[--hl-sm] focus:ring-[--hl-lg] hover:bg-[--hl-xs] focus:bg-[--hl-sm] transition-all ${item.loading ? 'animate-pulse' : ''}`}
|
className={`flex-1 overflow-hidden flex-col outline-none p-[--padding-md] flex select-none w-full rounded-md hover:shadow-md aspect-square ring-1 ring-[--hl-md] hover:ring-[--hl-sm] focus:ring-[--hl-lg] hover:bg-[--hl-xs] focus:bg-[--hl-sm] transition-all ${item.loading ? 'animate-pulse' : ''}`}
|
||||||
>
|
>
|
||||||
<div className="flex gap-2 h-[20px]">
|
<div className="flex gap-2 h-[20px]">
|
||||||
@ -1399,7 +1400,10 @@ const ProjectRoute: FC = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Link onPress={e => e.continuePropagation()} className="pt-4 text-base font-bold line-clamp-4">
|
<Link
|
||||||
|
onPress={item.action}
|
||||||
|
className="pt-4 text-base font-bold line-clamp-4 outline-none"
|
||||||
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
</Link>
|
</Link>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
|
Loading…
Reference in New Issue
Block a user