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

Change Cancel button to call cancel.json via JavaScript, to avoid page navigation #436

Open
ilias-ant opened this issue Mar 24, 2022 · 1 comment

Comments

@ilias-ant
Copy link

ilias-ant commented Mar 24, 2022

Problem

When someone uses the Cancel button(s) available in the /jobs page:

image

the action redirects you to the /cancel.json page (which is the respective web service response), detailing something like the following:

{"node_name": "foobar", "status": "ok", "prevstate": "pending"}

If someone wants to perform multiple Cancel actions, it has to navigate between the /jobs page and the individual redirected /cancel.json pages, which makes it a bit tiresome.

Context

scrapyd v1.3.0

Proposal

The Cancel action through the /jobs UI should not redirect, but rather display the response in the same view (/jobs). Perhaps this cannot be done purely with HTML, and a bit of Javascript may be needed.

@jpmckinney
Copy link
Contributor

jpmckinney commented Jul 15, 2024

Yes, we can maybe make the request to cancel.json and then display the results.

There was a start at a new UI in #304 from before I became maintainer.

There was also some relevant code in #254

Edit: Another idea is to maybe add a hidden input to the form, which, if received, causes the webservice to return a 302 to redirect to the homepage. While that's maybe simpler, the JavaScript solution is preferred, to avoid polluting the API with this sort of frontend logic.

@jpmckinney jpmckinney changed the title Cancel button redirects to another page - and this makes the user experience a bit tiresome Change Cancel button to call cancel.json via JavaScript, to avoid page navigation Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants