Skip to content

[Sqllab] Add offline state to sqllab - #6013

Merged
timifasubaa merged 3 commits into
apache:masterfrom
timifasubaa:sqllab_timeout_when_disconnected_from_server
Oct 23, 2018
Merged

timifasubaa merged 3 commits into
apache:masterfrom
timifasubaa:sqllab_timeout_when_disconnected_from_server

Conversation

@timifasubaa

@timifasubaa timifasubaa commented Oct 1, 2018 •

Copy link
Copy Markdown
Contributor

This is a user experience improvement in sqllab. Historically, if the user was disconnected from the internet or the backed was down, sqllab continues to poll from the backend. All the while showing the user they are in the pending state. This is confusing to the user as they would keep thinking their query is pending for a long time when the request hasn't been sent to the backend.
This PR makes it show offline when the ajax request cannot connect to the backend to avoid confusion .

@graceguo-supercat @kristw
screen shot 2018-10-09 at 12 26 52 am

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch 4 times, most recently from 120826e to ee89873 Compare October 1, 2018 18:47
@codecov-io

codecov-io commented Oct 1, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #6013 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6013   +/-   ##
=======================================
  Coverage   76.91%   76.91%           
=======================================
  Files          47       47           
  Lines        9362     9362           
=======================================
  Hits         7201     7201           
  Misses       2161     2161

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a71e6eb...3879751. Read the comment docs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this line will make all long query (>3 seconds) abort.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will remove the timeout option.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i will prefer show error message not force refresh user's browser.

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch from ee89873 to b3ef68f Compare October 3, 2018 20:10
@timifasubaa timifasubaa changed the title [Sqllab] add timeout and refresh for failed backend polling [Sqllab] Add offline state to sqllab Oct 3, 2018
@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch 7 times, most recently from da86a1f to f079f04 Compare October 9, 2018 07:34
@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch 2 times, most recently from 70774eb to 34b1453 Compare October 11, 2018 08:49
@timifasubaa

Copy link
Copy Markdown
Contributor Author

Ready for review

@graceguo-supercat graceguo-supercat Oct 4, 2018 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you don't need self variable. see the exist code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

also corrected.

Comment thread superset/assets/src/SqlLab/App.jsx Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this logic (set initial value for offline state) should be in function getInitialState

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is offline prop type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops. Corrected.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is adding redux connect for this component necessary? where do you need to check state?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's necessary because I ensure it is online before the ajax calls

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch 5 times, most recently from ced2f09 to 78f66fe Compare October 12, 2018 00:39
@timifasubaa

Copy link
Copy Markdown
Contributor Author

All concerns addressed.

Comment thread superset/assets/src/SqlLab/actions.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rename this to SET_USER_OFFLINE to make verb like other action names.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

very good catch!

Comment thread superset/assets/src/SqlLab/actions.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

userOffline => setUserOffline

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch from 78f66fe to b459143 Compare October 12, 2018 01:06
Comment thread superset/assets/src/SqlLab/actions.js Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

very good catch!

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if it is in offline state, you don't need to run these logic, you just render offline and exit early, right? so you can move offline check before this line.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

instead of create a hard-coded text here, you should create new entry in STATUS_OPTIONS in constants.js

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch from b459143 to 734bcdb Compare October 12, 2018 17:46
@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch 4 times, most recently from b6fd18e to 46009c3 Compare October 18, 2018 04:28
@timifasubaa

Copy link
Copy Markdown
Contributor Author

Ready for review

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch from 46009c3 to 7221cc5 Compare October 18, 2018 04:57

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

before .setProps, can you add an expect that disabled props toBe(false)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch 2 times, most recently from 2c1be7e to 81c4be4 Compare October 20, 2018 00:38
@timifasubaa

Copy link
Copy Markdown
Contributor Author

Ready for stamp!

@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch from 81c4be4 to 3879751 Compare October 20, 2018 01:26
@timifasubaa
timifasubaa force-pushed the sqllab_timeout_when_disconnected_from_server branch from 3879751 to 573ebac Compare October 22, 2018 23:47

@graceguo-supercat graceguo-supercat left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@timifasubaa timifasubaa reopened this Oct 23, 2018
@timifasubaa timifasubaa reopened this Oct 23, 2018
@timifasubaa
timifasubaa merged commit fc3b68e into apache:master Oct 23, 2018
bipinsoniguavus pushed a commit to ThalesGroup/incubator-superset that referenced this pull request Dec 26, 2018
* add timeout and refresh for failed backend

* show offline state instead of refreshing

* add southpane tests
@mistercrunch

Copy link
Copy Markdown
Member

FYI #6782

@mistercrunch

Copy link
Copy Markdown
Member

@timifasubaa I'm not sure why, but in some cases when queries that return errors are executed, I see offline flash on the UI

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 First shipped in 0.34.0 labels Feb 27, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
* add timeout and refresh for failed backend

* show offline state instead of refreshing

* add southpane tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 First shipped in 0.34.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants