Skip to content

Commit

Permalink
add fileUpload to useMlKibana context and replace dependencyCache wit…
Browse files Browse the repository at this point in the history
…h useMlKibana
  • Loading branch information
nreese committed Mar 2, 2021
1 parent 56957f4 commit a1cbbfb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/ml/public/application/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const App: FC<AppProps> = ({ coreStart, deps, appMountParams }) => {
embeddable: deps.embeddable,
maps: deps.maps,
triggersActionsUi: deps.triggersActionsUi,
fileUpload: deps.fileUpload,
...coreStart,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { MlServicesContext } from '../../app';
import { IStorageWrapper } from '../../../../../../../src/plugins/kibana_utils/public';
import type { EmbeddableStart } from '../../../../../../../src/plugins/embeddable/public';
import type { MapsStartApi } from '../../../../../maps/public';
import type { FileUploadPluginStart } from '../../../../../file_upload/public';
import type { LensPublicStart } from '../../../../../lens/public';
import { TriggersAndActionsUIPublicPluginStart } from '../../../../../triggers_actions_ui/public';

Expand All @@ -30,6 +31,7 @@ interface StartPlugins {
maps?: MapsStartApi;
lens?: LensPublicStart;
triggersActionsUi?: TriggersAndActionsUIPublicPluginStart;
fileUpload?: FileUploadPluginStart;
}
export type StartServices = CoreStart &
StartPlugins & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { isFullLicense } from '../license';
import { useTimefilter, useMlKibana, useNavigateToPath } from '../contexts/kibana';
import { NavigationMenu } from '../components/navigation_menu';
import { HelpMenu } from '../components/help_menu';
import { getFileUpload } from '../util/dependency_cache';

function startTrialDescription() {
return (
Expand Down Expand Up @@ -57,8 +56,10 @@ export const DatavisualizerSelector: FC = () => {
licenseManagement,
http: { basePath },
docLinks,
fileUpload,
},
} = useMlKibana();

const helpLink = docLinks.links.ml.guide;
const navigateToPath = useNavigateToPath();

Expand All @@ -67,7 +68,7 @@ export const DatavisualizerSelector: FC = () => {
licenseManagement.enabled === true &&
isFullLicense() === false;

const maxFileSize = getFileUpload().getMaxBytesFormatted();
const maxFileSize = fileUpload.getMaxBytesFormatted();

return (
<Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {
} from '@elastic/eui';

import { ExperimentalBadge } from '../experimental_badge';
import { getFileUpload } from '../../../../util/dependency_cache';

import { useMlKibana } from '../../../../contexts/kibana';

export const WelcomeContent: FC = () => {
const toolTipContent = i18n.translate(
Expand All @@ -30,7 +31,11 @@ export const WelcomeContent: FC = () => {
}
);

const maxFileSize = getFileUpload().getMaxBytesFormatted();
const {
services: { fileUpload },
} = useMlKibana();

const maxFileSize = fileUpload.getMaxBytesFormatted();

return (
<EuiFlexGroup gutterSize="xl" alignItems="center">
Expand Down

0 comments on commit a1cbbfb

Please sign in to comment.