Skip to content

Commit

Permalink
Merge pull request #17 from tsullivan/separate-share-reporting
Browse files Browse the repository at this point in the history
“@kbn/reporting-share” => “@kbn/reporting-public/share”
  • Loading branch information
rshen91 authored Feb 20, 2024
2 parents 612aad7 + e37ddd5 commit f11ff38
Show file tree
Hide file tree
Showing 44 changed files with 60 additions and 126 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,6 @@ packages/kbn-reporting/mocks_server @elastic/appex-sharedux
x-pack/plugins/reporting @elastic/appex-sharedux
packages/kbn-reporting/public @elastic/appex-sharedux
packages/kbn-reporting/server @elastic/appex-sharedux
packages/kbn-reporting/public/share @elastic/appex-sharedux
packages/kbn-resizable-layout @elastic/kibana-data-discovery
examples/resizable_layout_examples @elastic/kibana-data-discovery
x-pack/test/plugin_functional/plugins/resolver_test @elastic/security-solution
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,6 @@
"@kbn/reporting-plugin": "link:x-pack/plugins/reporting",
"@kbn/reporting-public": "link:packages/kbn-reporting/public",
"@kbn/reporting-server": "link:packages/kbn-reporting/server",
"@kbn/reporting-share": "link:packages/kbn-reporting/public/share",
"@kbn/resizable-layout": "link:packages/kbn-resizable-layout",
"@kbn/resizable-layout-examples-plugin": "link:examples/resizable_layout_examples",
"@kbn/resolver-test-plugin": "link:x-pack/test/plugin_functional/plugins/resolver_test",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-reporting/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type {
PerformanceMetrics as ScreenshotMetrics,
} from '@kbn/screenshotting-plugin/common';
import type { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server';
import type { LocatorParams } from './url';
import { JOB_STATUS } from './constants';
import type { LocatorParams } from './url';

export * from './url';

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-reporting/public/context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import type { HttpSetup } from '@kbn/core/public';
import React, { createContext, useContext, FunctionComponent } from 'react';
import React, { createContext, useContext, type FunctionComponent } from 'react';
import { ReportingAPIClient } from './reporting_api_client';

interface ContextValue {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-reporting/public/reporting_api_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { tz } from 'moment-timezone';

import { HttpSetup, IUiSettingsClient } from '@kbn/core/public';
import { httpServiceMock, uiSettingsServiceMock } from '@kbn/core/public/mocks';
import { ReportingAPIClient } from './reporting_api_client';
import { Job } from './job';
import { ReportingAPIClient } from './reporting_api_client';

describe('ReportingAPIClient', () => {
let uiSettingsClient: jest.Mocked<IUiSettingsClient>;
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-reporting/public/share/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions packages/kbn-reporting/public/share/kibana.jsonc

This file was deleted.

6 changes: 0 additions & 6 deletions packages/kbn-reporting/public/share/package.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
} from '@kbn/core/public';
import { ILicense } from '@kbn/licensing-plugin/public';
import type { LayoutParams } from '@kbn/screenshotting-plugin/common';
import type { ReportingAPIClient } from '@kbn/reporting-public/reporting_api_client';
import type { ReportingAPIClient } from '../../reporting_api_client';

export interface ExportPanelShareOpts {
apiClient: ReportingAPIClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import * as React from 'react';
import { EuiSpacer, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';

export const PanelSpinner: React.FC = (props) => {
export const PanelSpinner: React.FC = () => {
return (
<>
<EuiSpacer />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { CSV_JOB_TYPE, CSV_JOB_TYPE_V2 } from '@kbn/reporting-export-types-csv-c

import type { SearchSourceFields } from '@kbn/data-plugin/common';
import { ShareContext, ShareMenuProvider } from '@kbn/share-plugin/public';
import { checkLicense } from '@kbn/reporting-public';
import type { ExportPanelShareOpts } from '.';
import { checkLicense } from '../..';
import { ReportingPanelContent } from './reporting_panel_content_lazy';

export const reportingCsvShareProvider = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
*/

import { i18n } from '@kbn/i18n';
import React from 'react';
import { ShareContext, ShareMenuProvider } from '@kbn/share-plugin/public';
import { checkLicense } from '@kbn/reporting-public';
import { ReportingAPIClient } from '@kbn/reporting-public';
import React from 'react';
import { ExportPanelShareOpts, JobParamsProviderOptions, ReportingSharingData } from '.';
import { ReportingAPIClient, checkLicense } from '../..';
import { ScreenCapturePanelContent } from './screen_capture_panel_content_lazy';

const getJobParams =
Expand Down Expand Up @@ -125,9 +124,11 @@ export const reportingScreenshotShareProvider = ({
objectType,
sharingData,
};
// eslint-disable-next-line @typescript-eslint/no-shadow
const isJobV2Params = ({ sharingData }: { sharingData: Record<string, unknown> }): boolean =>
sharingData.locatorParams != null;
const isJobV2Params = ({
sharingData: _sharingData,
}: {
sharingData: Record<string, unknown>;
}) => _sharingData.locatorParams != null;

const isV2Job = isJobV2Params(jobProviderOptions);
const requiresSavedState = !isV2Job;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
* Side Public License, v 1.
*/

import React from 'react';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import {
httpServiceMock,
notificationServiceMock,
themeServiceMock,
uiSettingsServiceMock,
} from '@kbn/core/public/mocks';
import { ReportingAPIClient } from '@kbn/reporting-public';
import { ReportingPanelContent, ReportingPanelProps as Props } from '.';
import { mountWithIntl } from '@kbn/test-jest-helpers';
import React from 'react';
import { ReportingPanelProps as Props, ReportingPanelContent } from '.';
import { ReportingAPIClient } from '../../..';
import { ErrorUnsavedWorkPanel } from './components';
import * as constants from './constants';

jest.mock('./constants', () => ({
getMaxUrlLength: jest.fn(() => 9999999),
}));
import * as constants from './constants';

const theme = themeServiceMock.createSetupContract();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n-react';
import { toMountPoint } from '@kbn/kibana-react-plugin/public';
import type { BaseParams } from '@kbn/reporting-common/types';

import { ReportingAPIClient } from '@kbn/reporting-public/reporting_api_client';
import { ReportingAPIClient } from '../../../reporting_api_client';
import { ErrorUnsavedWorkPanel, ErrorUrlTooLongPanel } from './components';
import { getMaxUrlLength } from './constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
* Side Public License, v 1.
*/

import { coreMock, themeServiceMock } from '@kbn/core/public/mocks';
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
import { mount } from 'enzyme';
import React from 'react';
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
import { coreMock, themeServiceMock } from '@kbn/core/public/mocks';
import { ReportingAPIClient } from '@kbn/reporting-public';
import { ReportingAPIClient } from '../..';
import { ScreenCapturePanelContent } from './screen_capture_panel_content';

const { http, uiSettings, ...coreSetup } = coreMock.createSetup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React from 'react';
import { PDF_REPORT_TYPE, PDF_REPORT_TYPE_V2 } from '@kbn/reporting-export-types-pdf-common';
import { PNG_REPORT_TYPE_V2 } from '@kbn/reporting-export-types-png-common';

import { ReportingAPIClient } from '@kbn/reporting-public/reporting_api_client';
import { ReportingAPIClient } from '../../reporting_api_client';
import { ReportingPanelProps } from '../share_context_menu/reporting_panel_content';
import { ScreenCapturePanelContent } from '../share_context_menu/screen_capture_panel_content_lazy';

Expand Down
33 changes: 0 additions & 33 deletions packages/kbn-reporting/public/share/tsconfig.json

This file was deleted.

2 changes: 0 additions & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1264,8 +1264,6 @@
"@kbn/reporting-public/*": ["packages/kbn-reporting/public/*"],
"@kbn/reporting-server": ["packages/kbn-reporting/server"],
"@kbn/reporting-server/*": ["packages/kbn-reporting/server/*"],
"@kbn/reporting-share": ["packages/kbn-reporting/public/share"],
"@kbn/reporting-share/*": ["packages/kbn-reporting/public/share/*"],
"@kbn/resizable-layout": ["packages/kbn-resizable-layout"],
"@kbn/resizable-layout/*": ["packages/kbn-resizable-layout/*"],
"@kbn/resizable-layout-examples-plugin": ["examples/resizable_layout_examples"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* 2.0.
*/

// Export Type Sets
import {
CSV_JOB_TYPE,
CSV_JOB_TYPE_DEPRECATED,
Expand All @@ -26,6 +25,7 @@ import {
PNG_REPORT_TYPE_V2,
} from '@kbn/reporting-export-types-png-common';

// Export Type Sets
export const reportTypes = [
CSV_REPORT_TYPE,
CSV_REPORT_TYPE_V2,
Expand All @@ -52,3 +52,7 @@ export const USES_HEADLESS_JOB_TYPES = [
];

export const DEPRECATED_JOB_TYPES = [CSV_JOB_TYPE_DEPRECATED];

// Test Subjects
export const REPORT_TABLE_ID = 'reportJobListing';
export const REPORT_TABLE_ROW_ID = 'reportJobRow';
13 changes: 0 additions & 13 deletions x-pack/plugins/reporting/common/constants/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type { PluginInitializerContext } from '@kbn/core/public';
import type { ReportingPublicComponents } from '@kbn/reporting-share';
import type { ReportingPublicComponents } from '@kbn/reporting-public/share';
import { ReportingPublicPlugin } from './plugin';

/**
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { coreMock } from '@kbn/core/public/mocks';
import { getSharedComponents } from '@kbn/reporting-share';
import { getSharedComponents } from '@kbn/reporting-public/share';
import { ReportingAPIClient } from '@kbn/reporting-public/reporting_api_client';
import { ReportingSetup } from '.';

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/reporting/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
getSharedComponents,
reportingScreenshotShareProvider,
reportingCsvShareProvider,
} from '@kbn/reporting-share';
} from '@kbn/reporting-public/share';
import type { ReportingSetup, ReportingStart } from '.';
import { ReportingNotifierStreamHandler as StreamHandler } from './lib/stream_handler';
import { getGeneralErrorToast } from './notifier';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import { DeprecationsDetails, GetDeprecationsContext } from '@kbn/core/server';
import { i18n } from '@kbn/i18n';
import { ILM_POLICY_NAME } from '@kbn/reporting-common';
import { INTERNAL_ROUTES } from '../../common/constants';
import { ILM_POLICY_NAME, INTERNAL_ROUTES } from '@kbn/reporting-common';
import { ReportingCore } from '../core';
import { deprecations } from '../lib/deprecations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import moment from 'moment';
import { schema, TypeOf } from '@kbn/config-schema';
import type { KibanaRequest, KibanaResponseFactory, Logger } from '@kbn/core/server';
import { i18n } from '@kbn/i18n';
import { PUBLIC_ROUTES } from '@kbn/reporting-common';
import type { BaseParams } from '@kbn/reporting-common/types';
import { cryptoFactory } from '@kbn/reporting-server';
import rison from '@kbn/rison';

import { Counters, getCounters } from '..';
import { type Counters, getCounters } from '..';
import type { ReportingCore } from '../../..';
import { PUBLIC_ROUTES } from '../../../../common/constants';
import { checkParamsVersion } from '../../../lib';
import { Report } from '../../../lib/store';
import type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
*/
import { errors } from '@elastic/elasticsearch';
import type { Logger, RequestHandler } from '@kbn/core/server';
import { ILM_POLICY_NAME } from '@kbn/reporting-common';
import { ILM_POLICY_NAME, INTERNAL_ROUTES } from '@kbn/reporting-common';
import type { IlmPolicyStatusResponse } from '@kbn/reporting-common/url';
import { INTERNAL_ROUTES } from '../../../../common/constants';
import type { ReportingCore } from '../../../core';
import { IlmPolicyManager } from '../../../lib';
import { deprecations } from '../../../lib/deprecations';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import { setupServer } from '@kbn/core-test-helpers-test-utils';
import { loggingSystemMock } from '@kbn/core/server/mocks';
import { licensingMock } from '@kbn/licensing-plugin/server/mocks';
import { INTERNAL_ROUTES } from '@kbn/reporting-common';
import { createMockConfigSchema } from '@kbn/reporting-mocks-server';
import { securityMock } from '@kbn/security-plugin/server/mocks';
import supertest from 'supertest';
import { INTERNAL_ROUTES } from '../../../../../common/constants';
import {
createMockPluginSetup,
createMockPluginStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import type { DocLinksServiceSetup, Logger } from '@kbn/core/server';
import { i18n } from '@kbn/i18n';
import { INTERNAL_ROUTES } from '@kbn/reporting-common';
import { lastValueFrom } from 'rxjs';
import type { DiagnosticResponse } from '.';
import type { ReportingCore } from '../../..';
import { INTERNAL_ROUTES } from '../../../../common/constants';
import { authorizedUserPreRouting, getCounters } from '../../common';

const logsToHelpMapFactory = (docLinks: DocLinksServiceSetup) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import supertest from 'supertest';

import { setupServer } from '@kbn/core-test-helpers-test-utils';
import { docLinksServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';
import { ScreenshottingStart } from '@kbn/screenshotting-plugin/server';
import { INTERNAL_ROUTES } from '@kbn/reporting-common';
import { createMockConfigSchema } from '@kbn/reporting-mocks-server';
import { ScreenshottingStart } from '@kbn/screenshotting-plugin/server';
import { IUsageCounter } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counter';
import { ReportingCore } from '../../../..';
import { INTERNAL_ROUTES } from '../../../../../common/constants';
import { reportingMock } from '../../../../mocks';
import { createMockPluginSetup, createMockReportingCore } from '../../../../test_helpers';
import { ReportingRequestHandlerContext } from '../../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import moment from 'moment';

import { schema } from '@kbn/config-schema';
import type { KibanaRequest, Logger } from '@kbn/core/server';
import { INTERNAL_ROUTES } from '@kbn/reporting-common';
import {
CSV_SEARCHSOURCE_IMMEDIATE_TYPE,
JobParamsDownloadCSV,
} from '@kbn/reporting-export-types-csv-common';
import type { ReportingCore } from '../../..';
import { INTERNAL_ROUTES } from '../../../../common/constants';
import { PassThroughStream } from '../../../lib';
import { authorizedUserPreRouting, getCounters } from '../../common';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import { KibanaResponse } from '@kbn/core-http-router-server-internal';
import type { Logger } from '@kbn/core/server';
import { INTERNAL_ROUTES } from '@kbn/reporting-common';
import type { ReportingCore } from '../../..';
import { INTERNAL_ROUTES } from '../../../../common/constants';
import { authorizedUserPreRouting } from '../../common';
import { RequestHandler } from '../../common/generate';

Expand Down
Loading

0 comments on commit f11ff38

Please sign in to comment.