-
Notifications
You must be signed in to change notification settings - Fork 125
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
feat: Readable metrics view url params #5675
Conversation
fd6f6c1
to
af1a029
Compare
web-admin/src/routes/[organization]/[project]/-/reports/[report]/open/+page.svelte
Show resolved
Hide resolved
web-admin/src/routes/[organization]/[project]/-/share/[token]/+page.svelte
Outdated
Show resolved
Hide resolved
web-common/src/features/dashboards/url-state/convertMetricsEntityToURLSearchParams.ts
Outdated
Show resolved
Hide resolved
web-common/src/features/dashboards/url-state/convertMetricsExploreToPreset.ts
Outdated
Show resolved
Hide resolved
export function getBasePreset( | ||
explore: V1ExploreSpec, | ||
preferences: LocalUserPreferences, | ||
) { |
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 feels like this function is doing two things: 1. defining the "base" ("default"?) state for all Explores and 2. merging the generic default state with the given Explore's default state and the user preferences.
Could we define a DEFAULT_EXPLORE_STATE
in a constant outside this function? And maybe the function name should be reconsidered.
return { | ||
timeZone: getLocalIANA(), | ||
}; |
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 wouldn't expect this default/fallback to be included in this function. I'd expect timeZone: getLocalIANA()
to be included in the default generic Explore state, which would later be merged with user preferences.
@@ -16,20 +15,21 @@ | |||
const queryClient = useQueryClient(); | |||
|
|||
export let data: PageData; | |||
$: ({ metricsView, explore, basePreset, partialMetrics } = data); |
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's confusing seeing both basePreset
and partialMetrics
. Could we merge the two of them further upstream?
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.
They are not used together. If basePreset
is used to keep the url clean and not add defaults. partialMetrics
is the metrics from url. basePreset
will not be needed in the future when we directly update the url in actions.
const basePreset = getBasePreset( | ||
exploreResource.explore.state?.validSpec ?? {}, | ||
getLocalUserPreferencesState(exploreName), | ||
); |
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 feels like this doesn't belong in this function. Maybe it could be pushed down to a central place where we synthesize the initial 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.
I kicked off a UXQA doc here
1a4350f
to
0f5f94f
Compare
720bca1
to
7b88d3b
Compare
5e662a4
to
9b10c0d
Compare
aed2a91
to
e7b9d37
Compare
fe3291e
to
b8fb2cb
Compare
Move our dashboard url state from base64 encoded protobuf to human readable urls params.