[shared-ux] no-data analytics page package code cleanup (#172416)

## Summary

1. Update "type" in kibana.jsonc files where applicable for improvement
to developer experience.
2. Create `@kbn/content-management-table-list-view-table-common` package
and update imports

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Tim Sullivan 2023-12-04 13:07:59 -07:00 committed by GitHub
parent e69063e082
commit f044bcccdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
63 changed files with 144 additions and 93 deletions

1
.github/CODEOWNERS vendored
View file

@ -92,6 +92,7 @@ examples/content_management_examples @elastic/appex-sharedux
src/plugins/content_management @elastic/appex-sharedux
packages/content-management/tabbed_table_list_view @elastic/appex-sharedux
packages/content-management/table_list_view @elastic/appex-sharedux
packages/content-management/table_list_view_common @elastic/appex-sharedux
packages/content-management/table_list_view_table @elastic/appex-sharedux
packages/kbn-content-management-utils @elastic/kibana-data-discovery
examples/controls_example @elastic/kibana-presentation

View file

@ -6,10 +6,11 @@
* Side Public License, v 1.
*/
import { TableListView, UserContentCommonSchema } from '@kbn/content-management-table-list-view';
import { useContentClient } from '@kbn/content-management-plugin/public';
import React from 'react';
import { TableListView } from '@kbn/content-management-table-list-view';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import { SavedObjectsFindOptionsReference } from '@kbn/core-saved-objects-api-browser';
import React from 'react';
const LISTING_LIMIT = 1000;

View file

@ -30,5 +30,6 @@
"@kbn/content-management-table-list-view",
"@kbn/shared-ux-router",
"@kbn/saved-objects-finder-plugin",
"@kbn/content-management-table-list-view-common",
]
}

View file

@ -198,6 +198,7 @@
"@kbn/content-management-plugin": "link:src/plugins/content_management",
"@kbn/content-management-tabbed-table-list-view": "link:packages/content-management/tabbed_table_list_view",
"@kbn/content-management-table-list-view": "link:packages/content-management/table_list_view",
"@kbn/content-management-table-list-view-common": "link:packages/content-management/table_list_view_common",
"@kbn/content-management-table-list-view-table": "link:packages/content-management/table_list_view_table",
"@kbn/content-management-utils": "link:packages/kbn-content-management-utils",
"@kbn/controls-example-plugin": "link:examples/controls_example",

View file

@ -8,3 +8,4 @@
export { ContentEditorProvider, ContentEditorKibanaProvider, useOpenContentEditor } from './src';
export type { OpenContentEditorParams } from './src';
export type { SavedObjectsReference } from './src/services';

View file

@ -7,5 +7,3 @@
*/
export { TabbedTableListView, type TableListTab, type TableListTabParentProps } from './src';
export type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-table';

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/content-management-tabbed-table-list-view",
"owner": "@elastic/appex-sharedux"
}

View file

@ -8,10 +8,8 @@
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import React, { useCallback, useEffect, useState } from 'react';
import type {
TableListViewTableProps,
UserContentCommonSchema,
} from '@kbn/content-management-table-list-view-table';
import type { TableListViewTableProps } from '@kbn/content-management-table-list-view-table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { TableListViewProps } from '@kbn/content-management-table-list-view';
export type TableListTabParentProps<T extends UserContentCommonSchema = UserContentCommonSchema> =

View file

@ -20,6 +20,7 @@
"@kbn/shared-ux-page-kibana-template",
"@kbn/content-management-table-list-view-table",
"@kbn/content-management-table-list-view",
"@kbn/content-management-table-list-view-common",
],
"exclude": [
"target/**/*",

View file

@ -8,5 +8,3 @@
export { TableListView } from './src/table_list_view';
export type { TableListViewProps } from './src/table_list_view';
export type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-table';

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/content-management-table-list-view",
"owner": "@elastic/appex-sharedux"
}

View file

@ -6,13 +6,14 @@
* Side Public License, v 1.
*/
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import React, { ReactNode, useCallback, useState } from 'react';
import {
TableListViewTable,
type TableListViewTableProps,
type UserContentCommonSchema,
} from '@kbn/content-management-table-list-view-table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
export type TableListViewProps<T extends UserContentCommonSchema = UserContentCommonSchema> = Pick<
TableListViewTableProps<T>,

View file

