[OGUI-1298] Add button to cancel ongoing query request#3482
Conversation
| window.fetch = async () => { | ||
| postCalls += 1; | ||
| return { ok: true, result: { rows: [] } }; | ||
| return { ok: true, status: 200, json: async () => JSON.stringify({ rows: [] }) }; |
There was a problem hiding this comment.
I think response returns an object right not a JSON string?
There was a problem hiding this comment.
Yes. Initially I used text() and converted to JSON and then i moved to using json and missed the test logic update.
Thank you!
| ); | ||
| } | ||
| } catch (error) { | ||
| if (abortController.signal.aborted || error.name === 'AbortError') { |
There was a problem hiding this comment.
Error has had name stripped by this point in jsonPost.js L:37 so I think the error.name === 'AbortError' is redundant. What do you think?
There was a problem hiding this comment.
You are correct, the second part of the check is dead code. I removed it
| * @returns {Promise<null|object>} null if query is aborted, result of the query otherwise | ||
| */ | ||
| async query() { | ||
| if (!this.model.frameworkInfo.isSuccess() || !this.model.frameworkInfo.payload.mysql.status.ok) { |
There was a problem hiding this comment.
I understand the Query button is disabled if the DB isn't ready but things like Enter key still can call it so I think the check is still good to have?
There was a problem hiding this comment.
Good catch, I am also adding a note in the docs to prevent removal in the future
| id: 'query-button', | ||
| title: isDbReady ? 'Query database with filters (Enter)' : 'Query service not configured', | ||
| disabled: !isDbReady || queryResult.isLoading(), | ||
| className: queryResult.isLoading() ? 'loading' : queryButtonType, |
There was a problem hiding this comment.
We now have the isLoading check above so this extra one is not needed. What do you think?
I have JIRA issue created
PR which:
newdeprecated parameter anymore