Explore: deprecate compact URL encoding & dafault to extended (#44385)

This commit is contained in:
Giordano Ricci
2022-01-27 11:23:56 +00:00
committed by GitHub
parent 465ed9f5d3
commit ea48d131ee
5 changed files with 38 additions and 20 deletions

View File

@@ -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);
}