mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: deprecate compact URL encoding & dafault to extended (#44385)
This commit is contained in:
@@ -199,19 +199,12 @@ export const urlUtil = {
|
||||
* Create an string that is used in URL to represent the Explore state. This is basically just a stringified json
|
||||
* that is that used as a state of a single Explore pane so it does not represent full Explore URL.
|
||||
*
|
||||
* There are 2 versions of this, normal and compact. Normal is just the same object stringified while compact turns
|
||||
* properties of the object into array where the order is significant.
|
||||
* @param urlState
|
||||
* @param compact
|
||||
* @param compact this parameter is deprecated and will be removed in a future release.
|
||||
*/
|
||||
export function serializeStateToUrlParam(urlState: ExploreUrlState, compact?: boolean): string {
|
||||
if (compact) {
|
||||
const compactState: unknown[] = [urlState.range.from, urlState.range.to, urlState.datasource, ...urlState.queries];
|
||||
// only serialize panel state if we have at least one non-default panel configuration
|
||||
if (urlState.panelsState !== undefined) {
|
||||
compactState.push({ __panelsState: urlState.panelsState });
|
||||
}
|
||||
return JSON.stringify(compactState);
|
||||
if (compact !== undefined) {
|
||||
console.warn('`compact` parameter is deprecated and will be removed in a future release');
|
||||
}
|
||||
return JSON.stringify(urlState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user