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

Stopped crawls should not show stop/cancel buttons #2101

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

ikreymer
Copy link
Member

@ikreymer ikreymer commented Oct 3, 2024

  • crawler isActive() should only look at running states, not 'stopping', since stopping may not be reset to false after crawl is stopped (probably should reset, but also a record that the crawl ended as being stopped). crawl is guaranteed to remain in one of the active states while stopping on the backend
  • fixes [Bug]: Stopped crawls still showing stop/cancel button #2100

Testing:

  • Check a stopped crawl, confirm stop/cancel buttons no longer show up.

- crawler isActive() should only look at running states, not 'stopping', since stopping may not be reset to false
after crawl is stopped. crawl is guaranteed to remain in one of the active states while stopping on the backend
Comment on lines 32 to 38
export function isActive({ state }: Partial<Crawl | QARun>): boolean {
return (
(state &&
(activeCrawlStates as readonly string[]).includes(state as string)) ||
stopping === true
false
);
}
Copy link
Member

Choose a reason for hiding this comment

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

This could be simplified a little:

export function isActive({ state }: Partial<Crawl | QARun>) {
  return (activeCrawlStates as readonly (typeof state)[]).includes(state);
}

Array.prototype.includes can be passed undefined as an argument, and will correctly return false if the array doesn't contain an undefined, which it doesn't in this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, updated!

@ikreymer ikreymer requested a review from emma-sg October 3, 2024 06:09
@ikreymer ikreymer merged commit 00efb36 into main Oct 3, 2024
2 checks passed
@ikreymer ikreymer deleted the fix-is-active-dont-check-stopping branch October 3, 2024 06:28
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.

[Bug]: Stopped crawls still showing stop/cancel button
2 participants