-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
ui: add manual refresh option to the Active Executions in SQL Activity #103786
Conversation
Note on the progress of this PR: Currently, the behavior of the manual / automatic refresh toggle is so that the state of the toggle is shared across the two views. See this loom demo for an example. However, recent discussions have led us to opt for a non-shared toggle state between the active statements view and the active transactions view. This means that a user can set the active statements view to be auto-refreshing while the active transactions can be set to manually-refreshing, and vice versa. This came about when we noticed that when a user triggered a manual refresh in the active statements view, the data in the active transactions view would also get updated, which is misleading as each view has its own toggle option. Based on this, we decided that we should not share the toggle state between the two views. This is currently not possible because the data for active statements and active transactions are both served by the same endpoint, Alternatively, we can also keep using the CC: @dongniwang, @kevin-v-ngo |
In the spirit of moving fast, we decided to keep the toggle sharing behavior between the active statements and active transactions pages. See loom demo. |
I think you included the file |
😅 oops, removed it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just some comments on the last refresh timestamp.
|
||
interface IconProps { | ||
className?: string; | ||
onClick?: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you can remove this since you put onClick into the container div instead (which IMO is preferable over putting it on the svg component).
onAutoRefreshToggle: (isEnabled: boolean) => { | ||
dispatch( | ||
localStorageActions.update({ | ||
key: "isAutoRefreshEnabled/ActiveExecutions", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this key a const in the localStorage file?
|
||
// lastRefreshTimestampLocalSetting is shared between the Active Statements and | ||
// Active Transactions components. | ||
const lastRefreshTimestampLocalSetting = new LocalSetting<AdminUIState, string>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to create a new value for this. I think you can pull this timestamp from the sessions redux state (last updated) so that they can see the latest time the info was returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/icon/refreshIcon.tsx
line 15 at r3 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Looks like you can remove this since you put onClick into the container div instead (which IMO is preferable over putting it on the svg component).
Done.
pkg/ui/workspaces/cluster-ui/src/statementsPage/activeStatementsPage.selectors.ts
line 99 at r3 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Can you make this key a const in the localStorage file?
Done.
pkg/ui/workspaces/db-console/src/views/statements/activeStatementsSelectors.tsx
line 65 at r3 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
You don't need to create a new value for this. I think you can pull this timestamp from the sessions redux state (last updated) so that they can see the latest time the info was returned.
Makes sense! Removed it as a local setting and used the lastUpdated
from the sessions redux state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 13 files at r2, 50 of 50 files at r4, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @gtr, and @xinhaoz)
-- commits
line 11 at r4:
nit: clarify this is under SQL Activity page
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 38 at r4 (raw file):
} // RefreshButton consists of the RefreshIcon and the text "Refresh"
nit: period
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 58 at r4 (raw file):
<span>Active {capitalize(execType)} Executions As Of: </span> {lastRefreshTimestamp && lastRefreshTimestamp.isValid() ? ( <Timestamp time={lastRefreshTimestamp} format={DATE_FORMAT_24_TZ} />
because the refresh is every 10s I think is better to show the seconds here too
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 66 at r4 (raw file):
<span className={cx("refresh-divider")}> <span className={cx("auto-refresh-label")}>Auto Refresh: </span> <Switch
can you change the style here to use the same tone of blue we use elsewhere?
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.module.scss
line 24 at r4 (raw file):
.refresh-text { color: #0055FF;
you should use the variables we have for colors, in this case $colors--primary-blue-3
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.module.scss
line 35 at r4 (raw file):
.refresh-divider { border-left: 1px solid #c0c6d9;
same thing here, use $colors--neutral-4
fa9dcd0
to
f734b3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added analytics in activeStatementsPage.selectors.ts
and activeTransactionsPage.selectors.tsx
!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @maryliag, and @xinhaoz)
Previously, maryliag (Marylia Gutierrez) wrote…
nit: clarify this is under SQL Activity page
Done.
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 58 at r4 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
because the refresh is every 10s I think is better to show the seconds here too
Makes sense! Done.
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 66 at r4 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
can you change the style here to use the same tone of blue we use elsewhere?
Done.
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.module.scss
line 24 at r4 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
you should use the variables we have for colors, in this case
$colors--primary-blue-3
Done.
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.module.scss
line 35 at r4 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
same thing here, use
$colors--neutral-4
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 13 of 13 files at r5, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @gtr, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 70 at r5 (raw file):
<span className={cx("auto-refresh-label")}>Auto Refresh: </span> <Switch className={cx(`ant-switch-${isAutoRefreshEnabled ? "checked" : ""}`)}
can you add a pic to show how it looks like with the new color?
pkg/ui/workspaces/cluster-ui/src/statementsPage/activeStatementsPage.selectors.ts
line 122 at r5 (raw file):
analyticsActions.track({ name: "Manual Refresh", page: "Statements",
nice! thanks for adding those!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a demo of the two new feedback items I got on Tuesday, which were to default the toggle as ON and to add a warning banner after x minutes. For now I set it to 10 minutes but I'm open to changing this.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @maryliag, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/activeExecutions/refreshControl/refreshControl.tsx
line 70 at r5 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
can you add a pic to show how it looks like with the new color?
Sure! The new demo I linked above should have this changes but it may be hard to see from the demo so here's an additional screenshot:
pkg/ui/workspaces/cluster-ui/src/statementsPage/activeStatementsView.tsx
line 152 at r6 (raw file):
checkTimeDifference(); const intervalId = setInterval(checkTimeDifference, 10 * 1000);
I'm checking the time difference described in the above comment every 10 seconds. This was arbitrary and I was wondering if there's a preferred interval for this kind of thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few ui nits:
- looks like the warning is cut off a little on the top part
- the "refresh" and toggle are not quite aligned with the text, they both should be a little more up to centralize
Reviewed 2 of 8 files at r6, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @gtr, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/store/localStorage/localStorage.reducer.ts
line 42 at r7 (raw file):
DB_DETAILS_VIEW_MODE = "viewMode/DatabasesDetailsPage", ACTIVE_EXECUTIONS_IS_AUTOREFRESH_ENABLED = "isAutoRefreshEnabled/ActiveExecutions", ACTIVE_EXECUTIONS_DISPLAY_REFRESH_ALERT = "displayRefreshAlert/ActiveExecutions",
you don't need a value on localstorage for this, because the page already have all the info you need to know if it should be displayed or not.
pkg/ui/workspaces/cluster-ui/src/statementsPage/activeStatementsView.tsx
line 152 at r6 (raw file):
Previously, gtr (Gerardo Torres Castro) wrote…
I'm checking the time difference described in the above comment every 10 seconds. This was arbitrary and I was wondering if there's a preferred interval for this kind of thing.
I think 10 seconds is good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @gtr, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/transactionsPage/activeTransactionsView.tsx
line 288 at r7 (raw file):
</PageConfigItem> </PageConfig> {displayRefreshAlert && (
this one here too, you don't need a a value on local storage for it, you can just compare if has been 10min since last refresh (a data you already have here)
Thanks @gtr for the PR, looks good to me! Re
The other thing is, can you share a screenshot of the inline statement you mentioned? Thank you!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the warning is cut off a little on the top part
Fixed.
the "refresh" and toggle are not quite aligned with the text, they both should be a little more up to centralize
Also fixed, I had previously had an extra vertical-align: middle
which caused that issue.
Do we have a plan for implementing the not sharing behavior? From a UI perspective, we can also look into moving the control above the tabs so it's more clear that the refresh behavior is shared between statements and transactions.
Switching to a non-shared behavior would require creating a new endpoint for each txns and stmts because they are currently refreshed by the same endpoint. This is feasible. From a UI perspective, we definitely could move the control above the tabs but that could also disrupt Statement Fingerprints view since that view doesn't do any auto refresh.
The other thing is, can you share a screenshot of the inline statement you mentioned? Thank you!
Sure thing! it's in the new CC loom demo but here is an additional screenshot too:
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @maryliag, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/store/localStorage/localStorage.reducer.ts
line 42 at r7 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
you don't need a value on localstorage for this, because the page already have all the info you need to know if it should be displayed or not.
Makes sense, removed thanks!
pkg/ui/workspaces/cluster-ui/src/statementsPage/activeStatementsPage.selectors.ts
line 122 at r5 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
nice! thanks for adding those!
Done.
pkg/ui/workspaces/cluster-ui/src/transactionsPage/activeTransactionsView.tsx
line 288 at r7 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
this one here too, you don't need a a value on local storage for it, you can just compare if has been 10min since last refresh (a data you already have here)
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 11 of 11 files at r8, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @gtr, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/store/localStorage/localStorage.reducer.ts
line 157 at r8 (raw file):
const defaultIsAutoRefreshEnabledSetting = true; const defaultDisplayRefreshAlertSetting = false;
this is not being used anywhere
pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.module.scss
line 63 at r8 (raw file):
padding-top: 5px; display: flex; // flex: 0 0 auto;
remove the comment line
Part of: #100663. Previously, the Active Executions views in the SQL Activity pages only only supported automatic refresh at a rate of every 10 seconds. This is a papercut which may lead to some queries disappearing before a user is able to investigate it. This commit adds adds support for manual refresh in the Active Executions page as well as a toggle to switch between automatic and manual refresh. A summary of changes: - A new component `RefreshControl` which contains an auto-refresh toggle, a manual refresh button, and a timestamp indicating when the last refresh was performed.. - `ActiveStatementsView` and `ActiveTransactionsView` make use of this component to control when their data gets refreshed. The toggle defaults to ON for both pages. - Analytics for the auto refresh toggle and the manual refresh button. - A inline alert if the data hasn't been refreshed in over 10 minutes. Release note (ui change): the active executions views in the SQL Activity pages now support toggling between automatic and manual refresh. A manual refresh button is also added along with a timestamp indicating when the last refresh was performed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @dongniwang, @maryliag, and @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/store/localStorage/localStorage.reducer.ts
line 157 at r8 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
this is not being used anywhere
Done.
pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.module.scss
line 63 at r8 (raw file):
Previously, maryliag (Marylia Gutierrez) wrote…
remove the comment line
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r9, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @dongniwang and @xinhaoz)
TFTR! |
Build succeeded: |
Previously, the Active Executions views in the SQL Activity pages only
only supported automatic refresh at a rate of every 10 seconds. This
is a papercut which may lead to some queries disappearing before a user
is able to investigate it. This commit adds adds support for manual
refresh in the Active Executions page as well as a toggle to switch
between automatic and manual refresh.
A summary of changes:
RefreshControl
which contains an auto-refreshtoggle, a manual refresh button, and a timestamp indicating when the
last refresh was performed..
ActiveStatementsView
andActiveTransactionsView
make use of thiscomponent to control when their data gets refreshed. The toggle
defaults to ON for both pages.
Loom (DB): https://www.loom.com/share/5bdab5a62a0c4bc694c9c5d7f936759a
Loom (CC): https://www.loom.com/share/de399300225540059bc7c4f156bc8270
Release note (ui change): the active executions views in the SQL
Activity pages now support toggling between automatic and manual
refresh. A manual refresh button is also added along with a timestamp
indicating when the last refresh was performed.