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

[Asset graph] Add query refresh button with "Date at most X seconds old" tooltip #16886

Merged
merged 6 commits into from
Sep 29, 2023

Conversation

salazarm
Copy link
Contributor

@salazarm salazarm commented Sep 28, 2023

Summary & Motivation

Adding back the ability to refresh data and also including a message indicating how old the last visible refreshed data on the screen is.

How I Tested These Changes

Screenshot 2023-09-29 at 1 21 20 AM

@salazarm salazarm requested review from bengotow, hellendag and schrockn and removed request for bengotow September 28, 2023 19:12
@github-actions
Copy link

github-actions bot commented Sep 28, 2023

Deploy preview for dagit-storybook ready!

✅ Preview
https://dagit-storybook-5e4idt0fm-elementl.vercel.app
https://salazarm-asset-graph-query-refresh.components-storybook.dagster-docs.io

Built with commit 51d97c2.
This pull request is being automatically deployed with vercel-action

@github-actions
Copy link

github-actions bot commented Sep 28, 2023

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-b6porj5b0-elementl.vercel.app
https://salazarm-asset-graph-query-refresh.core-storybook.dagster-docs.io

Built with commit 51d97c2.
This pull request is being automatically deployed with vercel-action

Base automatically changed from salazarm/status-in-sidebar to master September 28, 2023 21:35
@salazarm salazarm force-pushed the salazarm/asset-graph-query-refresh branch from 820e799 to 06457c8 Compare September 29, 2023 05:25
@salazarm salazarm changed the title [Asset graph] Add query refresh button with "Date at most X seconds old" label [Asset graph] Add query refresh button with "Date at most X seconds old" tooltip Sep 29, 2023
@salazarm salazarm requested a review from braunjj September 29, 2023 06:58
Comment on lines +50 to +52
<Button
icon={<Icon name="refresh" color={Colors.Gray400} />}
onClick={() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a huge fan of this looking different than all our other refresh buttons but I'd defer to josh on this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this was josh's design, we thought the text makes the button too long

const [text, setText] = React.useState(dayjs(timestamp).fromNow(true));
React.useEffect(() => {
const interval = setInterval(() => {
setText(dayjs(timestamp).fromNow(true));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, is this too flickery to display this outside a tooltip? Would be nice to have data age onscreen in some way vs just a refresh button. Would "At most 22 sec old" in gray text be too long? Feels like it'd match our refreshableCountdown UI a bit more

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nick had some qualms with the countdown counting upwards, he said it gave him anxiety

Comment on lines +160 to +162
const [isGloballyRefreshing, setIsGloballyRefreshing] = React.useState(false);
const [oldestDataTimestamp, setOldestDataTimestamp] = React.useState(0);

Copy link
Collaborator

Choose a reason for hiding this comment

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

It feels a bit odd that oldestDataTimestamp is a separate piece of state when it's a pure derivation of allAssetKeys and cache? (eg: given a set of asset keys and the cache, I should be able to tell you the oldest data timestamp)

It might be nice to write it as a useMemo instead of imperatively updating it in all the correct places where you call fetchData. It seems like it'd be super easy to forget it in one of those callsites and have this state fall out of sync.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it depends on lastFetchedOrRequested which is a global so a useMemo wouldn't work here. lastFetchedOrRequested is only mutated by one function _batchedAssetsFetch which is the same function that calls onUpdatedOrUpdating() so it's all centralized.

## Summary & Motivation

Requests from Josh:

- [x] Can we fix the alignment of the Selection box query row? Right now
it does not align with the items in the sidebar (designs below)
    - [x]  Put all items into a toolbar that matches the sidebar header
    - [x]  Stretch the query input to fill space
    - [x]  Add an info icon action that opens a dialog (see designs)
- [x] Add a “Clear query” action to make it easier to reset this field

## How I Tested These Changes
locally:
<img width="1496" alt="Screenshot 2023-09-29 at 2 57 04 AM"
src="https://github.com/dagster-io/dagster/assets/2286579/ff368fcf-f47e-42f7-80ab-64beec16ea98">
<img width="1496" alt="Screenshot 2023-09-29 at 2 46 53 AM"
src="https://github.com/dagster-io/dagster/assets/2286579/e5f0f945-bbc1-4782-a9d7-75fef52fd7a2">
<img width="869" alt="Screenshot 2023-09-29 at 2 46 44 AM"
src="https://github.com/dagster-io/dagster/assets/2286579/54f352ea-ba8a-4ab8-908c-b0841bea2aec">
@salazarm salazarm merged commit 202cb1d into master Sep 29, 2023
2 checks passed
@salazarm salazarm deleted the salazarm/asset-graph-query-refresh branch September 29, 2023 17:58
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.

2 participants