Skip to content

Commit

Permalink
improve READMEs. remove prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Dec 30, 2022
1 parent 928a2d6 commit c0e5b87
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion x-pack/packages/ml/is_defined/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @kbn/ml-is-defined

Empty package generated by @kbn/generate
Utility function to determine if a value is not `undefined` and not `null`.
2 changes: 1 addition & 1 deletion x-pack/packages/ml/local_storage/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @kbn/ml-local-storage

Empty package generated by @kbn/generate
Utilities to combine url state management with local storage.
2 changes: 1 addition & 1 deletion x-pack/packages/ml/local_storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* 2.0.
*/

export { MlStorageContextProvider, useStorage } from './src/storage_context';
export { StorageContextProvider, useStorage } from './src/storage_context';
6 changes: 3 additions & 3 deletions x-pack/packages/ml/local_storage/src/storage_context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ export const MlStorageContext = React.createContext<StorageAPI>({
},
});

interface MlStorageContextProviderProps<K extends TStorageKey> {
interface StorageContextProviderProps<K extends TStorageKey> {
storage: Storage;
storageKeys: readonly K[];
}

export function MlStorageContextProvider<K extends TStorageKey, T extends TStorage>({
export function StorageContextProvider<K extends TStorageKey, T extends TStorage>({
children,
storage,
storageKeys,
}: PropsWithChildren<MlStorageContextProviderProps<K>>) {
}: PropsWithChildren<StorageContextProviderProps<K>>) {
const initialValue = useMemo(() => {
return storageKeys.reduce((acc, curr) => {
acc[curr as K] = storage.get(curr as string);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { FC } from 'react';

import { DataView } from '@kbn/data-views-plugin/common';
import { SavedSearch } from '@kbn/saved-search-plugin/public';
import { MlStorageContextProvider } from '@kbn/ml-local-storage';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { UrlStateProvider } from '@kbn/ml-url-state';
import { Storage } from '@kbn/kibana-utils-plugin/public';

Expand Down Expand Up @@ -40,12 +40,12 @@ export const ChangePointDetectionAppState: FC<ChangePointDetectionAppStateProps>
<AiopsAppContext.Provider value={appDependencies}>
<UrlStateProvider>
<DataSourceContext.Provider value={{ dataView, savedSearch }}>
<MlStorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<PageHeader />
<ChangePointDetectionContextProvider>
<ChangePointDetectionPage />
</ChangePointDetectionContextProvider>
</MlStorageContextProvider>
</StorageContextProvider>
</DataSourceContext.Provider>
</UrlStateProvider>
</AiopsAppContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { Filter, Query } from '@kbn/es-query';
import { i18n } from '@kbn/i18n';
import type { SavedSearch } from '@kbn/discover-plugin/public';
import type { DataView } from '@kbn/data-views-plugin/public';
import { MlStorageContextProvider } from '@kbn/ml-local-storage';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { UrlStateProvider } from '@kbn/ml-url-state';
import { Storage } from '@kbn/kibana-utils-plugin/public';

Expand Down Expand Up @@ -99,9 +99,9 @@ export const ExplainLogRateSpikesAppState: FC<ExplainLogRateSpikesAppStateProps>
<AiopsAppContext.Provider value={appDependencies}>
<UrlStateProvider>
<SpikeAnalysisTableRowStateProvider>
<MlStorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<ExplainLogRateSpikesPage dataView={dataView} savedSearch={savedSearch} />
</MlStorageContextProvider>
</StorageContextProvider>
</SpikeAnalysisTableRowStateProvider>
</UrlStateProvider>
</AiopsAppContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React, { FC } from 'react';
import type { SavedSearch } from '@kbn/discover-plugin/public';
import type { DataView } from '@kbn/data-views-plugin/public';
import { MlStorageContextProvider } from '@kbn/ml-local-storage';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { UrlStateProvider } from '@kbn/ml-url-state';
import { Storage } from '@kbn/kibana-utils-plugin/public';

Expand All @@ -34,9 +34,9 @@ export const LogCategorizationAppState: FC<LogCategorizationAppStateProps> = ({
return (
<AiopsAppContext.Provider value={appDependencies}>
<UrlStateProvider>
<MlStorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<StorageContextProvider storage={localStorage} storageKeys={AIOPS_STORAGE_KEYS}>
<LogCategorizationPage dataView={dataView} savedSearch={savedSearch} />
</MlStorageContextProvider>
</StorageContextProvider>
</UrlStateProvider>
</AiopsAppContext.Provider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { SimpleSavedObject } from '@kbn/core/public';
import { i18n } from '@kbn/i18n';
import { Storage } from '@kbn/kibana-utils-plugin/public';
import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { MlStorageContextProvider } from '@kbn/ml-local-storage';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { DataView } from '@kbn/data-views-plugin/public';
import { getNestedProperty } from '@kbn/ml-nested-property';
import {
Expand Down Expand Up @@ -321,12 +321,12 @@ export const IndexDataVisualizer: FC<{
return (
<KibanaThemeProvider theme$={coreStart.theme.theme$}>
<KibanaContextProvider services={{ ...services }}>
<MlStorageContextProvider storage={localStorage} storageKeys={DV_STORAGE_KEYS}>
<StorageContextProvider storage={localStorage} storageKeys={DV_STORAGE_KEYS}>
<DataVisualizerStateContextProvider
IndexDataVisualizerComponent={IndexDataVisualizerView}
getAdditionalLinks={getAdditionalLinks}
/>
</MlStorageContextProvider>
</StorageContextProvider>
</KibanaContextProvider>
</KibanaThemeProvider>
);
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/ml/common/types/storage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { FC } from 'react';
import { renderHook, act } from '@testing-library/react-hooks';

import type { Storage } from '@kbn/kibana-utils-plugin/public';
import { MlStorageContextProvider, useStorage } from '@kbn/ml-local-storage';
import { StorageContextProvider, useStorage } from '@kbn/ml-local-storage';

import { ML_STORAGE_KEYS } from './storage';

Expand All @@ -32,9 +32,9 @@ const mockStorage: Storage = {

const Provider: FC = ({ children }) => {
return (
<MlStorageContextProvider storage={mockStorage} storageKeys={ML_STORAGE_KEYS}>
<StorageContextProvider storage={mockStorage} storageKeys={ML_STORAGE_KEYS}>
{children}
</MlStorageContextProvider>
</StorageContextProvider>
);
};

Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/ml/public/application/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public';
import { Storage } from '@kbn/kibana-utils-plugin/public';

import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
import { MlStorageContextProvider } from '@kbn/ml-local-storage';
import { StorageContextProvider } from '@kbn/ml-local-storage';
import { ML_STORAGE_KEYS } from '../../common/types/storage';
import { setDependencyCache, clearCache } from './util/dependency_cache';
import { setLicenseCache } from './license';
Expand Down Expand Up @@ -112,9 +112,9 @@ const App: FC<AppProps> = ({ coreStart, deps, appMountParams }) => {
mlServices: getMlGlobalServices(coreStart.http, deps.usageCollection),
}}
>
<MlStorageContextProvider storage={localStorage} storageKeys={ML_STORAGE_KEYS}>
<StorageContextProvider storage={localStorage} storageKeys={ML_STORAGE_KEYS}>
<MlRouter pageDeps={pageDeps} />
</MlStorageContextProvider>
</StorageContextProvider>
</KibanaContextProvider>
</KibanaThemeProvider>
</I18nContext>
Expand Down

0 comments on commit c0e5b87

Please sign in to comment.