Skip to content
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

Remove deprecated api #125524

Merged
merged 9 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/.storybook/context/stubs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { FleetStartServices } from '../../public/plugin';
type Stubs =
| 'storage'
| 'data'
| 'fieldFormats'
| 'deprecations'
| 'fatalErrors'
| 'navigation'
Expand All @@ -21,6 +22,7 @@ type StubbedStartServices = Pick<FleetStartServices, Stubs>;
export const stubbedStartServices: StubbedStartServices = {
storage: {} as FleetStartServices['storage'],
data: {} as FleetStartServices['data'],
fieldFormats: {} as FleetStartServices['fieldFormats'],
deprecations: {} as FleetStartServices['deprecations'],
fatalErrors: {} as FleetStartServices['fatalErrors'],
navigation: {} as FleetStartServices['navigation'],
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/public/applications/fleet/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export const WithPermissionsAndSetup: React.FC = memo(({ children }) => {
* and no routes defined
*/
export const FleetAppContext: React.FC<{
basepath: string;
startServices: FleetStartServices;
config: FleetConfigType;
history: AppMountParameters['history'];
Expand Down
6 changes: 1 addition & 5 deletions x-pack/plugins/fleet/public/applications/fleet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export const ProtectedRoute: React.FunctionComponent<ProtectedRouteProps> = ({
};

interface FleetAppProps {
basepath: string;
startServices: FleetStartServices;
config: FleetConfigType;
history: AppMountParameters['history'];
Expand All @@ -41,7 +40,6 @@ interface FleetAppProps {
theme$: AppMountParameters['theme$'];
}
const FleetApp = ({
basepath,
startServices,
config,
history,
Expand All @@ -52,7 +50,6 @@ const FleetApp = ({
}: FleetAppProps) => {
return (
<FleetAppContext
basepath={basepath}
startServices={startServices}
config={config}
history={history}
Expand All @@ -69,14 +66,13 @@ const FleetApp = ({

export function renderApp(
startServices: FleetStartServices,
{ element, appBasePath, history, setHeaderActionMenu, theme$ }: AppMountParameters,
{ element, history, setHeaderActionMenu, theme$ }: AppMountParameters,
config: FleetConfigType,
kibanaVersion: string,
extensions: UIExtensionsStorage
) {
ReactDOM.render(
<FleetApp
basepath={appBasePath}
startServices={startServices}
config={config}
history={history}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ import { DataStreamRowActions } from './components/data_stream_row_actions';
export const DataStreamListPage: React.FunctionComponent<{}> = () => {
useBreadcrumbs('data_streams');

const {
data: { fieldFormats },
} = useStartServices();
const { fieldFormats } = useStartServices();

const { pagination, pageSizeOptions } = usePagination();

Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/fleet/public/mock/create_test_renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export const createFleetTestRendererMock = (): TestRenderer => {
AppWrapper: memo(({ children }) => {
return (
<FleetAppContext
basepath={basePath}
startServices={testRendererMocks.startServices}
config={testRendererMocks.config}
history={testRendererMocks.mountHistory}
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/public/mock/plugin_dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { homePluginMock } from '../../../../../src/plugins/home/public/mocks';
import { navigationPluginMock } from '../../../../../src/plugins/navigation/public/mocks';
import { customIntegrationsMock } from '../../../../../src/plugins/custom_integrations/public/mocks';
import { sharePluginMock } from '../../../../../src/plugins/share/public/mocks';
import { fieldFormatsServiceMock } from '../../../../../src/plugins/field_formats/public/mocks';

export const createSetupDepsMock = () => {
const cloud = cloudMock.createSetup();
Expand All @@ -27,6 +28,7 @@ export const createSetupDepsMock = () => {
export const createStartDepsMock = () => {
return {
data: dataPluginMock.createStartContract(),
fieldFormats: fieldFormatsServiceMock.createStartContract() as any,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this the type check was failing in createStartServices here. I think there is something weird with the type returned by createStartContract.

navigation: navigationPluginMock.createStartContract(),
customIntegrations: customIntegrationsMock.createStart(),
share: sharePluginMock.createStartContract(),
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/fleet/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ import type {
DataPublicPluginSetup,
DataPublicPluginStart,
} from '../../../../src/plugins/data/public';
import type { FieldFormatsStart } from '../../../../src/plugins/field_formats/public/index';
import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public';
import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
import { Storage } from '../../../../src/plugins/kibana_utils/public';
import type { LicensingPluginSetup } from '../../licensing/public';
import type { LicensingPluginStart } from '../../licensing/public';
import type { CloudSetup } from '../../cloud/public';
import type { GlobalSearchPluginSetup } from '../../global_search/public';
import {
Expand Down Expand Up @@ -82,7 +83,7 @@ export interface FleetStart {
}

export interface FleetSetupDeps {
licensing: LicensingPluginSetup;
licensing: LicensingPluginStart;
Copy link
Member

@nchaulet nchaulet Feb 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we move this to the startDeps instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, it should be ok to move it there

data: DataPublicPluginSetup;
home?: HomePublicPluginSetup;
cloud?: CloudSetup;
Expand All @@ -93,6 +94,7 @@ export interface FleetSetupDeps {

export interface FleetStartDeps {
data: DataPublicPluginStart;
fieldFormats: FieldFormatsStart;
navigation: NavigationPublicPluginStart;
customIntegrations: CustomIntegrationsStart;
share: SharePluginStart;
Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/fleet/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
CoreStart,
ElasticsearchServiceStart,
Logger,
AsyncPlugin,
Plugin,
PluginInitializerContext,
SavedObjectsServiceStart,
HttpServiceSetup,
Expand All @@ -33,7 +33,7 @@ import {
ServiceStatusLevels,
} from '../../../../src/core/server';
import type { PluginStart as DataPluginStart } from '../../../../src/plugins/data/server';
import type { LicensingPluginSetup, ILicense } from '../../licensing/server';
import type { LicensingPluginStart, ILicense } from '../../licensing/server';
import type {
EncryptedSavedObjectsPluginStart,
EncryptedSavedObjectsPluginSetup,
Expand Down Expand Up @@ -93,7 +93,7 @@ import { TelemetryEventsSender } from './telemetry/sender';
import { setupFleet } from './services/setup';

export interface FleetSetupDeps {
licensing: LicensingPluginSetup;
licensing: LicensingPluginStart;
security: SecurityPluginSetup;
features?: FeaturesPluginSetup;
encryptedSavedObjects: EncryptedSavedObjectsPluginSetup;
Expand Down Expand Up @@ -175,7 +175,7 @@ export interface FleetStartContract {
}

export class FleetPlugin
implements AsyncPlugin<FleetSetupContract, FleetStartContract, FleetSetupDeps, FleetStartDeps>
implements Plugin<FleetSetupContract, FleetStartContract, FleetSetupDeps, FleetStartDeps>
{
private licensing$!: Observable<ILicense>;
private config$: Observable<FleetConfigType>;
Expand Down