-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Transforms: Use data views service for loading data views #131819
[ML] Transforms: Use data views service for loading data views #131819
Conversation
Pinging @elastic/ml-ui (:ml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some small comments, but generally LGTM
@@ -27,8 +27,7 @@ export type DiscoverAction = ReturnType<typeof useDiscoverAction>; | |||
export const useDiscoverAction = (forceDisable: boolean) => { | |||
const appDeps = useAppDependencies(); | |||
const { share } = appDeps; | |||
const savedObjectsClient = appDeps.savedObjects.client; | |||
const dataViews = appDeps.data.dataViews; | |||
const dataViewsContract = appDeps.data.dataViews; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, data
and application
could be added to the line above along with share
, to clean this code up a bit.
In fact they could all be added to line 28 and appDeps
removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
getStartServices: CoreSetup<PluginStartContract>['getStartServices']; | ||
} | ||
|
||
export interface PluginStartContract { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should be renamed PluginStartDependencies
and Dependencies
on line 15 should be renamed PluginSetuptDependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! just a couple of minor suggestions
@@ -6,68 +6,31 @@ | |||
*/ | |||
|
|||
import { buildEsQuery } from '@kbn/es-query'; | |||
import { SavedObjectsClientContract, SimpleSavedObject, IUiSettingsClient } from '@kbn/core/public'; | |||
import { IUiSettingsClient } from '@kbn/core/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
import { IUiSettingsClient } from '@kbn/core/public'; | |
import type { IUiSettingsClient } from '@kbn/core/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
import { getEsQueryConfig } from '@kbn/data-plugin/public'; | ||
import { DataView, DataViewAttributes, DataViewsContract } from '@kbn/data-views-plugin/public'; | ||
import { DataView, DataViewsContract } from '@kbn/data-views-plugin/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { DataView, DataViewsContract } from '@kbn/data-views-plugin/public'; | |
import type { DataView, DataViewsContract } from '@kbn/data-views-plugin/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
@@ -5,8 +5,8 @@ | |||
* 2.0. | |||
*/ | |||
|
|||
import { HttpSetup, SavedObjectsClientContract } from '@kbn/core/public'; | |||
import { DataView } from '@kbn/data-views-plugin/public'; | |||
import { HttpSetup } from '@kbn/core/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { HttpSetup } from '@kbn/core/public'; | |
import type { HttpSetup } from '@kbn/core/public'; |
import { HttpSetup, SavedObjectsClientContract } from '@kbn/core/public'; | ||
import { DataView } from '@kbn/data-views-plugin/public'; | ||
import { HttpSetup } from '@kbn/core/public'; | ||
import { DataViewsContract } from '@kbn/data-views-plugin/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { DataViewsContract } from '@kbn/data-views-plugin/public'; | |
import type { DataViewsContract } from '@kbn/data-views-plugin/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
const dv = (await dataViewsContract.find(indexName)).find(({ title }) => title === indexName); | ||
return dv !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const dv = (await dataViewsContract.find(indexName)).find(({ title }) => title === indexName); | |
return dv !== undefined; | |
return (await dataViewsContract.find(indexName)).some(({ title }) => title === indexName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
@@ -9,6 +9,7 @@ import { i18n as kbnI18n } from '@kbn/i18n'; | |||
|
|||
import type { CoreSetup } from '@kbn/core/public'; | |||
import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; | |||
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; | |
import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 36d6398
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
Replaces all uses of the saved object client for loading and deleting data views with the data views service from the
data-views-plugin
.Part of #91715
Closes #124381