@ -17,7 +17,8 @@
],
"kbn_references": [
"@kbn/shared-ux-page-kibana-template",
"@kbn/content-management-table-list-view-table"
"@kbn/content-management-table-list-view-table",
"@kbn/content-management-table-list-view-common"
],
"exclude": [
"target/**/*",

View file

@ -0,0 +1,3 @@
# @kbn/content-management-table-list-view-common
Empty package generated by @kbn/generate

View file

@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { SavedObjectsReference } from '@kbn/content-management-content-editor';
export interface UserContentCommonSchema {
id: string;
updatedAt: string;
managed?: boolean;
references: SavedObjectsReference[];
type: string;
attributes: {
title: string;
description?: string;
};
}

View file

@ -0,0 +1,5 @@
{
"type": "shared-common",
"id": "@kbn/content-management-table-list-view-common",
"owner": "@elastic/appex-sharedux"
}

View file

@ -0,0 +1,6 @@
{
"name": "@kbn/content-management-table-list-view-common",
"private": true,
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0"
}

View file

@ -0,0 +1,19 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node"
]
},
"include": [
"**/*.ts",
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/content-management-content-editor",
]
}

View file

@ -8,6 +8,6 @@
export { TableListViewTable, TableListViewProvider, TableListViewKibanaProvider } from './src';
export type { UserContentCommonSchema, TableListViewTableProps, RowActions } from './src';
export type { TableListViewTableProps, RowActions } from './src';
export type { TableListViewKibanaDependencies } from './src/services';

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/content-management-table-list-view-table",
"owner": "@elastic/appex-sharedux"
}

View file

