-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Migrate Dashboard and Public Dashboard to React #4228
Conversation
- initial rendering - some actions - temporary updated less file
} | ||
|
||
function useRefreshRateHandler(refreshDashboard, updateUrlSearch) { | ||
const [refreshRate, setRefreshRate] = useState(getRefreshRateFromUrl()); |
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.
I like that this now allows custom refresh rates 🕺
@gabrieldutra I know that it was an attempt to fix the issue with unnecessary API calls, but IMHO the solution should be different: there is a dirty-check mechanism for auto-save layout feature - this mechanism should be disabled in non-edit mode (as it was prior to Dashboard grid migration to React). |
I agree with @kravets-levko -- we should keep the migration mechanism and implement the solution only for saves during non edits. |
Thanks @kravets-levko, I didn't know about that. Moved to option B to be closer to how this was done prior to the autosave: disabled layout saving when not in edit mode. |
This passes the sanity check from my end-user perspective. I like the new button look. |
Thanks, @susodapop 🙂 |
|
||
function RefreshButton({ dashboardOptions }) { | ||
const { refreshRate, setRefreshRate, refreshing, refreshDashboard } = dashboardOptions; | ||
const refreshRateOptions = clientConfig.dashboardRefreshIntervals; |
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.
It seems to be missing the use of a policy to define allowed refresh intervals:
redash/client/app/pages/dashboards/dashboard.js
Lines 116 to 121 in 2633052
const allowedIntervals = policy.getDashboardRefreshIntervals(); | |
if (_.isArray(allowedIntervals)) { | |
_.each(this.refreshRates, (rate) => { | |
rate.enabled = allowedIntervals.indexOf(rate.rate) >= 0; | |
}); | |
} |
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.
🤔, currently it's still possible to put any interval you want through the url, should it be reflected in there?
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.
I think it was possible before as well, but we can also make sure that the value in the url is not lower than the minimum value the policy allows. Something like:
const refreshRate = max(urlValue, lowestPolicyValue);
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.
Yeah, my currently was meant to be master
version, but cool, will go with it 👍
2286325
to
93ed21a
Compare
|
||
useEffect(() => { | ||
document.title = dashboard.name; | ||
}, [dashboard.name]); |
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.
👍
👍 |
What type of PR is this? (check all applicable)
Description
Migration of the Dashboard to React
Refresh and Refresh rate
Same presets kept, now updates URL accordingly with
refresh=[refreshRate]
.No button on the Public Dashboard, but can be updated through the URL (as it was before).
Fullscreen
Now updates URL accordingly.
The button is still only visible for Published queries, lmk if you want that changed.
Publish/Unpublish
Mobile
Edit Mode
Public Dashboard
Features
Bugs Found
Related Tickets & Documents
Closes #2076
Closes #4204
Closes #4341