Skip to content

Commit

Permalink
fix: runner select all
Browse files Browse the repository at this point in the history
  • Loading branch information
CurryYangxx committed Dec 26, 2024
1 parent f311ac2 commit e271c50
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/insomnia/src/ui/routes/runner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ export const Runner: FC<{}> = () => {

window.main.trackSegmentEvent({ event: SegmentEvent.collectionRunExecute, properties: { plan: currentPlan?.type || 'scratchpad', iterations: iterationCount } });

const selected = new Set(reqList.selectedKeys);
const requests = Array.from(reqList.items)
.filter(item => selected.has(item.id));
const requests = reqList.selectedKeys === 'all'
? reqList.items
: reqList.items.filter(item => (reqList.selectedKeys as Set<Key>).has(item.id));

// convert uploadData to environment data
const userUploadEnvs = uploadData.map(data => {
Expand Down Expand Up @@ -345,7 +345,7 @@ export const Runner: FC<{}> = () => {
navigate(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug/request/${requestId}`);
};
const onToggleSelection = () => {
if (Array.from(reqList.selectedKeys).length === Array.from(reqList.items).length) {
if (reqList.selectedKeys === 'all' || Array.from(reqList.selectedKeys).length === Array.from(reqList.items).length) {
// unselect all
reqList.setSelectedKeys(new Set([]));
} else {
Expand Down Expand Up @@ -476,10 +476,10 @@ export const Runner: FC<{}> = () => {
? Array.from(reqList.items)
.filter(item => item.ancestorIds.includes(targetFolderId))
.map(item => item.id)
.filter(id => new Set(reqList.selectedKeys).has(id))
.filter(id => reqList.selectedKeys === 'all' || new Set(reqList.selectedKeys).has(id))
: Array.from(reqList.items)
.map(item => item.id)
.filter(id => new Set(reqList.selectedKeys).has(id));
.filter(id => reqList.selectedKeys === 'all' || new Set(reqList.selectedKeys).has(id));

return (
<>
Expand Down Expand Up @@ -598,7 +598,7 @@ export const Runner: FC<{}> = () => {
<Toolbar className="w-full flex-shrink-0 h-[--line-height-sm] border-b border-solid border-[--hl-md] flex items-center px-2">
<span className="mr-2">
{
Array.from(reqList.selectedKeys).length === Array.from(reqList.items).length ?
(reqList.selectedKeys === 'all' || Array.from(reqList.selectedKeys).length === Array.from(reqList.items).length) ?
<span onClick={onToggleSelection}><i style={{ color: 'rgb(74 222 128)' }} className="fa fa-square-check fa-1x h-4 mr-2" /> <span className="cursor-pointer" >Unselect All</span></span> :
Array.from(reqList.selectedKeys).length === 0 ?
<span onClick={onToggleSelection}><i className="fa fa-square fa-1x h-4 mr-2" /> <span className="cursor-pointer" >Select All</span></span> :
Expand Down

0 comments on commit e271c50

Please sign in to comment.