@ -7,8 +7,8 @@
*/
import type { IHttpFetchError } from '@kbn/core-http-browser';
import type { Query } from '@elastic/eui';
import type { State, UserContentCommonSchema } from './table_list_view_table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { State } from './table_list_view_table';
/** Action to trigger a fetch of the table items */
export interface OnFetchItemsAction {

View file

@ -9,10 +9,12 @@
import React, { useCallback, useMemo } from 'react';
import { EuiText, EuiLink, EuiSpacer, EuiHighlight } from '@elastic/eui';
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
import { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { Tag } from '../types';
import { useServices } from '../services';
import type { UserContentCommonSchema, TableListViewTableProps } from '../table_list_view_table';
import type { TableListViewTableProps } from '../table_list_view_table';
import { TagBadge } from './tag_badge';
type InheritedProps<T extends UserContentCommonSchema> = Pick<

View file

@ -21,13 +21,13 @@ import {
type EuiTableSelectionType,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import { useServices } from '../services';
import type { Action } from '../actions';
import type {
State as TableListViewState,
TableListViewTableProps,
UserContentCommonSchema,
} from '../table_list_view_table';
import type { TableItemsRowActions } from '../types';
import { TableSortSelect } from './table_sort_select';

View file

@ -8,11 +8,7 @@
export { TableListViewTable } from './table_list_view_table';
export type {
TableListViewTableProps,
State as TableListViewState,
UserContentCommonSchema,
} from './table_list_view_table';
export type { TableListViewTableProps, State as TableListViewState } from './table_list_view_table';
export { TableListViewProvider, TableListViewKibanaProvider } from './services';

View file

@ -5,7 +5,9 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import type { State, UserContentCommonSchema } from './table_list_view_table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { State } from './table_list_view_table';
import type { Action } from './actions';
export function getReducer<T extends UserContentCommonSchema>() {

View file

@ -12,19 +12,16 @@ import type { FormattedRelative } from '@kbn/i18n-react';
import type { MountPoint, OverlayRef } from '@kbn/core-mount-utils-browser';
import type { OverlayFlyoutOpenOptions } from '@kbn/core-overlays-browser';
import { RedirectAppLinksKibanaProvider } from '@kbn/shared-ux-link-redirect-app';
import { ContentEditorKibanaProvider } from '@kbn/content-management-content-editor';
import {
ContentEditorKibanaProvider,
type SavedObjectsReference,
} from '@kbn/content-management-content-editor';
import { TAG_MANAGEMENT_APP_URL } from './constants';
import type { Tag } from './types';
type NotifyFn = (title: JSX.Element, text?: string) => void;
export interface SavedObjectsReference {
id: string;
name: string;
type: string;
}
export type SavedObjectsFindOptionsReference = Omit<SavedObjectsReference, 'name'>;
export type DateFormatter = (props: {

View file

@ -17,12 +17,9 @@ import type { LocationDescriptor, History } from 'history';
import { WithServices } from './__jest__';
import { getTagList } from './mocks';
import {
TableListViewTable,
type TableListViewTableProps,
type UserContentCommonSchema,
} from './table_list_view_table';
import { TableListViewTable, type TableListViewTableProps } from './table_list_view_table';
import { getActions } from './table_list_view.test.helpers';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
const mockUseEffect = useEffect;

View file

@ -27,7 +27,11 @@ import { FormattedMessage } from '@kbn/i18n-react';
import type { IHttpFetchError } from '@kbn/core-http-browser';
import { KibanaPageTemplate } from '@kbn/shared-ux-page-kibana-template';
import { useOpenContentEditor } from '@kbn/content-management-content-editor';
import type { OpenContentEditorParams } from '@kbn/content-management-content-editor';
import type {
OpenContentEditorParams,
SavedObjectsReference,
} from '@kbn/content-management-content-editor';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import {
Table,
@ -37,7 +41,7 @@ import {
UpdatedAtField,
} from './components';
import { useServices } from './services';
import type { SavedObjectsReference, SavedObjectsFindOptionsReference } from './services';
import type { SavedObjectsFindOptionsReference } from './services';
import { getReducer } from './reducer';
import type { SortColumnField } from './components';
import { useTags } from './use_tags';
@ -143,18 +147,6 @@ export interface State<T extends UserContentCommonSchema = UserContentCommonSche
};
}
export interface UserContentCommonSchema {
id: string;
updatedAt: string;
managed?: boolean;
references: SavedObjectsReference[];
type: string;
attributes: {
title: string;
description?: string;
};
}
export interface URLState {
s?: string;
sort?: {

View file

@ -7,9 +7,8 @@
*/
import { useCallback, useMemo } from 'react';
import { Query } from '@elastic/eui';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { Tag } from './types';
import type { UserContentCommonSchema } from './table_list_view_table';
type QueryUpdater = (query: Query, tag: Tag) => Query;

View file

@ -25,6 +25,7 @@
"@kbn/shared-ux-page-kibana-template",
"@kbn/shared-ux-link-redirect-app",
"@kbn/test-jest-helpers",
"@kbn/content-management-table-list-view-common",
],
"exclude": [
"target/**/*",

View file

@ -15,9 +15,9 @@
],
"kbn_references": [
"@kbn/data-plugin",
"@kbn/content-management-table-list-view-table",
"@kbn/visualization-ui-components",
"@kbn/ui-theme",
"@kbn/i18n",
"@kbn/content-management-table-list-view-common",
]
}

View file

@ -8,7 +8,7 @@
import { $Values } from 'utility-types';
import { DataViewSpec, KibanaQueryOutput } from '@kbn/data-plugin/common';
import { UserContentCommonSchema } from '@kbn/content-management-table-list-view-table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { LineStyle } from '@kbn/visualization-ui-components';
import { AvailableAnnotationIcons } from '.';

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-card-no-data",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-card-no-data-mocks",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-card-no-data-types",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-analytics-no-data",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-analytics-no-data-types",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-kibana-no-data",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-kibana-no-data-types",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-kibana-template",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-kibana-template-mocks",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-kibana-template-types",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-no-data",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-no-data-types",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-page-no-data-config",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-prompt-no-data-views",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-prompt-no-data-views-mocks",
"owner": "@elastic/appex-sharedux"
}

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/shared-ux-prompt-no-data-views-types",
"owner": "@elastic/appex-sharedux"
}

View file

@ -5,10 +5,10 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { PropsWithChildren } from 'react';
import { type UserContentCommonSchema } from '@kbn/content-management-table-list-view-table';
import { ViewMode } from '@kbn/embeddable-plugin/public';
import { DashboardApplicationService } from '../services/application/types';
import type { PropsWithChildren } from 'react';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { ViewMode } from '@kbn/embeddable-plugin/public';
import type { DashboardApplicationService } from '../services/application/types';
export type DashboardListingProps = PropsWithChildren<{
disableCreateDashboardButton?: boolean;

View file

@ -68,7 +68,8 @@
"@kbn/no-data-page-plugin",
"@kbn/react-kibana-mount",
"@kbn/core-lifecycle-browser",
"@kbn/logging"
"@kbn/logging",
"@kbn/content-management-table-list-view-common"
],
"exclude": ["target/**/*"]
}

View file

@ -12,10 +12,8 @@ import {
SAVED_OBJECTS_LIMIT_SETTING,
SAVED_OBJECTS_PER_PAGE_SETTING,
} from './table_list';
import {
TableListViewTable,
type UserContentCommonSchema,
} from '@kbn/content-management-table-list-view-table';
import { TableListViewTable } from '@kbn/content-management-table-list-view-table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { EventAnnotationServiceType } from '@kbn/event-annotation-components/types';
import { IUiSettingsClient } from '@kbn/core-ui-settings-browser';
import { shallow, ShallowWrapper } from 'enzyme';

View file

@ -40,7 +40,8 @@
"@kbn/core-ui-settings-browser",
"@kbn/core-notifications-browser-mocks",
"@kbn/core-notifications-browser",
"@kbn/core-saved-objects-api-browser"
"@kbn/core-saved-objects-api-browser",
"@kbn/content-management-table-list-view-common"
],
"exclude": [
"target/**/*",

View file

@ -9,7 +9,8 @@
import type { FunctionComponent } from 'react';
import React, { useState } from 'react';
import { EuiButtonEmpty } from '@elastic/eui';
import { TableListView, UserContentCommonSchema } from '@kbn/content-management-table-list-view';
import { TableListView } from '@kbn/content-management-table-list-view';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import numeral from '@elastic/numeral';
import type { FileJSON } from '@kbn/files-plugin/common';

View file

@ -15,6 +15,7 @@
"@kbn/i18n-react",
"@kbn/shared-ux-file-image",
"@kbn/shared-ux-router",
"@kbn/content-management-table-list-view-common",
],
"exclude": [
"target/**/*",

View file

@ -31,11 +31,9 @@ import {
type TableListTab,
} from '@kbn/content-management-tabbed-table-list-view';
import type { OpenContentEditorParams } from '@kbn/content-management-content-editor';
import {
type UserContentCommonSchema,
TableListViewProps,
} from '@kbn/content-management-table-list-view';
import { TableListViewProps } from '@kbn/content-management-table-list-view';
import { TableListViewTable } from '@kbn/content-management-table-list-view-table';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import { findListItems } from '../../utils/saved_visualize_utils';
import { updateBasicSoAttributes } from '../../utils/saved_objects_utils/update_basic_attributes';

View file

@ -64,7 +64,8 @@
"@kbn/serverless",
"@kbn/no-data-page-plugin",
"@kbn/search-response-warnings",
"@kbn/logging"
"@kbn/logging",
"@kbn/content-management-table-list-view-common"
],
"exclude": [
"target/**/*",

View file

@ -178,6 +178,8 @@
"@kbn/content-management-tabbed-table-list-view/*": ["packages/content-management/tabbed_table_list_view/*"],
"@kbn/content-management-table-list-view": ["packages/content-management/table_list_view"],
"@kbn/content-management-table-list-view/*": ["packages/content-management/table_list_view/*"],
"@kbn/content-management-table-list-view-common": ["packages/content-management/table_list_view_common"],
"@kbn/content-management-table-list-view-common/*": ["packages/content-management/table_list_view_common/*"],
"@kbn/content-management-table-list-view-table": ["packages/content-management/table_list_view_table"],
"@kbn/content-management-table-list-view-table/*": ["packages/content-management/table_list_view_table/*"],
"@kbn/content-management-utils": ["packages/kbn-content-management-utils"],

View file

@ -1,5 +1,5 @@
{
"type": "shared-common",
"type": "shared-browser",
"id": "@kbn/security-solution-upselling",
"owner": "@elastic/security-threat-hunting-explore"
}
}

View file

@ -12,7 +12,7 @@ import { EuiEmptyPrompt, EuiLink, EuiButton } from '@elastic/eui';
import { ApplicationStart } from '@kbn/core/public';
import { useHistory, useLocation } from 'react-router-dom';
import { TableListView } from '@kbn/content-management-table-list-view';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import { deleteSavedWorkspace, findSavedWorkspace } from '../helpers/saved_workspace_utils';
import { getEditPath, getEditUrl, getNewPath, setBreadcrumbs } from '../services/url';
import { GraphWorkspaceSavedObject } from '../types';

View file

@ -48,6 +48,7 @@
"@kbn/react-kibana-mount",
"@kbn/content-management-utils",
"@kbn/logging",
"@kbn/content-management-table-list-view-common",
],
"exclude": [
"target/**/*",

View file

@ -10,7 +10,7 @@ import type { SavedObjectsFindOptionsReference, ScopedHistory } from '@kbn/core/
import { METRIC_TYPE } from '@kbn/analytics';
import { i18n } from '@kbn/i18n';
import { TableListView } from '@kbn/content-management-table-list-view';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view';
import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view-common';
import type { MapAttributes, MapItem } from '../../../common/content_management';
import { APP_ID, APP_NAME, getEditPath, MAP_PATH } from '../../../common/constants';

View file

@ -76,6 +76,7 @@
"@kbn/logging",
"@kbn/search-response-warnings",
"@kbn/calculate-width-from-char-count",
"@kbn/content-management-table-list-view-common",
],
"exclude": [
"target/**/*",

View file

@ -3287,6 +3287,10 @@
version "0.0.0"
uid ""
"@kbn/content-management-table-list-view-common@link:packages/content-management/table_list_view_common":
version "0.0.0"
uid ""
"@kbn/content-management-table-list-view-table@link:packages/content-management/table_list_view_table":
version "0.0.0"
uid ""