Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runner improvements (multiple tabs)-[INS-4779] #8244

Merged
merged 12 commits into from
Dec 27, 2024

Conversation

CurryYangxx
Copy link
Member

@CurryYangxx CurryYangxx commented Dec 11, 2024

Changes

  • runnerId: use for save runner test result and query runner execution state
    • collection runner use workspaceId as runnerId
    • folder runner use folderId as runnerId
  • maintain all the runner states in a Context, so that we can keep the state when switching between runner tabs
    • request list (we need to keep order)
    • selected request
    • iteration count/delay
    • upload data
    • advanced config
  • change runner execution status display logic
    • not return redirect in runCollectionAction
    • if there is an error, store it in runnerExecutions
  • add a common EventBus class
    • listen tab close event and clear runner context state in callbeck
image

@CurryYangxx CurryYangxx marked this pull request as draft December 11, 2024 08:23
@CurryYangxx CurryYangxx changed the title runner improvements runner improvements (multiple tabs) Dec 16, 2024
@@ -160,6 +128,8 @@ export const Runner: FC<{}> = () => {
const [bail, setBail] = useState<boolean>(true);
const [isRunning, setIsRunning] = useState(false);

const runnerId = targetFolderId ? `${workspaceId}-${targetFolderId}` : workspaceId;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collection runner: workspaceId
folder runner: runnerId
If move the folder, the result will not be found

@CurryYangxx CurryYangxx changed the title runner improvements (multiple tabs) runner improvements (multiple tabs)-[INS-4779] Dec 17, 2024

useInterval(() => {
refreshPanes();
}, isRunning ? 1000 : null);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only start interval when runner is running

} catch (e) {
// the error could be from third party
const errMsg = encodeURIComponent(e.error || e);
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug/runner?refresh-pane&error=${errMsg}&folder=${targetFolderId}`);
Copy link
Member Author

@CurryYangxx CurryYangxx Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not return redirect, because we can not receive the redirect response if we navigate to another route

@CurryYangxx CurryYangxx marked this pull request as ready for review December 17, 2024 09:00
@CurryYangxx CurryYangxx force-pushed the fix/tab-runner-execution branch 3 times, most recently from aa45892 to 5ed1066 Compare December 23, 2024 08:26
@CurryYangxx CurryYangxx force-pushed the fix/tab-runner-execution branch from 7b37221 to 15dd057 Compare December 24, 2024 02:41
return;
}

const index = currentTabs.tabList.findIndex(tab => deleteIds.includes(tab.id));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be !deleteIds.includes(tab.id) here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to find the first deleted element and then navigate to the adjacent tab to the left of it

}, []);

const handleTabClose = useCallback((ids: 'all' | string[]) => {
if (ids === 'all') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it clean all runner tab states under all orgs?

Copy link
Member Author

@CurryYangxx CurryYangxx Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already changed the data structure 9c2f31c, will only clean up the runner states in current org

runnerState: {
 orgId: {
  runnerId: {}
 }
}

packages/insomnia/src/ui/routes/runner.tsx Outdated Show resolved Hide resolved
@CurryYangxx CurryYangxx force-pushed the fix/tab-runner-execution branch from 533da88 to 9c2f31c Compare December 24, 2024 09:08
@@ -0,0 +1,37 @@
type EventHandler = (...args: any[]) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lets name these files with hyphen event-bus and tabList here or in the main feature branch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me change the name in the main feature branch

@CurryYangxx CurryYangxx merged commit e0e0b04 into feat/multiple-tab Dec 27, 2024
8 checks passed
@CurryYangxx CurryYangxx deleted the fix/tab-runner-execution branch December 27, 2024 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants