[Logs UI] Replace dependencies in the infra bundle (#91503)

This commit is contained in:
Alejandro Fernández Gómez 2021-02-19 15:06:33 +01:00 committed by GitHub
parent 8b909cedc8
commit 4d34a13bab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 15 deletions

View file

@ -34,7 +34,7 @@ pageLoadAssetSize:
indexLifecycleManagement: 107090
indexManagement: 140608
indexPatternManagement: 28222
infra: 204800
infra: 184320
fleet: 415829
ingestPipelines: 58003
inputControlVis: 172675

View file

@ -5,7 +5,6 @@
* 2.0.
*/
import Mustache from 'mustache';
import { createBytesFormatter } from './bytes';
import { formatNumber } from './number';
import { formatPercent } from './percent';
@ -34,5 +33,5 @@ export const createFormatter = (format: InventoryFormatterType, template: string
}
const fmtFn = FORMATTERS[format];
const value = fmtFn(Number(val));
return Mustache.render(template, { value });
return template.replace(/{{value}}/g, value);
};

View file

@ -11,7 +11,6 @@ import { AppMountParameters } from 'kibana/public';
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, RouteProps, Router, Switch } from 'react-router-dom';
import url from 'url';
// This exists purely to facilitate legacy app/infra URL redirects.
// It will be removed in 8.0.0.
@ -79,11 +78,10 @@ const LegacyApp: React.FunctionComponent<{ history: History<unknown> }> = ({ his
nextPath = nextPathParts[0];
nextSearch = nextPathParts[1] ? nextPathParts[1] : undefined;
let nextUrl = url.format({
pathname: `${nextBasePath}/${nextPath}`,
hash: undefined,
search: nextSearch,
});
const builtPathname = `${nextBasePath}/${nextPath}`;
const builtSearch = nextSearch ? `?${nextSearch}` : '';
let nextUrl = `${builtPathname}${builtSearch}`;
nextUrl = nextUrl.replace('//', '/');

View file

@ -7,7 +7,6 @@
import { useMemo } from 'react';
import { stringify } from 'query-string';
import url from 'url';
import { url as urlUtils } from '../../../../../src/plugins/kibana_utils/public';
import { usePrefixPathWithBasepath } from './use_prefix_path_with_basepath';
import { useKibana } from '../../../../../src/plugins/kibana_react/public';
@ -58,11 +57,11 @@ export const useLinkProps = (
}, [pathname, encodedSearch]);
const href = useMemo(() => {
const link = url.format({
pathname,
hash: mergedHash,
search: !hash ? encodedSearch : undefined,
});
const builtPathname = pathname ?? '';
const builtHash = mergedHash ? `#${mergedHash}` : '';
const builtSearch = !hash ? (encodedSearch ? `?${encodedSearch}` : '') : '';
const link = `${builtPathname}${builtSearch}${builtHash}`;
return prefixer(app, link);
}, [mergedHash, hash, encodedSearch, pathname, prefixer, app]);