Skip to content

Commit

Permalink
[Dashboard][Lens] Small code fixes (#54625)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
Maja Grubic and elasticmachine authored Jan 15, 2020
1 parent 1a62392 commit 7ca858e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ import { DashboardConstants } from './dashboard_constants';
*/
export function getUrlVars(url: string): Record<string, string> {
const vars: Record<string, string> = {};
// @ts-ignore
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(_, key, value) {
// @ts-ignore
for (const [, key, value] of url.matchAll(/[?&]+([^=&]+)=([^&]*)/gi)) {
vars[key] = decodeURIComponent(value);
});
}
return vars;
}

Expand Down
6 changes: 3 additions & 3 deletions x-pack/legacy/plugins/lens/public/app_plugin/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ export class AppPlugin {
})
);
const updateUrlTime = (urlVars: Record<string, string>): void => {
const decoded: RisonObject = rison.decode(urlVars._g) as RisonObject;
if (!decoded) {
const decoded = rison.decode(urlVars._g);
if (!isRisonObject(decoded)) {
return;
}
// @ts-ignore
decoded.time = data.query.timefilter.timefilter.getTime();
urlVars._g = rison.encode((decoded as unknown) as RisonObject);
urlVars._g = rison.encode(decoded);
};
const redirectTo = (
routeProps: RouteComponentProps<{ id?: string }>,
Expand Down

0 comments on commit 7ca858e

Please sign in to comment.